LCOV - code coverage report
Current view: top level - EnergyPlus - AirLoopHVACDOAS.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 7 7
Test Date: 2025-05-22 16:09:37 Functions: 100.0 % 3 3

            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_AIRLOOPHVACDOAS_HH
      49              : #define ENERGYPLUS_AIRLOOPHVACDOAS_HH
      50              : 
      51              : // C++ Headers
      52              : #include <string>
      53              : #include <vector>
      54              : 
      55              : // EnergyPlus Headers
      56              : #include <EnergyPlus/Data/BaseData.hh>
      57              : #include <EnergyPlus/EPVector.hh>
      58              : #include <EnergyPlus/EnergyPlus.hh>
      59              : #include <EnergyPlus/Plant/Enums.hh>
      60              : #include <EnergyPlus/Plant/PlantLocation.hh>
      61              : #include <EnergyPlus/SimAirServingZones.hh>
      62              : 
      63              : namespace EnergyPlus {
      64              : 
      65              : // Forward declarations
      66              : struct EnergyPlusData;
      67              : 
      68              : namespace AirLoopHVACDOAS {
      69              : 
      70              :     void CheckConvergence(EnergyPlusData &state);
      71              : 
      72              :     struct AirLoopMixer
      73              :     {
      74              :         std::string name;
      75              :         static AirLoopMixer *factory(EnergyPlusData &state, int object_type_of_num, std::string const &objectName);
      76              :         int numOfInletNodes = 0;
      77              :         int m_AirLoopMixer_Num = 0;
      78              :         int OutletNodeNum = 0;
      79              :         std::string OutletNodeName;
      80              :         std::vector<std::string> InletNodeName;
      81              :         std::vector<int> InletNodeNum;
      82              :         Real64 OutletTemp = 0.0;
      83              : 
      84              :         static void getAirLoopMixer(EnergyPlusData &state);
      85              :         void CalcAirLoopMixer(EnergyPlusData &state);
      86              :     };
      87              : 
      88              :     struct AirLoopSplitter
      89              :     {
      90              :         std::string name;
      91              :         static AirLoopSplitter *factory(EnergyPlusData &state, int object_type_of_num, std::string const &objectName);
      92              :         int numOfOutletNodes = 0;
      93              :         int m_AirLoopSplitter_Num = 0;
      94              :         std::string InletNodeName;
      95              :         std::vector<std::string> OutletNodeName;
      96              :         std::vector<int> OutletNodeNum;
      97              :         Real64 InletTemp = 0.0;
      98              :         int InletNodeNum = 0;
      99              : 
     100              :         static void getAirLoopSplitter(EnergyPlusData &state);
     101              :         void CalcAirLoopSplitter(EnergyPlusData &state, Real64 Temp, Real64 Humrat);
     102              :     };
     103              : 
     104              :     struct AirLoopDOAS
     105              :     {
     106              :         // friend class AirLoopMixer and AirLoopSplitter;
     107              :         Real64 SumMassFlowRate = 0.0;
     108              :         Real64 PreheatTemp = -999.0;
     109              :         Real64 PrecoolTemp = -999.0;
     110              :         Real64 PreheatHumRat = -999.0;
     111              :         Real64 PrecoolHumRat = -999.0;
     112              :         Real64 SizingMassFlow = 0.0;
     113              :         Real64 SizingCoolOATemp = -999.0;
     114              :         Real64 SizingCoolOAHumRat = -999.0;
     115              :         Real64 HeatOutTemp = 999.0;   // outdoor air temperature for heating sizing calculation
     116              :         Real64 HeatOutHumRat = 999.0; // outdoor air humidity ratio for heating sizing calculation
     117              : 
     118              :         int m_AirLoopDOASNum = 0;
     119              :         int m_OASystemNum = 0;
     120              :         Sched::Schedule *m_AvailManagerSched = nullptr;
     121              :         int m_AirLoopMixerIndex = -1;
     122              :         int m_AirLoopSplitterIndex = -1;
     123              :         int NumOfAirLoops = 0;
     124              :         int m_InletNodeNum = 0;
     125              :         int m_OutletNodeNum = 0;
     126              :         int m_FanIndex = 0;
     127              :         int m_FanInletNodeNum = 0;
     128              :         int m_FanOutletNodeNum = 0;
     129              :         SimAirServingZones::CompType m_FanTypeNum = SimAirServingZones::CompType::Invalid;
     130              :         int m_HeatCoilNum = 0;
     131              :         int m_CoolCoilNum = 0;
     132              :         int ConveCount = 0;
     133              :         int ConveIndex = 0;
     134              : 
     135              :         bool m_HeatExchangerFlag = false;
     136              :         bool SizingOnceFlag = true;
     137              :         bool FanBeforeCoolingCoilFlag = false;
     138              : 
     139              :         AirLoopMixer *m_CompPointerAirLoopMixer = nullptr;
     140              :         AirLoopSplitter *m_CompPointerAirLoopSplitter = nullptr;
     141              : 
     142              :         std::string Name;
     143              :         std::string AvailManagerSchedName;
     144              :         std::string OASystemName;
     145              :         std::string AirLoopMixerName;
     146              :         std::string AirLoopSplitterName;
     147              :         std::string FanName;
     148              : 
     149              :         std::vector<int> m_AirLoopNum; // array of AirLoop number
     150              :         std::vector<std::string> AirLoopName;
     151              :         std::vector<int> m_OACtrlNum; // array of OA controller number
     152              : 
     153              :         PlantLocation HWPlantLoc;
     154              :         int HWCtrlNodeNum = 0;
     155              :         PlantLocation CWPlantLoc;
     156              :         int CWCtrlNodeNum = 0;
     157              :         bool MyEnvrnFlag = true;
     158              : 
     159              :         static void getAirLoopDOASInput(EnergyPlusData &state);
     160              : 
     161              :         void SimAirLoopHVACDOAS(EnergyPlusData &state, bool firstHVACIteration, int &CompIndex);
     162              : 
     163              :         void initAirLoopDOAS(EnergyPlusData &state, bool FirstHVACIteration);
     164              : 
     165              :         void CalcAirLoopDOAS(EnergyPlusData &state, bool FirstHVACIteration);
     166              : 
     167              :         void SizingAirLoopDOAS(EnergyPlusData &state);
     168              : 
     169              :         void GetDesignDayConditions(EnergyPlusData &state);
     170              :     };
     171              : 
     172              :     int getAirLoopMixerIndex(EnergyPlusData &state, std::string const &objectName);
     173              :     int getAirLoopSplitterIndex(EnergyPlusData &state, std::string const &objectName);
     174              :     void getAirLoopHVACDOASInput(EnergyPlusData &state);
     175              : 
     176              : } // namespace AirLoopHVACDOAS
     177              : 
     178              : struct AirLoopHVACDOASData : BaseGlobalStruct
     179              : {
     180              :     bool GetInputOnceFlag = true;
     181              :     bool getAirLoopMixerInputOnceFlag = true;
     182              :     bool getAirLoopSplitterInputOnceFlag = true;
     183              :     std::vector<AirLoopHVACDOAS::AirLoopDOAS> airloopDOAS;
     184              :     std::vector<AirLoopHVACDOAS::AirLoopMixer> airloopMixer;
     185              :     std::vector<AirLoopHVACDOAS::AirLoopSplitter> airloopSplitter;
     186              : 
     187         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     188              :     {
     189         2126 :     }
     190              : 
     191         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     192              :     {
     193         1152 :     }
     194              : 
     195         2100 :     void clear_state() override
     196              :     {
     197         2100 :         new (this) AirLoopHVACDOASData();
     198         2100 :     }
     199              : };
     200              : 
     201              : } // namespace EnergyPlus
     202              : #endif // ENERGYPLUS_AIRLOOPHVACDOAS_HH
        

Generated by: LCOV version 2.0-1