LCOV - code coverage report
Current view: top level - EnergyPlus/Coils - CoilCoolingDXCurveFitPerformance.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 49.1 % 57 28
Test Date: 2025-07-17 05:04:31 Functions: 60.0 % 20 12

            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              : #ifndef ENERGYPLUS_COILS_COILCOOLINGDXCURVEFITPERFORMANCE
      49              : #define ENERGYPLUS_COILS_COILCOOLINGDXCURVEFITPERFORMANCE
      50              : 
      51              : #include <string>
      52              : #include <vector>
      53              : 
      54              : #include <EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.hh>
      55              : #include <EnergyPlus/Coils/CoilCoolingDXPerformanceBase.hh>
      56              : #include <EnergyPlus/DataGlobalConstants.hh>
      57              : #include <EnergyPlus/EnergyPlus.hh>
      58              : #include <EnergyPlus/ScheduleManager.hh>
      59              : #include <EnergyPlus/StandardRatings.hh>
      60              : 
      61              : namespace EnergyPlus {
      62              : 
      63              : // Forward declarations
      64              : struct EnergyPlusData;
      65              : 
      66              : struct CoilCoolingDXCurveFitPerformanceInputSpecification
      67              : {
      68              :     std::string name;
      69              :     Real64 crankcase_heater_capacity;
      70              :     Real64 minimum_outdoor_dry_bulb_temperature_for_compressor_operation;
      71              :     Real64 maximum_outdoor_dry_bulb_temperature_for_crankcase_heater_operation;
      72              :     Real64 unit_internal_static_air_pressure;
      73              :     Real64 basin_heater_capacity;
      74              :     Real64 basin_heater_setpoint_temperature;
      75              :     std::string basin_heater_operating_schedule_name;
      76              :     std::string compressor_fuel_type;
      77              :     std::string base_operating_mode_name;
      78              :     std::string alternate_operating_mode_name;
      79              :     std::string alternate_operating_mode2_name;
      80              :     std::string outdoor_temperature_dependent_crankcase_heater_capacity_curve_name;
      81              :     std::string capacity_control;
      82              : };
      83              : 
      84              : struct CoilCoolingDXCurveFitPerformance : public CoilCoolingDXPerformanceBase
      85              : {
      86              :     static constexpr std::string_view object_name = "Coil:Cooling:DX:CurveFit:Performance";
      87              :     std::string parentName;
      88              : 
      89              :     void instantiateFromInputSpec(EnergyPlusData &state, const CoilCoolingDXCurveFitPerformanceInputSpecification &input_data);
      90              : 
      91              :     void simulate(EnergyPlusData &state,
      92              :                   const DataLoopNode::NodeData &inletNode,
      93              :                   DataLoopNode::NodeData &outletNode,
      94              :                   HVAC::CoilMode currentCoilMode,
      95              :                   int speedNum,
      96              :                   Real64 speedRatio,
      97              :                   HVAC::FanOp const fanOp,
      98              :                   DataLoopNode::NodeData &condInletNode,
      99              :                   DataLoopNode::NodeData &condOutletNode,
     100              :                   bool const singleMode,
     101              :                   Real64 LoadSHR = 0.0) override;
     102              : 
     103              :     void calculate(EnergyPlusData &state,
     104              :                    CoilCoolingDXCurveFitOperatingMode &currentMode,
     105              :                    const DataLoopNode::NodeData &inletNode,
     106              :                    DataLoopNode::NodeData &outletNode,
     107              :                    int speedNum,
     108              :                    Real64 speedRatio,
     109              :                    HVAC::FanOp const fanOp,
     110              :                    DataLoopNode::NodeData &condInletNode,
     111              :                    DataLoopNode::NodeData &condOutletNode,
     112              :                    bool const singleMode);
     113              : 
     114              :     void calcStandardRatings210240(EnergyPlusData &state) override;
     115              : 
     116              :     CoilCoolingDXCurveFitPerformanceInputSpecification original_input_specs;
     117              : 
     118            0 :     CoilCoolingDXCurveFitPerformance() = default;
     119              : 
     120              :     explicit CoilCoolingDXCurveFitPerformance(EnergyPlusData &state, const std::string &name);
     121              : 
     122              :     void size(EnergyPlusData &state) override;
     123              : 
     124              :     void setOperMode(EnergyPlusData &state, CoilCoolingDXCurveFitOperatingMode &currentMode, int const mode);
     125              : 
     126           54 :     Real64 ratedCBF(EnergyPlusData &) override
     127              :     {
     128           54 :         return normalMode.speeds[normalMode.nominalSpeedIndex].RatedCBF;
     129              :     }
     130              : 
     131           54 :     Real64 grossRatedSHR(EnergyPlusData &) override
     132              :     {
     133           54 :         return normalMode.speeds[normalMode.nominalSpeedIndex].grossRatedSHR;
     134              :     }
     135              : 
     136            1 :     Real64 grossRatedCoolingCOPAtMaxSpeed(EnergyPlusData &) override
     137              :     {
     138            1 :         return normalMode.speeds.back().original_input_specs.gross_rated_cooling_COP;
     139              :     }
     140              : 
     141            0 :     const std::string_view nameAtSpeed(int speed) override
     142              :     {
     143            0 :         return normalMode.speeds[speed].name;
     144              :     }
     145              : 
     146            0 :     Real64 ratedAirMassFlowRateMaxSpeed(EnergyPlusData &, HVAC::CoilMode const mode) override
     147              :     {
     148            0 :         if (mode != HVAC::CoilMode::Normal) {
     149            0 :             return alternateMode.speeds.back().RatedAirMassFlowRate;
     150              :         } else {
     151            0 :             return normalMode.speeds.back().RatedAirMassFlowRate;
     152              :         }
     153              :     }
     154              : 
     155            0 :     Real64 ratedAirMassFlowRateMinSpeed(EnergyPlusData &, HVAC::CoilMode const mode) override
     156              :     {
     157            0 :         if (mode != HVAC::CoilMode::Normal) {
     158            0 :             return alternateMode.speeds.front().RatedAirMassFlowRate;
     159              :         } else {
     160            0 :             return normalMode.speeds.front().RatedAirMassFlowRate;
     161              :         }
     162              :     }
     163              : 
     164     11222805 :     Real64 ratedCondAirMassFlowRateNomSpeed(EnergyPlusData &, HVAC::CoilMode const mode) override
     165              :     {
     166     11222805 :         if (mode != HVAC::CoilMode::Normal) {
     167        76864 :             return alternateMode.speeds[alternateMode.nominalSpeedIndex].RatedCondAirMassFlowRate;
     168              :         } else {
     169     11145941 :             return normalMode.speeds[normalMode.nominalSpeedIndex].RatedCondAirMassFlowRate;
     170              :         }
     171              :     }
     172              : 
     173           54 :     Real64 ratedEvapAirMassFlowRate(EnergyPlusData &) override
     174              :     {
     175           54 :         return normalMode.ratedEvapAirMassFlowRate;
     176              :     }
     177              : 
     178          107 :     Real64 ratedEvapAirFlowRate(EnergyPlusData &) override
     179              :     {
     180          107 :         return normalMode.ratedEvapAirFlowRate;
     181              :     }
     182              : 
     183          217 :     Real64 ratedGrossTotalCap() override
     184              :     {
     185          217 :         return normalMode.ratedGrossTotalCap;
     186              :     }
     187              : 
     188           50 :     int indexCapFT(HVAC::CoilMode const mode) override
     189              :     {
     190           50 :         if (mode != HVAC::CoilMode::Normal) {
     191            0 :             return alternateMode.speeds[alternateMode.nominalSpeedIndex].indexCapFT;
     192              :         } else {
     193           50 :             return normalMode.speeds[normalMode.nominalSpeedIndex].indexCapFT;
     194              :         }
     195              :     }
     196              : 
     197           54 :     bool subcoolReheatFlag() override
     198              :     {
     199           60 :         return (!original_input_specs.base_operating_mode_name.empty() && !original_input_specs.alternate_operating_mode_name.empty() &&
     200           60 :                 !original_input_specs.alternate_operating_mode2_name.empty());
     201              :     }
     202              : 
     203        58729 :     int numSpeeds() override
     204              :     {
     205        58729 :         return static_cast<int>(normalMode.speeds.size());
     206              :     }
     207              : 
     208            0 :     virtual void setToHundredPercentDOAS() override
     209              :     {
     210            0 :         for (auto &speed : normalMode.speeds) {
     211            0 :             speed.minRatedVolFlowPerRatedTotCap = HVAC::MinRatedVolFlowPerRatedTotCap2;
     212            0 :             speed.maxRatedVolFlowPerRatedTotCap = HVAC::MaxRatedVolFlowPerRatedTotCap2;
     213            0 :         }
     214            0 :         if (maxAvailCoilMode != HVAC::CoilMode::Normal) {
     215            0 :             for (auto &speed : alternateMode.speeds) {
     216            0 :                 speed.minRatedVolFlowPerRatedTotCap = HVAC::MinRatedVolFlowPerRatedTotCap2;
     217            0 :                 speed.maxRatedVolFlowPerRatedTotCap = HVAC::MaxRatedVolFlowPerRatedTotCap2;
     218            0 :             }
     219              :         }
     220            0 :     }
     221              : 
     222           49 :     Real64 evapAirFlowRateAtSpeedIndex(EnergyPlusData &, int index) override
     223              :     {
     224           49 :         return normalMode.speeds[index].evap_air_flow_rate;
     225              :     }
     226              : 
     227            0 :     Real64 ratedTotalCapacityAtSpeedIndex(EnergyPlusData &, int index) override
     228              :     {
     229            0 :         return normalMode.speeds[index].rated_total_capacity;
     230              :     }
     231              : 
     232            0 :     Real64 currentEvapCondPumpPowerAtSpeed(EnergyPlusData &, int speed) override
     233              :     {
     234            0 :         return normalMode.getCurrentEvapCondPumpPower(speed);
     235              :     }
     236              : 
     237            0 :     Real64 evapCondenserEffectivenessAtSpeedIndex(EnergyPlusData &, int index) override
     238              :     {
     239            0 :         return normalMode.speeds[index].evap_condenser_effectiveness;
     240              :     }
     241              : 
     242           17 :     Real64 evapAirFlowFraction(EnergyPlusData &) override
     243              :     {
     244           17 :         return normalMode.speeds.front().original_input_specs.evaporator_air_flow_fraction;
     245              :     }
     246              : 
     247              :     Real64 maxOutdoorDrybulbForBasin = 0.0;
     248              :     bool mySizeFlag = true;
     249              : 
     250              :     Real64 evapCondBasinHeatSetpoint = 0.0;
     251              :     Sched::Schedule *evapCondBasinHeatSched = nullptr;
     252              :     bool oneTimeEIOHeaderWrite = true;
     253              :     Real64 wasteHeatRate = 0.0;
     254              : 
     255              :     CoilCoolingDXCurveFitOperatingMode normalMode;
     256              :     CoilCoolingDXCurveFitOperatingMode alternateMode;  // enhanced dehumidifcation or Subcool mode
     257              :     CoilCoolingDXCurveFitOperatingMode alternateMode2; // Reheat mode
     258              : };
     259              : 
     260              : } // namespace EnergyPlus
     261              : 
     262              : #endif // ENERGYPLUS_COILS_COILCOOLINGDXCURVEFITPERFORMANCE
        

Generated by: LCOV version 2.0-1