LCOV - code coverage report
Current view: top level - EnergyPlus/Coils - CoilCoolingDXCurveFitOperatingMode.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 79.7 % 231 184
Test Date: 2025-05-22 16:09:37 Functions: 83.3 % 6 5

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, 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 <EnergyPlus/Autosizing/All_Simple_Sizing.hh>
      49              : #include <EnergyPlus/Autosizing/CoolingAirFlowSizing.hh>
      50              : #include <EnergyPlus/Autosizing/CoolingCapacitySizing.hh>
      51              : #include <EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.hh>
      52              : #include <EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh>
      53              : #include <EnergyPlus/Data/EnergyPlusData.hh>
      54              : #include <EnergyPlus/DataEnvironment.hh>
      55              : #include <EnergyPlus/DataHVACGlobals.hh>
      56              : #include <EnergyPlus/DataIPShortCuts.hh>
      57              : #include <EnergyPlus/DataSizing.hh>
      58              : #include <EnergyPlus/EMSManager.hh>
      59              : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      60              : #include <EnergyPlus/Psychrometrics.hh>
      61              : 
      62              : using namespace EnergyPlus;
      63              : 
      64           28 : void CoilCoolingDXCurveFitOperatingMode::instantiateFromInputSpec(EnergyPlus::EnergyPlusData &state,
      65              :                                                                   CoilCoolingDXCurveFitOperatingModeInputSpecification input_data)
      66              : {
      67              :     static constexpr std::string_view routineName("CoilCoolingDXCurveFitOperatingMode::instantiateFromInputSpec: ");
      68           28 :     bool errorsFound(false);
      69           28 :     this->original_input_specs = input_data;
      70           28 :     this->name = input_data.name;
      71           28 :     this->ratedGrossTotalCap = input_data.gross_rated_total_cooling_capacity;
      72           28 :     if (this->ratedGrossTotalCap == DataSizing::AutoSize) this->ratedGrossTotalCapIsAutosized = true;
      73           28 :     this->ratedEvapAirFlowRate = input_data.rated_evaporator_air_flow_rate;
      74           28 :     if (this->ratedEvapAirFlowRate == DataSizing::AutoSize) this->ratedEvapAirFlowRateIsAutosized = true;
      75           28 :     this->ratedCondAirFlowRate = input_data.rated_condenser_air_flow_rate;
      76           28 :     this->timeForCondensateRemoval = input_data.nominal_time_for_condensate_removal_to_begin;
      77           28 :     this->evapRateRatio = input_data.ratio_of_initial_moisture_evaporation_rate_and_steady_state_latent_capacity;
      78           28 :     this->maxCyclingRate = input_data.maximum_cycling_rate;
      79           28 :     this->latentTimeConst = input_data.latent_capacity_time_constant;
      80           28 :     if (Util::SameString(input_data.apply_latent_degradation_to_speeds_greater_than_1, "Yes")) {
      81            5 :         this->applyLatentDegradationAllSpeeds = true;
      82              :     } else {
      83           23 :         this->applyLatentDegradationAllSpeeds = false;
      84              :     }
      85              :     // TODO: UNUSED apply_latent_degradation_to_speeds_greater_than_1
      86           28 :     this->nominalEvaporativePumpPower = input_data.nominal_evap_condenser_pump_power;
      87              : 
      88              :     // Must all be greater than zero to use the latent capacity degradation model
      89           28 :     if ((this->maxCyclingRate > 0.0 || this->evapRateRatio > 0.0 || this->latentTimeConst > 0.0 || this->timeForCondensateRemoval > 0.0) &&
      90            5 :         (this->maxCyclingRate <= 0.0 || this->evapRateRatio <= 0.0 || this->latentTimeConst <= 0.0 || this->timeForCondensateRemoval <= 0.0)) {
      91            0 :         ShowWarningError(state, std::string{routineName} + this->object_name + "=\"" + this->name + "\":");
      92            0 :         ShowContinueError(state, "...At least one of the four input parameters for the latent capacity degradation model");
      93            0 :         ShowContinueError(state, "...is set to zero. Therefore, the latent degradation model will not be used for this simulation.");
      94            0 :         this->latentDegradationActive = false;
      95           28 :     } else if (this->maxCyclingRate > 0.0 && this->evapRateRatio > 0.0 && this->latentTimeConst > 0.0 && this->timeForCondensateRemoval > 0.0) {
      96            5 :         this->latentDegradationActive = true;
      97              :     }
      98              : 
      99           28 :     if (Util::SameString(input_data.condenser_type, "AirCooled")) {
     100           21 :         this->condenserType = CondenserType::AIRCOOLED;
     101            7 :     } else if (Util::SameString(input_data.condenser_type, "EvaporativelyCooled")) {
     102            7 :         this->condenserType = CondenserType::EVAPCOOLED;
     103              :     } else {
     104            0 :         ShowSevereError(state, std::string{routineName} + this->object_name + "=\"" + this->name + "\", invalid");
     105            0 :         ShowContinueError(state, "...Condenser Type=\"" + input_data.condenser_type + "\":");
     106            0 :         ShowContinueError(state, "...must be AirCooled or EvaporativelyCooled.");
     107            0 :         errorsFound = true;
     108              :     }
     109           84 :     for (auto &speed_name : input_data.speed_data_names) {
     110           56 :         this->speeds.emplace_back(state, speed_name);
     111              :     }
     112              : 
     113              :     // convert speed num in IDF to vector index
     114           28 :     this->nominalSpeedIndex = input_data.nominal_speed_number - 1;
     115              : 
     116           28 :     if (errorsFound) {
     117            0 :         ShowFatalError(
     118            0 :             state, std::string{routineName} + "Errors found in getting " + this->object_name + " input. Preceding condition(s) causes termination.");
     119              :     }
     120           28 : }
     121              : 
     122           84 : CoilCoolingDXCurveFitOperatingMode::CoilCoolingDXCurveFitOperatingMode(EnergyPlus::EnergyPlusData &state, const std::string &name_to_find)
     123              : {
     124           28 :     int numModes = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CoilCoolingDXCurveFitOperatingMode::object_name);
     125              :     if (numModes <= 0) {
     126              :         // error
     127              :     }
     128           28 :     bool found_it = false;
     129           37 :     for (int modeNum = 1; modeNum <= numModes; ++modeNum) {
     130              :         int NumAlphas;  // Number of Alphas for each GetObjectItem call
     131              :         int NumNumbers; // Number of Numbers for each GetObjectItem call
     132              :         int IOStatus;
     133           74 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
     134              :                                                                  CoilCoolingDXCurveFitOperatingMode::object_name,
     135              :                                                                  modeNum,
     136           37 :                                                                  state.dataIPShortCut->cAlphaArgs,
     137              :                                                                  NumAlphas,
     138           37 :                                                                  state.dataIPShortCut->rNumericArgs,
     139              :                                                                  NumNumbers,
     140              :                                                                  IOStatus);
     141           37 :         if (!Util::SameString(name_to_find, state.dataIPShortCut->cAlphaArgs(1))) {
     142            9 :             continue;
     143              :         }
     144           28 :         found_it = true;
     145              : 
     146           28 :         CoilCoolingDXCurveFitOperatingModeInputSpecification input_specs;
     147              : 
     148           28 :         input_specs.name = state.dataIPShortCut->cAlphaArgs(1);
     149           28 :         input_specs.gross_rated_total_cooling_capacity = state.dataIPShortCut->rNumericArgs(1);
     150           28 :         input_specs.rated_evaporator_air_flow_rate = state.dataIPShortCut->rNumericArgs(2);
     151           28 :         input_specs.rated_condenser_air_flow_rate = state.dataIPShortCut->rNumericArgs(3);
     152           28 :         input_specs.maximum_cycling_rate = state.dataIPShortCut->rNumericArgs(4);
     153           28 :         input_specs.ratio_of_initial_moisture_evaporation_rate_and_steady_state_latent_capacity = state.dataIPShortCut->rNumericArgs(5);
     154           28 :         input_specs.latent_capacity_time_constant = state.dataIPShortCut->rNumericArgs(6);
     155           28 :         input_specs.nominal_time_for_condensate_removal_to_begin = state.dataIPShortCut->rNumericArgs(7);
     156           28 :         input_specs.apply_latent_degradation_to_speeds_greater_than_1 = state.dataIPShortCut->cAlphaArgs(2);
     157           28 :         input_specs.condenser_type = state.dataIPShortCut->cAlphaArgs(3);
     158           28 :         input_specs.nominal_evap_condenser_pump_power = state.dataIPShortCut->rNumericArgs(8);
     159           28 :         input_specs.nominal_speed_number = state.dataIPShortCut->rNumericArgs(9);
     160           84 :         for (int fieldNum = 4; fieldNum <= NumAlphas; fieldNum++) {
     161           56 :             if (state.dataIPShortCut->cAlphaArgs(fieldNum).empty()) {
     162            0 :                 break;
     163              :             }
     164           56 :             input_specs.speed_data_names.push_back(state.dataIPShortCut->cAlphaArgs(fieldNum));
     165              :         }
     166              : 
     167           28 :         this->instantiateFromInputSpec(state, input_specs);
     168           28 :         break;
     169           28 :     }
     170              : 
     171           28 :     if (!found_it) {
     172            0 :         ShowFatalError(state, "Could not find Coil:Cooling:DX:CurveFit:OperatingMode object with name: " + name_to_find);
     173              :     }
     174           28 : }
     175              : 
     176           24 : void CoilCoolingDXCurveFitOperatingMode::oneTimeInit(EnergyPlus::EnergyPlusData &state)
     177              : {
     178           24 :     if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
     179            0 :         SetupEMSActuator(state,
     180              :                          this->object_name,
     181              :                          this->name,
     182              :                          "Autosized Rated Air Flow Rate",
     183              :                          "[m3/s]",
     184            0 :                          this->ratedAirVolFlowEMSOverrideON,
     185            0 :                          this->ratedAirVolFlowEMSOverrideValue);
     186            0 :         SetupEMSActuator(state,
     187              :                          this->object_name,
     188              :                          this->name,
     189              :                          "Autosized Rated Total Cooling Capacity",
     190              :                          "[W]",
     191            0 :                          this->ratedTotCapFlowEMSOverrideON,
     192            0 :                          this->ratedTotCapFlowEMSOverrideValue);
     193              :     }
     194           24 : }
     195              : 
     196           21 : void CoilCoolingDXCurveFitOperatingMode::size(EnergyPlus::EnergyPlusData &state)
     197              : {
     198              : 
     199              :     static constexpr std::string_view RoutineName = "sizeOperatingMode";
     200           21 :     std::string CompType = this->object_name;
     201           21 :     std::string CompName = this->name;
     202           21 :     bool PrintFlag = true;
     203           21 :     bool errorsFound = false;
     204              : 
     205           21 :     Real64 TempSize = this->original_input_specs.rated_evaporator_air_flow_rate;
     206           21 :     CoolingAirFlowSizer sizingCoolingAirFlow;
     207           21 :     std::string stringOverride = "Rated Evaporator Air Flow Rate [m3/s]";
     208           21 :     if (state.dataGlobal->isEpJSON) stringOverride = "rated_evaporator_air_flow_rate";
     209           21 :     sizingCoolingAirFlow.overrideSizingString(stringOverride);
     210           21 :     sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
     211           21 :     this->ratedEvapAirFlowRate = sizingCoolingAirFlow.size(state, TempSize, errorsFound);
     212              : 
     213           21 :     Real64 constexpr ratedInletAirTemp(26.6667);     // 26.6667C or 80F
     214           21 :     Real64 constexpr ratedInletAirHumRat(0.0111847); // Humidity ratio corresponding to 80F dry bulb/67F wet bulb
     215           21 :     this->ratedEvapAirMassFlowRate =
     216           42 :         this->ratedEvapAirFlowRate *
     217           21 :         Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, ratedInletAirTemp, ratedInletAirHumRat, RoutineName);
     218              : 
     219           21 :     std::string SizingString = "Rated Gross Total Cooling Capacity [W]";
     220           21 :     state.dataSize->DataFlowUsedForSizing = this->ratedEvapAirFlowRate;
     221           21 :     state.dataSize->DataTotCapCurveIndex = this->speeds[this->nominalSpeedIndex].indexCapFT;
     222           21 :     TempSize = this->original_input_specs.gross_rated_total_cooling_capacity;
     223           21 :     CoolingCapacitySizer sizerCoolingCapacity;
     224           21 :     sizerCoolingCapacity.overrideSizingString(SizingString);
     225           21 :     sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
     226           21 :     this->ratedGrossTotalCap = sizerCoolingCapacity.size(state, TempSize, errorsFound);
     227              : 
     228              :     // Auto size condenser air flow to Total Capacity * 0.000114 m3/s/w (850 cfm/ton)
     229           21 :     state.dataSize->DataConstantUsedForSizing = this->ratedGrossTotalCap;
     230           21 :     state.dataSize->DataFractionUsedForSizing = 0.000114;
     231           21 :     TempSize = this->original_input_specs.rated_condenser_air_flow_rate;
     232              : 
     233           21 :     AutoCalculateSizer sizerCondAirFlow;
     234           21 :     stringOverride = "Rated Condenser Air Flow Rate [m3/s]";
     235           21 :     if (state.dataGlobal->isEpJSON) stringOverride = "rated_condenser_air_flow_rate";
     236           21 :     sizerCondAirFlow.overrideSizingString(stringOverride);
     237           21 :     sizerCondAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
     238           21 :     this->ratedCondAirFlowRate = sizerCondAirFlow.size(state, TempSize, errorsFound);
     239              : 
     240           21 :     if (this->condenserType != CondenserType::AIRCOOLED) {
     241              :         // Auto size Nominal Evaporative Condenser Pump Power to Total Capacity * 0.004266 w/w (15 W/ton)
     242            1 :         AutoCalculateSizer sizerCondEvapPumpPower;
     243            1 :         state.dataSize->DataConstantUsedForSizing = this->ratedGrossTotalCap;
     244            1 :         state.dataSize->DataFractionUsedForSizing = 0.004266;
     245            1 :         stringOverride = "Nominal Evaporative Condenser Pump Power [W]";
     246            1 :         sizerCondEvapPumpPower.overrideSizingString(stringOverride);
     247            1 :         TempSize = this->original_input_specs.nominal_evap_condenser_pump_power;
     248            1 :         sizerCondEvapPumpPower.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName);
     249            1 :         this->nominalEvaporativePumpPower = sizerCondEvapPumpPower.size(state, TempSize, errorsFound);
     250            1 :     }
     251              : 
     252           21 :     int thisSpeedNum = 0;
     253           65 :     for (auto &curSpeed : this->speeds) {
     254           44 :         curSpeed.parentName = this->parentName;
     255           44 :         curSpeed.parentModeRatedGrossTotalCap = this->ratedGrossTotalCap;
     256           44 :         curSpeed.ratedGrossTotalCapIsAutosized = this->ratedGrossTotalCapIsAutosized;
     257           44 :         curSpeed.parentModeRatedEvapAirFlowRate = this->ratedEvapAirFlowRate;
     258           44 :         curSpeed.ratedEvapAirFlowRateIsAutosized = this->ratedEvapAirFlowRateIsAutosized;
     259           44 :         curSpeed.parentModeRatedCondAirFlowRate = this->ratedCondAirFlowRate;
     260              : 
     261              :         // Set latent degradation parameters if applicable
     262           44 :         curSpeed.doLatentDegradation = false;
     263           44 :         if (this->latentDegradationActive) {
     264            0 :             if ((thisSpeedNum == 0) || ((thisSpeedNum > 0) && this->applyLatentDegradationAllSpeeds)) {
     265            0 :                 curSpeed.parentModeTimeForCondensateRemoval = this->timeForCondensateRemoval;
     266            0 :                 curSpeed.parentModeEvapRateRatio = this->evapRateRatio;
     267            0 :                 curSpeed.parentModeMaxCyclingRate = this->maxCyclingRate;
     268            0 :                 curSpeed.parentModeLatentTimeConst = this->latentTimeConst;
     269            0 :                 curSpeed.doLatentDegradation = true;
     270              :             }
     271              :         }
     272              : 
     273           44 :         curSpeed.size(state);
     274           44 :         thisSpeedNum++;
     275              :     }
     276           21 : }
     277              : 
     278          184 : void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlusData &state,
     279              :                                                            const DataLoopNode::NodeData &inletNode,
     280              :                                                            DataLoopNode::NodeData &outletNode,
     281              :                                                            int const speedNum,
     282              :                                                            Real64 const speedRatio,
     283              :                                                            HVAC::FanOp const fanOp,
     284              :                                                            DataLoopNode::NodeData &condInletNode,
     285              :                                                            [[maybe_unused]] DataLoopNode::NodeData &condOutletNode,
     286              :                                                            [[maybe_unused]] bool const singleMode)
     287              : {
     288              : 
     289              :     static constexpr std::string_view RoutineName = "CoilCoolingDXCurveFitOperatingMode::calcOperatingMode";
     290              :     // Currently speedNum is 1-based, while this->speeds are zero-based
     291          184 :     auto &thisspeed(this->speeds[max(speedNum - 1, 0)]);
     292              : 
     293          184 :     if ((speedNum == 0) || ((speedNum == 1) && (speedRatio == 0.0)) || (inletNode.MassFlowRate == 0.0)) {
     294           30 :         outletNode.Temp = inletNode.Temp;
     295           30 :         outletNode.HumRat = inletNode.HumRat;
     296           30 :         outletNode.Enthalpy = inletNode.Enthalpy;
     297           30 :         outletNode.Press = inletNode.Press;
     298           30 :         OpModeRTF = 0.0;
     299           30 :         OpModePower = 0.0;
     300           30 :         OpModeWasteHeat = 0.0;
     301           30 :         return;
     302              :     }
     303              : 
     304          154 :     if (condInletNode.Press <= 0.0) {
     305            0 :         condInletNode.Press = state.dataEnvrn->OutBaroPress;
     306              :     }
     307          154 :     if (this->condenserType == CondenserType::AIRCOOLED) {
     308          154 :         this->condInletTemp = condInletNode.Temp;
     309            0 :     } else if (this->condenserType == CondenserType::EVAPCOOLED) {
     310            0 :         this->condInletTemp = Psychrometrics::PsyTwbFnTdbWPb(
     311              :             state, condInletNode.Temp, condInletNode.HumRat, condInletNode.Press, "CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode");
     312              :     }
     313          154 :     thisspeed.ambPressure = condInletNode.Press;
     314          154 :     thisspeed.AirMassFlow = inletNode.MassFlowRate;
     315          154 :     if (fanOp == HVAC::FanOp::Cycling && speedNum == 1) {
     316          109 :         if (speedRatio > 0.0) {
     317          109 :             thisspeed.AirMassFlow = thisspeed.AirMassFlow / speedRatio;
     318              :         } else {
     319            0 :             thisspeed.AirMassFlow = 0.0;
     320              :         }
     321           45 :     } else if (speedNum > 1) {
     322           28 :         thisspeed.AirMassFlow = state.dataHVACGlobal->MSHPMassFlowRateHigh;
     323              :     }
     324              :     // rated flow rate is adjusted by coil face area fraction so adjustment is before next IF
     325          154 :     thisspeed.AirMassFlow *= thisspeed.active_fraction_of_face_coil_area;
     326          154 :     if (thisspeed.RatedAirMassFlowRate > 0.0) {
     327          154 :         thisspeed.AirFF = thisspeed.AirMassFlow / thisspeed.RatedAirMassFlowRate;
     328              :     } else {
     329            0 :         thisspeed.AirFF = 0.0;
     330              :     }
     331              : 
     332              :     // If multispeed, evaluate high speed first using speedRatio as PLR
     333              : 
     334          154 :     thisspeed.CalcSpeedOutput(state, inletNode, outletNode, speedRatio, fanOp, this->condInletTemp);
     335              : 
     336              :     // the outlet node conditions are based on it running at the truncated flow, we need to merge the bypassed air back in and ramp up flow rate
     337          154 :     if (thisspeed.adjustForFaceArea) {
     338            6 :         thisspeed.AirMassFlow /= thisspeed.active_fraction_of_face_coil_area;
     339            6 :         Real64 correctedEnthalpy = (1.0 - thisspeed.active_fraction_of_face_coil_area) * inletNode.Enthalpy +
     340            6 :                                    thisspeed.active_fraction_of_face_coil_area * outletNode.Enthalpy;
     341            6 :         Real64 correctedHumRat =
     342            6 :             (1.0 - thisspeed.active_fraction_of_face_coil_area) * inletNode.HumRat + thisspeed.active_fraction_of_face_coil_area * outletNode.HumRat;
     343            6 :         Real64 correctedTemp = Psychrometrics::PsyTdbFnHW(correctedEnthalpy, correctedHumRat);
     344              :         // Check for saturation error and modify temperature at constant enthalpy
     345            6 :         if (correctedTemp < Psychrometrics::PsyTsatFnHPb(state, correctedEnthalpy, inletNode.Press, RoutineName)) {
     346            1 :             correctedTemp = Psychrometrics::PsyTsatFnHPb(state, correctedEnthalpy, inletNode.Press, RoutineName);
     347            1 :             correctedHumRat = Psychrometrics::PsyWFnTdbH(state, correctedTemp, correctedEnthalpy, RoutineName);
     348              :         }
     349            6 :         outletNode.Temp = correctedTemp;
     350            6 :         outletNode.HumRat = correctedHumRat;
     351            6 :         outletNode.Enthalpy = correctedEnthalpy;
     352              :     }
     353              : 
     354          154 :     Real64 outSpeed1HumRat = outletNode.HumRat;
     355          154 :     Real64 outSpeed1Enthalpy = outletNode.Enthalpy;
     356              : 
     357          154 :     if (fanOp == HVAC::FanOp::Continuous) {
     358           21 :         outletNode.HumRat = outletNode.HumRat * speedRatio + (1.0 - speedRatio) * inletNode.HumRat;
     359           21 :         outletNode.Enthalpy = outletNode.Enthalpy * speedRatio + (1.0 - speedRatio) * inletNode.Enthalpy;
     360           21 :         outletNode.Temp = Psychrometrics::PsyTdbFnHW(outletNode.Enthalpy, outletNode.HumRat);
     361              : 
     362              :         // Check for saturation error and modify temperature at constant enthalpy
     363           21 :         Real64 tsat = Psychrometrics::PsyTsatFnHPb(state, outletNode.Enthalpy, inletNode.Press, RoutineName);
     364           21 :         if (outletNode.Temp < tsat) {
     365            0 :             outletNode.Temp = tsat;
     366            0 :             outletNode.HumRat = Psychrometrics::PsyWFnTdbH(state, tsat, outletNode.Enthalpy);
     367              :         }
     368              :     }
     369              : 
     370          154 :     OpModeRTF = thisspeed.RTF;
     371          154 :     OpModePower = thisspeed.fullLoadPower * thisspeed.RTF;
     372          154 :     OpModeWasteHeat = thisspeed.fullLoadWasteHeat * thisspeed.RTF;
     373              : 
     374          154 :     if ((speedNum > 1) && (speedRatio < 1.0) && !singleMode) {
     375              : 
     376              :         // If multispeed, evaluate next lower speed using PLR, then combine with high speed for final outlet conditions
     377           15 :         auto &lowerspeed(this->speeds[max(speedNum - 2, 0)]);
     378           15 :         lowerspeed.AirMassFlow = state.dataHVACGlobal->MSHPMassFlowRateLow * lowerspeed.active_fraction_of_face_coil_area;
     379              : 
     380           15 :         lowerspeed.CalcSpeedOutput(state, inletNode, outletNode, 1.0, fanOp, condInletTemp); // out
     381              : 
     382           15 :         if (lowerspeed.adjustForFaceArea) {
     383            0 :             lowerspeed.AirMassFlow /= lowerspeed.active_fraction_of_face_coil_area;
     384            0 :             Real64 correctedEnthalpy = (1.0 - lowerspeed.active_fraction_of_face_coil_area) * inletNode.Enthalpy +
     385            0 :                                        lowerspeed.active_fraction_of_face_coil_area * outletNode.Enthalpy;
     386            0 :             Real64 correctedHumRat = (1.0 - lowerspeed.active_fraction_of_face_coil_area) * inletNode.HumRat +
     387            0 :                                      lowerspeed.active_fraction_of_face_coil_area * outletNode.HumRat;
     388            0 :             Real64 correctedTemp = Psychrometrics::PsyTdbFnHW(correctedEnthalpy, correctedHumRat);
     389              :             // Check for saturation error and modify temperature at constant enthalpy
     390            0 :             if (correctedTemp < Psychrometrics::PsyTsatFnHPb(state, correctedEnthalpy, inletNode.Press, RoutineName)) {
     391            0 :                 correctedTemp = Psychrometrics::PsyTsatFnHPb(state, correctedEnthalpy, inletNode.Press, RoutineName);
     392            0 :                 correctedHumRat = Psychrometrics::PsyWFnTdbH(state, correctedTemp, correctedEnthalpy, RoutineName);
     393              :             }
     394            0 :             outletNode.Temp = correctedTemp;
     395            0 :             outletNode.HumRat = correctedHumRat;
     396            0 :             outletNode.Enthalpy = correctedEnthalpy;
     397              :         }
     398              : 
     399           15 :         outletNode.HumRat = (outSpeed1HumRat * speedRatio * thisspeed.AirMassFlow + (1.0 - speedRatio) * outletNode.HumRat * lowerspeed.AirMassFlow) /
     400           15 :                             inletNode.MassFlowRate;
     401           15 :         outletNode.Enthalpy =
     402           15 :             (outSpeed1Enthalpy * speedRatio * thisspeed.AirMassFlow + (1.0 - speedRatio) * outletNode.Enthalpy * lowerspeed.AirMassFlow) /
     403           15 :             inletNode.MassFlowRate;
     404           15 :         outletNode.Temp = Psychrometrics::PsyTdbFnHW(outletNode.Enthalpy, outletNode.HumRat);
     405              : 
     406           15 :         this->OpModePower += (1.0 - thisspeed.RTF) * lowerspeed.fullLoadPower;
     407           15 :         this->OpModeWasteHeat += (1.0 - thisspeed.RTF) * lowerspeed.fullLoadWasteHeat;
     408           15 :         this->OpModeRTF = 1.0; // if we are on greater than 1 speed, RTF *must* be 1
     409              :     }
     410              : }
     411              : 
     412            0 : Real64 CoilCoolingDXCurveFitOperatingMode::getCurrentEvapCondPumpPower(int speedNum)
     413              : {
     414              :     // Currently speedNum is 1-based, while this->speeds are zero-based
     415            0 :     auto const &thisspeed(this->speeds[max(speedNum - 1, 0)]);
     416            0 :     auto const &powerFraction(thisspeed.evap_condenser_pump_power_fraction);
     417            0 :     return this->nominalEvaporativePumpPower * powerFraction;
     418              : }
        

Generated by: LCOV version 2.0-1