LCOV - code coverage report
Current view: top level - EnergyPlus/Coils - CoilCoolingDX.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 313 408 76.7 %
Date: 2023-01-17 19:17:23 Functions: 16 19 84.2 %

          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             : #include <ObjexxFCL/Array1D.hh> // needs to be in BranchNodeConnections.hh
      49             : 
      50             : #include <EnergyPlus/BranchNodeConnections.hh>
      51             : #include <EnergyPlus/Coils/CoilCoolingDX.hh>
      52             : #include <EnergyPlus/Data/EnergyPlusData.hh>
      53             : #include <EnergyPlus/DataAirLoop.hh>
      54             : #include <EnergyPlus/DataEnvironment.hh>
      55             : #include <EnergyPlus/DataGlobalConstants.hh>
      56             : #include <EnergyPlus/DataGlobals.hh>
      57             : #include <EnergyPlus/DataHVACGlobals.hh>
      58             : #include <EnergyPlus/DataHeatBalance.hh>
      59             : #include <EnergyPlus/DataIPShortCuts.hh>
      60             : #include <EnergyPlus/DataLoopNode.hh>
      61             : #include <EnergyPlus/DataWater.hh>
      62             : #include <EnergyPlus/Fans.hh>
      63             : #include <EnergyPlus/GeneralRoutines.hh>
      64             : #include <EnergyPlus/HVACFan.hh>
      65             : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      66             : #include <EnergyPlus/NodeInputManager.hh>
      67             : #include <EnergyPlus/OutAirNodeManager.hh>
      68             : #include <EnergyPlus/OutputProcessor.hh>
      69             : #include <EnergyPlus/OutputReportPredefined.hh>
      70             : #include <EnergyPlus/Psychrometrics.hh>
      71             : #include <EnergyPlus/ReportCoilSelection.hh>
      72             : #include <EnergyPlus/ScheduleManager.hh>
      73             : #include <EnergyPlus/SimAirServingZones.hh>
      74             : #include <EnergyPlus/WaterManager.hh>
      75             : 
      76             : using namespace EnergyPlus;
      77             : 
      78         105 : int CoilCoolingDX::factory(EnergyPlus::EnergyPlusData &state, std::string const &coilName)
      79             : {
      80         105 :     if (state.dataCoilCooingDX->coilCoolingDXGetInputFlag) {
      81          19 :         CoilCoolingDX::getInput(state);
      82          19 :         state.dataCoilCooingDX->coilCoolingDXGetInputFlag = false;
      83             :     }
      84         105 :     int handle = -1;
      85         265 :     for (auto const &thisCoil : state.dataCoilCooingDX->coilCoolingDXs) {
      86         265 :         handle++;
      87         265 :         if (EnergyPlus::UtilityRoutines::MakeUPPERCase(coilName) == EnergyPlus::UtilityRoutines::MakeUPPERCase(thisCoil.name)) {
      88         105 :             return handle;
      89             :         }
      90             :     }
      91           0 :     ShowSevereError(state, "Coil:Cooling:DX Coil not found=" + coilName);
      92           0 :     return -1;
      93             : }
      94             : 
      95          19 : void CoilCoolingDX::getInput(EnergyPlus::EnergyPlusData &state)
      96             : {
      97          19 :     int numCoolingCoilDXs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, state.dataCoilCooingDX->coilCoolingDXObjectName);
      98          19 :     if (numCoolingCoilDXs <= 0) {
      99           0 :         ShowFatalError(state, R"(No "Coil:Cooling:DX" objects in input file)");
     100             :     }
     101          70 :     for (int coilNum = 1; coilNum <= numCoolingCoilDXs; ++coilNum) {
     102             :         int NumAlphas;  // Number of Alphas for each GetObjectItem call
     103             :         int NumNumbers; // Number of Numbers for each GetObjectItem call
     104             :         int IOStatus;
     105         204 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
     106          51 :                                                                  state.dataCoilCooingDX->coilCoolingDXObjectName,
     107             :                                                                  coilNum,
     108          51 :                                                                  state.dataIPShortCut->cAlphaArgs,
     109             :                                                                  NumAlphas,
     110          51 :                                                                  state.dataIPShortCut->rNumericArgs,
     111             :                                                                  NumNumbers,
     112             :                                                                  IOStatus);
     113         102 :         CoilCoolingDXInputSpecification input_specs;
     114          51 :         input_specs.name = state.dataIPShortCut->cAlphaArgs(1);
     115          51 :         input_specs.evaporator_inlet_node_name = state.dataIPShortCut->cAlphaArgs(2);
     116          51 :         input_specs.evaporator_outlet_node_name = state.dataIPShortCut->cAlphaArgs(3);
     117          51 :         input_specs.availability_schedule_name = state.dataIPShortCut->cAlphaArgs(4);
     118          51 :         input_specs.condenser_zone_name = state.dataIPShortCut->cAlphaArgs(5);
     119          51 :         input_specs.condenser_inlet_node_name = state.dataIPShortCut->cAlphaArgs(6);
     120          51 :         input_specs.condenser_outlet_node_name = state.dataIPShortCut->cAlphaArgs(7);
     121          51 :         input_specs.performance_object_name = state.dataIPShortCut->cAlphaArgs(8);
     122          51 :         input_specs.condensate_collection_water_storage_tank_name = state.dataIPShortCut->cAlphaArgs(9);
     123          51 :         input_specs.evaporative_condenser_supply_water_storage_tank_name = state.dataIPShortCut->cAlphaArgs(10);
     124         102 :         CoilCoolingDX thisCoil;
     125          51 :         thisCoil.instantiateFromInputSpec(state, input_specs);
     126          51 :         state.dataCoilCooingDX->coilCoolingDXs.push_back(thisCoil);
     127             :     }
     128          19 : }
     129             : 
     130          51 : void CoilCoolingDX::instantiateFromInputSpec(EnergyPlus::EnergyPlusData &state, const CoilCoolingDXInputSpecification &input_data)
     131             : {
     132             :     static constexpr std::string_view routineName("CoilCoolingDX::instantiateFromInputSpec: ");
     133          51 :     this->original_input_specs = input_data;
     134          51 :     bool errorsFound = false;
     135          51 :     this->name = input_data.name;
     136             : 
     137             :     // initialize reclaim heat parameters
     138          51 :     this->reclaimHeat.Name = this->name;
     139          51 :     this->reclaimHeat.SourceType = state.dataCoilCooingDX->coilCoolingDXObjectName;
     140             : 
     141          51 :     this->performance = CoilCoolingDXCurveFitPerformance(state, input_data.performance_object_name);
     142             : 
     143         153 :     if (!this->performance.original_input_specs.base_operating_mode_name.empty() &&
     144          57 :         !this->performance.original_input_specs.alternate_operating_mode_name.empty() &&
     145           6 :         !this->performance.original_input_specs.alternate_operating_mode2_name.empty()) {
     146           1 :         this->SubcoolReheatFlag = true;
     147             :     }
     148             : 
     149             :     // other construction below
     150          51 :     this->evapInletNodeIndex = NodeInputManager::GetOnlySingleNode(state,
     151             :                                                                    input_data.evaporator_inlet_node_name,
     152             :                                                                    errorsFound,
     153             :                                                                    DataLoopNode::ConnectionObjectType::CoilCoolingDX,
     154             :                                                                    input_data.name,
     155             :                                                                    DataLoopNode::NodeFluidType::Air,
     156             :                                                                    DataLoopNode::ConnectionType::Inlet,
     157             :                                                                    NodeInputManager::CompFluidStream::Primary,
     158          51 :                                                                    DataLoopNode::ObjectIsNotParent);
     159          51 :     this->evapOutletNodeIndex = NodeInputManager::GetOnlySingleNode(state,
     160             :                                                                     input_data.evaporator_outlet_node_name,
     161             :                                                                     errorsFound,
     162             :                                                                     DataLoopNode::ConnectionObjectType::CoilCoolingDX,
     163             :                                                                     input_data.name,
     164             :                                                                     DataLoopNode::NodeFluidType::Air,
     165             :                                                                     DataLoopNode::ConnectionType::Outlet,
     166             :                                                                     NodeInputManager::CompFluidStream::Primary,
     167          51 :                                                                     DataLoopNode::ObjectIsNotParent);
     168             : 
     169          51 :     this->condInletNodeIndex = NodeInputManager::GetOnlySingleNode(state,
     170             :                                                                    input_data.condenser_inlet_node_name,
     171             :                                                                    errorsFound,
     172             :                                                                    DataLoopNode::ConnectionObjectType::CoilCoolingDX,
     173             :                                                                    input_data.name,
     174             :                                                                    DataLoopNode::NodeFluidType::Air,
     175             :                                                                    DataLoopNode::ConnectionType::Inlet,
     176             :                                                                    NodeInputManager::CompFluidStream::Secondary,
     177          51 :                                                                    DataLoopNode::ObjectIsNotParent);
     178             : 
     179          51 :     this->condOutletNodeIndex = NodeInputManager::GetOnlySingleNode(state,
     180             :                                                                     input_data.condenser_outlet_node_name,
     181             :                                                                     errorsFound,
     182             :                                                                     DataLoopNode::ConnectionObjectType::CoilCoolingDX,
     183             :                                                                     input_data.name,
     184             :                                                                     DataLoopNode::NodeFluidType::Air,
     185             :                                                                     DataLoopNode::ConnectionType::Outlet,
     186             :                                                                     NodeInputManager::CompFluidStream::Secondary,
     187          51 :                                                                     DataLoopNode::ObjectIsNotParent);
     188             : 
     189          51 :     if (!input_data.condensate_collection_water_storage_tank_name.empty()) {
     190           0 :         WaterManager::SetupTankSupplyComponent(state,
     191             :                                                this->name,
     192           0 :                                                state.dataCoilCooingDX->coilCoolingDXObjectName,
     193             :                                                input_data.condensate_collection_water_storage_tank_name,
     194             :                                                errorsFound,
     195             :                                                this->condensateTankIndex,
     196             :                                                this->condensateTankSupplyARRID);
     197             :     }
     198             : 
     199          51 :     if (!input_data.evaporative_condenser_supply_water_storage_tank_name.empty()) {
     200           0 :         WaterManager::SetupTankDemandComponent(state,
     201             :                                                this->name,
     202           0 :                                                state.dataCoilCooingDX->coilCoolingDXObjectName,
     203             :                                                input_data.evaporative_condenser_supply_water_storage_tank_name,
     204             :                                                errorsFound,
     205             :                                                this->evaporativeCondSupplyTankIndex,
     206             :                                                this->evaporativeCondSupplyTankARRID);
     207             :     }
     208             : 
     209          51 :     if (input_data.availability_schedule_name.empty()) {
     210          42 :         this->availScheduleIndex = DataGlobalConstants::ScheduleAlwaysOn;
     211             :     } else {
     212           9 :         this->availScheduleIndex = ScheduleManager::GetScheduleIndex(state, input_data.availability_schedule_name);
     213             :     }
     214             : 
     215          51 :     if (this->availScheduleIndex == 0) {
     216           0 :         ShowSevereError(state, std::string{routineName} + state.dataCoilCooingDX->coilCoolingDXObjectName + "=\"" + this->name + "\", invalid");
     217           0 :         ShowContinueError(state, "...Availability Schedule Name=\"" + input_data.availability_schedule_name + "\".");
     218           0 :         errorsFound = true;
     219             :     }
     220             : 
     221          51 :     if (!input_data.condenser_zone_name.empty()) {
     222           0 :         this->isSecondaryDXCoilInZone = true;
     223             :         // Setup zone data here
     224             :     }
     225             : 
     226         102 :     BranchNodeConnections::TestCompSet(state,
     227          51 :                                        state.dataCoilCooingDX->coilCoolingDXObjectName,
     228             :                                        this->name,
     229             :                                        input_data.evaporator_inlet_node_name,
     230             :                                        input_data.evaporator_outlet_node_name,
     231             :                                        "Air Nodes");
     232             : 
     233          51 :     if (errorsFound) {
     234           0 :         ShowFatalError(state,
     235           0 :                        std::string{routineName} + "Errors found in getting " + state.dataCoilCooingDX->coilCoolingDXObjectName +
     236             :                            " input. Preceding condition(s) causes termination.");
     237             :     }
     238          51 : }
     239             : 
     240          51 : void CoilCoolingDX::oneTimeInit(EnergyPlus::EnergyPlusData &state)
     241             : {
     242             : 
     243             :     // setup output variables, needs to be done after object is instantiated and emplaced
     244         102 :     SetupOutputVariable(state,
     245             :                         "Cooling Coil Total Cooling Rate",
     246             :                         OutputProcessor::Unit::W,
     247             :                         this->totalCoolingEnergyRate,
     248             :                         OutputProcessor::SOVTimeStepType::System,
     249             :                         OutputProcessor::SOVStoreType::Average,
     250          51 :                         this->name);
     251         102 :     SetupOutputVariable(state,
     252             :                         "Cooling Coil Total Cooling Energy",
     253             :                         OutputProcessor::Unit::J,
     254             :                         this->totalCoolingEnergy,
     255             :                         OutputProcessor::SOVTimeStepType::System,
     256             :                         OutputProcessor::SOVStoreType::Summed,
     257             :                         this->name,
     258             :                         _,
     259             :                         "ENERGYTRANSFER",
     260             :                         "COOLINGCOILS",
     261             :                         _,
     262          51 :                         "System");
     263         102 :     SetupOutputVariable(state,
     264             :                         "Cooling Coil Sensible Cooling Rate",
     265             :                         OutputProcessor::Unit::W,
     266             :                         this->sensCoolingEnergyRate,
     267             :                         OutputProcessor::SOVTimeStepType::System,
     268             :                         OutputProcessor::SOVStoreType::Average,
     269          51 :                         this->name);
     270         102 :     SetupOutputVariable(state,
     271             :                         "Cooling Coil Sensible Cooling Energy",
     272             :                         OutputProcessor::Unit::J,
     273             :                         this->sensCoolingEnergy,
     274             :                         OutputProcessor::SOVTimeStepType::System,
     275             :                         OutputProcessor::SOVStoreType::Summed,
     276          51 :                         this->name);
     277         102 :     SetupOutputVariable(state,
     278             :                         "Cooling Coil Latent Cooling Rate",
     279             :                         OutputProcessor::Unit::W,
     280             :                         this->latCoolingEnergyRate,
     281             :                         OutputProcessor::SOVTimeStepType::System,
     282             :                         OutputProcessor::SOVStoreType::Average,
     283          51 :                         this->name);
     284         102 :     SetupOutputVariable(state,
     285             :                         "Cooling Coil Latent Cooling Energy",
     286             :                         OutputProcessor::Unit::J,
     287             :                         this->latCoolingEnergy,
     288             :                         OutputProcessor::SOVTimeStepType::System,
     289             :                         OutputProcessor::SOVStoreType::Summed,
     290          51 :                         this->name);
     291         102 :     SetupOutputVariable(state,
     292             :                         "Cooling Coil Electricity Rate",
     293             :                         OutputProcessor::Unit::W,
     294             :                         this->performance.powerUse,
     295             :                         OutputProcessor::SOVTimeStepType::System,
     296             :                         OutputProcessor::SOVStoreType::Average,
     297          51 :                         this->name);
     298         102 :     SetupOutputVariable(state,
     299             :                         "Cooling Coil Electricity Energy",
     300             :                         OutputProcessor::Unit::J,
     301             :                         this->performance.electricityConsumption,
     302             :                         OutputProcessor::SOVTimeStepType::System,
     303             :                         OutputProcessor::SOVStoreType::Summed,
     304             :                         this->name,
     305             :                         _,
     306             :                         "Electricity",
     307             :                         "COOLING",
     308             :                         _,
     309          51 :                         "System");
     310             : 
     311          51 :     if (this->performance.compressorFuelType != DataGlobalConstants::ResourceType::Electricity) {
     312           0 :         SetupOutputVariable(state,
     313           0 :                             "Cooling Coil " + this->performance.compressorFuelTypeForOutput + " Rate",
     314             :                             OutputProcessor::Unit::W,
     315             :                             this->performance.compressorFuelRate,
     316             :                             OutputProcessor::SOVTimeStepType::System,
     317             :                             OutputProcessor::SOVStoreType::Average,
     318             :                             this->name);
     319           0 :         SetupOutputVariable(state,
     320           0 :                             "Cooling Coil " + this->performance.compressorFuelTypeForOutput + " Energy",
     321             :                             OutputProcessor::Unit::J,
     322             :                             this->performance.compressorFuelConsumption,
     323             :                             OutputProcessor::SOVTimeStepType::System,
     324             :                             OutputProcessor::SOVStoreType::Summed,
     325             :                             this->name,
     326             :                             _,
     327             :                             this->performance.compressorFuelTypeForOutput,
     328             :                             "COOLING",
     329             :                             _,
     330             :                             "System");
     331             :     }
     332             : 
     333         102 :     SetupOutputVariable(state,
     334             :                         "Cooling Coil Runtime Fraction",
     335             :                         OutputProcessor::Unit::None,
     336             :                         this->coolingCoilRuntimeFraction,
     337             :                         OutputProcessor::SOVTimeStepType::System,
     338             :                         OutputProcessor::SOVStoreType::Average,
     339          51 :                         this->name);
     340         102 :     SetupOutputVariable(state,
     341             :                         "Cooling Coil Crankcase Heater Electricity Rate",
     342             :                         OutputProcessor::Unit::W,
     343             :                         this->performance.crankcaseHeaterPower,
     344             :                         OutputProcessor::SOVTimeStepType::System,
     345             :                         OutputProcessor::SOVStoreType::Average,
     346          51 :                         this->name);
     347         102 :     SetupOutputVariable(state,
     348             :                         "Cooling Coil Crankcase Heater Electricity Energy",
     349             :                         OutputProcessor::Unit::J,
     350             :                         this->performance.crankcaseHeaterElectricityConsumption,
     351             :                         OutputProcessor::SOVTimeStepType::System,
     352             :                         OutputProcessor::SOVStoreType::Summed,
     353             :                         this->name,
     354             :                         _,
     355             :                         "Electricity",
     356             :                         "Cooling",
     357             :                         _,
     358          51 :                         "System");
     359             :     // Ported from variable speed coil
     360         102 :     SetupOutputVariable(state,
     361             :                         "Cooling Coil Air Mass Flow Rate",
     362             :                         OutputProcessor::Unit::kg_s,
     363             :                         this->airMassFlowRate,
     364             :                         OutputProcessor::SOVTimeStepType::System,
     365             :                         OutputProcessor::SOVStoreType::Average,
     366          51 :                         this->name);
     367         102 :     SetupOutputVariable(state,
     368             :                         "Cooling Coil Air Inlet Temperature",
     369             :                         OutputProcessor::Unit::C,
     370             :                         this->inletAirDryBulbTemp,
     371             :                         OutputProcessor::SOVTimeStepType::System,
     372             :                         OutputProcessor::SOVStoreType::Average,
     373          51 :                         this->name);
     374         102 :     SetupOutputVariable(state,
     375             :                         "Cooling Coil Air Inlet Humidity Ratio",
     376             :                         OutputProcessor::Unit::kgWater_kgDryAir,
     377             :                         this->inletAirHumRat,
     378             :                         OutputProcessor::SOVTimeStepType::System,
     379             :                         OutputProcessor::SOVStoreType::Average,
     380          51 :                         this->name);
     381         102 :     SetupOutputVariable(state,
     382             :                         "Cooling Coil Air Outlet Temperature",
     383             :                         OutputProcessor::Unit::C,
     384             :                         this->outletAirDryBulbTemp,
     385             :                         OutputProcessor::SOVTimeStepType::System,
     386             :                         OutputProcessor::SOVStoreType::Average,
     387          51 :                         this->name);
     388         102 :     SetupOutputVariable(state,
     389             :                         "Cooling Coil Air Outlet Humidity Ratio",
     390             :                         OutputProcessor::Unit::kgWater_kgDryAir,
     391             :                         this->outletAirHumRat,
     392             :                         OutputProcessor::SOVTimeStepType::System,
     393             :                         OutputProcessor::SOVStoreType::Average,
     394          51 :                         this->name);
     395         102 :     SetupOutputVariable(state,
     396             :                         "Cooling Coil Part Load Ratio",
     397             :                         OutputProcessor::Unit::None,
     398             :                         this->partLoadRatioReport,
     399             :                         OutputProcessor::SOVTimeStepType::System,
     400             :                         OutputProcessor::SOVStoreType::Average,
     401          51 :                         this->name);
     402         102 :     SetupOutputVariable(state,
     403             :                         "Cooling Coil Upper Speed Level",
     404             :                         OutputProcessor::Unit::None,
     405             :                         this->speedNumReport,
     406             :                         OutputProcessor::SOVTimeStepType::System,
     407             :                         OutputProcessor::SOVStoreType::Average,
     408          51 :                         this->name);
     409         102 :     SetupOutputVariable(state,
     410             :                         "Cooling Coil Neighboring Speed Levels Ratio",
     411             :                         OutputProcessor::Unit::None,
     412             :                         this->speedRatioReport,
     413             :                         OutputProcessor::SOVTimeStepType::System,
     414             :                         OutputProcessor::SOVStoreType::Average,
     415          51 :                         this->name);
     416         102 :     SetupOutputVariable(state,
     417             :                         "Cooling Coil Condenser Inlet Temperature",
     418             :                         OutputProcessor::Unit::C,
     419             :                         this->condenserInletTemperature,
     420             :                         OutputProcessor::SOVTimeStepType::System,
     421             :                         OutputProcessor::SOVStoreType::Average,
     422          51 :                         this->name);
     423         102 :     SetupOutputVariable(state,
     424             :                         "Cooling Coil Dehumidification Mode",
     425             :                         OutputProcessor::Unit::None,
     426             :                         this->dehumidificationMode,
     427             :                         OutputProcessor::SOVTimeStepType::System,
     428             :                         OutputProcessor::SOVStoreType::Average,
     429          51 :                         this->name);
     430         102 :     SetupOutputVariable(state,
     431             :                         "Cooling Coil Waste Heat Power",
     432             :                         OutputProcessor::Unit::W,
     433             :                         this->wasteHeatEnergyRate,
     434             :                         OutputProcessor::SOVTimeStepType::System,
     435             :                         OutputProcessor::SOVStoreType::Average,
     436          51 :                         this->name);
     437         102 :     SetupOutputVariable(state,
     438             :                         "Cooling Coil Waste Heat Energy",
     439             :                         OutputProcessor::Unit::J,
     440             :                         this->wasteHeatEnergy,
     441             :                         OutputProcessor::SOVTimeStepType::System,
     442             :                         OutputProcessor::SOVStoreType::Summed,
     443          51 :                         this->name);
     444             : 
     445          51 :     if (this->performance.evapCondBasinHeatCap > 0) {
     446           0 :         SetupOutputVariable(state,
     447             :                             "Cooling Coil Basin Heater Electricity Rate",
     448             :                             OutputProcessor::Unit::W,
     449             :                             this->performance.basinHeaterPower,
     450             :                             OutputProcessor::SOVTimeStepType::System,
     451             :                             OutputProcessor::SOVStoreType::Average,
     452           0 :                             this->name);
     453           0 :         SetupOutputVariable(state,
     454             :                             "Cooling Coil Basin Heater Electricity Energy",
     455             :                             OutputProcessor::Unit::J,
     456             :                             this->performance.basinHeaterElectricityConsumption,
     457             :                             OutputProcessor::SOVTimeStepType::System,
     458             :                             OutputProcessor::SOVStoreType::Summed,
     459             :                             this->name,
     460             :                             _,
     461             :                             "Electricity",
     462             :                             "COOLING",
     463             :                             _,
     464           0 :                             "System");
     465             :     }
     466          51 :     if (this->condensateTankIndex > 0) {
     467           0 :         SetupOutputVariable(state,
     468             :                             "Cooling Coil Condensate Volume Flow Rate",
     469             :                             OutputProcessor::Unit::m3_s,
     470             :                             this->condensateVolumeFlow,
     471             :                             OutputProcessor::SOVTimeStepType::System,
     472             :                             OutputProcessor::SOVStoreType::Average,
     473           0 :                             this->name);
     474           0 :         SetupOutputVariable(state,
     475             :                             "Cooling Coil Condensate Volume",
     476             :                             OutputProcessor::Unit::m3,
     477             :                             this->condensateVolumeConsumption,
     478             :                             OutputProcessor::SOVTimeStepType::System,
     479             :                             OutputProcessor::SOVStoreType::Summed,
     480             :                             this->name,
     481             :                             _,
     482             :                             "OnSiteWater",
     483             :                             "Condensate",
     484             :                             _,
     485           0 :                             "System");
     486             :     }
     487          51 :     if (this->evaporativeCondSupplyTankIndex > 0) {
     488           0 :         SetupOutputVariable(state,
     489             :                             "Cooling Coil Evaporative Condenser Pump Electricity Rate",
     490             :                             OutputProcessor::Unit::W,
     491             :                             this->evapCondPumpElecPower,
     492             :                             OutputProcessor::SOVTimeStepType::System,
     493             :                             OutputProcessor::SOVStoreType::Average,
     494           0 :                             this->name);
     495           0 :         SetupOutputVariable(state,
     496             :                             "Cooling Coil Evaporative Condenser Pump Electricity Energy",
     497             :                             OutputProcessor::Unit::J,
     498             :                             this->evapCondPumpElecConsumption,
     499             :                             OutputProcessor::SOVTimeStepType::System,
     500             :                             OutputProcessor::SOVStoreType::Summed,
     501             :                             this->name,
     502             :                             _,
     503             :                             "Electricity",
     504             :                             "COOLING",
     505             :                             _,
     506           0 :                             "System");
     507           0 :         SetupOutputVariable(state,
     508             :                             "Cooling Coil Evaporative Condenser Water Volume Flow Rate",
     509             :                             OutputProcessor::Unit::m3_s,
     510             :                             this->evaporativeCondSupplyTankVolumeFlow,
     511             :                             OutputProcessor::SOVTimeStepType::System,
     512             :                             OutputProcessor::SOVStoreType::Average,
     513           0 :                             this->name);
     514           0 :         SetupOutputVariable(state,
     515             :                             "Cooling Coil Evaporative Condenser Water Volume",
     516             :                             OutputProcessor::Unit::m3,
     517             :                             this->evaporativeCondSupplyTankConsump,
     518             :                             OutputProcessor::SOVTimeStepType::System,
     519             :                             OutputProcessor::SOVStoreType::Summed,
     520             :                             this->name,
     521             :                             _,
     522             :                             "Water",
     523             :                             "Cooling",
     524             :                             _,
     525           0 :                             "System");
     526           0 :         SetupOutputVariable(state,
     527             :                             "Cooling Coil Evaporative Condenser Mains Supply Water Volume",
     528             :                             OutputProcessor::Unit::m3,
     529             :                             this->evaporativeCondSupplyTankConsump,
     530             :                             OutputProcessor::SOVTimeStepType::System,
     531             :                             OutputProcessor::SOVStoreType::Summed,
     532             :                             this->name,
     533             :                             _,
     534             :                             "MainsWater",
     535             :                             "Cooling",
     536             :                             _,
     537           0 :                             "System");
     538             :     }
     539          51 :     if (this->SubcoolReheatFlag) {
     540           2 :         SetupOutputVariable(state,
     541             :                             "SubcoolReheat Cooling Coil Operation Mode",
     542             :                             OutputProcessor::Unit::None,
     543             :                             this->performance.OperatingMode,
     544             :                             OutputProcessor::SOVTimeStepType::System,
     545             :                             OutputProcessor::SOVStoreType::Average,
     546           1 :                             this->name);
     547           2 :         SetupOutputVariable(state,
     548             :                             "SubcoolReheat Cooling Coil Operation Mode Ratio",
     549             :                             OutputProcessor::Unit::None,
     550             :                             this->performance.ModeRatio,
     551             :                             OutputProcessor::SOVTimeStepType::System,
     552             :                             OutputProcessor::SOVStoreType::Average,
     553           1 :                             this->name);
     554           2 :         SetupOutputVariable(state,
     555             :                             "SubcoolReheat Cooling Coil Recovered Heat Energy Rate",
     556             :                             OutputProcessor::Unit::W,
     557             :                             this->recoveredHeatEnergyRate,
     558             :                             OutputProcessor::SOVTimeStepType::System,
     559             :                             OutputProcessor::SOVStoreType::Average,
     560           1 :                             this->name);
     561           2 :         SetupOutputVariable(state,
     562             :                             "SubcoolReheat Cooling Coil Recovered Heat Energy",
     563             :                             OutputProcessor::Unit::J,
     564             :                             this->recoveredHeatEnergy,
     565             :                             OutputProcessor::SOVTimeStepType::System,
     566             :                             OutputProcessor::SOVStoreType::Summed,
     567             :                             this->name,
     568             :                             _,
     569             :                             "ENERGYTRANSFER",
     570             :                             "HEATRECOVERY",
     571             :                             _,
     572           1 :                             "System");
     573             :     }
     574             : 
     575          51 :     if (this->isSecondaryDXCoilInZone) {
     576           0 :         SetupOutputVariable(state,
     577             :                             "Secondary Coil Heat Rejection Rate",
     578             :                             OutputProcessor::Unit::W,
     579             :                             this->secCoilSensHeatRejEnergyRate,
     580             :                             OutputProcessor::SOVTimeStepType::System,
     581             :                             OutputProcessor::SOVStoreType::Average,
     582           0 :                             this->name);
     583             : 
     584           0 :         SetupOutputVariable(state,
     585             :                             "Secondary Coil Heat Rejection Energy",
     586             :                             OutputProcessor::Unit::J,
     587             :                             this->secCoilSensHeatRejEnergy,
     588             :                             OutputProcessor::SOVTimeStepType::System,
     589             :                             OutputProcessor::SOVStoreType::Summed,
     590           0 :                             this->name);
     591             :     }
     592          51 : }
     593             : 
     594       59864 : int CoilCoolingDX::getNumModes()
     595             : {
     596       59864 :     int numModes = 1;
     597       59864 :     if (this->performance.hasAlternateMode) {
     598           4 :         numModes++;
     599             :     }
     600       59864 :     return numModes;
     601             : }
     602             : 
     603          47 : int CoilCoolingDX::getOpModeCapFTIndex(bool const useAlternateMode)
     604             : {
     605          47 :     if (useAlternateMode) {
     606           0 :         return this->altModeNomSpeed().indexCapFT;
     607             :     } else {
     608          47 :         return this->normModeNomSpeed().indexCapFT;
     609             :     }
     610             : }
     611             : 
     612          50 : void CoilCoolingDX::setData(int fanIndex, int fanType, std::string const &fanName, int _airLoopNum)
     613             : {
     614          50 :     this->supplyFanIndex = fanIndex;
     615          50 :     this->supplyFanName = fanName;
     616          50 :     this->supplyFanType = fanType;
     617          50 :     this->airLoopNum = _airLoopNum;
     618          50 : }
     619             : 
     620           0 : void CoilCoolingDX::getFixedData(int &_evapInletNodeIndex,
     621             :                                  int &_evapOutletNodeIndex,
     622             :                                  int &_condInletNodeIndex,
     623             :                                  int &_normalModeNumSpeeds,
     624             :                                  CoilCoolingDXCurveFitPerformance::CapControlMethod &_capacityControlMethod,
     625             :                                  Real64 &_minOutdoorDryBulb)
     626             : {
     627           0 :     _evapInletNodeIndex = this->evapInletNodeIndex;
     628           0 :     _evapOutletNodeIndex = this->evapOutletNodeIndex;
     629           0 :     _condInletNodeIndex = this->condInletNodeIndex;
     630           0 :     _normalModeNumSpeeds = (int)this->performance.normalMode.speeds.size();
     631           0 :     _capacityControlMethod = this->performance.capControlMethod;
     632           0 :     _minOutdoorDryBulb = this->performance.minOutdoorDrybulb;
     633           0 : }
     634             : 
     635           0 : void CoilCoolingDX::getDataAfterSizing(Real64 &_normalModeRatedEvapAirFlowRate,
     636             :                                        Real64 &_normalModeRatedCapacity,
     637             :                                        std::vector<Real64> &_normalModeFlowRates,
     638             :                                        std::vector<Real64> &_normalModeRatedCapacities)
     639             : {
     640           0 :     _normalModeRatedEvapAirFlowRate = this->performance.normalMode.ratedEvapAirFlowRate;
     641           0 :     _normalModeFlowRates.clear();
     642           0 :     _normalModeRatedCapacities.clear();
     643           0 :     for (auto const &thisSpeed : this->performance.normalMode.speeds) {
     644           0 :         _normalModeFlowRates.push_back(thisSpeed.evap_air_flow_rate);
     645           0 :         _normalModeRatedCapacities.push_back(thisSpeed.rated_total_capacity);
     646             :     }
     647           0 :     _normalModeRatedCapacity = this->performance.normalMode.ratedGrossTotalCap;
     648           0 : }
     649             : 
     650     4434459 : CoilCoolingDXCurveFitSpeed &CoilCoolingDX::normModeNomSpeed()
     651             : {
     652     4434459 :     return this->performance.normalMode.speeds[this->performance.normalMode.nominalSpeedIndex];
     653             : }
     654             : 
     655       76768 : CoilCoolingDXCurveFitSpeed &CoilCoolingDX::altModeNomSpeed()
     656             : {
     657       76768 :     return this->performance.alternateMode.speeds[this->performance.alternateMode.nominalSpeedIndex];
     658             : }
     659             : 
     660     4511078 : Real64 CoilCoolingDX::condMassFlowRate(bool const useAlternateMode)
     661             : {
     662     4511078 :     if (useAlternateMode) {
     663       76768 :         return this->altModeNomSpeed().RatedCondAirMassFlowRate;
     664             :     } else {
     665     4434310 :         return this->normModeNomSpeed().RatedCondAirMassFlowRate;
     666             :     }
     667             : }
     668             : 
     669          51 : void CoilCoolingDX::size(EnergyPlus::EnergyPlusData &state)
     670             : {
     671          51 :     this->performance.parentName = this->name;
     672          51 :     this->performance.size(state);
     673          51 : }
     674             : 
     675     4511078 : void CoilCoolingDX::simulate(EnergyPlus::EnergyPlusData &state,
     676             :                              int useAlternateMode,
     677             :                              Real64 PLR,
     678             :                              int speedNum,
     679             :                              Real64 speedRatio,
     680             :                              int const fanOpMode,
     681             :                              bool const singleMode,
     682             :                              Real64 LoadSHR)
     683             : {
     684     4511078 :     if (this->myOneTimeInitFlag) {
     685          51 :         this->oneTimeInit(state);
     686          51 :         this->myOneTimeInitFlag = false;
     687             :     }
     688             : 
     689             :     static constexpr std::string_view RoutineName = "CoilCoolingDX::simulate";
     690             : 
     691             :     // get node references
     692     4511078 :     auto &evapInletNode = state.dataLoopNodes->Node(this->evapInletNodeIndex);
     693     4511078 :     auto &evapOutletNode = state.dataLoopNodes->Node(this->evapOutletNodeIndex);
     694     4511078 :     auto &condInletNode = state.dataLoopNodes->Node(this->condInletNodeIndex);
     695     4511078 :     auto &condOutletNode = state.dataLoopNodes->Node(this->condOutletNodeIndex);
     696             : 
     697             :     // set some reporting variables
     698     4511078 :     this->condenserInletTemperature = condInletNode.Temp;
     699     4511078 :     this->dehumidificationMode = useAlternateMode;
     700             : 
     701             :     // set condenser inlet/outlet nodes
     702             :     // once condenser inlet is connected to upstream components, will need to revisit
     703     4511078 :     condInletNode.MassFlowRate = this->condMassFlowRate(useAlternateMode);
     704     4511078 :     condOutletNode.MassFlowRate = condInletNode.MassFlowRate;
     705             : 
     706             :     // call the simulation, which returns useful data
     707             :     // TODO: check the avail schedule and reset data/pass through data as needed
     708             :     // TODO: check the minOATcompressor and reset data/pass through data as needed
     709     4511078 :     this->performance.OperatingMode = 0;
     710     4511078 :     this->performance.ModeRatio = 0.0;
     711     4511078 :     this->performance.simulate(state,
     712             :                                evapInletNode,
     713             :                                evapOutletNode,
     714             :                                useAlternateMode,
     715             :                                PLR,
     716             :                                speedNum,
     717             :                                speedRatio,
     718             :                                fanOpMode,
     719             :                                condInletNode,
     720             :                                condOutletNode,
     721             :                                singleMode,
     722             :                                LoadSHR);
     723     4511078 :     EnergyPlus::CoilCoolingDX::passThroughNodeData(evapInletNode, evapOutletNode);
     724             : 
     725             :     // calculate energy conversion factor
     726     4511078 :     Real64 reportingConstant = state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
     727             : 
     728             :     // update condensate collection tank
     729     4511078 :     if (this->condensateTankIndex > 0) {
     730           0 :         if (speedNum > 0) {
     731             :             // calculate and report condensation rates  (how much water extracted from the air stream)
     732             :             // water flow of water in m3/s for water system interactions
     733           0 :             Real64 averageTemp = (evapInletNode.Temp - evapOutletNode.Temp) / 2.0;
     734           0 :             Real64 waterDensity = Psychrometrics::RhoH2O(averageTemp);
     735           0 :             Real64 inHumidityRatio = evapInletNode.HumRat;
     736           0 :             Real64 outHumidityRatio = evapOutletNode.HumRat;
     737           0 :             this->condensateVolumeFlow = max(0.0, (evapInletNode.MassFlowRate * (inHumidityRatio - outHumidityRatio) / waterDensity));
     738           0 :             this->condensateVolumeConsumption = this->condensateVolumeFlow * reportingConstant;
     739           0 :             state.dataWaterData->WaterStorage(this->condensateTankIndex).VdotAvailSupply(this->condensateTankSupplyARRID) =
     740           0 :                 this->condensateVolumeFlow;
     741           0 :             state.dataWaterData->WaterStorage(this->condensateTankIndex).TwaterSupply(this->condensateTankSupplyARRID) = evapOutletNode.Temp;
     742             :         } else {
     743           0 :             state.dataWaterData->WaterStorage(this->condensateTankIndex).VdotAvailSupply(this->condensateTankSupplyARRID) = 0.0;
     744           0 :             state.dataWaterData->WaterStorage(this->condensateTankIndex).TwaterSupply(this->condensateTankSupplyARRID) = evapOutletNode.Temp;
     745             :         }
     746             :     }
     747             : 
     748             :     // update requests for evaporative condenser tank
     749     4511078 :     if (this->evaporativeCondSupplyTankIndex > 0) {
     750           0 :         if (speedNum > 0) {
     751             :             Real64 condInletTemp =
     752           0 :                 state.dataEnvrn->OutWetBulbTemp + (state.dataEnvrn->OutDryBulbTemp - state.dataEnvrn->OutWetBulbTemp) *
     753           0 :                                                       (1.0 - this->performance.normalMode.speeds[speedNum - 1].evap_condenser_effectiveness);
     754             :             Real64 condInletHumRat =
     755           0 :                 Psychrometrics::PsyWFnTdbTwbPb(state, condInletTemp, state.dataEnvrn->OutWetBulbTemp, state.dataEnvrn->OutBaroPress, RoutineName);
     756           0 :             Real64 outdoorHumRat = state.dataEnvrn->OutHumRat;
     757             : 
     758           0 :             Real64 condAirMassFlow = condInletNode.MassFlowRate;
     759           0 :             Real64 waterDensity = Psychrometrics::RhoH2O(state.dataEnvrn->OutDryBulbTemp);
     760           0 :             this->evaporativeCondSupplyTankVolumeFlow = (condInletHumRat - outdoorHumRat) * condAirMassFlow / waterDensity;
     761           0 :             this->evaporativeCondSupplyTankConsump = this->evaporativeCondSupplyTankVolumeFlow * reportingConstant;
     762           0 :             if (useAlternateMode == DataHVACGlobals::coilNormalMode) {
     763           0 :                 this->evapCondPumpElecPower = this->performance.normalMode.getCurrentEvapCondPumpPower(speedNum);
     764             :             }
     765           0 :             state.dataWaterData->WaterStorage(this->evaporativeCondSupplyTankIndex).VdotRequestDemand(this->evaporativeCondSupplyTankARRID) =
     766           0 :                 this->evaporativeCondSupplyTankVolumeFlow;
     767             :         } else {
     768           0 :             state.dataWaterData->WaterStorage(this->evaporativeCondSupplyTankIndex).VdotRequestDemand(this->evaporativeCondSupplyTankARRID) = 0.0;
     769             :         }
     770             :     }
     771             : 
     772             :     // update report variables
     773     4511078 :     this->airMassFlowRate = evapOutletNode.MassFlowRate;
     774     4511078 :     this->inletAirDryBulbTemp = evapInletNode.Temp;
     775     4511078 :     this->inletAirHumRat = evapInletNode.HumRat;
     776     4511078 :     this->outletAirDryBulbTemp = evapOutletNode.Temp;
     777     4511078 :     this->outletAirHumRat = evapOutletNode.HumRat;
     778             : 
     779     4511078 :     CalcComponentSensibleLatentOutput(evapOutletNode.MassFlowRate,
     780             :                                       evapInletNode.Temp,
     781             :                                       evapInletNode.HumRat,
     782             :                                       evapOutletNode.Temp,
     783             :                                       evapOutletNode.HumRat,
     784             :                                       this->sensCoolingEnergyRate,
     785             :                                       this->latCoolingEnergyRate,
     786             :                                       this->totalCoolingEnergyRate);
     787     4511078 :     this->totalCoolingEnergy = this->totalCoolingEnergyRate * reportingConstant;
     788     4511078 :     this->sensCoolingEnergy = this->sensCoolingEnergyRate * reportingConstant;
     789     4511078 :     this->latCoolingEnergy = this->latCoolingEnergyRate * reportingConstant;
     790             : 
     791     4511078 :     this->evapCondPumpElecConsumption = this->evapCondPumpElecPower * reportingConstant;
     792             : 
     793     4511078 :     this->coolingCoilRuntimeFraction = this->performance.RTF;
     794     4511078 :     this->elecCoolingPower = this->performance.powerUse;
     795     4511078 :     this->elecCoolingConsumption = this->performance.powerUse * reportingConstant;
     796     4511078 :     this->wasteHeatEnergyRate = this->performance.wasteHeatRate;
     797     4511078 :     this->wasteHeatEnergy = this->performance.wasteHeatRate * reportingConstant;
     798             : 
     799     4511078 :     this->partLoadRatioReport = PLR;
     800     4511078 :     this->speedNumReport = speedNum;
     801     4511078 :     this->speedRatioReport = speedRatio;
     802             : 
     803     4511078 :     if (useAlternateMode == DataHVACGlobals::coilSubcoolReheatMode) {
     804       76768 :         this->recoveredHeatEnergyRate = this->performance.recoveredEnergyRate;
     805       76768 :         this->recoveredHeatEnergy = this->recoveredHeatEnergyRate * reportingConstant;
     806             :     }
     807             : 
     808     4511078 :     if (this->isSecondaryDXCoilInZone) {
     809             :         // call CalcSecondaryDXCoils ???
     810           0 :         this->secCoilSensHeatRejEnergyRate = this->totalCoolingEnergyRate + this->elecCoolingPower;
     811           0 :         this->secCoilSensHeatRejEnergy = this->totalCoolingEnergy + this->elecCoolingConsumption;
     812             :     }
     813             : 
     814             :     // Fishy global things that need to be set here, try to set the AFN stuff now
     815             :     // This appears to be the only location where airLoopNum gets used
     816             :     // DataAirLoop::LoopDXCoilRTF = max(this->coolingCoilRuntimeFraction, DXCoil(DXCoilNum).HeatingCoilRuntimeFraction);
     817     4511078 :     state.dataAirLoop->LoopDXCoilRTF = this->coolingCoilRuntimeFraction;
     818     4511078 :     state.dataHVACGlobal->DXElecCoolingPower = this->elecCoolingPower;
     819     4511078 :     if (this->airLoopNum > 0) {
     820           0 :         state.dataAirLoop->AirLoopAFNInfo(this->airLoopNum).AFNLoopDXCoilRTF = this->coolingCoilRuntimeFraction;
     821             :         // The original calculation is below, but no heating yet
     822             :         //        max(DXCoil(DXCoilNum).CoolingCoilRuntimeFraction, DXCoil(DXCoilNum).HeatingCoilRuntimeFraction);
     823             :     }
     824             : 
     825             :     // report out to the coil sizing report if needed
     826     4511078 :     if (this->reportCoilFinalSizes) {
     827     1037573 :         if (!state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingHVACSizingSimulations && !state.dataGlobal->DoingSizing) {
     828             : 
     829             :             // report out final coil sizing info
     830          51 :             Real64 ratedSensCap(0.0);
     831          51 :             ratedSensCap = this->performance.normalMode.ratedGrossTotalCap * this->normModeNomSpeed().grossRatedSHR;
     832         102 :             state.dataRptCoilSelection->coilSelectionReportObj->setCoilFinalSizes(state,
     833             :                                                                                   this->name,
     834          51 :                                                                                   state.dataCoilCooingDX->coilCoolingDXObjectName,
     835             :                                                                                   this->performance.normalMode.ratedGrossTotalCap,
     836             :                                                                                   ratedSensCap,
     837             :                                                                                   this->performance.normalMode.ratedEvapAirFlowRate,
     838             :                                                                                   -999.0);
     839             : 
     840             :             // report out fan information
     841          51 :             if (this->supplyFanType == DataHVACGlobals::FanType_SystemModelObject) {
     842           6 :                 if (this->supplyFanIndex >= 0) {
     843          18 :                     state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(state,
     844             :                                                                                              this->name,
     845           6 :                                                                                              state.dataCoilCooingDX->coilCoolingDXObjectName,
     846           6 :                                                                                              state.dataHVACFan->fanObjs[this->supplyFanIndex]->name,
     847             :                                                                                              DataAirSystems::ObjectVectorOOFanSystemModel,
     848             :                                                                                              this->supplyFanIndex);
     849             :                 }
     850             :             } else {
     851          45 :                 if (this->supplyFanIndex >= 1) {
     852         126 :                     state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(state,
     853             :                                                                                              this->name,
     854          42 :                                                                                              state.dataCoilCooingDX->coilCoolingDXObjectName,
     855          42 :                                                                                              state.dataFans->Fan(this->supplyFanIndex).FanName,
     856             :                                                                                              DataAirSystems::StructArrayLegacyFanModels,
     857             :                                                                                              this->supplyFanIndex);
     858             :                 }
     859             :             }
     860             : 
     861             :             // report out coil rating conditions, just create a set of dummy nodes and run calculate on them
     862          51 :             DataLoopNode::NodeData dummyEvapInlet;
     863          51 :             DataLoopNode::NodeData dummyEvapOutlet;
     864          51 :             DataLoopNode::NodeData dummyCondInlet;
     865          51 :             DataLoopNode::NodeData dummyCondOutlet;
     866          51 :             Real64 dummyPLR = 1.0;
     867          51 :             int dummySpeedNum = 1;
     868          51 :             Real64 dummySpeedRatio = 1.0;
     869          51 :             int dummyFanOpMode = 1.0;
     870          51 :             bool dummySingleMode = false;
     871             : 
     872          51 :             Real64 constexpr RatedInletAirTemp(26.6667);   // 26.6667C or 80F
     873          51 :             Real64 constexpr RatedInletWetBulbTemp(19.44); // 19.44 or 67F
     874          51 :             Real64 constexpr RatedOutdoorAirTemp(35.0);    // 35 C or 95F
     875          51 :             Real64 ratedOutdoorAirWetBulb = 23.9;          // from I/O ref. more precise value?
     876             : 
     877          51 :             Real64 ratedInletEvapMassFlowRate = this->performance.normalMode.ratedEvapAirMassFlowRate;
     878          51 :             dummyEvapInlet.MassFlowRate = ratedInletEvapMassFlowRate;
     879          51 :             dummyEvapInlet.Temp = RatedInletAirTemp;
     880             :             Real64 dummyInletAirHumRat =
     881          51 :                 Psychrometrics::PsyWFnTdbTwbPb(state, RatedInletAirTemp, RatedInletWetBulbTemp, DataEnvironment::StdPressureSeaLevel, RoutineName);
     882          51 :             dummyEvapInlet.Press = DataEnvironment::StdPressureSeaLevel;
     883          51 :             dummyEvapInlet.HumRat = dummyInletAirHumRat;
     884          51 :             dummyEvapInlet.Enthalpy = Psychrometrics::PsyHFnTdbW(RatedInletAirTemp, dummyInletAirHumRat);
     885             : 
     886             :             // maybe we don't actually need to override weather below, we'll see
     887          51 :             dummyCondInlet.Temp = RatedOutdoorAirTemp;
     888          51 :             dummyCondInlet.HumRat =
     889          51 :                 Psychrometrics::PsyWFnTdbTwbPb(state, RatedOutdoorAirTemp, ratedOutdoorAirWetBulb, DataEnvironment::StdPressureSeaLevel, RoutineName);
     890          51 :             dummyCondInlet.OutAirWetBulb = ratedOutdoorAirWetBulb;
     891          51 :             dummyCondInlet.Press = condInletNode.Press; // for now; TODO: Investigate
     892             : 
     893             :             // overriding outdoor conditions temporarily
     894          51 :             Real64 holdOutDryBulbTemp = state.dataEnvrn->OutDryBulbTemp;
     895          51 :             Real64 holdOutHumRat = state.dataEnvrn->OutHumRat;
     896          51 :             Real64 holdOutWetBulb = state.dataEnvrn->OutWetBulbTemp;
     897          51 :             Real64 holdOutBaroPress = state.dataEnvrn->OutBaroPress;
     898          51 :             state.dataEnvrn->OutDryBulbTemp = RatedOutdoorAirTemp;
     899          51 :             state.dataEnvrn->OutWetBulbTemp = ratedOutdoorAirWetBulb;
     900          51 :             state.dataEnvrn->OutBaroPress = DataEnvironment::StdPressureSeaLevel; // assume rating is for sea level.
     901          51 :             state.dataEnvrn->OutHumRat =
     902          51 :                 Psychrometrics::PsyWFnTdbTwbPb(state, RatedOutdoorAirTemp, ratedOutdoorAirWetBulb, DataEnvironment::StdPressureSeaLevel, RoutineName);
     903             : 
     904          51 :             this->performance.simulate(state,
     905             :                                        dummyEvapInlet,
     906             :                                        dummyEvapOutlet,
     907             :                                        false,
     908             :                                        dummyPLR,
     909             :                                        dummySpeedNum,
     910             :                                        dummySpeedRatio,
     911             :                                        dummyFanOpMode,
     912             :                                        dummyCondInlet,
     913             :                                        dummyCondOutlet,
     914             :                                        dummySingleMode);
     915             : 
     916             :             // reset outdoor conditions back to previous state
     917          51 :             state.dataEnvrn->OutDryBulbTemp = holdOutDryBulbTemp;
     918          51 :             state.dataEnvrn->OutWetBulbTemp = holdOutWetBulb;
     919          51 :             state.dataEnvrn->OutBaroPress = holdOutBaroPress;
     920          51 :             state.dataEnvrn->OutHumRat = holdOutHumRat;
     921             : 
     922             :             // Real64 const coolingRate = dummyEvapInlet.MassFlowRate * (dummyEvapInlet.Enthalpy - dummyEvapOutlet.Enthalpy);
     923             :             // Real64 const thisMinAirHumRat = min(dummyEvapInlet.HumRat, dummyEvapOutlet.HumRat);
     924             :             // Real64 const sensCoolingRate = dummyEvapInlet.MassFlowRate * (Psychrometrics::PsyHFnTdbW(dummyEvapInlet.Temp, thisMinAirHumRat) -
     925             :             //                                                              Psychrometrics::PsyHFnTdbW(dummyEvapOutlet.Temp, thisMinAirHumRat));
     926          51 :             Real64 coolingRate = 0.0;
     927          51 :             Real64 sensCoolingRate = 0.0;
     928          51 :             Real64 latCoolingRate = 0.0;
     929          51 :             CalcComponentSensibleLatentOutput(dummyEvapInlet.MassFlowRate,
     930             :                                               dummyEvapInlet.Temp,
     931             :                                               dummyEvapInlet.HumRat,
     932             :                                               dummyEvapOutlet.Temp,
     933             :                                               dummyEvapOutlet.HumRat,
     934             :                                               sensCoolingRate,
     935             :                                               latCoolingRate,
     936             :                                               coolingRate);
     937             : 
     938         102 :             Real64 const ratedOutletWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
     939         102 :                 state, dummyEvapOutlet.Temp, dummyEvapOutlet.HumRat, DataEnvironment::StdPressureSeaLevel, "Coil:Cooling:DX::simulate");
     940         153 :             state.dataRptCoilSelection->coilSelectionReportObj->setRatedCoilConditions(state,
     941             :                                                                                        this->name,
     942          51 :                                                                                        state.dataCoilCooingDX->coilCoolingDXObjectName,
     943             :                                                                                        coolingRate,
     944             :                                                                                        sensCoolingRate,
     945             :                                                                                        ratedInletEvapMassFlowRate,
     946             :                                                                                        RatedInletAirTemp,
     947             :                                                                                        dummyInletAirHumRat,
     948             :                                                                                        RatedInletWetBulbTemp,
     949             :                                                                                        dummyEvapOutlet.Temp,
     950             :                                                                                        dummyEvapOutlet.HumRat,
     951             :                                                                                        ratedOutletWetBulb,
     952             :                                                                                        RatedOutdoorAirTemp,
     953             :                                                                                        ratedOutdoorAirWetBulb,
     954          51 :                                                                                        this->normModeNomSpeed().RatedCBF,
     955             :                                                                                        -999.0);
     956             : 
     957          51 :             this->reportCoilFinalSizes = false;
     958             :         }
     959             :     }
     960             : 
     961             :     // update available reclaim heat
     962     4511078 :     this->reclaimHeat.AvailCapacity = this->totalCoolingEnergyRate + this->elecCoolingPower;
     963     4511078 : }
     964             : 
     965           0 : void CoilCoolingDX::setToHundredPercentDOAS()
     966             : {
     967           0 :     for (auto &speed : this->performance.normalMode.speeds) {
     968           0 :         speed.minRatedVolFlowPerRatedTotCap = DataHVACGlobals::MinRatedVolFlowPerRatedTotCap2;
     969           0 :         speed.maxRatedVolFlowPerRatedTotCap = DataHVACGlobals::MaxRatedVolFlowPerRatedTotCap2;
     970             :     }
     971           0 :     if (this->performance.hasAlternateMode) {
     972           0 :         for (auto &speed : this->performance.alternateMode.speeds) {
     973           0 :             speed.minRatedVolFlowPerRatedTotCap = DataHVACGlobals::MinRatedVolFlowPerRatedTotCap2;
     974           0 :             speed.maxRatedVolFlowPerRatedTotCap = DataHVACGlobals::MaxRatedVolFlowPerRatedTotCap2;
     975             :         }
     976             :     }
     977           0 : }
     978             : 
     979     4511078 : void CoilCoolingDX::passThroughNodeData(EnergyPlus::DataLoopNode::NodeData &in, EnergyPlus::DataLoopNode::NodeData &out)
     980             : {
     981             :     // pass through all the other node variables that we don't update as a part of this model calculation
     982     4511078 :     out.MassFlowRate = in.MassFlowRate;
     983     4511078 :     out.Press = in.Press;
     984     4511078 :     out.Quality = in.Quality;
     985     4511078 :     out.MassFlowRateMax = in.MassFlowRateMax;
     986     4511078 :     out.MassFlowRateMin = in.MassFlowRateMin;
     987     4511078 :     out.MassFlowRateMaxAvail = in.MassFlowRateMaxAvail;
     988     4511078 :     out.MassFlowRateMinAvail = in.MassFlowRateMinAvail;
     989     4511078 : }
     990             : 
     991         769 : void CoilCoolingDX::reportAllStandardRatings(EnergyPlus::EnergyPlusData &state)
     992             : {
     993         769 :     if (!state.dataCoilCooingDX->coilCoolingDXs.empty()) {
     994          19 :         Real64 constexpr ConvFromSIToIP(3.412141633); // Conversion from SI to IP [3.412 Btu/hr-W]
     995             :         static constexpr std::string_view Format_990(
     996             :             "! <DX Cooling Coil Standard Rating Information>, Component Type, Component Name, Standard Rating (Net) "
     997             :             "Cooling Capacity {W}, Standard Rated Net COP {W/W}, EER {Btu/W-h}, SEER {Btu/W-h}, IEER {Btu/W-h}\n");
     998          19 :         print(state.files.eio, "{}", Format_990);
     999          70 :         for (auto &coil : state.dataCoilCooingDX->coilCoolingDXs) {
    1000          51 :             coil.performance.calcStandardRatings210240(state);
    1001             : 
    1002             :             static constexpr std::string_view Format_991(
    1003             :                 " DX Cooling Coil Standard Rating Information, {}, {}, {:.1R}, {:.2R}, {:.2R}, {:.2R}, {:.2R}\n");
    1004          51 :             print(state.files.eio,
    1005             :                   Format_991,
    1006             :                   "Coil:Cooling:DX",
    1007             :                   coil.name,
    1008             :                   coil.performance.standardRatingCoolingCapacity,
    1009             :                   coil.performance.standardRatingEER,
    1010         102 :                   coil.performance.standardRatingEER * ConvFromSIToIP,
    1011         102 :                   coil.performance.standardRatingSEER * ConvFromSIToIP,
    1012         102 :                   coil.performance.standardRatingIEER * ConvFromSIToIP);
    1013             : 
    1014          51 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilType, coil.name, "Coil:Cooling:DX");
    1015         102 :             OutputReportPredefined::PreDefTableEntry(
    1016          51 :                 state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSI, coil.name, coil.performance.standardRatingCoolingCapacity, 1);
    1017             :             // W/W is the same as Btuh/Btuh so that's fine too
    1018         102 :             OutputReportPredefined::PreDefTableEntry(
    1019          51 :                 state, state.dataOutRptPredefined->pdchDXCoolCoilCOP, coil.name, coil.performance.standardRatingEER, 2);
    1020             :             // Btu/W-h will convert to itself
    1021         153 :             OutputReportPredefined::PreDefTableEntry(
    1022         102 :                 state, state.dataOutRptPredefined->pdchDXCoolCoilEERIP, coil.name, coil.performance.standardRatingEER * ConvFromSIToIP, 2);
    1023         153 :             OutputReportPredefined::PreDefTableEntry(
    1024         102 :                 state, state.dataOutRptPredefined->pdchDXCoolCoilSEERUserIP, coil.name, coil.performance.standardRatingSEER * ConvFromSIToIP, 2);
    1025         153 :             OutputReportPredefined::PreDefTableEntry(
    1026         102 :                 state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP, coil.name, coil.performance.standardRatingIEER * ConvFromSIToIP, 2);
    1027          51 :             OutputReportPredefined::addFootNoteSubTable(
    1028          51 :                 state, state.dataOutRptPredefined->pdstDXCoolCoil, "ANSI/AHRI ratings account for supply air fan heat and electric power.");
    1029             : 
    1030             :             // AHRI 2023 Standard SEER2 Calculations
    1031             :             static constexpr std::string_view Format_991_(
    1032             :                 " DX Cooling Coil Standard Rating Information, {}, {}, {:.1R}, {:.2R}, {:.2R}, {:.2R}, {:.2R}, {}\n");
    1033         153 :             print(state.files.eio,
    1034             :                   Format_991_,
    1035             :                   "Coil:Cooling:DX",
    1036             :                   coil.name,
    1037             :                   coil.performance.standardRatingCoolingCapacity2023,
    1038             :                   coil.performance.standardRatingEER2,
    1039         102 :                   coil.performance.standardRatingEER2 * ConvFromSIToIP,
    1040         102 :                   coil.performance.standardRatingSEER2_User * ConvFromSIToIP,
    1041         102 :                   coil.performance.standardRatingSEER2_Standard * ConvFromSIToIP,
    1042             :                   ' ');
    1043             : 
    1044          51 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilType_2023, coil.name, "Coil:Cooling:DX");
    1045         102 :             OutputReportPredefined::PreDefTableEntry(
    1046          51 :                 state, state.dataOutRptPredefined->pdchDXCoolCoilNetCapSI_2023, coil.name, coil.performance.standardRatingCoolingCapacity2023, 1);
    1047             :             // W/W is the same as Btuh/Btuh so that's fine too
    1048         102 :             OutputReportPredefined::PreDefTableEntry(
    1049          51 :                 state, state.dataOutRptPredefined->pdchDXCoolCoilCOP_2023, coil.name, coil.performance.standardRatingEER2, 2);
    1050             :             // Btu/W-h will convert to itself
    1051         153 :             OutputReportPredefined::PreDefTableEntry(
    1052         102 :                 state, state.dataOutRptPredefined->pdchDXCoolCoilEERIP_2023, coil.name, coil.performance.standardRatingEER2 * ConvFromSIToIP, 2);
    1053         153 :             OutputReportPredefined::PreDefTableEntry(state,
    1054          51 :                                                      state.dataOutRptPredefined->pdchDXCoolCoilSEER2UserIP_2023,
    1055             :                                                      coil.name,
    1056          51 :                                                      coil.performance.standardRatingSEER2_User * ConvFromSIToIP,
    1057             :                                                      2);
    1058         153 :             OutputReportPredefined::PreDefTableEntry(state,
    1059          51 :                                                      state.dataOutRptPredefined->pdchDXCoolCoilSEER2StandardIP_2023,
    1060             :                                                      coil.name,
    1061          51 :                                                      coil.performance.standardRatingSEER2_Standard * ConvFromSIToIP,
    1062             :                                                      2);
    1063             :             // OutputReportPredefined::PreDefTableEntry(
    1064             :             // state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP_2023, coil.name, coil.performance.standardRatingIEER * ConvFromSIToIP, 2);
    1065          51 :             OutputReportPredefined::addFootNoteSubTable(
    1066          51 :                 state, state.dataOutRptPredefined->pdstDXCoolCoil_2023, "ANSI/AHRI 2023 ratings account for supply air fan heat and electric power.");
    1067             :         }
    1068             :     }
    1069         769 :     state.dataCoilCooingDX->stillNeedToReportStandardRatings = false;
    1070        3082 : }

Generated by: LCOV version 1.13