LCOV - code coverage report
Current view: top level - EnergyPlus - DataZoneControls.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 26 48 54.2 %
Date: 2023-01-17 19:17:23 Functions: 17 23 73.9 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2023, 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 DataZoneControls_hh_INCLUDED
      49             : #define DataZoneControls_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             : 
      59             : namespace EnergyPlus {
      60             : 
      61             : namespace DataZoneControls {
      62             : 
      63             :     // Average method parameter with multiple people objects in a zone
      64             :     enum class AverageMethod
      65             :     {
      66             :         Invalid = -1,
      67             :         NO,  // No multiple people objects
      68             :         SPE, // Specific people object
      69             :         OBJ, // People object average
      70             :         PEO, // People number average
      71             :         Num
      72             :     };
      73             : 
      74        8629 :     struct ZoneTempControls
      75             :     {
      76             :         // Members
      77             :         std::string Name;     // Name of the thermostat
      78             :         std::string ZoneName; // Name of the zone
      79             :         int ActualZoneNum;
      80             :         std::string ControlTypeSchedName; // Name of the schedule which determines the zone temp setpoint
      81             :         int CTSchedIndex;                 // Index for this schedule
      82             : 
      83             :         // this is the number of control types defined on this zone control object
      84             :         int NumControlTypes;
      85             : 
      86             :         // these are all allocated to NumControlTypes, should be a struct allocated once
      87             :         Array1D_string ControlType; // from IDF, the "types" (string-should be an enum) of control modes for this particular thermostat - delete this
      88             :         Array1D_string ControlTypeName;                           // from IDF, the names of the control modes for this particular thermostat
      89             :         Array1D<DataHVACGlobals::ThermostatType> ControlTypeEnum; // from IDF, the enum types of each control mode for this particular thermostat
      90             : 
      91             :         // these now reflect that actual underlying setpoint temperature schedule indexes for each possible control type,
      92             :         // so they can be used to call directly to ScheduleValue(...)
      93             :         int SchIndx_SingleHeatSetPoint;
      94             :         int SchIndx_SingleCoolSetPoint;
      95             :         int SchIndx_SingleHeatCoolSetPoint;
      96             :         int SchIndx_DualSetPointWDeadBandHeat;
      97             :         int SchIndx_DualSetPointWDeadBandCool;
      98             : 
      99             :         bool ManageDemand;                      // Flag to indicate whether to use demand limiting
     100             :         Real64 HeatingResetLimit;               // Lowest heating setpoint that can be set by demand manager [C]
     101             :         Real64 CoolingResetLimit;               // Highest cooling setpoint that can be set by demand manager [C]
     102             :         bool EMSOverrideHeatingSetPointOn;      // EMS is calling to override heating setpoint
     103             :         Real64 EMSOverrideHeatingSetPointValue; // value EMS is directing to use for heating setpoint [C]
     104             :         bool EMSOverrideCoolingSetPointOn;      // EMS is calling to override cooling setpoint
     105             :         Real64 EMSOverrideCoolingSetPointValue; // value EMS is directing to use for cooling setpoint [C]
     106             :         bool OperativeTempControl;              // flag to indicate whether control based on Operative Temp
     107             :         bool OpTempCntrlModeScheduled;          // flag to indicate if radiative fraction is scheduled,
     108             :         // else constant
     109             :         Real64 FixedRadiativeFraction;    // weighting factor for mean radiant temp for Operative temperature
     110             :         int OpTempRadiativeFractionSched; // index of schedule for when fraction is scheduled
     111             : 
     112             :         bool AdaptiveComfortTempControl;   // flag to indicate whether control based on Operative Temp
     113             :         int AdaptiveComfortModelTypeIndex; // index to adaptive comfort model type
     114             : 
     115             :         Real64 ZoneOvercoolRange;        // Zone overcool temperature range (max), deg C
     116             :         bool ZoneOvercoolControl;        // Flag to indicate whether control is based on overcool
     117             :         bool OvercoolCntrlModeScheduled; // Flag to indicate if zone overcool range is scheduled
     118             :         //   or constant
     119             :         Real64 ZoneOvercoolConstRange;   // Overcool Range for Zone Air Setpoint Temperature [deltaC]
     120             :         int ZoneOvercoolRangeSchedIndex; // Index for Overcool Range Schedule
     121             :         Real64 ZoneOvercoolControlRatio; // Zone relative humidity shift per dry-bulb temperature overcooling
     122             :         //      below the original cooling setpoint, %RH/deltaC
     123             :         std::string DehumidifyingSched;  // Name of the schedule to determine the zone dehumidifying setpoint
     124             :         int DehumidifyingSchedIndex;     // Index for dehumidifying schedule
     125             :         Real64 DeltaTCutSet;             // Temperature difference between cutout and setpoint
     126             :         Real64 ZoneThermostatSetPointHi; // Cooling setpoint
     127             :         Real64 ZoneThermostatSetPointLo; // Heating setpoint
     128             :         bool CoolModeLast;
     129             :         bool HeatModeLast;
     130             :         bool CoolModeLastSave;
     131             :         bool HeatModeLastSave;
     132             :         bool CoolOffFlag; // Cooling off flag
     133             :         bool HeatOffFlag; // Heating off flag
     134             : 
     135             :         // Default Constructor
     136         665 :         ZoneTempControls()
     137         665 :             : ActualZoneNum(0), CTSchedIndex(0), NumControlTypes(0), SchIndx_SingleHeatSetPoint(0), SchIndx_SingleCoolSetPoint(0),
     138             :               SchIndx_SingleHeatCoolSetPoint(0), SchIndx_DualSetPointWDeadBandHeat(0), SchIndx_DualSetPointWDeadBandCool(0), ManageDemand(false),
     139             :               HeatingResetLimit(0.0), CoolingResetLimit(0.0), EMSOverrideHeatingSetPointOn(false), EMSOverrideHeatingSetPointValue(0.0),
     140             :               EMSOverrideCoolingSetPointOn(false), EMSOverrideCoolingSetPointValue(0.0), OperativeTempControl(false), OpTempCntrlModeScheduled(false),
     141             :               FixedRadiativeFraction(0.0), OpTempRadiativeFractionSched(0), AdaptiveComfortTempControl(false), AdaptiveComfortModelTypeIndex(0),
     142             :               ZoneOvercoolRange(0.0), ZoneOvercoolControl(false), OvercoolCntrlModeScheduled(false), ZoneOvercoolConstRange(0.0),
     143             :               ZoneOvercoolRangeSchedIndex(0), ZoneOvercoolControlRatio(0.0), DehumidifyingSchedIndex(0), DeltaTCutSet(0),
     144             :               ZoneThermostatSetPointHi(0.0), ZoneThermostatSetPointLo(0.0), CoolModeLast(false), HeatModeLast(false), CoolModeLastSave(false),
     145         665 :               HeatModeLastSave(false), CoolOffFlag(false), HeatOffFlag(false)
     146             : 
     147             :         {
     148         665 :         }
     149             :     };
     150             : 
     151         406 :     struct ZoneHumidityControls
     152             :     {
     153             :         // Members
     154             :         std::string ControlName;        // Name of this humidity controller
     155             :         std::string ZoneName;           // Name of the zone
     156             :         std::string HumidifyingSched;   // Name of the schedule to determine the zone humidifying setpoint
     157             :         std::string DehumidifyingSched; // Name of the schedule to determine the zone dehumidifying setpoint
     158             :         int ActualZoneNum;
     159             :         int HumidifyingSchedIndex;                 // Index for humidifying schedule
     160             :         int DehumidifyingSchedIndex;               // Index for dehumidifying schedule
     161             :         int ErrorIndex;                            // Error index when LowRH setpoint > HighRH setpoint
     162             :         bool EMSOverrideHumidifySetPointOn;        // EMS is calling to override humidifying setpoint
     163             :         Real64 EMSOverrideHumidifySetPointValue;   // value EMS is directing to use for humidifying setpoint
     164             :         bool EMSOverrideDehumidifySetPointOn;      // EMS is calling to override dehumidifying setpoint
     165             :         Real64 EMSOverrideDehumidifySetPointValue; // value EMS is directing to use for dehumidifying setpoint
     166             : 
     167             :         // Default Constructor
     168          88 :         ZoneHumidityControls()
     169          88 :             : ActualZoneNum(0), HumidifyingSchedIndex(0), DehumidifyingSchedIndex(0), ErrorIndex(0), EMSOverrideHumidifySetPointOn(false),
     170          88 :               EMSOverrideHumidifySetPointValue(0.0), EMSOverrideDehumidifySetPointOn(false), EMSOverrideDehumidifySetPointValue(0.0)
     171             :         {
     172          88 :         }
     173             :     };
     174             : 
     175           3 :     struct ZoneComfortControls
     176             :     {
     177             :         // Members
     178             :         std::string Name;                              // Name of the thermostat
     179             :         std::string ZoneName;                          // Name of the zone
     180             :         int ActualZoneNum;                             // Index number of zone
     181             :         std::string ControlTypeSchedName;              // Name of the schedule which determines the zone temp setpoint
     182             :         int ComfortSchedIndex;                         // Index for this schedule
     183             :         int NumControlTypes;                           // Number of control types in ZoneControl:ThermalComfort object
     184             :         Array1D_string ControlType;                    // Type of control
     185             :         Array1D_string ControlTypeName;                // Name of control type
     186             :         Array1D_int ControlTypeSchIndx;                // Index to control type schedule
     187             :         int SchIndx_SingleHeating;                     // Index to fanger single heating setpoint schedule
     188             :         int SchIndx_SingleCooling;                     // Index to fanger single cooling setpoint schedule
     189             :         int SchIndx_SingleHeatCool;                    // Index to fanger single heating/cooling setpoint schedule
     190             :         int SchIndx_DualSetPointWithDeadBand;          // Index to fanger dual setpoint schedule
     191             :         bool ManageDemand;                             // Flag to indicate whether to use demand limiting
     192             :         Real64 HeatingResetLimit;                      // Lowest heating setpoint that can be set by demand manager [C]
     193             :         Real64 CoolingResetLimit;                      // Highest cooling setpoint that can be set by demand manager [C]
     194             :         bool EMSOverrideHeatingSetPointOn;             // EMS is calling to override heating setpoint
     195             :         Real64 EMSOverrideHeatingSetPointValue;        // value EMS is directing to use for heating setpoint
     196             :         bool EMSOverrideCoolingSetPointOn;             // EMS is calling to override cooling setpoint
     197             :         Real64 EMSOverrideCoolingSetPointValue;        // value EMS is directing to use for cooling setpoint
     198             :         Real64 TdbMaxSetPoint;                         // Maximum dry-bulb temperature setpoint [C]
     199             :         Real64 TdbMinSetPoint;                         // Minimum dry-bulb temperature setpoint [C]
     200             :         std::string AverageMethodName;                 // Averaging Method for Zones with Multiple People Objects
     201             :         std::string AverageObjectName;                 // Object Name for Specific Object Average
     202             :         DataZoneControls::AverageMethod AverageMethod; // Averaging method
     203             :         int SpecificObjectNum;                         // People Object number used for Specific people object choice
     204             :         int PeopleAverageErrIndex;                     // People average error index
     205             :         int TdbMaxErrIndex;                            // Single cooling setpoint error index
     206             :         int TdbMinErrIndex;                            // Single heating setpoint error index
     207             :         int TdbHCErrIndex;                             // Single heating cooling setpoint error index
     208             :         int TdbDualMaxErrIndex;                        // Dual cooling setpoint error index
     209             :         int TdbDualMinErrIndex;                        // Dual heating setpoint error index
     210             : 
     211             :         // Default Constructor
     212           1 :         ZoneComfortControls()
     213           1 :             : ActualZoneNum(0), ComfortSchedIndex(0), NumControlTypes(0), SchIndx_SingleHeating(0), SchIndx_SingleCooling(0),
     214             :               SchIndx_SingleHeatCool(0), SchIndx_DualSetPointWithDeadBand(0), ManageDemand(false), HeatingResetLimit(0.0), CoolingResetLimit(0.0),
     215             :               EMSOverrideHeatingSetPointOn(false), EMSOverrideHeatingSetPointValue(0.0), EMSOverrideCoolingSetPointOn(false),
     216             :               EMSOverrideCoolingSetPointValue(0.0), TdbMaxSetPoint(50.0), TdbMinSetPoint(0.0), AverageMethodName("PEOPLE AVERGAE"),
     217             :               AverageMethod(DataZoneControls::AverageMethod::NO), SpecificObjectNum(0), PeopleAverageErrIndex(0), TdbMaxErrIndex(0),
     218           1 :               TdbMinErrIndex(0), TdbHCErrIndex(0), TdbDualMaxErrIndex(0), TdbDualMinErrIndex(0)
     219             :         {
     220           1 :         }
     221             :     };
     222             : 
     223          16 :     struct ZoneStagedControls
     224             :     {
     225             :         // Members
     226             :         std::string Name;                 // Name of the thermostat
     227             :         std::string ZoneName;             // Name of the zone
     228             :         int ActualZoneNum;                // Index number of zone
     229             :         std::string HeatSetBaseSchedName; // Name of the schedule which provides zone heating setpoint base
     230             :         int HSBchedIndex;                 // Index for this schedule
     231             :         std::string CoolSetBaseSchedName; // Name of the schedule which provides zone cooling setpoint base
     232             :         int CSBchedIndex;                 // Index for this schedule
     233             :         int NumOfHeatStages;              // Number of heating stages
     234             :         int NumOfCoolStages;              // Number of cooling stages
     235             :         Real64 HeatThroRange;             // Heating throttling tempeature range
     236             :         Real64 CoolThroRange;             // Cooling throttling tempeature range
     237             :         Array1D<Real64> HeatTOffset;      // Heating temperature offset
     238             :         Array1D<Real64> CoolTOffset;      // Cooling temperature offset
     239             :         Real64 HeatSetPoint;              // Heating throttling tempeature range
     240             :         Real64 CoolSetPoint;              // Cooling throttling tempeature range
     241             :         int StageErrCount;                // Staged setpoint erro count
     242             :         int StageErrIndex;                // Staged setpoint erro index
     243             : 
     244             :         // Default Constructor
     245           2 :         ZoneStagedControls()
     246           2 :             : ActualZoneNum(0), HSBchedIndex(0), CSBchedIndex(0), NumOfHeatStages(0), NumOfCoolStages(0), HeatThroRange(0.0), CoolThroRange(0.0),
     247           2 :               HeatSetPoint(0.0), CoolSetPoint(0.0), StageErrCount(0), StageErrIndex(0)
     248             :         {
     249           2 :         }
     250             :     };
     251             : 
     252        9452 :     struct TStatObject
     253             :     {
     254             :         // Members
     255             :         std::string Name;
     256             :         int ZoneOrZoneListPtr;
     257             :         int NumOfZones;
     258             :         int TempControlledZoneStartPtr;
     259             :         int ComfortControlledZoneStartPtr;
     260             :         int StageControlledZoneStartPtr;
     261             :         bool ZoneListActive;
     262             : 
     263             :         // Default Constructor
     264        1544 :         TStatObject()
     265        1544 :             : ZoneOrZoneListPtr(0), NumOfZones(0), TempControlledZoneStartPtr(0), ComfortControlledZoneStartPtr(0), StageControlledZoneStartPtr(0),
     266        1544 :               ZoneListActive(false)
     267             :         {
     268        1544 :         }
     269             :     };
     270             : 
     271             : } // namespace DataZoneControls
     272             : 
     273        1542 : struct DataZoneControlsData : BaseGlobalStruct
     274             : {
     275             :     int NumTempControlledZones = 0;
     276             :     int NumHumidityControlZones = 0;
     277             :     int NumComfortControlledZones = 0;
     278             :     int NumTStatStatements = 0;
     279             :     int NumComfortTStatStatements = 0;
     280             :     int NumOpTempControlledZones = 0;           // number of zones with operative temp control
     281             :     int NumTempAndHumidityControlledZones = 0;  // number of zones with over cool control
     282             :     bool AnyOpTempControl = false;              // flag set true if any zones have op temp control
     283             :     bool AnyZoneTempAndHumidityControl = false; // flag set true if any zones have over cool control
     284             :     Array1D_bool StageZoneLogic;                // Logical array, A zone with staged thermostat = .TRUE.
     285             :     Array1D<Real64> OccRoomTSetPointHeat;       // occupied heating set point for optimum start period
     286             :     Array1D<Real64> OccRoomTSetPointCool;       // occupied cooling set point for optimum start period
     287             :     bool GetZoneAirStatsInputFlag = true;       // True when need to get input
     288             :     Array1D<DataZoneControls::ZoneHumidityControls> HumidityControlZone;
     289             :     Array1D<DataZoneControls::ZoneTempControls> TempControlledZone;
     290             :     Array1D<DataZoneControls::ZoneComfortControls> ComfortControlledZone;
     291             :     Array1D<DataZoneControls::TStatObject> TStatObjects;
     292             :     Array1D<DataZoneControls::TStatObject> ComfortTStatObjects;
     293             :     Array1D<DataZoneControls::TStatObject> StagedTStatObjects;
     294             :     Array1D<DataZoneControls::ZoneStagedControls> StageControlledZone;
     295             : 
     296           0 :     void clear_state() override
     297             :     {
     298           0 :         this->NumTempControlledZones = 0;
     299           0 :         this->NumHumidityControlZones = 0;
     300           0 :         this->NumComfortControlledZones = 0;
     301           0 :         this->NumTStatStatements = 0;
     302           0 :         this->NumComfortTStatStatements = 0;
     303           0 :         this->NumOpTempControlledZones = 0;
     304           0 :         this->NumTempAndHumidityControlledZones = 0;
     305           0 :         this->AnyOpTempControl = false;
     306           0 :         this->AnyZoneTempAndHumidityControl = false;
     307           0 :         this->StageZoneLogic.deallocate();
     308           0 :         this->OccRoomTSetPointHeat.deallocate();
     309           0 :         this->OccRoomTSetPointCool.deallocate();
     310           0 :         this->GetZoneAirStatsInputFlag = true;
     311           0 :         this->HumidityControlZone.deallocate();
     312           0 :         this->TempControlledZone.deallocate();
     313           0 :         this->ComfortControlledZone.deallocate();
     314           0 :         this->TStatObjects.deallocate();
     315           0 :         this->ComfortTStatObjects.deallocate();
     316           0 :         this->StagedTStatObjects.deallocate();
     317           0 :         this->StageControlledZone.deallocate();
     318           0 :     }
     319             : };
     320             : 
     321             : } // namespace EnergyPlus
     322             : 
     323             : #endif

Generated by: LCOV version 1.13