LCOV - code coverage report
Current view: top level - EnergyPlus/Plant - EquipAndOperations.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 15 15
Test Date: 2025-05-22 16:09:37 Functions: 100.0 % 5 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              : #ifndef PlantOperationEquipAndOperations_hh_INCLUDED
      49              : #define PlantOperationEquipAndOperations_hh_INCLUDED
      50              : 
      51              : #include <EnergyPlus/Plant/Enums.hh>
      52              : #include <EnergyPlus/Plant/PlantLocation.hh>
      53              : #include <EnergyPlus/PlantComponent.hh>
      54              : #include <EnergyPlus/PlantLoopHeatPumpEIR.hh>
      55              : #include <EnergyPlus/ScheduleManager.hh>
      56              : #include <ObjexxFCL/Array1D.hh>
      57              : 
      58              : namespace EnergyPlus::DataPlant {
      59              : 
      60              : struct EquipListPtrData
      61              : {
      62              :     // Members
      63              :     int ListPtr; // points to List on OpScheme on plant loop:
      64              :     int CompPtr; // points to this component on List on OpScheme on plant loop:
      65              : 
      66              :     // Default Constructor
      67          121 :     EquipListPtrData() : ListPtr(0), CompPtr(0)
      68              :     {
      69          121 :     }
      70              : };
      71              : 
      72              : struct OpSchemePtrData
      73              : {
      74              :     // Members
      75              :     int OpSchemePtr;                     // points to OpScheme on plant loop:
      76              :     int NumEquipLists;                   // ALLOCATABLE to the schedule (for valid schedules)
      77              :     Array1D<EquipListPtrData> EquipList; // Component  list
      78              : 
      79              :     // Default Constructor
      80          127 :     OpSchemePtrData() : OpSchemePtr(0), NumEquipLists(0)
      81              :     {
      82          127 :     }
      83              : };
      84              : 
      85              : struct EquipListCompData
      86              : {
      87              :     // Members
      88              :     std::string Name;                           // The name of each item in the list
      89              :     std::string TypeOf;                         // The name of each item in the list
      90              :     DataPlant::CtrlType CtrlType;               // CoolingOp, HeatingOp, DualOp
      91              :     int LoopNumPtr;                             // pointer to the comp location in the data structure
      92              :     DataPlant::LoopSideLocation LoopSideNumPtr; // pointer to the comp location in the data structure
      93              :     int BranchNumPtr;                           // pointer to the comp location in the data structure
      94              :     int CompNumPtr;                             // pointer to the comp location in the data structure
      95              :     Real64 SetPointFlowRate;                    // COMP SETPOINT CTRL ONLY--load calculation comp flow rate
      96              :     bool SetPointFlowRateWasAutosized;          // true if comp setpoint control flow rate was autosize on input (not used)
      97              :     std::string DemandNodeName;                 // COMP SETPOINT CTRL ONLY--The name of each item in the list
      98              :     int DemandNodeNum;                          // COMP SETPOINT CTRL ONLY--The 'keyWord' identifying each item in list
      99              :     std::string SetPointNodeName;               // COMP SETPOINT CTRL ONLY--The name of each item in the list
     100              :     int SetPointNodeNum;                        // COMP SETPOINT CTRL ONLY--The 'keyWord' identifying each item in list
     101              :     Real64 EMSIntVarRemainingLoadValue;         // EMS internal variable remaining load, neg cooling [W]
     102              :     Real64 EMSActuatorDispatchedLoadValue;      // EMS actuator for dispatched load, neg= cooling [W]
     103              : 
     104              :     // Default Constructor
     105          145 :     EquipListCompData()
     106          290 :         : CtrlType(DataPlant::CtrlType::Invalid), LoopNumPtr(0), LoopSideNumPtr(DataPlant::LoopSideLocation::Invalid), BranchNumPtr(0), CompNumPtr(0),
     107          435 :           SetPointFlowRate(0.0), SetPointFlowRateWasAutosized(false), DemandNodeNum(0), SetPointNodeNum(0), EMSIntVarRemainingLoadValue(0.0),
     108          145 :           EMSActuatorDispatchedLoadValue(0.0)
     109              :     {
     110          145 :     }
     111              : };
     112              : 
     113              : struct EquipOpList
     114              : {
     115              :     // Members
     116              :     std::string Name;                // The name of each item in the list
     117              :     Real64 RangeUpperLimit;          // for range based controls
     118              :     Real64 RangeLowerLimit;          // for range based controls
     119              :     int NumComps;                    // ALLOCATABLE to the schedule (for valid schedules)
     120              :     Array1D<EquipListCompData> Comp; // Component type list
     121              : 
     122              :     // Default Constructor
     123           59 :     EquipOpList() : RangeUpperLimit(0.0), RangeLowerLimit(0.0), NumComps(0)
     124              :     {
     125           59 :     }
     126              : };
     127              : 
     128              : struct TempSetpoint
     129              : {
     130              :     Real64 PrimCW = 0.0;              // Chilled water setpoint for primary plant loop
     131              :     Real64 SecCW = 0.0;               // Chilled water setpoint for secondary/distribution plant loop
     132              :     Real64 PrimHW_High = 0.0;         // Hot water primary plant setpoint at High Outdoor Air Temperature, or higher, Deg. C
     133              :     Real64 PrimHW_Low = 0.0;          // Hot water primary plant setpoint at Low Outdoor Air Temperature, or Lower, Deg. C
     134              :     Real64 SecHW = 0.0;               // hot water setpoint for secondary/distribution plant loop
     135              :     Real64 PrimHW_BackupLow = -999.0; // optional hot water setpoint at Backup Low Outdoor Air Temperature, or lower, Deg. C
     136              : };
     137              : 
     138              : struct TempResetData
     139              : {
     140              :     Real64 HighOutdoorTemp = 0.0;
     141              :     Real64 LowOutdoorTemp = 0.0;
     142              :     Real64 BackupLowOutdoorTemp = -999.0; // optional back up low outdoor air temperature, Deg.C
     143              :     Real64 BoilerTemperatureOffset = 0.0;
     144              : };
     145              : 
     146              : struct PlantOpsData
     147              : {
     148              :     int NumOfZones = 0;           // Number of zones in the list
     149              :     int NumOfAirLoops = 0;        // number of air loops
     150              :     int numPlantLoadProfiles = 0; // number of load profiles
     151              :     int numBoilers = 0;           // number of boilers
     152              :     int numPlantHXs = 0;          // number of fluid to fluid heat exchangers
     153              :     int NumHeatingOnlyEquipLists = 0;
     154              :     int NumCoolingOnlyEquipLists = 0;
     155              :     int NumSimultHeatCoolHeatingEquipLists = 0;
     156              :     int NumSimultHeatCoolCoolingEquipLists = 0;
     157              :     int EquipListNumForLastCoolingOnlyStage = 0;
     158              :     int EquipListNumForLastHeatingOnlyStage = 0;
     159              :     int EquipListNumForLastSimultHeatCoolCoolingStage = 0;
     160              :     int EquipListNumForLastSimultHeatCoolHeatingStage = 0;
     161              :     bool SimultHeatCoolOpAvailable = false;
     162              :     bool SimultHeatCoolHeatingOpInput = false;
     163              :     bool SimulHeatCoolCoolingOpInput = false;
     164              :     bool DedicatedHR_ChWRetControl_Input = false;
     165              :     bool DedicatedHR_HWRetControl_Input = false;
     166              :     bool DedicatedHR_Present = false;
     167              :     Real64 DedicatedHR_SecChW_DesignCapacity = 0.0;             // design (sizing) capacity for cooling side of dedicated heat recovery WWHP, Watts
     168              :     Real64 DedicatedHR_SecChW_CurrentCapacity = 0.0;            // current capacity for cooling side of dedicated heat recovery WWHP, Watts
     169              :     Real64 DedicatedHR_SecHW_DesignCapacity = 0.0;              // design (sizing) capacity for heating side of dedicated heat recovery WWHP, Watts
     170              :     Real64 DedicatedHR_SecHW_CurrentCapacity = 0.0;             // current capacity for heating side of dedicated heat recovery WWHP, Watts
     171              :                                                                 //   Real64 DedicatedHR_CapacityControlFactor = 0.0;
     172              :     bool AirSourcePlantHeatingOnly = false;                     // operation mode, if true primary plant appears to only need heating
     173              :     bool AirSourcePlantCoolingOnly = false;                     // operation mode, if true primary plant appears to only need cooling
     174              :     bool AirSourcePlantSimultaneousHeatingAndCooling = false;   // operation mode, if true primary plant appears to need both heating and cooling
     175              :     bool SimultaneousHeatingCoolingWithCoolingDominant = false; //
     176              :     bool SimultaneousHeatingCoolingWithHeatingDominant = false;
     177              :     int PrimaryHWLoopIndex = 0;
     178              :     int PrimaryHWLoopSupInletNode = 0;
     179              :     int PrimaryChWLoopIndex = 0;
     180              :     int PrimaryChWLoopSupInletNode = 0;
     181              :     int SecondaryHWLoopIndex = 0;
     182              :     int SecondaryChWLoopIndex = 0;
     183              : };
     184              : 
     185              : struct ReportData
     186              : {
     187              :     int AirSourcePlant_OpMode = 0;          // heating only = 1, cooling only = 2, simult heat cool = 3
     188              :     int DedicHR_OpMode = 0;                 // not dispatched = 0, heating led = 1, cooling led = 2
     189              :     int BoilerAux_OpMode = 0;               // not Dispatched = 0, Boiler(s) On = 1
     190              :     Real64 BuildingPolledHeatingLoad = 0.0; // current  building heating loads from predicted sensible zone loads, air system ventilation loads, and
     191              :                                             // any plant load profile process laods
     192              :     Real64 BuildingPolledCoolingLoad = 0.0; //  current building Cooling loads from predicted sensible zone loads, air system ventilation loads, and
     193              :                                             //  any plant load profile process laods
     194              :     Real64 PrimaryPlantHeatingLoad = 0.0;   // current apparent plant load on primary hot water plant served by heatpumps
     195              :     Real64 PrimaryPlantCoolingLoad = 0.0;   // current apparent plant load on primary chilled water plant served by heatpumps
     196              :     Real64 SecondaryPlantHeatingLoad = 0.0; // current apparent plant load on secondary hot water plant served by heatpumps
     197              :     Real64 SecondaryPlantCoolingLoad = 0.0; // current apparent plant load on secondary chilled water plant served by heatpumps
     198              : };
     199              : 
     200              : struct ChillerHeaterSupervisoryOperationData
     201              : // Custom supervisory plant operation scheme, control dispatch across a set of related set of plant loops
     202              : // For two-pipe chiller heater. 1..N chiller heater, 1..M chiller only.
     203              : // poll zone list to decide mode between chiller only, heater only, or simultaneous
     204              : 
     205              : {
     206              :     // get rid of these strings if possible
     207              :     std::string Name;
     208              :     std::string TypeOf;
     209              :     std::string ZoneListName;
     210              :     std::string DedicatedHR_ChWRetControl_Name;
     211              :     std::string DedicatedHR_HWRetControl_Name;
     212              : 
     213              :     bool oneTimeSetupComplete = false;
     214              :     bool needsSimulation = false;
     215              :     DataPlant::OpScheme Type = DataPlant::OpScheme::Invalid; // Op scheme type (from keyword)
     216              : 
     217              :     TempSetpoint Setpoint;
     218              :     TempResetData TempReset;
     219              :     PlantOpsData PlantOps;
     220              :     Array1D_int ZonePtrs;
     221              :     Array1D_int AirLoopPtrs;
     222              :     Array1D<EquipOpList> HeatingOnlyEquipList;
     223              :     Array1D<EquipOpList> CoolingOnlyEquipList;
     224              :     Array1D<EquipOpList> SimultHeatCoolHeatingEquipList;
     225              :     Array1D<EquipOpList> SimultHeatCoolCoolingEquipList;
     226              :     EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump DedicatedHR_CoolingPLHP; // real pointer to the cooling side of dedicated heat recovery WWHP
     227              :     EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump DedicatedHR_HeatingPLHP; // real pointer to the heating side of dedicated heat recory WWHP
     228              :     Array1D<int> PlantLoopIndicesBeingSupervised;          // if non zero then points to index of a plant loop that has this supervisory scheme as its
     229              :                                                            // operation scheme
     230              :     Array1D<int> SecondaryPlantLoopIndicesBeingSupervised; // if not zero then points to index of a plant loop that is treated as being a
     231              :                                                            // seconday loop, as in primary secondary distribution plant configurations.
     232              :     Array1D<PlantLocation> PlantLoadProfileComps;          // LoadProfile:Plant objects that may be loading loop
     233              :     Array1D<PlantLocation> PlantBoilerComps;               // Boilers that may need to be managed.
     234              :     Array1D<PlantLocation>
     235              :         PlantHXComps; // fluid to fluid heat exchangers that may need to be managed, these are HX connection on a supply side of a loop.
     236              :     ReportData Report;
     237              : 
     238              :     void OneTimeInitChillerHeaterChangeoverOpScheme(EnergyPlusData &state);
     239              : 
     240              :     void EvaluateChillerHeaterChangeoverOpScheme(EnergyPlusData &state);
     241              : 
     242              :     void DetermineCurrentBuildingLoads(EnergyPlusData &state);
     243              : 
     244              :     void DetermineCurrentPlantLoads(EnergyPlusData &state);
     245              : 
     246              :     void ProcessSupervisoryControlLogicForAirSourcePlants(EnergyPlusData &state);
     247              : 
     248              :     void InitAirSourcePlantEquipmentOff(EnergyPlusData &state);
     249              : 
     250              :     void ProcessAndSetAirSourcePlantEquipLists(EnergyPlusData &state);
     251              : 
     252              :     void ProcessAndSetDedicatedHeatRecovWWHP(EnergyPlusData &state);
     253              : 
     254              :     void ProcessAndSetAuxilBoiler(EnergyPlusData &state);
     255              : 
     256              :     Real64 DetermineHWSetpointOARest(EnergyPlusData &state);
     257              : };
     258              : 
     259              : struct OperationData
     260              : {
     261              :     // Members
     262              :     std::string Name;                 // The name of each item in the list
     263              :     std::string TypeOf;               // The 'keyWord' identifying each item in the list
     264              :     DataPlant::OpScheme Type;         // Op scheme type (from keyword)
     265              :     Sched::Schedule *sched = nullptr; // schedule associated with the list
     266              :     bool Available;                   // TRUE = designated component or operation scheme available
     267              :     int NumEquipLists;                // number of equipment lists
     268              :     int CurListPtr;                   // points to the current equipment list
     269              :     Array1D<EquipOpList> EquipList;   // Component type list
     270              :     int EquipListNumForLastStage;     // points to the equipment list with the highest upper limit
     271              :     std::string ReferenceNodeName;    // DELTA CTRL ONLY--for calculation of delta Temp
     272              :     int ReferenceNodeNumber;          // DELTA CTRL ONLY--for calculation of delta Temp
     273              :     int ErlSimProgramMngr;            // EMS:ProgramManager to always run when this model is called
     274              :     int ErlInitProgramMngr;           // EMS:ProgramManager to run when this model is initialized and setup
     275              :     int initPluginLocation;           // If Python Plugins are used to init this, this defines the location in the plugin structure
     276              :     int simPluginLocation;            // If Python Plugins are used to simulate this, this defines the location in the plugin structure
     277              :     Real64 EMSIntVarLoopDemandRate;   // EMS internal variable for loop-level demand rate, neg cooling [W]
     278              :     bool MyEnvrnFlag;
     279              :     ChillerHeaterSupervisoryOperationData *ChillerHeaterSupervisoryOperation = nullptr;
     280              : 
     281              :     // Default Constructor
     282           51 :     OperationData()
     283          204 :         : Type(DataPlant::OpScheme::Invalid), Available(false), NumEquipLists(0), CurListPtr(0), EquipListNumForLastStage(0), ReferenceNodeNumber(0),
     284           51 :           ErlSimProgramMngr(0), ErlInitProgramMngr(0), initPluginLocation(-1), simPluginLocation(-1), EMSIntVarLoopDemandRate(0.0), MyEnvrnFlag(true)
     285              :     {
     286           51 :     }
     287              : };
     288              : } // namespace EnergyPlus::DataPlant
     289              : 
     290              : #endif
        

Generated by: LCOV version 2.0-1