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 HeatBalanceHAMTManager_hh_INCLUDED
49 : #define HeatBalanceHAMTManager_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Optional.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/EnergyPlus.hh>
57 :
58 : namespace EnergyPlus {
59 :
60 : // Forward declarations
61 : struct EnergyPlusData;
62 :
63 : namespace HeatBalanceHAMTManager {
64 :
65 : // Data
66 : // MODULE PARAMETER DEFINITIONS:
67 :
68 : constexpr int ittermax(150); // Maximum Number of itterations
69 : constexpr int adjmax(6); // Maximum Number of Adjacent Cells
70 :
71 : constexpr Real64 wdensity(1000.0); // Density of water kg.m-3
72 : constexpr Real64 wspech(4180.0); // Specific Heat Capacity of Water J.kg-1.K-1 (at 20C)
73 : constexpr Real64 whv(2489000.0); // Evaporation enthalpy of water J.kg-1
74 : constexpr Real64 convt(0.002); // Temperature convergence limit
75 : constexpr Real64 qvplim(100000.0); // Maximum latent heat W
76 : constexpr Real64 rhmax(1.01); // Maximum RH value
77 :
78 : // Types
79 877 : struct subcell
80 : {
81 : // Members
82 : int matid; // Material Id Number
83 : int sid; // Surface Id Number
84 : Real64 Qadds; // Additional sources of heat
85 : Real64 density; // Density
86 : Real64 wthermalc; // Moisture Dependant Thermal Conductivity
87 : Real64 spech; // Specific Heat capacity
88 : Real64 htc; // Heat Transfer Coefficient
89 : Real64 vtc; // Vapor Transfer Coefficient
90 : Real64 mu; // Vapor Diffusion resistance Factor
91 : Real64 volume; // Cell Volume
92 : Real64 temp;
93 : Real64 tempp1;
94 : Real64 tempp2;
95 : Real64 wreport; // Water content for reporting
96 : Real64 water; // Water Content of cells
97 : Real64 vp; // Vapor Pressure
98 : Real64 vpp1; // Vapor Pressure
99 : Real64 vpsat; // Saturation Vapor Pressure
100 : Real64 rh;
101 : Real64 rhp1;
102 : Real64 rhp2; // Relative Humidity
103 : Real64 rhp; // cell relative humidity (percent - reporting)
104 : Real64 dwdphi; // Moisture storage capacity
105 : Real64 dw; // Liquid transport Coefficient
106 : Array1D<Real64> origin; // Cell origin. The geometric centre of the cell.
107 : Array1D<Real64> length; // Cell lengths
108 : Array1D<Real64> overlap; // Area of overlap
109 : Array1D<Real64> dist; // distance between cell origins
110 : Array1D_int adjs;
111 : Array1D_int adjsl;
112 :
113 : // Default Constructor
114 3 : subcell()
115 3 : : matid(-1), sid(-1), Qadds(0.0), density(-1.0), wthermalc(0.0), spech(0.0), htc(-1.0), vtc(-1.0), mu(-1.0), volume(0.0), temp(0.0),
116 : tempp1(0.0), tempp2(0.0), wreport(0.0), water(0.0), vp(0.0), vpp1(0.0), vpsat(0.0), rh(0.1), rhp1(0.1), rhp2(0.1), rhp(10.0),
117 3 : dwdphi(-1.0), dw(-1.0), origin(3, 0.0), length(3, 0.0), overlap(6, 0.0), dist(6, 0.0), adjs(6, 0), adjsl(6, 0)
118 : {
119 3 : }
120 : };
121 :
122 : void ManageHeatBalHAMT(EnergyPlusData &state, int const SurfNum, Real64 &SurfTempInTmp, Real64 &TempSurfOutTmp);
123 :
124 : void GetHeatBalHAMTInput(EnergyPlusData &state);
125 :
126 : void InitHeatBalHAMT(EnergyPlusData &state);
127 :
128 : void CalcHeatBalHAMT(EnergyPlusData &state, int const sid, Real64 &SurfTempInTmp, Real64 &TempSurfOutTmp);
129 :
130 : void UpdateHeatBalHAMT(EnergyPlusData &state, int const sid);
131 :
132 : void interp(
133 : int const ndata, const Array1D<Real64> &xx, const Array1D<Real64> &yy, Real64 const invalue, Real64 &outvalue, Optional<Real64> outgrad = _);
134 :
135 : Real64 RHtoVP(EnergyPlusData &state, Real64 const RH, Real64 const Temperature);
136 :
137 : Real64 WVDC(Real64 const Temperature, Real64 const ambp);
138 :
139 : // COPYRIGHT NOTICE
140 :
141 : // Portions Copyright (c) University College London 2007. All rights
142 : // reserved.
143 :
144 : // UCL LEGAL NOTICE
145 : // Neither UCL, members of UCL nor any person or organisation acting on
146 : // behalf of either:
147 :
148 : // A. Makes any warranty of representation, express or implied with
149 : // respect to the accuracy, completeness, or usefulness of the
150 : // information contained in this program, including any warranty of
151 : // merchantability or fitness of any purpose with respect to the
152 : // program, or that the use of any information disclosed in this
153 : // program may not infringe privately-owned rights, or
154 :
155 : // B. Assumes any liability with respect to the use of, or for any and
156 : // all damages resulting from the use of the program or any portion
157 : // thereof or any information disclosed therein.
158 :
159 : } // namespace HeatBalanceHAMTManager
160 :
161 1542 : struct HeatBalHAMTMgrData : BaseGlobalStruct
162 : {
163 :
164 : Array1D_int firstcell;
165 : Array1D_int lastcell;
166 : Array1D_int Extcell;
167 : Array1D_int ExtRadcell;
168 : Array1D_int ExtConcell;
169 : Array1D_int ExtSkycell;
170 : Array1D_int ExtGrncell;
171 : Array1D_int Intcell;
172 : Array1D_int IntConcell;
173 : Array1D<Real64> watertot;
174 : Array1D<Real64> surfrh;
175 : Array1D<Real64> surfextrh;
176 : Array1D<Real64> surftemp;
177 : Array1D<Real64> surfexttemp;
178 : Array1D<Real64> surfvp;
179 : Array1D<Real64> extvtc; // External Surface vapor transfer coefficient
180 : Array1D<Real64> intvtc; // Internal Surface Vapor Transfer Coefficient
181 : Array1D_bool extvtcflag; // External Surface vapor transfer coefficient flag
182 : Array1D_bool intvtcflag; // Internal Surface Vapor Transfer Coefficient flag
183 : Array1D_bool MyEnvrnFlag; // Flag to reset surface properties.
184 : Real64 deltat = 0.0; // time step in seconds
185 : int TotCellsMax = 0; // Maximum number of cells per material
186 : bool latswitch = false; // latent heat switch,
187 : bool rainswitch = false; // rain switch,
188 : Array1D<HeatBalanceHAMTManager::subcell> cells;
189 : bool OneTimeFlag = true;
190 : int qvpErrCount = 0;
191 : int qvpErrReport = 0;
192 :
193 0 : void clear_state() override
194 : {
195 0 : this->OneTimeFlag = true;
196 0 : this->qvpErrCount = 0;
197 0 : this->qvpErrReport = 0;
198 0 : }
199 : };
200 :
201 : } // namespace EnergyPlus
202 :
203 : #endif
|