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

            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 DataZoneEnergyDemands_hh_INCLUDED
      49              : #define DataZoneEnergyDemands_hh_INCLUDED
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Array1D.hh>
      53              : 
      54              : // EnergyPlus Headers
      55              : #include <EnergyPlus/Data/BaseData.hh>
      56              : #include <EnergyPlus/EPVector.hh>
      57              : #include <EnergyPlus/EnergyPlus.hh>
      58              : 
      59              : namespace EnergyPlus {
      60              : 
      61              : namespace DataZoneEnergyDemands {
      62              : 
      63              :     struct ZoneSystemDemandData // Sensible cooling/heating loads to be met (watts) or Humidification/dehumidification loads to be met (kg water per
      64              :                                 // second)
      65              :     {
      66              :         Real64 RemainingOutputRequired = 0.0;      // The load each equipment sees as what is remaining with load fractions applied [W] (multiplied)
      67              :         Real64 UnadjRemainingOutputRequired = 0.0; // The total unadjusted load remaining to be met [W] (multiplied)
      68              :         Real64 TotalOutputRequired = 0.0;          // The total output required from all equipment [W] (multiplied)
      69              :         int NumZoneEquipment = 0;                  // count of zone equipment for this zone, from ZoneHVAC:EquipmentList
      70              :         Real64 SupplyAirAdjustFactor = 1.0;        // supply air adjustment factor due to the cap of
      71              :         // zone maximum outdoor air fraction
      72              :         int StageNum = 0; // The stage number when staged thermostate is used:
      73              :         // 0 no load, >0 Heating stage, <0 Cooling stage
      74              : 
      75          436 :         virtual ~ZoneSystemDemandData() = default;
      76              : 
      77              :         virtual void beginEnvironmentInit() = 0;
      78              : 
      79              :         virtual void setUpOutputVars(
      80              :             EnergyPlusData &state, std::string_view prefix, std::string const &name, bool staged, bool attachMeters, int zoneMult, int listMult) = 0;
      81              :     };
      82              : 
      83              :     struct ZoneSystemSensibleDemand : ZoneSystemDemandData // Sensible cooling/heating loads to be met (watts)
      84              :     {
      85              :         Real64 OutputRequiredToHeatingSP = 0.0; // Load required to meet heating setpoint (>0 is a heating load) [W] (multiplied)
      86              :         Real64 OutputRequiredToCoolingSP = 0.0; // Load required to meet cooling setpoint (<0 is a cooling load) [W] (multiplied)
      87              :         Real64 RemainingOutputReqToHeatSP =
      88              :             0.0; // Remaining load required to meet heating setpoint with load fractions applied (>0 is a heating load) [W] (multiplied)
      89              :         Real64 RemainingOutputReqToCoolSP =
      90              :             0.0; // Remaining load required to meet cooling setpoint with load fractions applied (<0 is a cooling load) [W] (multiplied)
      91              :         Real64 UnadjRemainingOutputReqToHeatSP =
      92              :             0.0; // Remaining unadjusted load required to meet heating setpoint (>0 is a heating load) [W] (multiplied)
      93              :         Real64 UnadjRemainingOutputReqToCoolSP =
      94              :             0.0; // Remaining unadjusted load required to meet cooling setpoint (<0 is a cooling load) [W] (multiplied)
      95              :         EPVector<Real64> SequencedOutputRequired;            // load required to meet setpoint by sequence [W] (multiplied)
      96              :         EPVector<Real64> SequencedOutputRequiredToHeatingSP; // load required to meet heating setpoint by sequence [W] (multiplied)
      97              :         EPVector<Real64> SequencedOutputRequiredToCoolingSP; // load required to meet cooling setpoint by sequence [W] (multiplied)
      98              :         Real64 predictedRate = 0.0;                          // Predicted sensible load [W] (unmultiplied)
      99              :         Real64 predictedHSPRate = 0.0;                       // Predicted sensible load to heating setpoint [W] (unmultiplied)
     100              :         Real64 predictedCSPRate = 0.0;                       // Predicted sensible load to cooling setpoint [W] (unmultiplied)
     101              :         Real64 airSysHeatRate = 0.0;                         // sensible heating rate [W] (unmultiplied)
     102              :         Real64 airSysCoolRate = 0.0;                         // sensible cooling rate [W] (unmultiplied)
     103              :         Real64 airSysHeatEnergy = 0.0;                       // sensible heating energy [J] (unmultiplied)
     104              :         Real64 airSysCoolEnergy = 0.0;                       // sensible cooling energy [J] (unmultiplied)
     105              : 
     106              :         void beginEnvironmentInit() override;
     107              : 
     108              :         void setUpOutputVars(EnergyPlusData &state,
     109              :                              std::string_view prefix,
     110              :                              std::string const &name,
     111              :                              bool staged,
     112              :                              bool attachMeters,
     113              :                              int zoneMult,
     114              :                              int listMult) override;
     115              : 
     116              :         void reportZoneAirSystemSensibleLoads(EnergyPlusData &state, Real64 SNLoad);
     117              : 
     118              :         void reportSensibleLoadsZoneMultiplier(
     119              :             EnergyPlusData &state, int zoneNum, Real64 totalLoad, Real64 loadToHeatingSetPoint, Real64 loadToCoolingSetPoint);
     120              :     };
     121              :     struct ZoneSystemMoistureDemand : ZoneSystemDemandData // Humidification/dehumidification loads to be met (kg water per second)
     122              :     {
     123              :         Real64 OutputRequiredToHumidifyingSP = 0.0; // Load required to meet humidifying setpoint (>0 = a humidify load) [kgWater/s] (multiplied)
     124              :         Real64 OutputRequiredToDehumidifyingSP =
     125              :             0.0;                                  // Load required to meet dehumidifying setpoint (<0 = a dehumidify load) [kgWater/s] (multiplied)
     126              :         Real64 RemainingOutputReqToHumidSP = 0.0; // Remaining load required to meet humidifying setpoint with load fractions applied
     127              :         // (>0 is a humidify load) [kgWater/s] (multiplied)
     128              :         Real64 RemainingOutputReqToDehumidSP = 0.0; // Remaining load required to meet dehumidifying setpoint with load fractions applied
     129              :         // (<0 is a dehumidify load) [kgWater/s] (multiplied)
     130              :         Real64 UnadjRemainingOutputReqToHumidSP = 0.0; // Remaining unadjusted load required to meet humidifying setpoint
     131              :         // (>0 is a humidify load) [kgWater/s] (multiplied)
     132              :         Real64 UnadjRemainingOutputReqToDehumidSP = 0.0; // Remaining unadjusted load required to meet dehumidifying setpoint
     133              :         // (<0 is a dehumidify load) [kgWater/s] (multiplied)
     134              :         EPVector<Real64> SequencedOutputRequired;            // load required to meet setpoint by sequence [kgWater/s] (multiplied)
     135              :         EPVector<Real64> SequencedOutputRequiredToHumidSP;   // load required to meet humidify setpoint by sequence [kgWater/s] (multiplied)
     136              :         EPVector<Real64> SequencedOutputRequiredToDehumidSP; // load required to meet dehumidify setpoint by sequenc [kgWater/s] (multiplied)
     137              :         Real64 predictedRate = 0.0;                          // Predicted moisture load to setpoint [kgWater/s] (unmultiplied)
     138              :         Real64 predictedHumSPRate = 0.0;                     // Predicted latent load to humidification setpoint [kgWater/s] (unmultiplied)
     139              :         Real64 predictedDehumSPRate = 0.0;                   // Predicted latent load to dehumidification setpoint [kgWater/s] (unmultiplied)
     140              :         Real64 airSysHeatRate = 0.0;                         // air system latent heating rate [W] (unmultiplied)
     141              :         Real64 airSysCoolRate = 0.0;                         // air system latent cooling rate [W] (unmultiplied)
     142              :         Real64 airSysHeatEnergy = 0.0;                       // air system latent heating energy [J] (unmultiplied)
     143              :         Real64 airSysCoolEnergy = 0.0;                       // latent cooling energy [J] (unmultiplied)
     144              :         Real64 airSysSensibleHeatRatio = 0.0;                // air system SHR []
     145              :         Real64 vaporPressureDifference = 0.0;                // vapor pressure depression [Pa]
     146              : 
     147              :         void beginEnvironmentInit() override;
     148              : 
     149              :         void setUpOutputVars(EnergyPlusData &state,
     150              :                              std::string_view prefix,
     151              :                              std::string const &name,
     152              :                              [[maybe_unused]] bool staged = false,
     153              :                              [[maybe_unused]] bool attachMeters = false,
     154              :                              [[maybe_unused]] int zoneMult = 0,
     155              :                              [[maybe_unused]] int listMult = 0) override;
     156              : 
     157              :         void reportZoneAirSystemMoistureLoads(EnergyPlusData &state, Real64 latentGain, Real64 sensibleLoad, Real64 vaporPressureDiff);
     158              : 
     159              :         void reportMoistLoadsZoneMultiplier(
     160              :             EnergyPlusData &state, int zoneNum, Real64 totalLoad, Real64 loadToHumidifySetPoint, Real64 loadToDehumidifySetPoint);
     161              :     };
     162              : 
     163              : } // namespace DataZoneEnergyDemands
     164              : 
     165              : struct DataZoneEnergyDemandsData : BaseGlobalStruct
     166              : {
     167              :     Array1D_bool DeadBandOrSetback;    // true if zone temperature is in the thermostat deadband before any heating / cooling done
     168              :     Array1D_bool Setback;              // true if zone temperature has increased from previous setting
     169              :     Array1D_bool CurDeadBandOrSetback; // same as above except updated after each piece of zone equipment in a zone is simulated
     170              :     EPVector<DataZoneEnergyDemands::ZoneSystemSensibleDemand> ZoneSysEnergyDemand;
     171              :     EPVector<DataZoneEnergyDemands::ZoneSystemMoistureDemand> ZoneSysMoistureDemand;
     172              :     EPVector<DataZoneEnergyDemands::ZoneSystemSensibleDemand> spaceSysEnergyDemand;
     173              :     EPVector<DataZoneEnergyDemands::ZoneSystemMoistureDemand> spaceSysMoistureDemand;
     174              : 
     175         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     176              :     {
     177         2126 :     }
     178              : 
     179         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     180              :     {
     181         1152 :     }
     182              : 
     183         2100 :     void clear_state() override
     184              :     {
     185         2100 :         new (this) DataZoneEnergyDemandsData();
     186         2100 :     }
     187              : };
     188              : 
     189              : } // namespace EnergyPlus
     190              : 
     191              : #endif
        

Generated by: LCOV version 2.0-1