Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2024, 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 Psychrometrics_hh_INCLUDED
49 : #define Psychrometrics_hh_INCLUDED
50 :
51 : // C++ Headers
52 : #include <cassert>
53 : #include <cmath>
54 :
55 : // ObjexxFCL Headers
56 : #include <ObjexxFCL/Array1D.hh>
57 : #include <ObjexxFCL/Fmath.hh>
58 :
59 : // EnergyPlus Headers
60 : #include <EnergyPlus/Data/BaseData.hh>
61 : #include <EnergyPlus/Data/EnergyPlusData.hh>
62 : #include <EnergyPlus/DataGlobals.hh>
63 : #include <EnergyPlus/EnergyPlus.hh>
64 : #include <EnergyPlus/PsychCacheData.hh>
65 : #include <EnergyPlus/UtilityRoutines.hh>
66 :
67 : namespace EnergyPlus {
68 :
69 : // Forward declarations
70 : struct EnergyPlusData;
71 :
72 : #ifdef EP_nocache_Psychrometrics
73 : #undef EP_cache_PsyTwbFnTdbWPb
74 : #undef EP_cache_PsyPsatFnTemp
75 : #undef EP_cache_PsyTsatFnPb
76 : #undef EP_cache_PsyTsatFnHPb
77 : #else
78 : #define EP_cache_PsyTwbFnTdbWPb
79 : #define EP_cache_PsyPsatFnTemp
80 : #define EP_cache_PsyTsatFnPb
81 : #define EP_cache_PsyTsatFnHPb
82 : #endif
83 :
84 : // Adapted from: https://www.fluentcpp.com/2019/08/30/how-to-disable-a-warning-in-cpp/
85 : // clang-format off
86 : #if defined(_MSC_VER)
87 : #define DISABLE_WARNING_PUSH __pragma(warning(push))
88 : #define DISABLE_WARNING_POP __pragma(warning(pop))
89 : #define DISABLE_WARNING(warningNumber) __pragma(warning(disable : warningNumber))
90 :
91 : // purposfully doing nothing here - does MSVC not have a strict-aliasing warning?
92 : #define DISABLE_WARNING_STRICT_ALIASING
93 : #define DISABLE_WARNING_UNINITIALIZED
94 : #elif defined(__GNUC__) || defined(__clang__)
95 : #define DO_PRAGMA(X) _Pragma(#X)
96 : #define DISABLE_WARNING_PUSH DO_PRAGMA(GCC diagnostic push)
97 : #define DISABLE_WARNING_POP DO_PRAGMA(GCC diagnostic pop)
98 : #define DISABLE_WARNING(warningName) DO_PRAGMA(GCC diagnostic ignored #warningName)
99 :
100 : #define DISABLE_WARNING_STRICT_ALIASING DISABLE_WARNING(-Wstrict-aliasing)
101 : #define DISABLE_WARNING_UNINITIALIZED DISABLE_WARNING(-Wuninitialized)
102 :
103 : #endif
104 : // clang-format on
105 :
106 : namespace Psychrometrics {
107 :
108 : // Data
109 : // MODULE PARAMETER DEFINITIONS:
110 : // call for recurring errors
111 :
112 : static constexpr std::array<std::string_view, static_cast<int>(PsychrometricFunction::Num)> PsyRoutineNames = {
113 : "PsyTdpFnTdbTwbPb",
114 : "PsyRhFnTdbWPb",
115 : "PsyTwbFnTdbWPb",
116 : "PsyVFnTdbWPb",
117 : "PsyWFnTdpPb",
118 : "PsyWFnTdbH",
119 : "PsyWFnTdbTwbPb",
120 : "PsyWFnTdbRhPb",
121 : "PsyPsatFnTemp",
122 : "PsyTsatFnHPb",
123 : "PsyTsatFnPb",
124 : "PsyRhFnTdbRhov",
125 : "PsyRhFnTdbRhovLBnd0C",
126 : "PsyTwbFnTdbWPb",
127 : "PsyTwbFnTdbWPb",
128 : "PsyWFnTdbTwbPb",
129 : "PsyTsatFnPb",
130 : "PsyTwbFnTdbWPb_cache",
131 : "PsyPsatFnTemp_cache"}; // 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
132 : // 14 - HR | 15 - max iter | 16 - HR | 17 - max iter | 18 -
133 : // PsyTwbFnTdbWPb_raw (raw calc) | 19 - PsyPsatFnTemp_raw
134 : // (raw calc)
135 : // sample bin size =64 Pa; sample size =1651 (continous)
136 : static constexpr std::array<Real64, 1651> tsat_fn_pb_y = {
137 : -100, -24.88812836, -17.74197121, -13.36696483, -10.17031904, -7.635747635, -5.528025298, -3.719474549, -2.132789207, -0.717496548,
138 : 0.635182846, 1.961212857, 3.184455749, 4.320585222, 5.381890646, 6.378191532, 7.317464071, 8.206277019, 9.050107781, 9.853572827,
139 : 10.62060139, 11.35456508, 12.05838073, 12.73458802, 13.38541367, 14.01282043, 14.61854774, 15.2041452, 15.77099766, 16.32035156,
140 : 16.85332662, 17.37094188, 17.87411665, 18.36369351, 18.84043883, 19.30505535, 19.75818947, 20.200435, 20.63234161, 21.05441545,
141 : 21.46712703, 21.87091368, 22.26617973, 22.65330582, 23.03264392, 23.40452474, 23.76925695, 24.12713074, 24.4784194, 24.82337925,
142 : 25.16224961, 25.49525941, 25.82262353, 26.14454343, 26.46121131, 26.77280989, 27.07951029, 27.38147718, 27.67886392, 27.97181871,
143 : 28.26048327, 28.54498875, 28.82546493, 29.10203155, 29.37480614, 29.64389783, 29.90941288, 30.17145332, 30.43011544, 30.68549275,
144 : 30.93767354, 31.1867437, 31.43278471, 31.67587535, 31.91609169, 32.15350578, 32.38818672, 32.62020399, 32.84962034, 33.07649705,
145 : 33.30089772, 33.52287753, 33.7424911, 33.95979768, 34.17484337, 34.38768181, 34.59836177, 34.8069286, 35.01342775, 35.21790433,
146 : 35.42039942, 35.62095455, 35.81961149, 36.0164063, 36.21137695, 36.40456083, 36.59599334, 36.78570706, 36.97373442, 37.16011096,
147 : 37.34486543, 37.5280276, 37.70962755, 37.88969498, 38.06825698, 38.24534078, 38.4209727, 38.59517724, 38.7679823, 38.93940873,
148 : 39.10948012, 39.2782229, 39.44565725, 39.6118041, 39.77668652, 39.94032485, 40.10273846, 40.26394796, 40.42397281, 40.58283123,
149 : 40.74054192, 40.89712156, 41.0525873, 41.20696011, 41.3602526, 41.5124819, 41.66366455, 41.81381521, 41.96295168, 42.11108573,
150 : 42.25823182, 42.40440716, 42.54962287, 42.69389419, 42.8372333, 42.97965197, 43.12116511, 43.2617866, 43.40152372, 43.5403934,
151 : 43.67840528, 43.81556931, 43.95189963, 44.0874032, 44.22209605, 44.35598543, 44.48908135, 44.62139435, 44.75293555, 44.88371503,
152 : 45.01374001, 45.14302132, 45.27156964, 45.39939168, 45.52649676, 45.65289264, 45.77859083, 45.90359809, 46.02792097, 46.15157051,
153 : 46.27455279, 46.39687482, 46.51854662, 46.63957407, 46.75996667, 46.87972868, 46.99886779, 47.11739332, 47.23530984, 47.35262368,
154 : 47.46934408, 47.58547585, 47.7010257, 47.81600131, 47.93040599, 48.0442474, 48.15753313, 48.27026594, 48.38245292, 48.49410119,
155 : 48.60521578, 48.71580123, 48.82586296, 48.93540734, 49.04443945, 49.15296424, 49.26098645, 49.36851262, 49.47554597, 49.58209088,
156 : 49.68815438, 49.7937401, 49.89885468, 50.00349843, 50.10767869, 50.21139915, 50.31466562, 50.41748127, 50.51984969, 50.6217774,
157 : 50.72326533, 50.8243191, 50.92494506, 51.02514303, 51.12491978, 51.22427873, 51.32322162, 51.42175505, 51.51988223, 51.61760565,
158 : 51.71492849, 51.81185626, 51.90838995, 52.00453601, 52.10029659, 52.19567395, 52.29067211, 52.38529434, 52.47954517, 52.57342522,
159 : 52.66694094, 52.76009179, 52.85288285, 52.94531781, 53.03739768, 53.12912747, 53.22050752, 53.31154238, 53.40223643, 53.49258938,
160 : 53.58260762, 53.67228883, 53.76164079, 53.85066348, 53.93935919, 54.02773136, 54.11578345, 54.20351687, 54.29093451, 54.37803778,
161 : 54.46483065, 54.55131516, 54.63749308, 54.7233676, 54.80894018, 54.89421491, 54.97919066, 55.0638724, 55.14826341, 55.23236115,
162 : 55.31617223, 55.39969882, 55.48294042, 55.56589968, 55.64857895, 55.7309827, 55.8131092, 55.89496315, 55.97654474, 56.05785774,
163 : 56.1389022, 56.21968099, 56.30019707, 56.38045024, 56.46044318, 56.54017846, 56.61965822, 56.69888215, 56.77785343, 56.85657191,
164 : 56.93504425, 57.01326641, 57.09124313, 57.16897715, 57.24646717, 57.32371609, 57.40072768, 57.4774991, 57.55403662, 57.63033718,
165 : 57.70640793, 57.7822446, 57.85785243, 57.93323193, 58.00838488, 58.08331234, 58.15801692, 58.23249741, 58.30675724, 58.38079823,
166 : 58.4546222, 58.52822764, 58.60161837, 58.67479622, 58.74775927, 58.82051339, 58.89305587, 58.96539129, 59.03751832, 59.1094403,
167 : 59.18115654, 59.25267006, 59.32398161, 59.39509291, 59.46600373, 59.53671502, 59.60723006, 59.67755023, 59.74767505, 59.81760513,
168 : 59.88734393, 59.95688928, 60.02624654, 60.09541405, 60.16439371, 60.2331876, 60.30179567, 60.37021755, 60.43845741, 60.50651412,
169 : 60.57438886, 60.64208387, 60.70960018, 60.77693773, 60.84409885, 60.91108356, 60.97789194, 61.04452769, 61.11098811, 61.1772789,
170 : 61.2433966, 61.30934573, 61.37512456, 61.44073521, 61.50617791, 61.57145516, 61.6365656, 61.70151178, 61.76629472, 61.83091455,
171 : 61.89537314, 61.95967045, 62.02380873, 62.08778598, 62.15160576, 62.21526616, 62.2787729, 62.34212215, 62.40531644, 62.46835564,
172 : 62.53124254, 62.59397652, 62.65655972, 62.7189898, 62.78127202, 62.84340443, 62.90538831, 62.96722333, 63.02891098, 63.09045474,
173 : 63.15185221, 63.21310404, 63.27421125, 63.33517636, 63.395999, 63.45668024, 63.5172196, 63.57761821, 63.63787789, 63.69799922,
174 : 63.75798178, 63.81782639, 63.87753525, 63.93710759, 63.99654311, 64.05584549, 64.11501608, 64.1740502, 64.23294864, 64.29172001,
175 : 64.35035847, 64.40886389, 64.4672399, 64.5254877, 64.5836074, 64.64159658, 64.69945949, 64.75719386, 64.81480044, 64.87228539,
176 : 64.92964246, 64.98687573, 65.04398502, 65.10096852, 65.15782959, 65.21457202, 65.27118885, 65.32768769, 65.38406204, 65.44031895,
177 : 65.49645605, 65.55247365, 65.60837577, 65.66415606, 65.7198208, 65.7753675, 65.8307992, 65.88611471, 65.94131694, 65.99640529,
178 : 66.05137563, 66.10623566, 66.16098047, 66.21561318, 66.27013565, 66.32454189, 66.37884177, 66.43303089, 66.48710748, 66.54107712,
179 : 66.59493603, 66.64868734, 66.70232946, 66.75586325, 66.80929006, 66.86261073, 66.91582873, 66.96893645, 67.02193922, 67.07484084,
180 : 67.12763318, 67.18032374, 67.23291261, 67.2853971, 67.33777697, 67.39005562, 67.44223342, 67.49431315, 67.54628565, 67.59816124,
181 : 67.64993655, 67.70161425, 67.75319106, 67.80466762, 67.85604816, 67.90732765, 67.95851385, 68.00959903, 68.06059149, 68.11148356,
182 : 68.16228279, 68.21298473, 68.26359087, 68.31410431, 68.36452488, 68.41484999, 68.46508104, 68.51521777, 68.56526159, 68.6152136,
183 : 68.6650752, 68.71484646, 68.76452459, 68.81410894, 68.86360503, 68.9130119, 68.96232932, 69.01155648, 69.06069295, 69.10974389,
184 : 69.15870478, 69.20757526, 69.25636202, 69.30505708, 69.35366941, 69.40219039, 69.45062774, 69.49898231, 69.54724573, 69.59542511,
185 : 69.64352333, 69.69153266, 69.73946144, 69.78730174, 69.83506042, 69.8827346, 69.93032771, 69.97783945, 70.02526447, 70.07260834,
186 : 70.11987362, 70.16705659, 70.21415392, 70.26117672, 70.3081124, 70.35497219, 70.40175094, 70.44845033, 70.49506926, 70.5416108,
187 : 70.58807245, 70.63445733, 70.68076429, 70.72698884, 70.77314, 70.81921262, 70.86521029, 70.91112621, 70.956971, 71.0027362,
188 : 71.04842458, 71.09404158, 71.13958183, 71.18504519, 71.23043212, 71.27574987, 71.3209896, 71.36615442, 71.41124924, 71.45626937,
189 : 71.50121362, 71.5460872, 71.59088911, 71.63561453, 71.68027218, 71.72485702, 71.76936872, 71.8138079, 71.85817753, 71.90247673,
190 : 71.94670456, 71.99086376, 72.03495158, 72.07896913, 72.12291519, 72.16679298, 72.21060503, 72.25434249, 72.29801465, 72.34161996,
191 : 72.38515599, 72.42862145, 72.47201901, 72.51535392, 72.5586171, 72.60181527, 72.64494367, 72.68800759, 72.73100471, 72.77393894,
192 : 72.81680315, 72.85960377, 72.90233649, 72.94500537, 72.98760805, 73.03014695, 73.07262276, 73.11503298, 73.1573782, 73.19966128,
193 : 73.24187731, 73.28403304, 73.32612125, 73.36815237, 73.41011791, 73.45201898, 73.49385988, 73.53563549, 73.57735287, 73.61900651,
194 : 73.6605957, 73.70212525, 73.74359587, 73.78500201, 73.82635101, 73.86763719, 73.90886374, 73.95002747, 73.99113361, 74.03217995,
195 : 74.07316582, 74.11409233, 74.15495789, 74.19576541, 74.23651553, 74.27720372, 74.31783561, 74.35840878, 74.39892536, 74.43938115,
196 : 74.47978004, 74.52011928, 74.56040515, 74.60062901, 74.64080092, 74.68091054, 74.72096571, 74.76096771, 74.80090708, 74.84079646,
197 : 74.88062483, 74.9204009, 74.96011942, 74.99977909, 75.03939008, 75.07893992, 75.11843698, 75.15788211, 75.19726977, 75.23660313,
198 : 75.27588023, 75.31510624, 75.3542739, 75.39339345, 75.43245611, 75.47146405, 75.51042254, 75.54932382, 75.58817471, 75.62697021,
199 : 75.66571461, 75.70440632, 75.74304491, 75.78163044, 75.82016525, 75.85865056, 75.89708068, 75.93545883, 75.97378492, 76.0120621,
200 : 76.05028712, 76.08846034, 76.12658418, 76.16465767, 76.2026797, 76.24065195, 76.27857222, 76.31644424, 76.35426512, 76.39203326,
201 : 76.42975531, 76.46742597, 76.50504989, 76.54262349, 76.58014732, 76.6176226, 76.6550495, 76.69242337, 76.72975292, 76.76703263,
202 : 76.80426597, 76.84144989, 76.87858556, 76.91567266, 76.95271451, 76.98970341, 77.02664946, 77.06354801, 77.10039946, 77.13720248,
203 : 77.17395743, 77.21066858, 77.24732868, 77.28394674, 77.32051481, 77.35703974, 77.3935179, 77.4299481, 77.46633278, 77.50267234,
204 : 77.53896767, 77.5752132, 77.6114198, 77.64757673, 77.68368996, 77.71975535, 77.75577955, 77.79175544, 77.82768892, 77.86357885,
205 : 77.89942204, 77.93522269, 77.97097918, 78.00669057, 78.04235789, 78.07798, 78.11356019, 78.14909725, 78.18459127, 78.22004104,
206 : 78.25544735, 78.29081033, 78.32613242, 78.3614084, 78.39664434, 78.43183732, 78.46698385, 78.50209439, 78.53715718, 78.57218022,
207 : 78.60716047, 78.64209878, 78.6769951, 78.71185226, 78.746663, 78.78143682, 78.81616758, 78.85085484, 78.88550274, 78.92010982,
208 : 78.9546777, 78.98920242, 79.02368438, 79.05812941, 79.09253277, 79.12689452, 79.16121566, 79.19549993, 79.22974184, 79.26394059,
209 : 79.29810401, 79.33222714, 79.36630773, 79.40034862, 79.43435261, 79.46831575, 79.50224105, 79.5361278, 79.56997224, 79.60377852,
210 : 79.63754844, 79.6712756, 79.70496707, 79.7386195, 79.77223095, 79.80580692, 79.8393431, 79.87284009, 79.90630324, 79.9397239,
211 : 79.9731062, 80.00645432, 80.03976078, 80.07303132, 80.10626466, 80.13946141, 80.17261862, 80.2057402, 80.23882443, 80.27187067,
212 : 80.30488333, 80.33785562, 80.37079099, 80.40368818, 80.43655134, 80.46937694, 80.50216672, 80.53492197, 80.56763831, 80.60032048,
213 : 80.63296434, 80.66557006, 80.69814406, 80.73067924, 80.7631833, 80.7956466, 80.82807796, 80.86046929, 80.89282813, 80.92515223,
214 : 80.95744088, 80.98969387, 81.02191322, 81.05409659, 81.08624412, 81.11835765, 81.15043579, 81.1824791, 81.21448773, 81.24646338,
215 : 81.27840107, 81.31030725, 81.34217912, 81.3740162, 81.40582266, 81.43759037, 81.4693268, 81.50102878, 81.53269738, 81.564328,
216 : 81.59592988, 81.62749803, 81.65902927, 81.69053248, 81.72199906, 81.75343024, 81.78483194, 81.81620159, 81.84753434, 81.87883589,
217 : 81.91010465, 81.94134123, 81.97254592, 82.0037149, 82.03485388, 82.06595769, 82.09703065, 82.1280729, 82.15908193, 82.19005726,
218 : 82.22100267, 82.25191447, 82.28279684, 82.31364612, 82.34446044, 82.37524835, 82.40600156, 82.43672281, 82.46741359, 82.49807143,
219 : 82.52869953, 82.55929763, 82.58986383, 82.62039574, 82.65090102, 82.68137014, 82.71181314, 82.74222283, 82.77260316, 82.80295069,
220 : 82.83327058, 82.86355667, 82.89381203, 82.92404037, 82.95423709, 82.98440109, 83.0145352, 83.04464057, 83.0747166, 83.10476355,
221 : 83.13477865, 83.16476369, 83.19471663, 83.22464346, 83.25454104, 83.28440557, 83.31424367, 83.34405051, 83.37382643, 83.403574,
222 : 83.43329363, 83.46298145, 83.49264184, 83.52227618, 83.55187566, 83.5814507, 83.61099411, 83.64050958, 83.66999636, 83.69945328,
223 : 83.72888435, 83.75828467, 83.78765457, 83.81699798, 83.84631261, 83.87559999, 83.90485773, 83.93408864, 83.96328773, 83.9924604,
224 : 84.02160824, 84.05072359, 84.07981307, 84.10887322, 84.13790674, 84.16691375, 84.19589213, 84.22484302, 84.25376552, 84.28266125,
225 : 84.31152889, 84.34036894, 84.36918258, 84.39796509, 84.426723, 84.4554566, 84.48416077, 84.51283457, 84.54148605, 84.57010873,
226 : 84.59870416, 84.62727398, 84.65581296, 84.68432935, 84.71281921, 84.74128034, 84.76971427, 84.79812356, 84.82650714, 84.85486414,
227 : 84.88319335, 84.91149363, 84.93977033, 84.96802107, 84.99624746, 85.02444686, 85.05261848, 85.08076234, 85.10888389, 85.13697661,
228 : 85.16504751, 85.19308996, 85.22110697, 85.24909745, 85.27706406, 85.3050058, 85.33291891, 85.36080872, 85.38867288, 85.41650897,
229 : 85.44432122, 85.47211082, 85.49987157, 85.5276116, 85.55532315, 85.58301033, 85.61067074, 85.63830715, 85.66592225, 85.69350747,
230 : 85.72106906, 85.74860734, 85.77612007, 85.80360992, 85.83107309, 85.85851235, 85.88592674, 85.91331883, 85.940685, 85.96802559,
231 : 85.99534052, 86.02263527, 86.04990355, 86.07714803, 86.1043677, 86.13156409, 86.15873472, 86.18588473, 86.21300672, 86.24010603,
232 : 86.267184, 86.29423588, 86.32126306, 86.34826803, 86.37525004, 86.40220887, 86.42914117, 86.45605219, 86.48294074, 86.50980317,
233 : 86.53664208, 86.56346029, 86.59025279, 86.61702366, 86.64376933, 86.6704935, 86.6971967, 86.72387239, 86.75052605, 86.77716019,
234 : 86.80376776, 86.83035345, 86.85691767, 86.88345664, 86.90997465, 86.93646901, 86.96294, 86.98938903, 87.01581375, 87.04222061,
235 : 87.06860086, 87.09495848, 87.12129645, 87.14761207, 87.17390292, 87.20017179, 87.22641888, 87.25264536, 87.27884551, 87.30502537,
236 : 87.33118401, 87.35732172, 87.38343463, 87.40952679, 87.43559834, 87.46164719, 87.48767415, 87.51367842, 87.53966135, 87.56562576,
237 : 87.59156283, 87.61748293, 87.64337717, 87.66925215, 87.69510798, 87.72093736, 87.74674778, 87.77253857, 87.79830413, 87.82405258,
238 : 87.84977774, 87.87547845, 87.90116109, 87.92682487, 87.95246439, 87.9780827, 88.00367984, 88.02925702, 88.05481207, 88.08035027,
239 : 88.10586302, 88.13135623, 88.15683029, 88.18227924, 88.2077092, 88.23311926, 88.25851218, 88.28387904, 88.30922637, 88.33455433,
240 : 88.35986038, 88.38515007, 88.41041472, 88.43566009, 88.46088564, 88.48608997, 88.51127475, 88.53643864, 88.5615843, 88.58670705,
241 : 88.61180925, 88.63689372, 88.66195676, 88.6870023, 88.71202293, 88.73702912, 88.76201161, 88.7869734, 88.81191947, 88.83684387,
242 : 88.86174532, 88.88662923, 88.91149412, 88.93633903, 88.96116308, 88.98596844, 89.01075422, 89.03552234, 89.0602694, 89.08499342,
243 : 89.10970333, 89.1343894, 89.15906041, 89.18370902, 89.20834007, 89.23295171, 89.25754223, 89.28211345, 89.30666784, 89.33119931,
244 : 89.35571584, 89.38021293, 89.40468873, 89.42914701, 89.45358423, 89.47800419, 89.50240334, 89.52678556, 89.55114712, 89.57549205,
245 : 89.59981659, 89.62412467, 89.64841158, 89.67267947, 89.69693248, 89.72116452, 89.74537692, 89.76957083, 89.7937454, 89.81790335,
246 : 89.84204321, 89.86616299, 89.89026483, 89.9143479, 89.93841405, 89.96245975, 89.98648709, 90.01049982, 90.03449049, 90.05846689,
247 : 90.08242149, 90.10635828, 90.13027714, 90.15417848, 90.17806217, 90.20192576, 90.22577482, 90.24960461, 90.27341656, 90.2972106,
248 : 90.32098387, 90.34474149, 90.36848137, 90.39220204, 90.41590903, 90.43959324, 90.46326397, 90.48691589, 90.51054803, 90.53416512,
249 : 90.55776192, 90.58134304, 90.60490873, 90.62845405, 90.65198139, 90.67549356, 90.69898682, 90.72246132, 90.74592103, 90.769361,
250 : 90.79278746, 90.81619179, 90.83958359, 90.86295533, 90.88630908, 90.90964877, 90.93297058, 90.95627204, 90.97955858, 91.00282768,
251 : 91.02608323, 91.04931768, 91.07253502, 91.09573908, 91.11892527, 91.14209171, 91.16524142, 91.1883783, 91.21149485, 91.23459599,
252 : 91.25767976, 91.2807473, 91.30379877, 91.32683136, 91.34984706, 91.37285084, 91.39583217, 91.41880262, 91.44175194, 91.46468678,
253 : 91.48760533, 91.51050867, 91.53339033, 91.55625985, 91.57911433, 91.60195137, 91.62476883, 91.64757164, 91.67036098, 91.69313301,
254 : 91.71588507, 91.73862389, 91.76134768, 91.78405458, 91.80674275, 91.82941719, 91.85207509, 91.87471831, 91.89734523, 91.91995466,
255 : 91.94254665, 91.96512422, 91.98768844, 92.01023542, 92.03276627, 92.05527817, 92.07777696, 92.10025976, 92.12272678, 92.14517897,
256 : 92.16761444, 92.19003427, 92.21243853, 92.23482725, 92.25720356, 92.27955771, 92.30190036, 92.3242278, 92.34654009, 92.36883447,
257 : 92.39111284, 92.41338006, 92.43562863, 92.45786234, 92.48008133, 92.50228177, 92.52446971, 92.54664103, 92.56880174, 92.59094039,
258 : 92.61306856, 92.63517859, 92.65727443, 92.67935617, 92.70142287, 92.72347274, 92.74550864, 92.76753071, 92.7895351, 92.81152687,
259 : 92.83350013, 92.85545971, 92.87740485, 92.89933747, 92.92125288, 92.943154, 92.96503896, 92.98690982, 93.0087646, 93.03060924,
260 : 93.05243319, 93.07424721, 93.09604538, 93.11782401, 93.13959274, 93.16134502, 93.18308465, 93.20480792, 93.22651868, 93.24821416,
261 : 93.26989246, 93.29155854, 93.31320847, 93.3348463, 93.35646639, 93.37807529, 93.3996693, 93.42124759, 93.44281016, 93.46436002,
262 : 93.48589524, 93.50741881, 93.52892603, 93.55041879, 93.57189532, 93.59336136, 93.61480953, 93.63624525, 93.65766882, 93.67907358,
263 : 93.70046721, 93.72184688, 93.74321081, 93.7645638, 93.78590211, 93.80722194, 93.82853104, 93.84982856, 93.8711087, 93.89237653,
264 : 93.91362794, 93.9348689, 93.95609091, 93.9773035, 93.99850109, 94.01968552, 94.04085511, 94.06201077, 94.08315348, 94.10428149,
265 : 94.12539575, 94.14649848, 94.16758545, 94.18865888, 94.20971874, 94.23076523, 94.25179828, 94.2728171, 94.29382356, 94.31481682,
266 : 94.33579601, 94.3567592, 94.37771222, 94.39865154, 94.41957488, 94.44048529, 94.46138296, 94.48226783, 94.50314002, 94.52399573,
267 : 94.54484271, 94.56567332, 94.58649145, 94.60729332, 94.6280858, 94.64886302, 94.6696293, 94.69037824, 94.71111801, 94.73184187,
268 : 94.75255372, 94.77325448, 94.79393861, 94.8146147, 94.8352743, 94.85591916, 94.87655236, 94.89717391, 94.91778139, 94.93837602,
269 : 94.95895446, 94.97952618, 95.00008186, 95.02062236, 95.04115163, 95.06166969, 95.08217276, 95.10266477, 95.12314186, 95.14360713,
270 : 95.16406232, 95.18450036, 95.20493, 95.22534421, 95.24574469, 95.26613366, 95.28651202, 95.30687598, 95.32722563, 95.34756393,
271 : 95.36788887, 95.38820343, 95.40850304, 95.42879168, 95.449067, 95.4693292, 95.48958046, 95.50981786, 95.53004526, 95.55025891,
272 : 95.57045881, 95.59064806, 95.61082454, 95.63098662, 95.65113602, 95.67127496, 95.6914036, 95.71151577, 95.73161845, 95.75170788,
273 : 95.77178414, 95.7918502, 95.81190402, 95.83194392, 95.85197168, 95.87198945, 95.89199053, 95.91198337, 95.93196106, 95.95193138,
274 : 95.97188434, 95.99182926, 96.01176161, 96.03168058, 96.05158784, 96.07148185, 96.09136342, 96.11123649, 96.13109341, 96.15094189,
275 : 96.17077664, 96.19059992, 96.21041192, 96.23021102, 96.24999892, 96.26977403, 96.28953722, 96.30929235, 96.32903185, 96.34875878,
276 : 96.36847475, 96.38818287, 96.40787474, 96.42755733, 96.44722605, 96.46688407, 96.48652908, 96.50616346, 96.5257865, 96.54539743,
277 : 96.5649979, 96.58458635, 96.60416366, 96.62372601, 96.64328114, 96.66282372, 96.68235301, 96.70187136, 96.72137804, 96.74087386,
278 : 96.76035587, 96.77983017, 96.79928993, 96.81874209, 96.83818056, 96.85760851, 96.87702132, 96.89642747, 96.91581871, 96.93520023,
279 : 96.95457142, 96.97393153, 96.99327835, 97.01261497, 97.03194067, 97.05125242, 97.07055411, 97.08984577, 97.10912744, 97.12839538,
280 : 97.14765195, 97.16689939, 97.18613698, 97.20535798, 97.22457231, 97.24377619, 97.26296359, 97.28214521, 97.30131272, 97.32047148,
281 : 97.33962005, 97.35875536, 97.37787753, 97.39699277, 97.41609556, 97.43518605, 97.45426661, 97.47333802, 97.49239649, 97.51144208,
282 : 97.53048245, 97.54950626, 97.56852035, 97.58752557, 97.60651883, 97.62550117, 97.64447612, 97.66343401, 97.68238777, 97.7013245,
283 : 97.72025336, 97.73917295, 97.75808021, 97.77697826, 97.79586097, 97.81473912, 97.83360053, 97.85245612, 97.87129715, 97.89012997,
284 : 97.90895465, 97.92776351, 97.94656357, 97.96535557, 97.98413572, 98.00290411, 98.0216607, 98.04040946, 98.0591458, 98.07787434,
285 : 98.09659062, 98.11529602, 98.13399297, 98.15267543, 98.17135021, 98.19001678, 98.20866815, 98.22731202, 98.24594464, 98.26456913,
286 : 98.28317933, 98.30178152, 98.32037191, 98.33895574, 98.35752401, 98.37608583, 98.39463599, 98.41317593, 98.43170428, 98.45022567,
287 : 98.46873238, 98.48723156, 98.50572064, 98.52419839, 98.54266935, 98.56112833, 98.5795743, 98.59801359, 98.61644162, 98.63485926,
288 : 98.65326612, 98.6716639, 98.69005, 98.70842759, 98.72679422, 98.74515239, 98.76349897, 98.78183652, 98.80016317, 98.818479,
289 : 98.83678649, 98.85508254, 98.87337098, 98.89164802, 98.90991685, 98.92817432, 98.94642114, 98.96465599, 98.98288655, 99.0011027,
290 : 99.0193095, 99.03750706, 99.05569661, 99.07387501, 99.09204163, 99.11020164, 99.12834992, 99.14649098, 99.16462101, 99.18274005,
291 : 99.20084747, 99.21894777, 99.23704034, 99.25511882, 99.2731896, 99.29125019, 99.30930313, 99.32734527, 99.34537664, 99.36340108,
292 : 99.38141098, 99.39941718, 99.41740889, 99.43539377, 99.45336677, 99.4713336, 99.48928668, 99.50723239, 99.5251714, 99.54309608,
293 : 99.56101346, 99.57892103, 99.59682135, 99.61470745, 99.63258635, 99.65045553, 99.66831756, 99.68616804, 99.70400948, 99.72184065,
294 : 99.7396654, 99.75747931, 99.77528304, 99.79307659, 99.81085938, 99.82863649, 99.84640288, 99.8641592, 99.88190929, 99.8996443,
295 : 99.91737375, 99.93509321, 99.95280653, 99.97050611, 99.98819959, 100.0058826, 100.0235557, 100.041219, 100.0588725, 100.0765193,
296 : 100.0941565, 100.1117838, 100.1294041, 100.147012, 100.1646135, 100.1822015, 100.1997837, 100.2173562, 100.2349186, 100.2524759,
297 : 100.2700192, 100.2875567, 100.3050842, 100.3226022, 100.3401102, 100.3576094, 100.3751023, 100.3925827, 100.4100569, 100.4275217,
298 : 100.4449773, 100.462423, 100.4798599, 100.4972871, 100.514705, 100.532117, 100.5495203, 100.5669127, 100.5842934, 100.6016687,
299 : 100.6190344, 100.636391, 100.6537386, 100.6710809, 100.6884104, 100.7057304, 100.7230452, 100.7403472, 100.7576436, 100.7749305,
300 : 100.7922053, 100.809475, 100.8267359, 100.8439874, 100.8612302, 100.8784641, 100.8956893, 100.9129053, 100.9301125, 100.947311,
301 : 100.9645009, 100.9816821, 100.9988569, 101.0160203, 101.0331752, 101.0503248, 101.067462, 101.0845908, 101.101711, 101.1188265,
302 : 101.1359293};
303 : static constexpr std::array<Real64, 1651> tsat_fn_pb_d2y = {
304 : 0.015250294, -0.030500589, 0.007192909, -0.002330349, 0.000402372, -0.000248973, -3.17456E-05, -0.000062284, -4.41164E-05, -1.23139E-05,
305 : 1.6533E-06, -3.33366E-05, -1.88742E-05, -1.87743E-05, -1.56343E-05, -1.39099E-05, -1.22638E-05, -1.09504E-05, -9.8264E-06, -8.8733E-06,
306 : -8.0541E-06, -7.3451E-06, -6.7277E-06, -0.000006186, -5.7085E-06, -5.2852E-06, -4.9077E-06, -0.000004571, -4.2666E-06, -3.9951E-06,
307 : -3.7455E-06, -3.5228E-06, -3.3165E-06, -3.1302E-06, -2.9589E-06, -2.8011E-06, -2.6567E-06, -2.5223E-06, -2.3992E-06, -2.2844E-06,
308 : -2.1774E-06, -2.0795E-06, -1.9859E-06, -1.9007E-06, -1.8196E-06, -1.7446E-06, -1.6737E-06, -0.000001607, -1.5443E-06, -1.4864E-06,
309 : -1.4302E-06, -1.3778E-06, -1.3288E-06, -1.2819E-06, -0.000001237, -1.1958E-06, -0.000001155, -1.1181E-06, -1.0818E-06, -1.0468E-06,
310 : -1.0157E-06, -0.000000983, -9.547E-07, -9.252E-07, -8.992E-07, -0.000000873, -0.000000848, -8.248E-07, -8.016E-07, -7.804E-07,
311 : -7.592E-07, -7.395E-07, -7.202E-07, -7.016E-07, -0.000000684, -6.675E-07, -6.499E-07, -6.349E-07, -6.203E-07, -6.039E-07,
312 : -0.000000591, -5.783E-07, -5.621E-07, -5.528E-07, -5.384E-07, -5.269E-07, -5.159E-07, -5.048E-07, -4.935E-07, -4.838E-07,
313 : -4.737E-07, -0.000000463, -4.549E-07, -4.453E-07, -4.362E-07, -4.274E-07, -4.196E-07, -0.000000412, -4.025E-07, -3.962E-07,
314 : -3.887E-07, -3.814E-07, -0.000000374, -3.676E-07, -3.609E-07, -3.542E-07, -3.489E-07, -3.411E-07, -3.368E-07, -3.311E-07,
315 : -3.239E-07, -3.196E-07, -3.145E-07, -3.085E-07, -3.037E-07, -2.991E-07, -2.939E-07, -2.891E-07, -2.849E-07, -2.801E-07,
316 : -2.761E-07, -2.724E-07, -2.661E-07, -2.642E-07, -2.594E-07, -2.554E-07, -2.523E-07, -2.471E-07, -0.000000245, -2.414E-07,
317 : -2.365E-07, -2.348E-07, -2.303E-07, -2.276E-07, -2.249E-07, -2.211E-07, -0.000000217, -2.168E-07, -2.111E-07, -2.095E-07,
318 : -2.074E-07, -2.028E-07, -2.028E-07, -0.000000197, -1.966E-07, -1.936E-07, -1.912E-07, -1.884E-07, -1.857E-07, -1.845E-07,
319 : -1.816E-07, -1.786E-07, -1.776E-07, -1.748E-07, -1.735E-07, -0.00000017, -1.687E-07, -1.675E-07, -0.000000164, -0.000000163,
320 : -1.615E-07, -1.583E-07, -1.578E-07, -1.545E-07, -1.543E-07, -1.522E-07, -1.495E-07, -1.488E-07, -1.474E-07, -1.445E-07,
321 : -1.439E-07, -1.422E-07, -1.398E-07, -1.398E-07, -1.375E-07, -1.353E-07, -1.354E-07, -1.332E-07, -1.314E-07, -1.303E-07,
322 : -1.292E-07, -1.279E-07, -1.262E-07, -1.251E-07, -1.238E-07, -1.229E-07, -1.208E-07, -1.204E-07, -1.195E-07, -1.171E-07,
323 : -1.171E-07, -1.143E-07, -1.157E-07, -1.127E-07, -1.126E-07, -1.106E-07, -1.101E-07, -1.095E-07, -1.071E-07, -1.078E-07,
324 : -1.061E-07, -1.039E-07, -1.051E-07, -1.025E-07, -1.019E-07, -0.000000102, -9.96E-08, -9.92E-08, -9.85E-08, -9.81E-08,
325 : -0.000000096, -9.68E-08, -9.42E-08, -9.42E-08, -9.37E-08, -9.25E-08, -0.000000092, -9.02E-08, -9.12E-08, -8.82E-08,
326 : -8.96E-08, -8.77E-08, -8.67E-08, -8.71E-08, -0.000000085, -8.58E-08, -8.43E-08, -8.27E-08, -0.000000084, -8.07E-08,
327 : -8.33E-08, -7.96E-08, -8.07E-08, -7.98E-08, -0.000000079, -0.000000078, -0.000000078, -7.69E-08, -0.000000077, -7.56E-08,
328 : -7.53E-08, -0.000000075, -7.38E-08, -7.41E-08, -7.22E-08, -7.35E-08, -7.17E-08, -7.05E-08, -7.24E-08, -6.95E-08,
329 : -6.93E-08, -6.98E-08, -6.88E-08, -6.87E-08, -6.66E-08, -6.84E-08, -0.000000066, -0.000000067, -6.52E-08, -6.58E-08,
330 : -6.49E-08, -6.39E-08, -6.45E-08, -6.34E-08, -0.000000063, -6.21E-08, -6.29E-08, -6.12E-08, -6.25E-08, -0.000000059,
331 : -6.19E-08, -5.96E-08, -0.000000059, -5.99E-08, -0.000000059, -5.73E-08, -5.96E-08, -0.000000056, -5.91E-08, -5.48E-08,
332 : -5.82E-08, -5.52E-08, -0.000000056, -5.51E-08, -5.53E-08, -0.000000054, -5.52E-08, -5.36E-08, -5.36E-08, -5.26E-08,
333 : -5.38E-08, -5.23E-08, -5.16E-08, -5.33E-08, -5.01E-08, -5.25E-08, -4.98E-08, -5.15E-08, -4.96E-08, -5.07E-08,
334 : -4.92E-08, -4.95E-08, -4.87E-08, -0.000000049, -4.89E-08, -4.78E-08, -4.75E-08, -4.77E-08, -4.79E-08, -4.61E-08,
335 : -0.000000048, -4.52E-08, -4.67E-08, -4.58E-08, -4.53E-08, -4.53E-08, -4.59E-08, -4.39E-08, -0.000000045, -4.44E-08,
336 : -4.38E-08, -4.35E-08, -4.39E-08, -4.29E-08, -0.000000043, -4.35E-08, -4.14E-08, -4.38E-08, -4.04E-08, -4.32E-08,
337 : -4.04E-08, -4.21E-08, -4.07E-08, -4.13E-08, -0.00000004, -4.11E-08, -3.99E-08, -3.98E-08, -0.00000004, -3.91E-08,
338 : -3.97E-08, -3.83E-08, -0.00000004, -3.77E-08, -3.98E-08, -3.65E-08, -3.92E-08, -3.74E-08, -3.83E-08, -3.68E-08,
339 : -3.77E-08, -3.62E-08, -3.82E-08, -3.53E-08, -0.000000037, -0.000000036, -3.65E-08, -3.62E-08, -3.46E-08, -3.61E-08,
340 : -3.54E-08, -3.55E-08, -3.44E-08, -0.000000035, -3.43E-08, -3.48E-08, -3.44E-08, -3.39E-08, -3.37E-08, -3.39E-08,
341 : -3.38E-08, -3.29E-08, -3.33E-08, -3.37E-08, -3.24E-08, -3.18E-08, -3.36E-08, -3.38E-08, -2.98E-08, -3.31E-08,
342 : -3.26E-08, -3.14E-08, -3.14E-08, -3.09E-08, -3.25E-08, -3.02E-08, -3.16E-08, -3.18E-08, -2.85E-08, -3.23E-08,
343 : -2.97E-08, -3.02E-08, -0.000000031, -3.01E-08, -2.79E-08, -3.22E-08, -2.72E-08, -3.19E-08, -2.76E-08, -2.96E-08,
344 : -2.96E-08, -2.71E-08, -0.000000031, -2.72E-08, -2.96E-08, -2.75E-08, -2.88E-08, -2.74E-08, -2.74E-08, -0.00000003,
345 : -2.57E-08, -2.89E-08, -2.73E-08, -2.61E-08, -2.99E-08, -2.46E-08, -2.74E-08, -2.81E-08, -2.52E-08, -2.78E-08,
346 : -2.57E-08, -2.69E-08, -2.64E-08, -0.000000026, -2.64E-08, -0.000000024, -0.000000028, -2.55E-08, -2.36E-08, -2.81E-08,
347 : -0.000000024, -2.48E-08, -2.56E-08, -2.58E-08, -2.43E-08, -2.52E-08, -2.26E-08, -2.81E-08, -2.21E-08, -2.54E-08,
348 : -2.32E-08, -2.49E-08, -2.49E-08, -2.24E-08, -2.62E-08, -0.000000021, -2.65E-08, -2.08E-08, -2.62E-08, -2.13E-08,
349 : -2.45E-08, -2.33E-08, -2.25E-08, -2.25E-08, -2.37E-08, -2.27E-08, -2.32E-08, -2.26E-08, -2.25E-08, -0.000000022,
350 : -2.19E-08, -2.28E-08, -2.34E-08, -0.000000021, -0.000000022, -2.18E-08, -2.19E-08, -2.27E-08, -2.01E-08, -2.22E-08,
351 : -2.28E-08, -1.89E-08, -2.43E-08, -1.82E-08, -0.000000024, -1.98E-08, -1.95E-08, -2.35E-08, -2.02E-08, -1.88E-08,
352 : -2.34E-08, -1.78E-08, -2.33E-08, -1.87E-08, -2.14E-08, -1.95E-08, -1.94E-08, -0.000000022, -1.95E-08, -0.000000019,
353 : -1.98E-08, -2.25E-08, -1.57E-08, -2.38E-08, -1.66E-08, -2.08E-08, -1.88E-08, -2.02E-08, -1.83E-08, -2.01E-08,
354 : -1.85E-08, -1.86E-08, -2.14E-08, -1.64E-08, -2.04E-08, -1.69E-08, -2.19E-08, -1.54E-08, -2.06E-08, -1.88E-08,
355 : -1.66E-08, -1.93E-08, -1.84E-08, -1.95E-08, -1.54E-08, -2.01E-08, -1.83E-08, -1.64E-08, -1.85E-08, -1.89E-08,
356 : -1.69E-08, -0.000000017, -0.00000002, -1.52E-08, -1.84E-08, -1.77E-08, -0.000000018, -1.67E-08, -1.72E-08, -1.78E-08,
357 : -1.62E-08, -1.79E-08, -1.68E-08, -1.78E-08, -1.68E-08, -1.49E-08, -1.99E-08, -1.48E-08, -1.66E-08, -1.69E-08,
358 : -1.74E-08, -1.71E-08, -1.39E-08, -1.92E-08, -1.44E-08, -1.83E-08, -1.47E-08, -1.73E-08, -1.41E-08, -1.86E-08,
359 : -1.42E-08, -1.76E-08, -1.48E-08, -1.67E-08, -1.54E-08, -1.52E-08, -1.62E-08, -1.62E-08, -1.43E-08, -1.77E-08,
360 : -0.000000013, -1.85E-08, -0.000000012, -0.000000017, -1.59E-08, -1.37E-08, -1.72E-08, -0.000000013, -1.61E-08, -0.000000016,
361 : -1.44E-08, -1.37E-08, -1.71E-08, -1.26E-08, -1.65E-08, -1.37E-08, -1.63E-08, -1.33E-08, -1.48E-08, -1.49E-08,
362 : -1.42E-08, -1.53E-08, -1.41E-08, -1.35E-08, -1.61E-08, -1.28E-08, -0.000000015, -0.000000013, -1.58E-08, -1.29E-08,
363 : -1.58E-08, -1.13E-08, -1.73E-08, -1.05E-08, -0.000000017, -1.27E-08, -1.19E-08, -1.75E-08, -9.6E-09, -1.71E-08,
364 : -1.13E-08, -1.44E-08, -1.55E-08, -9.7E-09, -0.000000017, -0.000000012, -1.23E-08, -1.48E-08, -1.25E-08, -1.47E-08,
365 : -0.000000011, -1.62E-08, -9.8E-09, -0.000000015, -1.36E-08, -1.08E-08, -1.55E-08, -1.09E-08, -1.46E-08, -1.18E-08,
366 : -1.31E-08, -1.29E-08, -1.31E-08, -1.25E-08, -1.14E-08, -1.43E-08, -1.22E-08, -1.32E-08, -1.13E-08, -1.31E-08,
367 : -1.27E-08, -1.18E-08, -1.23E-08, -1.29E-08, -1.17E-08, -1.33E-08, -1.12E-08, -1.25E-08, -1.37E-08, -0.00000001,
368 : -1.37E-08, -1.05E-08, -1.28E-08, -0.000000012, -0.000000012, -1.11E-08, -1.43E-08, -9.3E-09, -1.33E-08, -1.05E-08,
369 : -1.26E-08, -1.14E-08, -1.25E-08, -9.8E-09, -1.47E-08, -8.9E-09, -1.24E-08, -1.12E-08, -1.19E-08, -1.23E-08,
370 : -9.4E-09, -1.42E-08, -8.4E-09, -1.39E-08, -9.4E-09, -1.18E-08, -1.19E-08, -1.09E-08, -1.13E-08, -9.9E-09,
371 : -1.39E-08, -7.3E-09, -1.41E-08, -9.2E-09, -1.31E-08, -8.5E-09, -1.32E-08, -9.6E-09, -1.05E-08, -0.000000012,
372 : -9.8E-09, -1.09E-08, -1.12E-08, -1.05E-08, -1.15E-08, -9.8E-09, -1.08E-08, -1.03E-08, -0.000000011, -1.04E-08,
373 : -0.000000011, -9.1E-09, -1.23E-08, -0.000000009, -1.03E-08, -1.28E-08, -6.5E-09, -1.38E-08, -8.3E-09, -1.11E-08,
374 : -9.9E-09, -1.08E-08, -8.4E-09, -0.000000013, -7.5E-09, -1.12E-08, -1.09E-08, -9.1E-09, -1.04E-08, -9.1E-09,
375 : -1.08E-08, -1.09E-08, -8.1E-09, -1.07E-08, -0.00000001, -1.03E-08, -8.3E-09, -1.06E-08, -1.13E-08, -7.6E-09,
376 : -1.02E-08, -1.06E-08, -9.8E-09, -8.4E-09, -1.06E-08, -8.9E-09, -9.2E-09, -1.09E-08, -9.2E-09, -8.1E-09,
377 : -1.17E-08, -7.7E-09, -9.7E-09, -1.06E-08, -7.8E-09, -1.01E-08, -1.01E-08, -0.000000007, -1.15E-08, -9.3E-09,
378 : -7.3E-09, -1.15E-08, -7.9E-09, -9.5E-09, -8.4E-09, -1.03E-08, -8.2E-09, -9.2E-09, -9.8E-09, -7.1E-09,
379 : -1.09E-08, -8.3E-09, -0.00000001, -7.5E-09, -9.7E-09, -8.7E-09, -7.9E-09, -1.04E-08, -7.5E-09, -9.7E-09,
380 : -0.00000001, -6.3E-09, -1.12E-08, -5.6E-09, -1.21E-08, -5.8E-09, -1.15E-08, -6.8E-09, -8.9E-09, -8.5E-09,
381 : -0.000000009, -7.8E-09, -0.000000009, -8.9E-09, -0.000000008, -8.9E-09, -8.3E-09, -8.8E-09, -7.3E-09, -1.04E-08,
382 : -6.8E-09, -8.6E-09, -0.000000009, -6.2E-09, -0.000000011, -6.4E-09, -9.2E-09, -7.3E-09, -1.07E-08, -5.8E-09,
383 : -8.4E-09, -1.01E-08, -5.3E-09, -9.9E-09, -8.8E-09, -6.7E-09, -7.6E-09, -9.9E-09, -6.9E-09, -8.3E-09,
384 : -7.9E-09, -7.3E-09, -9.7E-09, -6.2E-09, -9.6E-09, -0.000000007, -7.4E-09, -8.1E-09, -8.7E-09, -6.5E-09,
385 : -9.1E-09, -6.5E-09, -8.1E-09, -9.6E-09, -4.9E-09, -9.6E-09, -7.5E-09, -7.1E-09, -8.6E-09, -6.9E-09,
386 : -7.4E-09, -7.5E-09, -9.5E-09, -4.6E-09, -0.000000011, -4.4E-09, -9.6E-09, -6.1E-09, -9.1E-09, -5.6E-09,
387 : -9.1E-09, -7.5E-09, -0.000000006, -0.000000008, -8.2E-09, -7.2E-09, -6.9E-09, -7.3E-09, -6.7E-09, -8.3E-09,
388 : -6.8E-09, -8.7E-09, -5.6E-09, -7.1E-09, -0.000000009, -5.4E-09, -8.2E-09, -7.5E-09, -6.9E-09, -6.4E-09,
389 : -8.4E-09, -6.6E-09, -5.3E-09, -1.04E-08, -4.1E-09, -0.000000009, -6.2E-09, -0.000000007, -7.8E-09, -5.5E-09,
390 : -0.000000008, -7.7E-09, -5.9E-09, -7.5E-09, -6.1E-09, -7.9E-09, -5.7E-09, -8.7E-09, -6.2E-09, -5.2E-09,
391 : -9.3E-09, -5.2E-09, -7.9E-09, -6.2E-09, -6.3E-09, -7.3E-09, -6.4E-09, -7.2E-09, -6.2E-09, -0.000000007,
392 : -6.9E-09, -5.8E-09, -8.6E-09, -5.4E-09, -5.7E-09, -7.3E-09, -8.3E-09, -4.1E-09, -7.9E-09, -6.6E-09,
393 : -5.5E-09, -8.8E-09, -4.4E-09, -6.8E-09, -7.1E-09, -6.7E-09, -5.7E-09, -6.4E-09, -6.5E-09, -6.6E-09,
394 : -7.7E-09, -0.000000005, -6.9E-09, -5.5E-09, -6.9E-09, -6.6E-09, -7.5E-09, -4.2E-09, -8.6E-09, -3.8E-09,
395 : -8.1E-09, -5.6E-09, -6.9E-09, -5.6E-09, -5.8E-09, -7.8E-09, -0.000000005, -6.3E-09, -7.3E-09, -5.7E-09,
396 : -4.7E-09, -8.5E-09, -3.4E-09, -8.3E-09, -5.1E-09, -0.000000007, -0.000000006, -4.2E-09, -8.6E-09, -5.1E-09,
397 : -5.6E-09, -6.7E-09, -4.9E-09, -7.2E-09, -5.3E-09, -6.6E-09, -4.8E-09, -6.8E-09, -5.9E-09, -0.000000007,
398 : -3.8E-09, -7.4E-09, -5.2E-09, -6.5E-09, -5.1E-09, -7.2E-09, -3.7E-09, -8.1E-09, -5.1E-09, -4.8E-09,
399 : -6.8E-09, -0.000000006, -5.2E-09, -5.8E-09, -5.2E-09, -7.3E-09, -4.6E-09, -5.4E-09, -6.8E-09, -5.8E-09,
400 : -4.3E-09, -7.2E-09, -4.4E-09, -6.9E-09, -0.000000005, -4.5E-09, -7.7E-09, -5.2E-09, -0.000000004, -7.5E-09,
401 : -4.9E-09, -4.9E-09, -6.9E-09, -4.4E-09, -6.1E-09, -5.8E-09, -4.8E-09, -0.000000007, -2.9E-09, -7.7E-09,
402 : -5.2E-09, -4.5E-09, -5.4E-09, -6.5E-09, -0.000000005, -5.7E-09, -4.2E-09, -7.5E-09, -4.1E-09, -5.6E-09,
403 : -4.6E-09, -6.8E-09, -4.7E-09, -4.9E-09, -5.8E-09, -5.2E-09, -5.6E-09, -5.6E-09, -3.2E-09, -8.7E-09,
404 : -2.1E-09, -7.9E-09, -0.000000004, -4.1E-09, -7.7E-09, -3.9E-09, -4.4E-09, -7.4E-09, -2.9E-09, -6.2E-09,
405 : -6.4E-09, -3.9E-09, -4.3E-09, -6.6E-09, -4.7E-09, -5.5E-09, -4.3E-09, -6.4E-09, -2.7E-09, -7.6E-09,
406 : -4.2E-09, -4.2E-09, -7.2E-09, -3.7E-09, -5.6E-09, -2.9E-09, -7.8E-09, -4.1E-09, -4.5E-09, -6.3E-09,
407 : -2.5E-09, -7.5E-09, -3.9E-09, -4.9E-09, -5.4E-09, -4.4E-09, -5.6E-09, -3.7E-09, -6.2E-09, -5.1E-09,
408 : -3.7E-09, -6.2E-09, -2.8E-09, -0.000000008, -1.5E-09, -0.000000007, -0.000000005, -3.1E-09, -5.6E-09, -6.1E-09,
409 : -3.7E-09, -4.9E-09, -4.8E-09, -5.4E-09, -4.2E-09, -5.1E-09, -3.9E-09, -0.000000005, -6.8E-09, -1.5E-09,
410 : -7.9E-09, -1.8E-09, -6.9E-09, -3.5E-09, -4.9E-09, -5.3E-09, -0.000000005, -3.2E-09, -0.000000007, -2.5E-09,
411 : -5.1E-09, -5.7E-09, -3.5E-09, -0.000000006, -3.3E-09, -0.000000006, -3.2E-09, -0.000000006, -3.1E-09, -5.9E-09,
412 : -3.1E-09, -5.8E-09, -4.8E-09, -2.8E-09, -5.8E-09, -4.7E-09, -4.3E-09, -5.1E-09, -3.7E-09, -4.4E-09,
413 : -5.3E-09, -0.000000004, -0.000000005, -3.6E-09, -5.4E-09, -4.8E-09, -2.4E-09, -0.000000007, -1.8E-09, -6.6E-09,
414 : -3.7E-09, -4.6E-09, -4.3E-09, -0.000000004, -5.7E-09, -2.5E-09, -5.4E-09, -4.2E-09, -4.1E-09, -5.8E-09,
415 : -3.2E-09, -4.3E-09, -5.5E-09, -1.8E-09, -7.5E-09, -1.8E-09, -5.1E-09, -5.3E-09, -2.7E-09, -5.9E-09,
416 : -3.4E-09, -3.4E-09, -5.5E-09, -4.4E-09, -3.2E-09, -4.9E-09, -0.000000005, -2.6E-09, -6.2E-09, -1.6E-09,
417 : -7.4E-09, -1.3E-09, -5.9E-09, -4.4E-09, -0.000000003, -4.4E-09, -5.7E-09, -2.8E-09, -5.2E-09, -2.1E-09,
418 : -6.2E-09, -0.000000004, -2.7E-09, -4.6E-09, -0.000000005, -4.4E-09, -2.1E-09, -6.2E-09, -2.9E-09, -4.7E-09,
419 : -3.9E-09, -3.7E-09, -4.8E-09, -4.7E-09, -1.2E-09, -7.8E-09, -3E-10, -7.1E-09, -2.4E-09, -4.7E-09,
420 : -2.7E-09, -6.8E-09, -1.7E-09, -4.1E-09, -0.000000004, -5.3E-09, -3.3E-09, -3.1E-09, -4.1E-09, -5.7E-09,
421 : -2.5E-09, -3.9E-09, -3.9E-09, -5.2E-09, -2.6E-09, -4.6E-09, -3.2E-09, -4.1E-09, -4.3E-09, -4.5E-09,
422 : -3.5E-09, -2.8E-09, -4.8E-09, -3.3E-09, -5.5E-09, -2.3E-09, -4.3E-09, -3.9E-09, -3.4E-09, -4.4E-09,
423 : -3.7E-09, -3.7E-09, -4.4E-09, -1.6E-09, -7.4E-09, -1.2E-09, -4.4E-09, -3.3E-09, -4.7E-09, -4.3E-09,
424 : -1.6E-09, -5.6E-09, -3.2E-09, -3.2E-09, -5.5E-09, -1.8E-09, -5.5E-09, -6E-10, -7.8E-09, -4E-10,
425 : -5.8E-09, -2.8E-09, -3.6E-09, -3.5E-09, -4.5E-09, -3.3E-09, -2.9E-09, -5.3E-09, -1.9E-09, -5.7E-09,
426 : -2.6E-09, -4.1E-09, -2.3E-09, -0.000000005, -2.9E-09, -4.5E-09, -2.8E-09, -0.000000005, -6E-10, -7.2E-09,
427 : -8E-10, -4.1E-09, -5.9E-09, -8E-10, -5.3E-09, -2.1E-09, -4.9E-09, -2.4E-09, -3.8E-09, -4.8E-09,
428 : -0.000000002, -0.000000005, -1.8E-09, -5.6E-09, -1.7E-09, -4.1E-09, -3.7E-09, -4.2E-09, -2.6E-09, -4.2E-09,
429 : -0.000000002, -4.8E-09, -2.9E-09, -4.9E-09, -1.2E-09, -5.6E-09, -2.6E-09, -2.3E-09, -5.9E-09, -1.7E-09,
430 : -3.6E-09, -4.4E-09, -0.000000002, -3.5E-09, -5.4E-09, -0.000000002, -2.4E-09, -5.3E-09, -1.9E-09, -5.3E-09,
431 : -9E-10, -6.6E-09, -6E-10, -4.7E-09, -2.7E-09, -3.9E-09, -3.4E-09, -0.000000003, -3.8E-09, -3.5E-09,
432 : -2.2E-09, -4.5E-09, -0.000000003, -3.4E-09, -3.3E-09, -3.2E-09, -3.7E-09, -2.8E-09, -3.3E-09, -3.2E-09,
433 : -4.6E-09, -1.7E-09, -3.5E-09, -4.2E-09, -2.9E-09, -3.1E-09, -3.3E-09, -2.5E-09, -5.3E-09, -5E-10,
434 : -5.4E-09, -1.9E-09, -5.3E-09, -9E-10, -5.1E-09, -1.3E-09, -5.9E-09, -6E-10, -0.000000005, -2.6E-09,
435 : -0.000000002, -5.5E-09, -3E-10, -5.1E-09, -3.4E-09, -2.8E-09, -2.6E-09, -3.9E-09, -2.4E-09, -5.4E-09,
436 : 1E-10, -0.000000005, -3.7E-09, -2.6E-09, -2.3E-09, -4.4E-09, -1.9E-09, -4.3E-09, -2.9E-09, -1.5E-09,
437 : -5.8E-09, -4E-10, -4.8E-09, -3.1E-09, -2.9E-09, -2.2E-09, -3.8E-09, -3.7E-09, -2.2E-09, -3.9E-09,
438 : -1.7E-09, -4.6E-09, -0.000000002, -3.5E-09, -3.4E-09, -2.1E-09, -4.1E-09, -1.7E-09, -3.7E-09, -3.6E-09,
439 : -2.2E-09, -3.2E-09, -3.7E-09, -3.1E-09, -2.6E-09, -1.8E-09, -5.3E-09, -1.2E-09, -3.7E-09, -3.4E-09,
440 : -2.1E-09, -3.1E-09, -3.5E-09, -3.2E-09, -1.4E-09, -5.7E-09, -2E-10, -5.6E-09, 3E-10, -6.3E-09,
441 : -4E-10, -3.7E-09, -3.3E-09, -2.6E-09, -3.3E-09, -3.5E-09, -9E-10, -5.5E-09, -6E-10, -4.2E-09,
442 : -2.5E-09, -2.7E-09, -3.5E-09, -2.4E-09, -3.2E-09, -3.3E-09, -9E-10, -4.9E-09, -2.6E-09, -3.2E-09,
443 : -7E-10, -5.6E-09, -9E-10, -4.4E-09, -1.9E-09, -3.7E-09, -2.3E-09, -2.8E-09, -3.2E-09, -2.2E-09,
444 : -3.3E-09, -0.000000002, -4.8E-09, -5E-10, -3.6E-09, -3.4E-09, -2.4E-09, -3.2E-09, -2.1E-09, -4.4E-09,
445 : -4E-10, -5.1E-09, -4E-10, -4.6E-09, -1.4E-09, -5.2E-09, 1E-10, -5.1E-09, -1.6E-09, -2.8E-09,
446 : -2.4E-09, -3.7E-09, -2.2E-09, -2.5E-09, -0.000000004, -0.000000002, -2.7E-09, -0.000000002, -3.9E-09, -2.6E-09,
447 : -2.3E-09, -1.6E-09, -5.5E-09, -5E-10, -2.3E-09, -5.6E-09, 5E-10, -0.000000005, -1.3E-09, -2.6E-09,
448 : -3.2E-09, -3.8E-09, -7E-10, -3.6E-09, -0.000000003, -2.4E-09, -1.9E-09, -3.2E-09, -0.000000004, 5E-10,
449 : -5.8E-09, -1.6E-09, -2.1E-09, -3.1E-09, -3.2E-09, -3E-10, -6.6E-09, 1.8E-09, -6.5E-09, -7E-10,
450 : -2.3E-09, -3.7E-09, -0.000000001, -5.7E-09, 1.4E-09, -6.7E-09, 8E-10, -5.2E-09, -1.4E-09, -1.4E-09,
451 : -5.1E-09, -1.5E-09, -1.8E-09, -3.2E-09, -2.6E-09, -3.4E-09, -0.000000001, -4.1E-09, -0.000000001, -3.6E-09,
452 : -2.8E-09, -1.2E-09, -4.7E-09, -1.3E-09, -1.4E-09, -5.1E-09, -5E-10, -3.8E-09, -8E-10, -4.9E-09,
453 : -7E-10, -4.2E-09, 1E-10, -5.7E-09, 0.000000, -3.8E-09, -1.9E-09, -3.7E-09, -4E-10, -5.1E-09,
454 : -8E-10, -2.7E-09, -3.3E-09, -9E-10, -3.2E-09, -3.8E-09, -7E-10, -3.4E-09, -2.2E-09, -0.000000003,
455 : -1.7E-09, -3.5E-09, -1.4E-09, -3.3E-09, -1.4E-09, -3.5E-09, -1.7E-09, -2.8E-09, -2.9E-09, -1.4E-09,
456 : -3.6E-09, -0.000000001, -3.6E-09, -1.3E-09, -3.3E-09, -2.1E-09, -0.000000004, 7E-10, -5.1E-09, -1.5E-09,
457 : -2.6E-09, -1.6E-09, -2.8E-09, -3.5E-09, -6E-10, -3.9E-09, -9E-10, -3.2E-09, -2.4E-09, -3.3E-09,
458 : -1.5E-09, -1.3E-09, -4.6E-09, -9E-10, -3.2E-09, -1.3E-09, -2.8E-09, -3.1E-09, -3E-10, -5.6E-09,
459 : 1.5E-09, -5.7E-09, 0.00000, -4.4E-09, 0.00000, -4.7E-09, -1.3E-09, -9E-10, -4.9E-09, -6E-10,
460 : -3.3E-09, -6E-10, -4.9E-09, -6E-10, -3.2E-09, -9E-10, -3.6E-09, -1.6E-09, -3.2E-09, -8E-10,
461 : -3.2E-09, -2.4E-09, -2.3E-09, -3.2E-09, -5E-10, -3.1E-09, -2.9E-09, -2E-10, -5.5E-09, 3E-10,
462 : -3.7E-09, -1E-10, -0.000000005, -2E-10, -3.2E-09, -2.2E-09, -2.4E-09, -2.7E-09, -1.1E-09, -2.6E-09,
463 : -2.7E-09, -9E-10, -4.3E-09, -1E-10, -4.9E-09, -2E-10, -2.7E-09, -3.1E-09, 2E-10, -5.2E-09,
464 : 0.0000, -3.2E-09, -0.000000002, -2.6E-09, -2.5E-09, -6E-10, -4.4E-09, -5E-10, -2.8E-09, -2.1E-09,
465 : -2.6E-09, -1.9E-09, -2.5E-09, -2.5E-09, -0.000000001, -2.3E-09, -2.5E-09, -3.6E-09, -3E-10, -0.000000003,
466 : -1.9E-09, -2.8E-09, -2E-10, -0.000000004, -2.5E-09, -1E-10, -4.6E-09, -3E-10, -2.5E-09, -3.8E-09,
467 : -3E-10, -2.6E-09, -2.3E-09, -2.1E-09, -2.2E-09, -2.1E-09, -2.4E-09, -2.1E-09, -2.2E-09, -0.000000002,
468 : -2.4E-09, -9E-10, -3.3E-09, -2.2E-09, -4E-10, -4.1E-09, -1.4E-09, -2.9E-09, 4E-10, -5.5E-09,
469 : 2.7E-09}; // namespace Psychrometrics
470 : #ifdef EP_psych_stats
471 : static constexpr std::array<bool, static_cast<int>(PsychrometricFunction::Num)> PsyReportIt = {
472 : true,
473 : true,
474 : true,
475 : true,
476 : true,
477 : true,
478 : true,
479 : true,
480 : true,
481 : true,
482 : true,
483 : true,
484 : true,
485 : false,
486 : false,
487 : false,
488 : false,
489 : true,
490 : true}; // PsyTdpFnTdbTwbPb 1 | PsyRhFnTdbWPb 2 | PsyTwbFnTdbWPb 3 | PsyVFnTdbWPb 4 |
491 : // PsyWFnTdpPb 5 | PsyWFnTdbH 6 | PsyWFnTdbTwbPb 7 | PsyWFnTdbRhPb 8 |
492 : // PsyPsatFnTemp 9 | PsyTsatFnHPb 10 | PsyTsatFnPb 11 | PsyRhFnTdbRhov 12 |
493 : // PsyRhFnTdbRhovLBnd0C 13 | PsyTwbFnTdbWPb 14 - HR | PsyTwbFnTdbWPb 15 - max iter |
494 : // PsyWFnTdbTwbPb 16 - HR | PsyTsatFnPb 17 - max iter | PsyTwbFnTdbWPb_cache 18 -
495 : // PsyTwbFnTdbWPb_raw (raw calc) | PsyPsatFnTemp_cache 19 - PsyPsatFnTemp_raw (raw calc)
496 : #endif
497 :
498 : void InitializePsychRoutines(EnergyPlusData &state);
499 :
500 : void ShowPsychrometricSummary(EnergyPlusData &state, InputOutputFile &auditFile);
501 :
502 : #ifdef EP_psych_errors
503 : void PsyRhoAirFnPbTdbW_error(EnergyPlusData &state,
504 : Real64 const pb, // barometric pressure (Pascals)
505 : Real64 const tdb, // dry bulb temperature (Celsius)
506 : Real64 const dw, // humidity ratio (kgWater/kgDryAir)
507 : Real64 const rhoair, // density of air
508 : std::string_view const CalledFrom = "" // routine this function was called from (error messages) !unused1208
509 : );
510 : #endif
511 :
512 : inline Real64
513 719521434 : PsyRhoAirFnPbTdbW([[maybe_unused]] EnergyPlusData &state,
514 : Real64 const pb, // pressure (Pascals)
515 : Real64 const tdb, // dry bulb temperature (Celsius)
516 : Real64 const dw, // humidity ratio (kgWater/kgDryAir)
517 : [[maybe_unused]] std::string_view const CalledFrom = "" // routine this function was called from (error messages) !unused1208
518 : )
519 :
520 : {
521 : // FUNCTION INFORMATION:
522 : // AUTHOR G. S. Wright
523 : // DATE WRITTEN June 2, 1994
524 : // MODIFIED na
525 : // RE-ENGINEERED na
526 :
527 : // PURPOSE OF THIS FUNCTION:
528 : // This function provides density of air as a function of barometric
529 : // pressure, dry bulb temperature, and humidity ratio.
530 :
531 : // METHODOLOGY EMPLOYED:
532 : // ideal gas law
533 : // universal gas const for air 287 J/(kg K)
534 : // air/water molecular mass ratio 28.9645/18.01534
535 :
536 : // REFERENCES:
537 : // Wylan & Sontag, Fundamentals of Classical Thermodynamics.
538 : // ASHRAE handbook 1985 Fundamentals, Ch. 6, eqn. (6),(26)
539 :
540 719521434 : Real64 const rhoair(pb / (287.0 * (tdb + Constant::Kelvin) * (1.0 + 1.6077687 * max(dw, 1.0e-5))));
541 : #ifdef EP_psych_errors
542 719521434 : if (rhoair < 0.0) PsyRhoAirFnPbTdbW_error(state, pb, tdb, dw, rhoair, CalledFrom);
543 : #endif
544 719521434 : return rhoair;
545 : }
546 :
547 32 : constexpr Real64 PsyRhoAirFnPbTdbW(Real64 const pb, // barometric pressure (Pascals)
548 : Real64 const tdb, // dry bulb temperature (Celsius)
549 : Real64 const dw // humidity ratio (kgWater/kgDryAir)
550 : )
551 : {
552 : // FUNCTION INFORMATION:
553 : // AUTHOR G. S. Wright
554 : // DATE WRITTEN June 2, 1994
555 : // MODIFIED na
556 : // RE-ENGINEERED na
557 :
558 : // PURPOSE OF THIS FUNCTION:
559 : // This function provides density of air as a function of barometric
560 : // pressure, dry bulb temperature, and humidity ratio.
561 :
562 : // METHODOLOGY EMPLOYED:
563 : // ideal gas law
564 : // universal gas const for air 287 J/(kg K)
565 : // air/water molecular mass ratio 28.9645/18.01534
566 :
567 : // REFERENCES:
568 : // Wylan & Sontag, Fundamentals of Classical Thermodynamics.
569 : // ASHRAE handbook 1985 Fundamentals, Ch. 6, eqn. (6),(26)
570 :
571 32 : return (pb / (287.0 * (tdb + Constant::Kelvin) * (1.0 + 1.6077687 * std::max(dw, 1.0e-5))));
572 : }
573 :
574 1054535 : inline Real64 PsyRhoAirFnPbTdbW_fast([[maybe_unused]] EnergyPlusData &state,
575 : Real64 const pb, // barometric pressure (Pascals)
576 : Real64 const tdb, // dry bulb temperature (Celsius)
577 : Real64 const dw // humidity ratio (kgWater/kgDryAir)
578 : )
579 : {
580 : // Faster version with humidity ratio already adjusted
581 1054535 : assert(dw >= 1.0e-5);
582 1054535 : Real64 const rhoair(pb / (287.0 * (tdb + Constant::Kelvin) * (1.0 + 1.6077687 * dw)));
583 : #ifdef EP_psych_errors
584 1054535 : if (rhoair < 0.0) PsyRhoAirFnPbTdbW_error(state, pb, tdb, dw, rhoair);
585 : #endif
586 1054535 : return rhoair;
587 : }
588 :
589 30806892 : inline Real64 PsyHfgAirFnWTdb([[maybe_unused]] Real64 const w, // humidity ratio {kgWater/kgDryAir} !unused1208
590 : Real64 const T // input temperature {Celsius}
591 : )
592 : {
593 : // FUNCTION INFORMATION:
594 : // AUTHOR Richard Liesen
595 : // DATE WRITTEN May, 2001
596 : // MODIFIED June, 2002
597 : // RE-ENGINEERED na
598 :
599 : // PURPOSE OF THIS FUNCTION:
600 : // This function provides latent energy of air as function of humidity ratio and temperature.
601 :
602 : // METHODOLOGY EMPLOYED:
603 : // calculates hg and then hf and the difference is Hfg.
604 :
605 : // REFERENCES:
606 : // see ASHRAE Fundamentals Psychrometric Chapter
607 : // USAGE: hfg = PsyHfgAirFnWTdb(w,T)
608 :
609 : // Return value
610 : // result => heat of vaporization for moist air {J/kg}
611 :
612 : // This formulation currently does not use W since it returns results that are in J/kg and the
613 : // amount of energy is on a per unit of moisture basis.
614 :
615 30806892 : Real64 const Temperature(max(T, 0.0)); // input temperature {Celsius} - corrected for >= 0C
616 30806892 : return (2500940.0 + 1858.95 * Temperature) - (4180.0 * Temperature); // enthalpy of the gas - enthalpy of the fluid
617 : }
618 :
619 90857036 : inline Real64 PsyHgAirFnWTdb([[maybe_unused]] Real64 const w, // humidity ratio {kgWater/kgDryAir} !unused1208
620 : Real64 const T // input temperature {Celsius}
621 : )
622 : {
623 :
624 : // FUNCTION INFORMATION:
625 : // AUTHOR Richard Liesen
626 : // DATE WRITTEN May, 2001
627 : // MODIFIED June, 2002
628 : // RE-ENGINEERED na
629 :
630 : // PURPOSE OF THIS FUNCTION:
631 : // This function provides latent energy of the moisture as a gas in the air as
632 : // function of humidity ratio and temperature.
633 :
634 : // REFERENCES:
635 : // see ASHRAE Fundamentals Psychrometric Chapter
636 : // USAGE: hg = PsyHgAirFnWTdb(w,T)
637 :
638 : // This formulation currently does not use W since it returns results that are in J/kg and the
639 : // amount of energy is on a per unit of moisture basis.
640 :
641 90857036 : return 2500940.0 + 1858.95 * T; // enthalpy of the gas {units?}
642 : }
643 :
644 1228374035 : inline Real64 PsyHFnTdbW(Real64 const TDB, // dry-bulb temperature {C}
645 : Real64 const dW // humidity ratio
646 : )
647 : {
648 : // FUNCTION INFORMATION:
649 : // AUTHOR George Shih
650 : // DATE WRITTEN May 1976
651 : // MODIFIED na
652 : // RE-ENGINEERED na
653 :
654 : // PURPOSE OF THIS FUNCTION:
655 : // This function calculates the enthalpy {J/kg} from dry-bulb temperature and humidity ratio.
656 :
657 : // REFERENCES:
658 : // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P100, EQN 32
659 :
660 : // calculate enthalpy
661 1228374035 : return 1.00484e3 * TDB + max(dW, 1.0e-5) * (2.50094e6 + 1.85895e3 * TDB); // enthalpy {J/kg}
662 : }
663 :
664 8140 : inline Real64 PsyHFnTdbW_fast(Real64 const TDB, // dry-bulb temperature {C}
665 : Real64 const dW // humidity ratio
666 : )
667 : {
668 : // Faster version with humidity ratio already adjusted
669 8140 : assert(dW >= 1.0e-5);
670 :
671 : // calculate enthalpy
672 8140 : return 1.00484e3 * TDB + dW * (2.50094e6 + 1.85895e3 * TDB); // enthalpy {J/kg}
673 : }
674 :
675 898490881 : inline Real64 PsyCpAirFnW(Real64 const dw // humidity ratio {kgWater/kgDryAir}
676 : )
677 : {
678 : // FUNCTION INFORMATION:
679 : // AUTHOR J. C. VanderZee
680 : // DATE WRITTEN Feb. 1994
681 : // MODIFIED na
682 : // RE-ENGINEERED na
683 :
684 : // PURPOSE OF THIS FUNCTION:
685 : // This function provides the heat capacity of air {J/kg-C} as function of humidity ratio.
686 :
687 : // METHODOLOGY EMPLOYED:
688 : // take numerical derivative of PsyHFnTdbW function
689 :
690 : // REFERENCES:
691 : // see PsyHFnTdbW ref. to ASHRAE Fundamentals
692 : // USAGE: cpa = PsyCpAirFnW(w)
693 :
694 : // Static locals
695 : static Real64 dwSave(-100.0);
696 : static Real64 cpaSave(-100.0);
697 :
698 : // check if last call had the same input and if it did just use the saved output
699 898490881 : if (dwSave == dw) return cpaSave;
700 :
701 : // compute heat capacity of air
702 447090500 : Real64 const w(max(dw, 1.0e-5));
703 447090500 : Real64 const cpa((1.00484e3 + w * 1.85895e3)); // result => heat capacity of moist air {J/kg-C}
704 :
705 : // save values for next call
706 447090500 : dwSave = dw;
707 447090500 : cpaSave = cpa;
708 :
709 447090500 : return cpa;
710 : }
711 :
712 1052500 : inline Real64 PsyCpAirFnW_fast(Real64 const dw // humidity ratio {kgWater/kgDryAir}
713 : )
714 : {
715 : // Faster version with humidity ratio already adjusted
716 1052500 : assert(dw >= 1.0e-5);
717 :
718 : // Static locals
719 : static Real64 dwSave(-100.0);
720 : static Real64 cpaSave(-100.0);
721 :
722 : // check if last call had the same input and if it did just use the saved output
723 1052500 : if (dwSave == dw) return cpaSave;
724 :
725 : // compute heat capacity of air
726 123036 : Real64 const cpa((1.00484e3 + dw * 1.85895e3)); // result => heat capacity of moist air {J/kg-C}
727 :
728 : // save values for next call
729 123036 : dwSave = dw;
730 123036 : cpaSave = cpa;
731 :
732 123036 : return cpa;
733 : }
734 :
735 299794880 : inline Real64 PsyTdbFnHW(Real64 const H, // enthalpy {J/kg}
736 : Real64 const dW // humidity ratio
737 : )
738 : {
739 : // FUNCTION INFORMATION:
740 : // AUTHOR J. C. VanderZee
741 : // DATE WRITTEN Feb. 1994
742 : // MODIFIED na
743 : // RE-ENGINEERED na
744 :
745 : // PURPOSE OF THIS FUNCTION:
746 : // This function provides air temperature from enthalpy and humidity ratio.
747 :
748 : // REFERENCES:
749 : // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P100, EQN 32
750 : // by inverting function PsyHFnTdbW
751 :
752 299794880 : Real64 const W(max(dW, 1.0e-5)); // humidity ratio
753 299794880 : return (H - 2.50094e6 * W) / (1.00484e3 + 1.85895e3 * W); // result=> dry-bulb temperature {C}
754 : }
755 :
756 417769 : inline Real64 PsyRhovFnTdbRhLBnd0C(Real64 const Tdb, // dry-bulb temperature {C}
757 : Real64 const RH // relative humidity value (0.0-1.0)
758 : )
759 : {
760 : // FUNCTION INFORMATION:
761 : // AUTHOR R. J. Liesen
762 : // DATE WRITTEN July 2000
763 : // MODIFIED Name change to signify derivation and temperatures were used
764 : // with 0C as minimum; LKL January 2008
765 : // RE-ENGINEERED na
766 :
767 : // PURPOSE OF THIS FUNCTION:
768 : // This function provides the Vapor Density in air as a
769 : // function of dry bulb temperature, and Relative Humidity.
770 :
771 : // METHODOLOGY EMPLOYED:
772 : // ideal gas law
773 : // Universal gas const for water vapor 461.52 J/(kg K)
774 :
775 : // REFERENCES:
776 : // ASHRAE handbook 1993 Fundamentals,
777 :
778 417769 : return RH / (461.52 * (Tdb + Constant::Kelvin)) * std::exp(23.7093 - 4111.0 / ((Tdb + Constant::Kelvin) - 35.45)); // Vapor density in air
779 : }
780 :
781 2041250 : inline Real64 PsyRhovFnTdbWPb(Real64 const Tdb, // dry-bulb temperature {C}
782 : Real64 const dW, // humidity ratio
783 : Real64 const PB // Barometric Pressure {Pascals}
784 : )
785 : {
786 : // FUNCTION INFORMATION:
787 : // AUTHOR R. J. Liesen
788 : // DATE WRITTEN July 2000
789 : // MODIFIED na
790 : // RE-ENGINEERED na
791 :
792 : // PURPOSE OF THIS FUNCTION:
793 : // This function provides the Vapor Density in air as a
794 : // function of dry bulb temperature, Humidity Ratio, and Barometric Pressure.
795 :
796 : // METHODOLOGY EMPLOYED:
797 : // ideal gas law
798 : // Universal gas const for water vapor 461.52 J/(kg K)
799 :
800 : // REFERENCES:
801 : // ASHRAE handbook 1993 Fundamentals,
802 :
803 2041250 : Real64 const W(max(dW, 1.0e-5)); // humidity ratio
804 2041250 : return W * PB / (461.52 * (Tdb + Constant::Kelvin) * (W + 0.62198));
805 : }
806 :
807 1052984 : inline Real64 PsyRhovFnTdbWPb_fast(Real64 const Tdb, // dry-bulb temperature {C}
808 : Real64 const dW, // humidity ratio
809 : Real64 const PB // Barometric Pressure {Pascals}
810 : )
811 : {
812 : // Faster version with humidity ratio already adjusted
813 1052984 : assert(dW >= 1.0e-5);
814 1052984 : return dW * PB / (461.52 * (Tdb + Constant::Kelvin) * (dW + 0.62198));
815 : }
816 :
817 : #ifdef EP_psych_errors
818 : void PsyRhFnTdbRhovLBnd0C_error(EnergyPlusData &state,
819 : Real64 const Tdb, // dry-bulb temperature {C}
820 : Real64 const Rhovapor, // vapor density in air {kg/m3}
821 : Real64 const RHValue, // relative humidity value (0.0-1.0)
822 : std::string_view const CalledFrom // routine this function was called from (error messages)
823 : );
824 : #endif
825 :
826 : inline Real64
827 152049 : PsyRhFnTdbRhovLBnd0C([[maybe_unused]] EnergyPlusData &state,
828 : Real64 const Tdb, // dry-bulb temperature {C}
829 : Real64 const Rhovapor, // vapor density in air {kg/m3}
830 : [[maybe_unused]] std::string_view const CalledFrom = "" // routine this function was called from (error message)
831 : )
832 : {
833 : // FUNCTION INFORMATION:
834 : // AUTHOR R. J. Liesen
835 : // DATE WRITTEN July 2000
836 : // MODIFIED Name change to signify derivation and temperatures were used
837 : // with 0C as minimum; LKL January 2008
838 : // RE-ENGINEERED na
839 :
840 : // PURPOSE OF THIS FUNCTION:
841 : // This function provides the Relative Humidity in air as a
842 : // function of dry bulb temperature and Vapor Density.
843 :
844 : // METHODOLOGY EMPLOYED:
845 : // ideal gas law
846 : // Universal gas const for water vapor 461.52 J/(kg K)
847 :
848 : // REFERENCES:
849 : // ASHRAE handbook 1993 Fundamentals,
850 :
851 : #ifdef EP_psych_stats
852 : ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::RhFnTdbRhovLBnd0C)];
853 : #endif
854 :
855 : Real64 const RHValue(
856 152049 : Rhovapor > 0.0 ? Rhovapor * 461.52 * (Tdb + Constant::Kelvin) * std::exp(-23.7093 + 4111.0 / ((Tdb + Constant::Kelvin) - 35.45)) : 0.0);
857 :
858 152049 : if ((RHValue < 0.0) || (RHValue > 1.0)) {
859 : #ifdef EP_psych_errors
860 0 : if ((RHValue < -0.05) || (RHValue > 1.01)) {
861 0 : PsyRhFnTdbRhovLBnd0C_error(state, Tdb, Rhovapor, RHValue, CalledFrom);
862 : }
863 : #endif
864 0 : return min(max(RHValue, 0.01), 1.0);
865 : } else {
866 152049 : return RHValue;
867 : }
868 : }
869 :
870 : #ifdef EP_cache_PsyTwbFnTdbWPb
871 :
872 : Real64 PsyTwbFnTdbWPb(EnergyPlusData &state,
873 : Real64 const Tdb, // dry-bulb temperature {C}
874 : Real64 const W, // humidity ratio
875 : Real64 const Pb, // barometric pressure {Pascals}
876 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
877 : );
878 :
879 : Real64 PsyTwbFnTdbWPb_raw(EnergyPlusData &state,
880 : Real64 const TDB, // dry-bulb temperature {C}
881 : Real64 const dW, // humidity ratio
882 : Real64 const Patm, // barometric pressure {Pascals}
883 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
884 : );
885 :
886 : #else
887 :
888 : Real64 PsyTwbFnTdbWPb(EnergyPlusData &state,
889 : Real64 const TDB, // dry-bulb temperature {C}
890 : Real64 const dW, // humidity ratio
891 : Real64 const Patm, // barometric pressure {Pascals}
892 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
893 : );
894 :
895 : #endif
896 :
897 : #ifdef EP_psych_errors
898 : void PsyVFnTdbWPb_error(EnergyPlusData &state,
899 : Real64 const TDB, // dry-bulb temperature {C}
900 : Real64 const w, // humidity ratio
901 : Real64 const PB, // barometric pressure {Pascals}
902 : Real64 const V, // specific volume {m3/kg}
903 : std::string_view const CalledFrom // routine this function was called from (error messages)
904 : );
905 : #endif
906 :
907 2031 : inline Real64 PsyVFnTdbWPb([[maybe_unused]] EnergyPlusData &state,
908 : Real64 const TDB, // dry-bulb temperature {C}
909 : Real64 const dW, // humidity ratio
910 : Real64 const PB, // barometric pressure {Pascals}
911 : [[maybe_unused]] std::string_view const CalledFrom = "" // routine this function was called from (error messages)
912 : )
913 : {
914 : // FUNCTION INFORMATION:
915 : // AUTHOR George Shih
916 : // DATE WRITTEN May 1976
917 : // MODIFIED na
918 : // RE-ENGINEERED na
919 :
920 : // PURPOSE OF THIS FUNCTION:
921 : // This function provides the specific volume from dry-bulb temperature,
922 : // humidity ratio and barometric pressure.
923 :
924 : // REFERENCES:
925 : // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P99, EQN 28
926 :
927 : #ifdef EP_psych_stats
928 : ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::VFnTdbWPb)];
929 : #endif
930 :
931 2031 : Real64 const w(max(dW, 1.0e-5)); // humidity ratio
932 2031 : Real64 const V(1.59473e2 * (1.0 + 1.6078 * w) * (1.8 * TDB + 492.0) / PB); // specific volume {m3/kg}
933 :
934 : // Validity test
935 2031 : if (V < 0.0) {
936 : #ifdef EP_psych_errors
937 0 : if (V <= -0.01) PsyVFnTdbWPb_error(state, TDB, w, PB, V, CalledFrom);
938 : #endif
939 0 : return 0.83; // Fix Was inside the ifdef
940 : } else {
941 2031 : return V;
942 : }
943 : }
944 :
945 : #ifdef EP_psych_errors
946 : void PsyWFnTdbH_error(EnergyPlusData &state,
947 : Real64 const TDB, // dry-bulb temperature {C}
948 : Real64 const H, // enthalpy {J/kg}
949 : Real64 const W, // humidity ratio
950 : std::string_view const CalledFrom // routine this function was called from (error messages)
951 : );
952 : #endif
953 :
954 225655562 : inline Real64 PsyWFnTdbH([[maybe_unused]] EnergyPlusData &state,
955 : Real64 const TDB, // dry-bulb temperature {C}
956 : Real64 const H, // enthalpy {J/kg}
957 : [[maybe_unused]] std::string_view const CalledFrom = "", // routine this function was called from (error messages)
958 : [[maybe_unused]] bool const SuppressWarnings = false // if calling function is calculating an intermediate state
959 : )
960 : {
961 : // FUNCTION INFORMATION:
962 : // AUTHOR George Shih
963 : // DATE WRITTEN May 1976
964 : // MODIFIED na
965 : // RE-ENGINEERED na
966 :
967 : // PURPOSE OF THIS FUNCTION:
968 : // This function provides the humidity ratio from dry-bulb temperature
969 : // and enthalpy.
970 :
971 : // REFERENCES:
972 : // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P100, EQN 32
973 :
974 : #ifdef EP_psych_stats
975 : ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::WFnTdbH)];
976 : #endif
977 :
978 225655562 : Real64 const W((H - 1.00484e3 * TDB) / (2.50094e6 + 1.85895e3 * TDB)); // humidity ratio
979 :
980 : // Validity test
981 225655562 : if (W < 0.0) {
982 : #ifdef EP_psych_errors
983 9338 : if ((W <= -0.0001) && (!SuppressWarnings)) PsyWFnTdbH_error(state, TDB, H, W, CalledFrom);
984 : #endif
985 9338 : return 1.0e-5;
986 : } else {
987 225646224 : return W;
988 : }
989 : }
990 :
991 : #ifdef EP_cache_PsyPsatFnTemp
992 :
993 : Real64 PsyPsatFnTemp_raw(EnergyPlusData &state,
994 : Real64 const T, // dry-bulb temperature {C}
995 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
996 : );
997 :
998 : // we are disabling these warnings on Windows because the cache value lookups are using 64bit integers,
999 : // but the () and [] operator overloads for Array1D (which stores the cache) only uses 32bit lookups
1000 : // this seems ... very bad. This problem will be fixed when we get rid of Array1D
1001 : // at which time this warning disable should be removed.
1002 : #ifdef _MSC_VER
1003 : #pragma warning(push)
1004 : #pragma warning(disable : 4244)
1005 : #endif
1006 :
1007 964862086 : inline Real64 PsyPsatFnTemp(EnergyPlusData &state,
1008 : Real64 const T, // dry-bulb temperature {C}
1009 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1010 : )
1011 : {
1012 : // FUNCTION INFORMATION:
1013 : // AUTHOR Linda Lawrie
1014 : // DATE WRITTEN March 2013
1015 : // MODIFIED na
1016 : // RE-ENGINEERED na
1017 :
1018 : // PURPOSE OF THIS FUNCTION:
1019 : // Provide a "cache" of results for the given argument (T) and pressure (Pascal) output result.
1020 :
1021 : // METHODOLOGY EMPLOYED:
1022 : // Use grid shifting and masking to provide hash into the cache. Use Equivalence to
1023 : // make Fortran ignore "types".
1024 :
1025 : // FUNCTION PARAMETER DEFINITIONS:
1026 : // integer(i64), parameter :: Grid_Mask=NOT(ISHFT(1_i64, Grid_Shift)-1)
1027 964862086 : std::uint64_t constexpr Grid_Shift = 64 - 12 - psatprecision_bits;
1028 :
1029 : #ifdef EP_psych_stats
1030 : ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::PsatFnTemp_cache)];
1031 : #endif
1032 :
1033 : DISABLE_WARNING_PUSH
1034 : DISABLE_WARNING_STRICT_ALIASING
1035 : // cppcheck-suppress invalidPointerCast
1036 964862086 : Int64 Tdb_tag(*reinterpret_cast<Int64 const *>(&T) >> Grid_Shift);
1037 : DISABLE_WARNING_POP
1038 964862086 : Int64 const hash(Tdb_tag & psatcache_mask);
1039 964862086 : auto &cPsat(state.dataPsychCache->cached_Psat[hash]);
1040 :
1041 964862086 : if (cPsat.iTdb != Tdb_tag) {
1042 465601563 : cPsat.iTdb = Tdb_tag;
1043 465601563 : Tdb_tag <<= Grid_Shift;
1044 : DISABLE_WARNING_PUSH
1045 : DISABLE_WARNING_STRICT_ALIASING
1046 : // cppcheck-suppress invalidPointerCast
1047 465601563 : Real64 Tdb_tag_r = *reinterpret_cast<Real64 const *>(&Tdb_tag);
1048 : DISABLE_WARNING_POP
1049 465601563 : cPsat.Psat = PsyPsatFnTemp_raw(state, Tdb_tag_r, CalledFrom);
1050 : }
1051 :
1052 964862086 : return cPsat.Psat; // saturation pressure {Pascals}
1053 : }
1054 :
1055 : #else
1056 :
1057 : Real64 PsyPsatFnTemp(EnergyPlusData &state,
1058 : Real64 const T, // dry-bulb temperature {C}
1059 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1060 : );
1061 :
1062 : #endif
1063 :
1064 : #ifdef EP_cache_PsyTsatFnHPb
1065 : Real64 PsyTsatFnHPb_raw(EnergyPlusData &state,
1066 : Real64 const H, // enthalpy {J/kg}
1067 : Real64 const PB, // barometric pressure {Pascals}
1068 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1069 : );
1070 275233971 : inline Real64 PsyTsatFnHPb(EnergyPlusData &state,
1071 : Real64 const H,
1072 : Real64 const Pb, // barometric pressure {Pascals}
1073 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1074 : )
1075 : {
1076 :
1077 : Real64 Tsat_result; // result=> Sat-Temp {C}
1078 :
1079 275233971 : std::uint64_t constexpr Grid_Shift = 64 - 12 - tsat_hbp_precision_bits;
1080 :
1081 : // INTERFACE BLOCK SPECIFICATIONS:
1082 : // na
1083 :
1084 : // DERIVED TYPE DEFINITIONS:
1085 : // na
1086 :
1087 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
1088 :
1089 : #ifdef EP_psych_stats
1090 : ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::TwbFnTdbWPb_cache)];
1091 : #endif
1092 : DISABLE_WARNING_PUSH
1093 : DISABLE_WARNING_STRICT_ALIASING
1094 : // cppcheck-suppress invalidPointerCast
1095 275233971 : Int64 H_tag = *reinterpret_cast<Int64 const *>(&H) >> Grid_Shift;
1096 : // cppcheck-suppress invalidPointerCast
1097 275233971 : Int64 Pb_tag = *reinterpret_cast<Int64 const *>(&Pb) >> Grid_Shift;
1098 : DISABLE_WARNING_POP
1099 275233971 : Int64 hash = (H_tag ^ Pb_tag) & Int64(tsat_hbp_cache_size - 1);
1100 275233971 : auto &cached_Tsat_HPb = state.dataPsychCache->cached_Tsat_HPb;
1101 275233971 : if (cached_Tsat_HPb[hash].iH != H_tag || cached_Tsat_HPb[hash].iPb != Pb_tag) {
1102 57462832 : cached_Tsat_HPb[hash].iH = H_tag;
1103 57462832 : cached_Tsat_HPb[hash].iPb = Pb_tag;
1104 57462832 : cached_Tsat_HPb[hash].Tsat = PsyTsatFnHPb_raw(state, H, Pb, CalledFrom);
1105 : }
1106 :
1107 275233971 : Tsat_result = cached_Tsat_HPb[hash].Tsat;
1108 :
1109 275233971 : return Tsat_result;
1110 : }
1111 :
1112 : #else
1113 :
1114 : Real64 PsyTsatFnHPb(EnergyPlusData &state,
1115 : Real64 const H, // enthalpy {J/kg}
1116 : Real64 const PB, // barometric pressure {Pascals}
1117 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1118 : );
1119 :
1120 : #endif
1121 :
1122 4512699 : inline Real64 PsyRhovFnTdbRh(EnergyPlusData &state,
1123 : Real64 const Tdb, // dry-bulb temperature {C}
1124 : Real64 const RH, // relative humidity value (0.0-1.0)
1125 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1126 : )
1127 : {
1128 : // FUNCTION INFORMATION:
1129 : // AUTHOR R. J. Liesen
1130 : // DATE WRITTEN July 2000
1131 : // MODIFIED Change temperature range applied (determine pws); Aug 2007; LKL
1132 : // Function is continuous over temperature spectrum
1133 : // RE-ENGINEERED na
1134 :
1135 : // PURPOSE OF THIS FUNCTION:
1136 : // This function provides the Vapor Density in air as a
1137 : // function of dry bulb temperature, and Relative Humidity.
1138 :
1139 : // METHODOLOGY EMPLOYED:
1140 : // ideal gas law
1141 : // Universal gas const for water vapor 461.52 J/(kg K)
1142 :
1143 : // REFERENCES:
1144 : // ASHRAE handbook 1993 Fundamentals, ??
1145 : // Used values from Table 2, HOF 2005, Chapter 6, to verify that these values match (at saturation)
1146 : // values from PsyRhFnTdbWPb
1147 :
1148 4512699 : return (PsyPsatFnTemp(state, Tdb, CalledFrom) * RH) / (461.52 * (Tdb + Constant::Kelvin)); // Vapor density in air
1149 : }
1150 :
1151 : #ifdef EP_psych_errors
1152 : void PsyRhFnTdbRhov_error(EnergyPlusData &state,
1153 : Real64 const Tdb, // dry-bulb temperature {C}
1154 : Real64 const Rhovapor, // vapor density in air {kg/m3}
1155 : Real64 const RHValue, // relative humidity
1156 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1157 : );
1158 : #endif
1159 :
1160 2450159 : inline Real64 PsyRhFnTdbRhov(EnergyPlusData &state,
1161 : Real64 const Tdb, // dry-bulb temperature {C}
1162 : Real64 const Rhovapor, // vapor density in air {kg/m3}
1163 : [[maybe_unused]] std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1164 : )
1165 : {
1166 : // FUNCTION INFORMATION:
1167 : // AUTHOR R. J. Liesen
1168 : // DATE WRITTEN July 2000
1169 : // MODIFIED Change temperature range applied (determine pws); Aug 2007; LKL
1170 : // Function is continuous over temperature spectrum
1171 : // RE-ENGINEERED na
1172 :
1173 : // PURPOSE OF THIS FUNCTION:
1174 : // This function provides the Relative Humidity in air as a
1175 : // function of dry bulb temperature and Vapor Density.
1176 :
1177 : // METHODOLOGY EMPLOYED:
1178 : // ideal gas law
1179 : // Universal gas const for water vapor 461.52 J/(kg K)
1180 :
1181 : // REFERENCES:
1182 : // ASHRAE handbook 1993 Fundamentals,
1183 : // Used values from Table 2, HOF 2005, Chapter 6, to verify that these values match (at saturation)
1184 : // values from PsyRhFnTdbWPb
1185 :
1186 : #ifdef EP_psych_stats
1187 : ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::RhFnTdbRhov)];
1188 : #endif
1189 :
1190 2450159 : Real64 const RHValue(Rhovapor > 0.0 ? Rhovapor * 461.52 * (Tdb + Constant::Kelvin) /
1191 2450159 : PsyPsatFnTemp(state, Tdb, PsyRoutineNames[static_cast<int>(PsychrometricFunction::RhFnTdbRhov)])
1192 2450159 : : 0.0);
1193 :
1194 2450159 : if ((RHValue < 0.0) || (RHValue > 1.0)) {
1195 : #ifdef EP_psych_errors
1196 62432 : if ((RHValue < -0.05) || (RHValue > 1.01)) {
1197 0 : PsyRhFnTdbRhov_error(state, Tdb, Rhovapor, RHValue, CalledFrom);
1198 : }
1199 : #endif
1200 62432 : return min(max(RHValue, 0.01), 1.0);
1201 : } else {
1202 2387727 : return RHValue;
1203 : }
1204 : }
1205 :
1206 : #ifdef EP_psych_errors
1207 : void PsyRhFnTdbWPb_error(EnergyPlusData &state,
1208 : Real64 const TDB, // dry-bulb temperature {C}
1209 : Real64 const W, // humidity ratio
1210 : Real64 const RHValue, // relative humidity (0.0-1.0)
1211 : std::string_view const CalledFrom // routine this function was called from (error messages)
1212 : );
1213 : #endif
1214 :
1215 70784237 : inline Real64 PsyRhFnTdbWPb(EnergyPlusData &state,
1216 : Real64 const TDB, // dry-bulb temperature {C}
1217 : Real64 const dW, // humidity ratio
1218 : Real64 const PB, // barometric pressure {Pascals}
1219 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1220 : )
1221 : {
1222 : // FUNCTION INFORMATION:
1223 : // AUTHOR Richard J. Liesen
1224 : // DATE WRITTEN Nov 1988
1225 : // MODIFIED Aug 1989, Michael J. Witte
1226 : // RE-ENGINEERED na
1227 :
1228 : // PURPOSE OF THIS FUNCTION:
1229 : // This function provides the relative humidity value (0.0-1.0) as a result of
1230 : // dry-bulb temperature, humidity ratio and barometric pressure.
1231 :
1232 : // REFERENCES:
1233 : // ASHRAE HANDBOOK FUNDAMENTALS 1985, P6.12, EQN 10,21,23
1234 :
1235 : #ifdef EP_psych_stats
1236 : ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::RhFnTdbWPb)];
1237 : #endif
1238 :
1239 70784237 : Real64 const PWS(PsyPsatFnTemp(state,
1240 : TDB,
1241 70784237 : (CalledFrom.empty() ? PsyRoutineNames[static_cast<int>(PsychrometricFunction::RhFnTdbWPb)]
1242 : : CalledFrom))); // Pressure -- saturated for pure water
1243 :
1244 : // Find Degree Of Saturation
1245 70784237 : Real64 const W(max(dW, 1.0e-5)); // humidity ratio
1246 70784237 : Real64 const U(W / (0.62198 * PWS / (PB - PWS))); // Degree of Saturation
1247 :
1248 : // Calculate The Relative Humidity
1249 70784237 : Real64 const RHValue(U / (1.0 - (1.0 - U) * (PWS / PB)));
1250 :
1251 : // Validity test
1252 70784237 : if ((RHValue < 0.0) || (RHValue > 1.0)) {
1253 : #ifdef EP_psych_errors
1254 349025 : if ((RHValue < -0.05) || (RHValue > 1.01)) {
1255 26 : PsyRhFnTdbWPb_error(state, TDB, W, RHValue, CalledFrom);
1256 : }
1257 : #endif
1258 349025 : return min(max(RHValue, 0.01), 1.0);
1259 : } else {
1260 70435212 : return RHValue;
1261 : }
1262 : }
1263 :
1264 : #ifdef EP_psych_errors
1265 : void PsyWFnTdpPb_error(EnergyPlusData &state,
1266 : Real64 const TDP, // dew-point temperature {C}
1267 : Real64 const PB, // barometric pressure {Pascals}
1268 : Real64 const W, // humidity ratio
1269 : Real64 const DeltaT, // Reduced temperature difference of dew point
1270 : std::string_view const CalledFrom // routine this function was called from (error messages)
1271 : );
1272 : #endif
1273 :
1274 57158340 : inline Real64 PsyWFnTdpPb(EnergyPlusData &state,
1275 : Real64 const TDP, // dew-point temperature {C}
1276 : Real64 const PB, // barometric pressure {Pascals}
1277 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1278 : )
1279 : {
1280 : // FUNCTION INFORMATION:
1281 : // AUTHOR George Shih
1282 : // DATE WRITTEN May 1976
1283 : // MODIFIED na
1284 : // RE-ENGINEERED na
1285 :
1286 : // PURPOSE OF THIS FUNCTION:
1287 : // This function provides the humidity ratio from dew-point temperature
1288 : // and barometric pressure.
1289 :
1290 : // REFERENCES:
1291 : // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P99, EQN 22
1292 :
1293 : #ifdef EP_psych_stats
1294 : ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::WFnTdpPb)];
1295 : #endif
1296 :
1297 57158340 : Real64 const PDEW(PsyPsatFnTemp(state,
1298 : TDP,
1299 57158340 : (CalledFrom.empty() ? PsyRoutineNames[static_cast<int>(PsychrometricFunction::WFnTdpPb)]
1300 : : CalledFrom))); // saturation pressure at dew-point temperature {Pascals}
1301 57158340 : Real64 const W(PDEW * 0.62198 / (PB - PDEW)); // humidity ratio
1302 :
1303 : // Validity test
1304 57158340 : if (W < 0.0) {
1305 2 : Real64 DeltaT = 0.0;
1306 2 : Real64 PDEW1 = PDEW;
1307 562 : while (PDEW1 >= PB) {
1308 560 : DeltaT++;
1309 560 : PDEW1 = PsyPsatFnTemp(state,
1310 : TDP - DeltaT,
1311 560 : (CalledFrom.empty() ? PsyRoutineNames[static_cast<int>(PsychrometricFunction::WFnTdpPb)]
1312 : : CalledFrom)); // saturation pressure at dew-point temperature {Pascals}
1313 : }
1314 2 : Real64 W1 = PDEW1 * 0.62198 / (PB - PDEW1);
1315 : #ifdef EP_psych_errors
1316 2 : if (W <= -0.0001) {
1317 2 : PsyWFnTdpPb_error(state, TDP, PB, W1, DeltaT, CalledFrom);
1318 : }
1319 : #endif
1320 2 : return W1;
1321 : } else {
1322 57158338 : return W;
1323 : }
1324 : }
1325 :
1326 : #ifdef EP_psych_errors
1327 : void PsyWFnTdbRhPb_error(EnergyPlusData &state,
1328 : Real64 const TDB, // dry-bulb temperature {C}
1329 : Real64 const RH, // relative humidity value (0.0-1.0)
1330 : Real64 const PB, // barometric pressure {Pascals}
1331 : Real64 const W, // humidity ratio
1332 : std::string_view const CalledFrom // routine this function was called from (error messages)
1333 : );
1334 : #endif
1335 :
1336 168995167 : inline Real64 PsyWFnTdbRhPb(EnergyPlusData &state,
1337 : Real64 const TDB, // dry-bulb temperature {C}
1338 : Real64 const RH, // relative humidity value (0.0-1.0)
1339 : Real64 const PB, // barometric pressure {Pascals}
1340 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1341 : )
1342 : {
1343 : // FUNCTION INFORMATION:
1344 : // AUTHOR George Shih
1345 : // DATE WRITTEN May 1976
1346 : // MODIFIED na
1347 : // RE-ENGINEERED na
1348 :
1349 : // PURPOSE OF THIS FUNCTION:
1350 : // This function provides the humidity ratio from dry-bulb temperature,
1351 : // relative humidty (value) and barometric pressure.
1352 :
1353 : // REFERENCES:
1354 : // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P99, EQN 22
1355 :
1356 : #ifdef EP_psych_stats
1357 : ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::WFnTdbRhPb)];
1358 : #endif
1359 :
1360 168995167 : Real64 const PDEW(RH * PsyPsatFnTemp(state,
1361 : TDB,
1362 168995167 : (CalledFrom.empty() ? PsyRoutineNames[static_cast<int>(PsychrometricFunction::WFnTdbRhPb)]
1363 168995167 : : CalledFrom))); // Pressure at dew-point temperature {Pascals}
1364 :
1365 : // Numeric error check when the temperature and RH values cause Pdew to equal or exceed
1366 : // barometric pressure which is physically impossible. An approach limit of 1000 pascals
1367 : // was chosen to keep the numerics stable as the denominator approaches 0.
1368 168995167 : Real64 const W(PDEW * 0.62198 / max(PB - PDEW, 1000.0)); // humidity ratio
1369 : // THIS EQUATION IN SI UNIT IS FROM ASHRAE HANDBOOK OF FUNDAMENTALS PAGE 99 EQUATION 22
1370 :
1371 : // Validity test
1372 168995167 : if (W < 1.0e-5) {
1373 : #ifdef EP_psych_errors
1374 951 : if (W <= -0.0001) PsyWFnTdbRhPb_error(state, TDB, RH, PB, W, CalledFrom);
1375 : #endif
1376 951 : return 1.0e-5;
1377 : } else {
1378 168994216 : return W;
1379 : }
1380 : }
1381 :
1382 : #ifdef EP_psych_errors
1383 :
1384 : void PsyWFnTdbTwbPb_temperature_error(EnergyPlusData &state,
1385 : Real64 const TDB, // dry-bulb temperature {C}
1386 : Real64 const TWB, // wet-bulb temperature {C}
1387 : Real64 const PB, // barometric pressure {Pascals}
1388 : std::string_view const CalledFrom // routine this function was called from (error messages)
1389 : );
1390 :
1391 : void PsyWFnTdbTwbPb_humidity_error(EnergyPlusData &state,
1392 : Real64 const TDB, // dry-bulb temperature {C}
1393 : Real64 const TWB, // wet-bulb temperature {C}
1394 : Real64 const PB, // barometric pressure {Pascals}
1395 : Real64 const W, // humidity ratio
1396 : std::string_view const CalledFrom // routine this function was called from (error messages)
1397 : );
1398 :
1399 : #endif
1400 :
1401 244070920 : inline Real64 PsyWFnTdbTwbPb(EnergyPlusData &state,
1402 : Real64 const TDB, // dry-bulb temperature {C}
1403 : Real64 const TWBin, // wet-bulb temperature {C}
1404 : Real64 const PB, // barometric pressure {Pascals}
1405 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1406 : )
1407 : {
1408 : // FUNCTION INFORMATION:
1409 : // AUTHOR George Shih
1410 : // DATE WRITTEN May 1976
1411 : // MODIFIED na
1412 : // RE-ENGINEERED na
1413 :
1414 : // PURPOSE OF THIS FUNCTION:
1415 : // This function provides the humidity ratio from dry-bulb temperature,
1416 : // wet-bulb temperature and barometric pressure.
1417 :
1418 : // REFERENCES:
1419 : // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P99, EQ 22,35
1420 :
1421 : #ifdef EP_psych_stats
1422 : ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::WFnTdbTwbPb)];
1423 : #endif
1424 :
1425 244070920 : Real64 TWB(TWBin); // test wet-bulb temperature
1426 :
1427 : // Validity check
1428 244070920 : if (TWB > TDB) {
1429 : #ifdef EP_psych_errors
1430 111377 : if (TWB > TDB + 0.01) PsyWFnTdbTwbPb_temperature_error(state, TDB, TWB, PB, CalledFrom);
1431 : #endif
1432 111377 : TWB = TDB;
1433 : }
1434 :
1435 : // Calculation
1436 244070920 : Real64 const PWET(PsyPsatFnTemp(state,
1437 : TWB,
1438 244070920 : (CalledFrom.empty() ? PsyRoutineNames[static_cast<int>(PsychrometricFunction::WFnTdbTwbPb)]
1439 : : CalledFrom))); // Pressure at wet-bulb temperature {Pascals}
1440 244070920 : Real64 const WET(0.62198 * PWET / (PB - PWET)); // Humidity ratio at wet-bulb temperature
1441 244070920 : Real64 const W(((2501.0 - 2.381 * TWB) * WET - (TDB - TWB)) / (2501.0 + 1.805 * TDB - 4.186 * TWB)); // humidity ratio
1442 :
1443 : // Validity check
1444 244070920 : if (W < 0.0) {
1445 : #ifdef EP_psych_errors
1446 320 : PsyWFnTdbTwbPb_humidity_error(state, TDB, TWB, PB, W, CalledFrom);
1447 : #endif
1448 320 : return PsyWFnTdbRhPb(state, TDB, 0.0001, PB, CalledFrom);
1449 : } else {
1450 244070600 : return W;
1451 : }
1452 : }
1453 :
1454 67458385 : inline Real64 PsyHFnTdbRhPb(EnergyPlusData &state,
1455 : Real64 const TDB, // dry-bulb temperature {C}
1456 : Real64 const RH, // relative humidity value (0.0 - 1.0)
1457 : Real64 const PB, // barometric pressure (N/M**2) {Pascals}
1458 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1459 : )
1460 : {
1461 : // FUNCTION INFORMATION:
1462 : // AUTHOR J. C. VanderZee
1463 : // DATE WRITTEN Feb. 1994
1464 : // MODIFIED na
1465 : // RE-ENGINEERED na
1466 :
1467 : // PURPOSE OF THIS FUNCTION:
1468 : // This function provides air enthalpy from temperature and relative humidity.
1469 :
1470 : // METHODOLOGY EMPLOYED:
1471 : // na
1472 :
1473 : // REFERENCES:
1474 : // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P100, EQN 32
1475 : // by using functions PsyWFnTdbRhPb and PsyHFnTdbW
1476 :
1477 67458385 : return PsyHFnTdbW(TDB, max(PsyWFnTdbRhPb(state, TDB, RH, PB, CalledFrom), 1.0e-5)); // enthalpy {J/kg}
1478 : }
1479 :
1480 : #ifdef EP_cache_PsyTsatFnPb
1481 :
1482 : Real64 PsyTsatFnPb_raw(EnergyPlusData &state,
1483 : Real64 const Press, // barometric pressure {Pascals}
1484 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1485 : );
1486 :
1487 122611997 : inline Real64 PsyTsatFnPb(EnergyPlusData &state,
1488 : Real64 const Press, // barometric pressure {Pascals}
1489 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1490 : )
1491 : {
1492 :
1493 122611997 : std::uint64_t Grid_Shift = 64 - 12 - state.dataPsychCache->tsatprecision_bits;
1494 : DISABLE_WARNING_PUSH
1495 : DISABLE_WARNING_STRICT_ALIASING
1496 : // cppcheck-suppress invalidPointerCast
1497 122611997 : Int64 const Pb_tag(*reinterpret_cast<Int64 const *>(&Press) >> Grid_Shift);
1498 : DISABLE_WARNING_POP
1499 :
1500 122611997 : Int64 const hash(Pb_tag & tsatcache_mask);
1501 122611997 : auto &cTsat(state.dataPsychCache->cached_Tsat[hash]);
1502 122611997 : if (cTsat.iPb != Pb_tag) {
1503 14863951 : cTsat.iPb = Pb_tag;
1504 14863951 : cTsat.Tsat = PsyTsatFnPb_raw(state, Press, CalledFrom);
1505 : }
1506 :
1507 122611997 : return cTsat.Tsat; // saturation temperature
1508 : }
1509 :
1510 : #ifdef _MSC_VER
1511 : #pragma warning(pop)
1512 : #endif
1513 :
1514 : #else
1515 : Real64 PsyTsatFnPb(EnergyPlusData &state,
1516 : Real64 const Press, // barometric pressure {Pascals}
1517 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1518 : );
1519 : #endif
1520 :
1521 122504232 : inline Real64 PsyTdpFnWPb(EnergyPlusData &state,
1522 : Real64 const W, // humidity ratio
1523 : Real64 const PB, // barometric pressure (N/M**2) {Pascals}
1524 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1525 : )
1526 : {
1527 : // FUNCTION INFORMATION:
1528 : // AUTHOR George Shih
1529 : // DATE WRITTEN May 1976
1530 : // MODIFIED na
1531 : // RE-ENGINEERED na
1532 :
1533 : // PURPOSE OF THIS FUNCTION:
1534 : // This function calculates the dew-point temperature {C} from humidity ratio and pressure.
1535 :
1536 : // METHODOLOGY EMPLOYED:
1537 : // na
1538 :
1539 : // REFERENCES:
1540 : // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P.99, EQN 22
1541 :
1542 122504232 : Real64 const W0(max(W, 1.0e-5)); // limited humidity ratio
1543 122504232 : Real64 const PDEW(PB * W0 / (0.62198 + W0)); // pressure at dew point temperature
1544 122504232 : return PsyTsatFnPb(state, PDEW, CalledFrom);
1545 : }
1546 :
1547 : #ifdef EP_psych_errors
1548 : void PsyTdpFnTdbTwbPb_error(EnergyPlusData &state,
1549 : Real64 const TDB, // dry-bulb temperature {C}
1550 : Real64 const TWB, // wet-bulb temperature {C}
1551 : Real64 const PB, // barometric pressure (N/M**2) {Pascals}
1552 : Real64 const W, // humidity ratio
1553 : Real64 const TDP, // dew-point temperature {C}
1554 : std::string_view const CalledFrom // routine this function was called from (error messages)
1555 : );
1556 : #endif
1557 :
1558 2152270 : inline Real64 PsyTdpFnTdbTwbPb(EnergyPlusData &state,
1559 : Real64 const TDB, // dry-bulb temperature {C}
1560 : Real64 const TWB, // wet-bulb temperature {C}
1561 : Real64 const PB, // barometric pressure (N/M**2) {Pascals}
1562 : std::string_view const CalledFrom = "" // routine this function was called from (error messages)
1563 : )
1564 : {
1565 : // FUNCTION INFORMATION:
1566 : // AUTHOR George Shih
1567 : // DATE WRITTEN May 1976
1568 : // MODIFIED na
1569 : // RE-ENGINEERED na
1570 :
1571 : // PURPOSE OF THIS FUNCTION:
1572 : // This function calculates the dew-point temperature {C} from dry-bulb, wet-bulb and pressure.
1573 :
1574 : #ifdef EP_psych_stats
1575 : ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::TdpFnTdbTwbPb)];
1576 : #endif
1577 :
1578 2152270 : Real64 const W(max(PsyWFnTdbTwbPb(state, TDB, TWB, PB, CalledFrom), 1.0e-5));
1579 2152270 : Real64 const TDP(PsyTdpFnWPb(state, W, PB, CalledFrom));
1580 :
1581 2152270 : if (TDP > TWB) {
1582 : #ifdef EP_psych_errors
1583 0 : if (TDP > TWB + 0.1) PsyTdpFnTdbTwbPb_error(state, TDB, TWB, PB, W, TDP, CalledFrom);
1584 : #endif
1585 0 : return TWB;
1586 : } else {
1587 2152270 : return TDP;
1588 : }
1589 : }
1590 :
1591 57462832 : inline Real64 F6(Real64 const X, Real64 const A0, Real64 const A1, Real64 const A2, Real64 const A3, Real64 const A4, Real64 const A5)
1592 : {
1593 57462832 : return A0 + X * (A1 + X * (A2 + X * (A3 + X * (A4 + X * A5))));
1594 : }
1595 :
1596 : inline Real64
1597 0 : F7(Real64 const X, Real64 const A0, Real64 const A1, Real64 const A2, Real64 const A3, Real64 const A4, Real64 const A5, Real64 const A6)
1598 : {
1599 0 : return (A0 + X * (A1 + X * (A2 + X * (A3 + X * (A4 + X * (A5 + X * A6)))))) / 1.0E10;
1600 : }
1601 :
1602 116952 : inline Real64 CPCW([[maybe_unused]] Real64 const Temperature // unused1208
1603 : )
1604 : {
1605 : // FUNCTION INFORMATION:
1606 : // AUTHOR RUSSELL D. TAYLOR
1607 : // DATE WRITTEN April 1992
1608 :
1609 : // PURPOSE OF THIS FUNCTION:
1610 : // This function provides the specific heat of chilled water. CPCW (J/Kg/k)
1611 :
1612 116952 : return 4180.0;
1613 : }
1614 :
1615 148798621 : inline Real64 CPHW([[maybe_unused]] Real64 const Temperature // unused1208
1616 : )
1617 : {
1618 : // FUNCTION INFORMATION:
1619 : // AUTHOR RUSSELL D. TAYLOR
1620 : // DATE WRITTEN April 1992
1621 :
1622 : // PURPOSE OF THIS FUNCTION:
1623 : // This function provides the specific heat of hot water. CPHW (J/Kg/k)
1624 :
1625 148798621 : return 4180.0;
1626 : }
1627 :
1628 10102948 : inline Real64 RhoH2O(Real64 const TB // Dry bulb temperature. {C}
1629 : )
1630 : {
1631 : // FUNCTION INFORMATION:
1632 : // AUTHOR SIGSTEINN P. GRETARSSON
1633 : // DATE WRITTEN April 1992
1634 :
1635 : // PURPOSE OF THIS FUNCTION:
1636 : // This function provides the density of water at a specific temperature.
1637 :
1638 : // METHODOLOGY EMPLOYED:
1639 : // Density of water [kg/m3]
1640 : // (RANGE: KelvinConv - 423.15 DEG. K) (convert to C first)
1641 :
1642 10102948 : return 1000.1207 + 8.3215874e-04 * TB - 4.929976e-03 * pow_2(TB) + 8.4791863e-06 * pow_3(TB);
1643 : }
1644 :
1645 186391009 : inline Real64 PsyDeltaHSenFnTdb2Tdb1W(Real64 const TDB2, // dry-bulb temperature at state 1 {C}
1646 : Real64 const TDB1, // dry-bulb temperature at state 2 {C}
1647 : Real64 const W // humidity ratio (at zone air node or Wmin)
1648 : )
1649 : {
1650 : // When called for zone equipment flow entering a zone (from CalcZoneSensibleLatentOutput or CalcZoneSensibleOutput):
1651 : // returns sensible enthalpy difference between equipment supply air (TDB2) and zone air (TDB1) evaluated
1652 : // using the zone air node humidity ratio. This enthalpy difference multiplied by supply
1653 : // air mass flow rate yields the sensible heat transfer rate in Watts.
1654 : // positive value is heating, negative value is cooling
1655 :
1656 : // When called across a component (from PsyDeltaHSenFnTdb2W2Tdb1W1 by CalcComponentSensibleLatentOutput):
1657 : // returns sensible enthalpy difference between state 1 (TDB1) and state 2 (TDB2) using the minimum
1658 : // humidity ratio from states 1 and 2. This enthalpy difference multiplied by supply air mass flow
1659 : // rate yields the sensible heat transfer rate in Watts.
1660 : // positive value is heating, negative value is cooling
1661 :
1662 : // the following two functions for calculating enthalpy difference are equivalent:
1663 : // PsyDeltaHSenFnTdb2Tdb1W() = PsyHFnTdbW(TDB2, W) - PsyHFnTdbW(TDB1, W)
1664 : // PsyDeltaHSenFnTdb2Tdb1W() function was derived by simplifying the expression above
1665 : // The constant coefficients come from the equation for moist air enthalpy, PsyHFnTdbW()
1666 :
1667 186391009 : return (1.00484e3 + max(1.0e-5, W) * 1.85895e3) * (TDB2 - TDB1);
1668 : }
1669 :
1670 96036630 : inline Real64 PsyDeltaHSenFnTdb2W2Tdb1W1(Real64 const TDB2, // dry-bulb temperature at state 2 {C}
1671 : Real64 const W2, // humidity ratio at state 2
1672 : Real64 const TDB1, // dry-bulb temperature at state 1 {C}
1673 : Real64 const W1 // humidity ratio at state 1
1674 : )
1675 : {
1676 : // returns sensible enthalpy difference of moist air going from state 1 to state 2 (e.g across coils)
1677 : // using the minimum humidity ratio state points 1 and 2. This enthalpy difference multiplied by
1678 : // supply air mass flow rate yields sensible heat transfer rate across coils in Watts
1679 : // positive value is heating, negative value is cooling
1680 :
1681 : // the following two functions for calculating enthalpy difference are equivalent:
1682 : // PsyDeltaHSenFnTdb2W2Tdb1W1() = PsyHFnTdbW(TDB2, min(W1, W2)) - PsyHFnTdbW(TDB1, min(W1,W2))
1683 : // PsyDeltaHSenFnTdb2W2Tdb1W1() function was derived by simplifying the above expression
1684 : // The constant coefficients came from the equation for moist air enthalpy, PsyHFnTdbW()
1685 :
1686 96036630 : Real64 const Wmin = min(W1, W2);
1687 96036630 : return PsyDeltaHSenFnTdb2Tdb1W(TDB2, TDB1, Wmin);
1688 : }
1689 : Real64 CSplineint(int const n, // sample data size
1690 : Real64 x); // given value of x
1691 : } // namespace Psychrometrics
1692 :
1693 : struct PsychrometricsData : BaseGlobalStruct
1694 : {
1695 : Real64 iconvTol = 0.0001;
1696 : Real64 last_Patm = -99999.0; // barometric pressure {Pascals} (last)
1697 : Real64 last_tBoil = -99999.0; // Boiling temperature of water at given pressure (last)
1698 : Real64 Press_Save = -99999.0;
1699 : Real64 tSat_Save = -99999.0;
1700 : std::array<int, static_cast<int>(EnergyPlus::PsychrometricFunction::Num)> iPsyErrIndex;
1701 : std::string String;
1702 : bool ReportErrors = true;
1703 : bool useInterpolationPsychTsatFnPb = false;
1704 :
1705 796 : void init_state(EnergyPlusData &state) override
1706 : {
1707 796 : Psychrometrics::InitializePsychRoutines(state);
1708 796 : }
1709 :
1710 0 : void clear_state() override
1711 : {
1712 0 : iPsyErrIndex.fill(0);
1713 0 : iconvTol = 0.0001;
1714 0 : last_Patm = -99999.0; // barometric pressure {Pascals} (last)
1715 0 : last_tBoil = -99999.0; // Boiling temperature of water at given pressure (last)
1716 0 : Press_Save = -99999.0;
1717 0 : tSat_Save = -99999.0;
1718 0 : String = "";
1719 0 : ReportErrors = true;
1720 0 : useInterpolationPsychTsatFnPb = false;
1721 0 : }
1722 : };
1723 :
1724 : } // namespace EnergyPlus
1725 :
1726 : #endif
|