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

          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 HVACFourPipeBeam_hh_INCLUDED
      49             : #define HVACFourPipeBeam_hh_INCLUDED
      50             : 
      51             : #include <memory>
      52             : // ObjexxFCL Headers
      53             : #include <ObjexxFCL/Array1.hh>
      54             : 
      55             : // EnergyPlus Headers
      56             : #include <EnergyPlus/AirTerminalUnit.hh>
      57             : #include <EnergyPlus/Data/BaseData.hh>
      58             : #include <EnergyPlus/DataGlobals.hh>
      59             : #include <EnergyPlus/EnergyPlus.hh>
      60             : #include <EnergyPlus/GlobalNames.hh>
      61             : #include <EnergyPlus/Plant/PlantLocation.hh>
      62             : 
      63             : namespace EnergyPlus {
      64             : 
      65             : // Forward declarations
      66             : struct EnergyPlusData;
      67             : 
      68             : namespace FourPipeBeam {
      69             : 
      70             :     class HVACFourPipeBeam : public AirTerminalUnit
      71             :     {
      72             : 
      73             :     private: // Creation
      74             :         // Default Constructor
      75          15 :         HVACFourPipeBeam()
      76          15 :             : coolingAvailSchedNum(0), coolingAvailable(false), heatingAvailSchedNum(0), heatingAvailable(false), totBeamLength(0.0),
      77             :               totBeamLengthWasAutosized(false), vDotNormRatedPrimAir(0.0), mDotNormRatedPrimAir(0.0), beamCoolingPresent(false), vDotDesignCW(0.0),
      78             :               vDotDesignCWWasAutosized(false), mDotDesignCW(0.0), qDotNormRatedCooling(0.0), deltaTempRatedCooling(0.0), vDotNormRatedCW(0.0),
      79             :               mDotNormRatedCW(0.0), modCoolingQdotDeltaTFuncNum(0), modCoolingQdotAirFlowFuncNum(0), modCoolingQdotCWFlowFuncNum(0), mDotCW(0.0),
      80             :               cWTempIn(0.0), cWTempOut(0.0), cWTempOutErrorCount(0), cWInNodeNum(0), cWOutNodeNum(0),
      81             :               cWplantLoc(PlantLocation(0, DataPlant::LoopSideLocation::Invalid, 0, 0)), beamHeatingPresent(false), vDotDesignHW(0.0),
      82             :               vDotDesignHWWasAutosized(false), mDotDesignHW(0.0), qDotNormRatedHeating(0.0), deltaTempRatedHeating(0.0), vDotNormRatedHW(0.0),
      83             :               mDotNormRatedHW(0.0), modHeatingQdotDeltaTFuncNum(0), modHeatingQdotAirFlowFuncNum(0), modHeatingQdotHWFlowFuncNum(0), mDotHW(0.0),
      84             :               hWTempIn(0.0), hWTempOut(0.0), hWTempOutErrorCount(0), hWInNodeNum(0), hWOutNodeNum(0),
      85             :               hWplantLoc(PlantLocation(0, DataPlant::LoopSideLocation::Invalid, 0, 0)), beamCoolingEnergy(0.0), beamCoolingRate(0.0),
      86             :               beamHeatingEnergy(0.0), beamHeatingRate(0.0), supAirCoolingEnergy(0.0), supAirCoolingRate(0.0), supAirHeatingEnergy(0.0),
      87             :               supAirHeatingRate(0.0), primAirFlow(0.0), OutdoorAirFlowRate(0.0), myEnvrnFlag(true), mySizeFlag(true), plantLoopScanFlag(true),
      88             :               zoneEquipmentListChecked(false), tDBZoneAirTemp(0.0), tDBSystemAir(0.0), mDotSystemAir(0.0), cpZoneAir(0.0), cpSystemAir(0.0),
      89             :               qDotSystemAir(0.0), qDotBeamCoolingMax(0.0), qDotBeamHeatingMax(0.0), qDotTotalDelivered(0.0), qDotBeamCooling(0.0),
      90          15 :               qDotBeamHeating(0.0), qDotZoneReq(0.0), qDotBeamReq(0.0), qDotZoneToHeatSetPt(0.0), qDotZoneToCoolSetPt(0.0)
      91             :         {
      92          15 :         }
      93             : 
      94             :     public:
      95             :         // Destructor
      96          30 :         virtual ~HVACFourPipeBeam()
      97          15 :         {
      98          30 :         }
      99             : 
     100             :     public: // Methods        MARK ANY THAT DON'T ALTER STATE const !!!
     101             :         ///// Note use of shared_ptr here is not a good pattern, not to be replicated without further discussion.
     102             :         static std::shared_ptr<AirTerminalUnit> fourPipeBeamFactory(EnergyPlusData &state, std::string objectName);
     103             :         void simulate(EnergyPlusData &state,
     104             :                       bool const FirstHVACIteration, // TRUE if first HVAC iteration in time step
     105             :                       Real64 &NonAirSysOutput        // convective cooling by the beam system [W]
     106             :         );
     107             : 
     108             :         int getZoneIndex();
     109             : 
     110             :         int getAirLoopNum();
     111             : 
     112             :         Real64 getPrimAirDesignVolFlow();
     113             : 
     114             :         int getTermUnitSizingIndex();
     115             : 
     116             :     private: // Methods
     117             :         void
     118             :         init(EnergyPlusData &state,
     119             :              bool const FirstHVACIteration // TRUE if first air loop solution this HVAC step         MAYBE THIS SHOULD HAVE A DEFAULT ARG OF = false
     120             :         );
     121             : 
     122             :         void set_size(EnergyPlusData &state);
     123             : 
     124             :         void control(EnergyPlusData &state,
     125             :                      bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
     126             :                      Real64 &NonAirSysOutput        // convective cooling by the beam system [W]
     127             :         );
     128             : 
     129             :         void calc(EnergyPlusData &state);
     130             : 
     131             :         void update(EnergyPlusData &state) const;
     132             : 
     133             :         void report(EnergyPlusData &state);
     134             : 
     135             :         void CalcOutdoorAirVolumeFlowRate(EnergyPlusData &state);
     136             : 
     137             :     private:                      // data
     138             :         int coolingAvailSchedNum; // index to schedule for cooling availability
     139             :         bool coolingAvailable;    // true if beam cooling is available
     140             :         int heatingAvailSchedNum; // index to schedule for heating availability
     141             :         bool heatingAvailable;    // true if beam heating is available
     142             : 
     143             :         Real64 totBeamLength;           // length of all the beams in the zone (autosizable) (m)
     144             :         bool totBeamLengthWasAutosized; // true if beam length was autosized on input
     145             :         Real64 vDotNormRatedPrimAir;    // normalized primary air volume flow rate at rating point (m3/s-m)
     146             :         Real64 mDotNormRatedPrimAir;    // normalized primary air mass flow rate at rating point (kg/s-m)
     147             :         // cooling
     148             :         bool beamCoolingPresent;          // true if chilled water system is connected to beam
     149             :         Real64 vDotDesignCW;              // Design chilled water volume flow rate (autosizable) (m3/s)
     150             :         bool vDotDesignCWWasAutosized;    // true if use input for chilled water flow was autosized
     151             :         Real64 mDotDesignCW;              // Design chilled water mass flow rate (kg/s)
     152             :         Real64 qDotNormRatedCooling;      // normalized cooling capacity at rating point (W/m)
     153             :         Real64 deltaTempRatedCooling;     // temperature difference between zone air and entering chilled water at rating point (delta C)
     154             :         Real64 vDotNormRatedCW;           // normalized chilled water volume flow rate at rating point (m3/s-m)
     155             :         Real64 mDotNormRatedCW;           // normalized chilled water mass flow rate at rating point (kg/s-m)
     156             :         int modCoolingQdotDeltaTFuncNum;  // index to curve or table modifying cooling capacity as a function of delta T ratio
     157             :         int modCoolingQdotAirFlowFuncNum; // index to curve or table modifying cooling capacity as a function of air flow ratio
     158             :         int modCoolingQdotCWFlowFuncNum;  // index to curve or table modifying cooling capacity as a function of chilled water flow ratio
     159             :         Real64 mDotCW;                    // current chilled water mass flow rate (kg/s)
     160             :         Real64 cWTempIn;                  // current inlet chilled water temperature [C]
     161             :         Real64 cWTempOut;                 // current outlet chilled water temperature [C]
     162             :         int cWTempOutErrorCount;          // counter for recurring errors in chilled water outlet temperature
     163             :         int cWInNodeNum;                  // chilled water inlet node
     164             :         int cWOutNodeNum;                 // chilled water outlet nod
     165             :         PlantLocation cWplantLoc;         // chilled water plant loop location
     166             :         // heating
     167             :         bool beamHeatingPresent;          // true if hot water system is connected to beam
     168             :         Real64 vDotDesignHW;              // Design hot water volume flow rate (autosizable) (m3/s)
     169             :         bool vDotDesignHWWasAutosized;    // true if user input for hot water flow was autosized
     170             :         Real64 mDotDesignHW;              // Design hot water mass flow rate (kg/s)
     171             :         Real64 qDotNormRatedHeating;      // normalized heating capacity at rating point (W/m)
     172             :         Real64 deltaTempRatedHeating;     // temperature difference between zone air and entering hot water at rating point (delta C)
     173             :         Real64 vDotNormRatedHW;           // normalized hot water volume flow rate at rating point (m3/s-m)
     174             :         Real64 mDotNormRatedHW;           // normalized hot water mass flow rate at rating point (kg/s-m)
     175             :         int modHeatingQdotDeltaTFuncNum;  // index to curve or table modifying heating capacity as a function of delta T ratio
     176             :         int modHeatingQdotAirFlowFuncNum; // index to curve or table modifying heating capacity as a function of air flow ratio
     177             :         int modHeatingQdotHWFlowFuncNum;  // index to curve or table modifying heating capacity as a function of chilled water flow ratio
     178             :         Real64 mDotHW;                    // current hot water mass flow rate (kg/s)
     179             :         Real64 hWTempIn;                  // current inlet hot water temperature (C)
     180             :         Real64 hWTempOut;                 // current outlet hot water temperature (C)
     181             :         int hWTempOutErrorCount;          // counter for recurring errors in hot water outlet temperature
     182             :         int hWInNodeNum;                  // hot water inlet node
     183             :         int hWOutNodeNum;                 // hot water outlet node
     184             :         PlantLocation hWplantLoc;         // hot water connection location structure
     185             : 
     186             :         // output variables
     187             :         Real64 beamCoolingEnergy;   // beam sensible cooling energy of all beams in the zone [J]
     188             :         Real64 beamCoolingRate;     // beam sensible cooling rate of all beams in the zone (positive convention) [W]
     189             :         Real64 beamHeatingEnergy;   // beam heating energy of all beams in the zone [J]
     190             :         Real64 beamHeatingRate;     // beam heating rate of all beams in the zone [W]
     191             :         Real64 supAirCoolingEnergy; // Total cooling energy from supply air [J]
     192             :         Real64 supAirCoolingRate;   // Total cooling rate from supply air [W]
     193             :         Real64 supAirHeatingEnergy; // Total cooling energy from supply air [J]
     194             :         Real64 supAirHeatingRate;   // Total cooling rate from supply air [W]
     195             :         Real64 primAirFlow;         // supply air flow per zone at standard elevation-adjusted density [m3/s]
     196             :         Real64 OutdoorAirFlowRate;  // zone outdoor air volume flow rate
     197             : 
     198             :         bool myEnvrnFlag;              // control when to re initialize for new environment period
     199             :         bool mySizeFlag;               // control when to run sizing method
     200             :         bool plantLoopScanFlag;        // control when to look up plant locations for water connections
     201             :         bool zoneEquipmentListChecked; // control when to check zone equipment list was input correctly
     202             : 
     203             :         Real64 tDBZoneAirTemp;      // current drybulb temperature of zone air, C
     204             :         Real64 tDBSystemAir;        // current drybulb temperature of primary supply air, C
     205             :         Real64 mDotSystemAir;       // current mass flow of primary supply air,kg/s
     206             :         Real64 cpZoneAir;           // current specific heat of zone air
     207             :         Real64 cpSystemAir;         // current specific heat of primary supply air
     208             :         Real64 qDotSystemAir;       // current heat transfer rate of primary supply air wrt zone, W
     209             :         Real64 qDotBeamCoolingMax;  // current beam cooling rate at maximum chilled water flow rate, W
     210             :         Real64 qDotBeamHeatingMax;  // curent beam heating rate at maximum hot water flow rate, W
     211             :         Real64 qDotTotalDelivered;  // current combined heat transfer rate of primary supply air and beam, W
     212             :         Real64 qDotBeamCooling;     // current beam cooling rate, W
     213             :         Real64 qDotBeamHeating;     // current beam heating rate, W
     214             :         Real64 qDotZoneReq;         // current zone sensible requested load to setpoint, W
     215             :         Real64 qDotBeamReq;         // current load requested of beam, W
     216             :         Real64 qDotZoneToHeatSetPt; // current zone sensible load to heating setpoint, W
     217             :         Real64 qDotZoneToCoolSetPt; // current zone sensible load to cooling setpoint, W
     218             : 
     219             :     }; // HVACFourPipeBeam
     220             : 
     221             : } // namespace FourPipeBeam
     222             : 
     223        1542 : struct FourPipeBeamData : BaseGlobalStruct
     224             : {
     225             : 
     226             :     ///// Note use of shared_ptr here is not a good pattern, not to be replicated without further discussion.
     227             :     Array1D<std::shared_ptr<FourPipeBeam::HVACFourPipeBeam>> FourPipeBeams; // dimension to number of machines
     228             : 
     229           0 :     void clear_state() override
     230             :     {
     231           0 :         FourPipeBeams.clear();
     232           0 :     }
     233             : };
     234             : 
     235             : } // namespace EnergyPlus
     236             : 
     237             : #endif // HVACFourPipeBeam_hh_INCLUDED

Generated by: LCOV version 1.13