LCOV - code coverage report
Current view: top level - EnergyPlus/Plant - PlantManager.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 4 16 25.0 %
Date: 2024-08-23 23:50:59 Functions: 2 3 66.7 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2024, 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 PlantManager_hh_INCLUDED
      49             : #define PlantManager_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.hh>
      53             : 
      54             : // EnergyPlus Headers
      55             : #include <EnergyPlus/Data/BaseData.hh>
      56             : #include <EnergyPlus/DataGlobals.hh>
      57             : #include <EnergyPlus/EnergyPlus.hh>
      58             : #include <EnergyPlus/Plant/DataPlant.hh>
      59             : 
      60             : namespace EnergyPlus {
      61             : 
      62             : // Forward declarations
      63             : struct EnergyPlusData;
      64             : 
      65             : namespace PlantManager {
      66             : 
      67             :     void ManagePlantLoops(EnergyPlusData &state,
      68             :                           bool FirstHVACIteration,
      69             :                           bool &SimAirLoops,         // True when the air loops need to be (re)simulated
      70             :                           bool &SimZoneEquipment,    // True when zone equipment components need to be (re)simulated
      71             :                           bool &SimNonZoneEquipment, // True when non-zone equipment components need to be (re)simulated
      72             :                           bool &SimPlantLoops,       // True when some part of Plant needs to be (re)simulated
      73             :                           bool &SimElecCircuits      // True when electric circuits need to be (re)simulated
      74             :     );
      75             : 
      76             :     void GetPlantLoopData(EnergyPlusData &state);
      77             : 
      78             :     void GetPlantInput(EnergyPlusData &state);
      79             : 
      80             :     void SetupReports(EnergyPlusData &state);
      81             : 
      82             :     void fillPlantCondenserTopology(EnergyPlusData &state, DataPlant::PlantLoopData &thisLoop, int &rowCounter);
      83             : 
      84             :     // void fillPlantToplogyRow(EnergyPlusData &state,
      85             :     //                          const std::string_view &compName,
      86             :     //                          const std::string_view &compType,
      87             :     //                          const std::string_view &side,
      88             :     //                          const std::string_view &parentType,
      89             :     //                          const std::string_view &parentName,
      90             :     //                          const std::string_view &fluidName,
      91             :     //                          const int reportOffset);
      92             : 
      93             :     void fillPlantToplogySplitterRow2(EnergyPlusData &state,
      94             :                                       const std::string_view &loopType,
      95             :                                       const std::string_view &loopName,
      96             :                                       const std::string_view &side,
      97             :                                       const std::string_view &splitterName,
      98             :                                       int &rowCounter);
      99             : 
     100             :     void fillPlantToplogyMixerRow2(EnergyPlusData &state,
     101             :                                    const std::string_view &loopType,
     102             :                                    const std::string_view &loopName,
     103             :                                    const std::string_view &side,
     104             :                                    const std::string_view &mixerName,
     105             :                                    int &rowCounter);
     106             : 
     107             :     void fillPlantToplogyComponentRow2(EnergyPlusData &state,
     108             :                                        const std::string_view &loopType,
     109             :                                        const std::string_view &loopName,
     110             :                                        const std::string_view &side,
     111             :                                        const std::string_view &branchName,
     112             :                                        const std::string_view &compType,
     113             :                                        const std::string_view &compName,
     114             :                                        int &rowCounter);
     115             : 
     116             :     void InitializeLoops(EnergyPlusData &state,
     117             :                          bool FirstHVACIteration); // true if first iteration of the simulation
     118             : 
     119             :     void ReInitPlantLoopsAtFirstHVACIteration(EnergyPlusData &state);
     120             : 
     121             :     void UpdateNodeThermalHistory(EnergyPlusData &state);
     122             : 
     123             :     void CheckPlantOnAbort(EnergyPlusData &state);
     124             : 
     125             :     void InitOneTimePlantSizingInfo(EnergyPlusData &state, int LoopNum); // loop being initialized for sizing
     126             : 
     127             :     void SizePlantLoop(EnergyPlusData &state,
     128             :                        int LoopNum, // Supply side loop being simulated
     129             :                        bool OkayToFinish);
     130             : 
     131             :     void ResizePlantLoopLevelSizes(EnergyPlusData &state, int LoopNum);
     132             : 
     133             :     void SetupInitialPlantCallingOrder(EnergyPlusData &state);
     134             : 
     135             :     void RevisePlantCallingOrder(EnergyPlusData &state);
     136             : 
     137             :     int FindLoopSideInCallingOrder(EnergyPlusData &state, int LoopNum, DataPlant::LoopSideLocation LoopSide);
     138             : 
     139             :     void SetupBranchControlTypes(EnergyPlusData &state);
     140             : 
     141             :     void CheckIfAnyPlant(EnergyPlusData &state);
     142             : 
     143             :     void CheckOngoingPlantWarnings(EnergyPlusData &state);
     144             : 
     145             :     struct EmptyPlantComponent : PlantComponent
     146             :     {
     147             :         // this is for purely air side equipment or similar that dont need anything at all done on plant for now
     148             :         // this could be a placeholder until those components are more integrated with plant side calcs.
     149   154469787 :         void simulate([[maybe_unused]] EnergyPlusData &state,
     150             :                       [[maybe_unused]] const PlantLocation &calledFromLocation,
     151             :                       [[maybe_unused]] bool FirstHVACIteration,
     152             :                       [[maybe_unused]] Real64 &CurLoad,
     153             :                       [[maybe_unused]] bool RunFlag) override
     154             :         {
     155             :             // this is empty on purpose
     156   154469787 :         }
     157             : 
     158             :         void oneTimeInit(EnergyPlusData &state) override;
     159             : 
     160             :         void oneTimeInit_new(EnergyPlusData &state) override;
     161             :     };
     162             : 
     163             : } // namespace PlantManager
     164             : 
     165             : struct PlantMgrData : BaseGlobalStruct
     166             : {
     167             : 
     168             :     bool GetCompSizFac = true;
     169             :     bool SupplyEnvrnFlag = true;
     170             :     bool MySetPointCheckFlag = true;
     171             :     Array1D_bool PlantLoopSetPointInitFlag;
     172             :     bool MyEnvrnFlag = true;
     173             :     int OtherLoopCallingIndex = 0;
     174             :     int OtherLoopDemandSideCallingIndex = 0;
     175             :     int NewOtherDemandSideCallingIndex = 0;
     176             :     int newCallingIndex = 0;
     177             :     PlantManager::EmptyPlantComponent dummyPlantComponent;
     178             : 
     179         796 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     180             :     {
     181         796 :     }
     182             : 
     183           0 :     void clear_state() override
     184             :     {
     185           0 :         this->GetCompSizFac = true;
     186           0 :         this->SupplyEnvrnFlag = true;
     187           0 :         this->MySetPointCheckFlag = true;
     188           0 :         this->PlantLoopSetPointInitFlag.clear();
     189           0 :         this->MyEnvrnFlag = true;
     190           0 :         this->OtherLoopCallingIndex = 0;
     191           0 :         this->OtherLoopDemandSideCallingIndex = 0;
     192           0 :         this->NewOtherDemandSideCallingIndex = 0;
     193           0 :         this->newCallingIndex = 0;
     194           0 :         this->dummyPlantComponent = {};
     195           0 :     }
     196             : };
     197             : 
     198             : } // namespace EnergyPlus
     199             : 
     200             : #endif

Generated by: LCOV version 1.14