LCOV - code coverage report
Current view: top level - EnergyPlus - WindowAC.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 14 28 50.0 %
Date: 2023-01-17 19:17:23 Functions: 8 11 72.7 %

          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 WindowAC_hh_INCLUDED
      49             : #define WindowAC_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             : // Forward declarations
      62             : struct EnergyPlusData;
      63             : 
      64             : namespace WindowAC {
      65             : 
      66          47 :     struct WindACData
      67             :     {
      68             :         // Members
      69             :         // input data
      70             :         std::string Name;      // name of unit
      71             :         int UnitType;          // type of unit
      72             :         std::string Sched;     // availability schedule
      73             :         int SchedPtr;          // index to schedule
      74             :         int FanSchedPtr;       // index to fan operating mode schedule
      75             :         int FanAvailSchedPtr;  // index to fan availability schedule
      76             :         Real64 MaxAirVolFlow;  // m3/s
      77             :         Real64 MaxAirMassFlow; // kg/s
      78             :         Real64 OutAirVolFlow;  // m3/s
      79             :         Real64 OutAirMassFlow; // kg/s
      80             :         int AirInNode;         // inlet air node number
      81             :         int AirOutNode;        // outlet air node number
      82             :         int OutsideAirNode;    // outside air node number
      83             :         int AirReliefNode;     // relief air node number
      84             :         int MixedAirNode;      // Mixed Air Node number
      85             :         std::string OAMixName; // name of outdoor air mixer
      86             :         std::string OAMixType; // type of outdoor air mixer
      87             :         int OAMixIndex;
      88             :         std::string FanName; // name of fan
      89             :         std::string FanType; // type of fan
      90             :         int FanType_Num;     // index to fan type
      91             :         int FanIndex;
      92             :         std::string DXCoilName; // name of cooling coil
      93             :         std::string DXCoilType; // type of cooling coil,Coil:DX:CoolingBypassFactorEmpirical or
      94             :         // 'CoilSystem:Cooling:DX:HeatExchangerAssisted'
      95             :         int DXCoilType_Num;    // Numeric Equivalent for DXCoil Type
      96             :         int DXCoilIndex;       // Index to DX cooling coil
      97             :         int DXCoilNumOfSpeeds; // number of speed levels for variable speed DX coil
      98             :         int CoilOutletNodeNum; // Outlet node number of DX cooling coil
      99             :         int OpMode;            // mode of operation; 1=cycling fan, cycling compressor,
     100             :         // 2=continuous fan, cycling compresor
     101             :         int FanPlace; // fan placement; 1=blow through, 2=draw through
     102             :         int MaxIterIndex1;
     103             :         int MaxIterIndex2;
     104             :         Real64 ConvergenceTol; // Convergence tolerance, fraction (ZoneLoad - Equip Output)/ZoneLoad
     105             :         // Calc data
     106             :         Real64 PartLoadFrac; // part load fraction for the unit
     107             :         bool EMSOverridePartLoadFrac;
     108             :         Real64 EMSValueForPartLoadFrac;
     109             :         // Report data
     110             :         Real64 TotCoolEnergyRate;         // total cooling output [W]
     111             :         Real64 TotCoolEnergy;             // total cooling output [J]
     112             :         Real64 SensCoolEnergyRate;        // sensible cooling output [W]
     113             :         Real64 SensCoolEnergy;            // sensible cooling output [J]
     114             :         Real64 LatCoolEnergyRate;         // sensible cooling output [W]
     115             :         Real64 LatCoolEnergy;             // sensible cooling output [J]
     116             :         Real64 ElecPower;                 // electricity consumed [W]
     117             :         Real64 ElecConsumption;           // electricity consumed [J]
     118             :         Real64 FanPartLoadRatio;          // fan part-load ratio for time step
     119             :         Real64 CompPartLoadRatio;         // compressor part-load ratio for time step
     120             :         std::string AvailManagerListName; // Name of an availability manager list object
     121             :         int AvailStatus;
     122             :         int ZonePtr;         // pointer to a zone served by a Window AC unit
     123             :         int HVACSizingIndex; // index of a HVACSizing object for a Window AC unit
     124             :         bool FirstPass;      // detects first time through for resetting sizing data
     125             : 
     126             :         // Default Constructor
     127           5 :         WindACData()
     128           5 :             : UnitType(0), SchedPtr(0), FanSchedPtr(0), FanAvailSchedPtr(0), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), OutAirVolFlow(0.0),
     129             :               OutAirMassFlow(0.0), AirInNode(0), AirOutNode(0), OutsideAirNode(0), AirReliefNode(0), MixedAirNode(0), OAMixIndex(0), FanType_Num(0),
     130             :               FanIndex(0), DXCoilType_Num(0), DXCoilIndex(0), DXCoilNumOfSpeeds(0), CoilOutletNodeNum(0), OpMode(0), FanPlace(0), MaxIterIndex1(0),
     131             :               MaxIterIndex2(0), ConvergenceTol(0.0), PartLoadFrac(0.0), EMSOverridePartLoadFrac(false), EMSValueForPartLoadFrac(0.0),
     132             :               TotCoolEnergyRate(0.0), TotCoolEnergy(0.0), SensCoolEnergyRate(0.0), SensCoolEnergy(0.0), LatCoolEnergyRate(0.0), LatCoolEnergy(0.0),
     133             :               ElecPower(0.0), ElecConsumption(0.0), FanPartLoadRatio(0.0), CompPartLoadRatio(0.0), AvailStatus(0), ZonePtr(0), HVACSizingIndex(0),
     134           5 :               FirstPass(true)
     135             :         {
     136           5 :         }
     137             :     };
     138             : 
     139          47 :     struct WindACNumericFieldData
     140             :     {
     141             :         // Members
     142             :         Array1D_string FieldNames;
     143             : 
     144             :         // Default Constructor
     145           5 :         WindACNumericFieldData()
     146           5 :         {
     147           5 :         }
     148             :     };
     149             : 
     150             :     // Functions
     151             : 
     152             :     void SimWindowAC(EnergyPlusData &state,
     153             :                      std::string_view CompName,     // name of the window AC unit
     154             :                      int const ZoneNum,             // number of zone being served
     155             :                      bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
     156             :                      Real64 &PowerMet,              // Sensible power supplied by window AC (W)
     157             :                      Real64 &LatOutputProvided,     // Latent add/removal supplied by window AC (kg/s), dehumid = negative
     158             :                      int &CompIndex                 // component index
     159             :     );
     160             : 
     161             :     void GetWindowAC(EnergyPlusData &state);
     162             : 
     163             :     void InitWindowAC(EnergyPlusData &state,
     164             :                       int const WindACNum,          // number of the current window AC unit being simulated
     165             :                       Real64 &QZnReq,               // zone load (modified as needed) (W)
     166             :                       int const ZoneNum,            // index to zone
     167             :                       bool const FirstHVACIteration // TRUE when first HVAC iteration
     168             :     );
     169             : 
     170             :     void SizeWindowAC(EnergyPlusData &state, int const WindACNum);
     171             : 
     172             :     void SimCyclingWindowAC(EnergyPlusData &state,
     173             :                             int const WindACNum,           // number of the current window AC unit being simulated
     174             :                             int const ZoneNum,             // number of zone being served !unused1208
     175             :                             bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
     176             :                             Real64 &PowerMet,              // Sensible power supplied (W)
     177             :                             Real64 const QZnReq,           // Sensible load to be met (W)
     178             :                             Real64 &LatOutputProvided      // Latent power supplied (kg/s), negative = dehumidification
     179             :     );
     180             : 
     181             :     void ReportWindowAC(EnergyPlusData &state, int const WindACNum); // number of the current AC unit being simulated
     182             : 
     183             :     void CalcWindowACOutput(EnergyPlusData &state,
     184             :                             int const WindACNum,           // Unit index in fan coil array
     185             :                             bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step
     186             :                             int const OpMode,              // operating mode: CycFanCycCoil | ContFanCycCoil
     187             :                             Real64 const PartLoadFrac,     // unit part load fraction
     188             :                             bool const HXUnitOn,           // Flag to toggle HX heat recovery as needed
     189             :                             Real64 &LoadMet                // load met by unit (watts)
     190             :     );
     191             : 
     192             :     void ControlCycWindACOutput(EnergyPlusData &state,
     193             :                                 int const WindACNum,           // Unit index in fan coil array
     194             :                                 bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step
     195             :                                 int const OpMode,              // operating mode: CycFanCycCoil | ContFanCycCoil
     196             :                                 Real64 const QZnReq,           // cooling output needed by zone [W]
     197             :                                 Real64 &PartLoadFrac,          // unit part load fraction
     198             :                                 bool &HXUnitOn                 // Used to control HX heat recovery as needed
     199             :     );
     200             : 
     201             :     int GetWindowACZoneInletAirNode(EnergyPlusData &state, int const WindACNum);
     202             : 
     203             :     int GetWindowACOutAirNode(EnergyPlusData &state, int const WindACNum);
     204             : 
     205             :     int GetWindowACReturnAirNode(EnergyPlusData &state, int const WindACNum);
     206             : 
     207             :     int GetWindowACMixedAirNode(EnergyPlusData &state, int const WindACNum);
     208             : 
     209             : } // namespace WindowAC
     210             : 
     211         771 : struct WindowACData : BaseGlobalStruct
     212             : {
     213             : 
     214             :     // MODULE PARAMETER DEFINITIONS
     215             :     int const WindowAC_UnitType;
     216             :     std::string const cWindowAC_UnitType;
     217             :     Array1D_string const cWindowAC_UnitTypes;
     218             : 
     219             :     bool MyOneTimeFlag;
     220             :     bool ZoneEquipmentListChecked;
     221             : 
     222             :     int NumWindAC;
     223             :     int NumWindACCyc;
     224             :     Array1D_bool MySizeFlag;
     225             :     bool GetWindowACInputFlag; // First time, input is "gotten"
     226             :     bool CoolingLoad;          // defines a cooling load
     227             :     Array1D_bool CheckEquipName;
     228             :     // Object Data
     229             :     Array1D<WindowAC::WindACData> WindAC;
     230             :     Array1D<WindowAC::WindACNumericFieldData> WindACNumericFields; // holds window AC numeric input fields character field name
     231             : 
     232             :     Array1D_bool MyEnvrnFlag;  // one time initialization flag
     233             :     Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers
     234             : 
     235           0 :     void clear_state() override
     236             :     {
     237           0 :         this->NumWindAC = 0;
     238           0 :         this->NumWindACCyc = 0;
     239           0 :         this->GetWindowACInputFlag = true;
     240           0 :         this->CoolingLoad = false;
     241           0 :         this->MyOneTimeFlag = true;
     242           0 :         this->ZoneEquipmentListChecked = false;
     243           0 :         this->MySizeFlag.deallocate();
     244           0 :         this->CheckEquipName.deallocate();
     245           0 :         this->WindAC.deallocate();
     246           0 :         this->WindACNumericFields.deallocate();
     247           0 :         this->MyEnvrnFlag.deallocate();
     248           0 :         this->MyZoneEqFlag.deallocate();
     249           0 :     }
     250             : 
     251             :     // Default Constructor
     252         771 :     WindowACData()
     253         771 :         : WindowAC_UnitType(1), cWindowAC_UnitType("ZoneHVAC:WindowAirConditioner"), cWindowAC_UnitTypes(1, cWindowAC_UnitType), MyOneTimeFlag(true),
     254         771 :           ZoneEquipmentListChecked(false), NumWindAC(0), NumWindACCyc(0), GetWindowACInputFlag(true), CoolingLoad(false)
     255             :     {
     256         771 :     }
     257             : };
     258             : 
     259             : } // namespace EnergyPlus
     260             : 
     261             : #endif

Generated by: LCOV version 1.13