LCOV - code coverage report
Current view: top level - EnergyPlus - Psychrometrics.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 89.1 % 211 188
Test Date: 2025-06-02 12:03:30 Functions: 97.4 % 38 37

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, 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     11400587 :     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     11400587 :         Real64 const rhoair(pb / (287.0 * (tdb + Constant::Kelvin) * (1.0 + 1.6077687 * max(dw, 1.0e-5))));
     541              : #ifdef EP_psych_errors
     542     11400587 :         if (rhoair < 0.0) {
     543            0 :             PsyRhoAirFnPbTdbW_error(state, pb, tdb, dw, rhoair, CalledFrom);
     544              :         }
     545              : #endif
     546     11400587 :         return rhoair;
     547              :     }
     548              : 
     549           59 :     constexpr Real64 PsyRhoAirFnPbTdbW(Real64 const pb,  // barometric pressure (Pascals)
     550              :                                        Real64 const tdb, // dry bulb temperature (Celsius)
     551              :                                        Real64 const dw   // humidity ratio (kgWater/kgDryAir)
     552              :     )
     553              :     {
     554              :         // FUNCTION INFORMATION:
     555              :         //       AUTHOR         G. S. Wright
     556              :         //       DATE WRITTEN   June 2, 1994
     557              :         //       MODIFIED       na
     558              :         //       RE-ENGINEERED  na
     559              : 
     560              :         // PURPOSE OF THIS FUNCTION:
     561              :         // This function provides density of air as a function of barometric
     562              :         // pressure, dry bulb temperature, and humidity ratio.
     563              : 
     564              :         // METHODOLOGY EMPLOYED:
     565              :         // ideal gas law
     566              :         //    universal gas const for air 287 J/(kg K)
     567              :         //    air/water molecular mass ratio 28.9645/18.01534
     568              : 
     569              :         // REFERENCES:
     570              :         // Wylan & Sontag, Fundamentals of Classical Thermodynamics.
     571              :         // ASHRAE handbook 1985 Fundamentals, Ch. 6, eqn. (6),(26)
     572              : 
     573           59 :         return (pb / (287.0 * (tdb + Constant::Kelvin) * (1.0 + 1.6077687 * std::max(dw, 1.0e-5))));
     574              :     }
     575              : 
     576         2030 :     inline Real64 PsyRhoAirFnPbTdbW_fast([[maybe_unused]] EnergyPlusData &state,
     577              :                                          Real64 const pb,  // barometric pressure (Pascals)
     578              :                                          Real64 const tdb, // dry bulb temperature (Celsius)
     579              :                                          Real64 const dw   // humidity ratio (kgWater/kgDryAir)
     580              :     )
     581              :     {
     582              :         // Faster version with humidity ratio already adjusted
     583         2030 :         assert(dw >= 1.0e-5);
     584         2030 :         Real64 const rhoair(pb / (287.0 * (tdb + Constant::Kelvin) * (1.0 + 1.6077687 * dw)));
     585              : #ifdef EP_psych_errors
     586         2030 :         if (rhoair < 0.0) {
     587            0 :             PsyRhoAirFnPbTdbW_error(state, pb, tdb, dw, rhoair);
     588              :         }
     589              : #endif
     590         2030 :         return rhoair;
     591              :     }
     592              : 
     593        15450 :     inline Real64 PsyHfgAirFnWTdb([[maybe_unused]] Real64 const w, // humidity ratio {kgWater/kgDryAir} !unused1208
     594              :                                   Real64 const T                   // input temperature {Celsius}
     595              :     )
     596              :     {
     597              :         // FUNCTION INFORMATION:
     598              :         //       AUTHOR         Richard Liesen
     599              :         //       DATE WRITTEN   May, 2001
     600              :         //       MODIFIED       June, 2002
     601              :         //       RE-ENGINEERED  na
     602              : 
     603              :         // PURPOSE OF THIS FUNCTION:
     604              :         // This function provides latent energy of air as function of humidity ratio and temperature.
     605              : 
     606              :         // METHODOLOGY EMPLOYED:
     607              :         // calculates hg and then hf and the difference is Hfg.
     608              : 
     609              :         // REFERENCES:
     610              :         // see ASHRAE Fundamentals Psychrometric Chapter
     611              :         // USAGE:  hfg = PsyHfgAirFnWTdb(w,T)
     612              : 
     613              :         // Return value
     614              :         // result => heat of vaporization for moist air {J/kg}
     615              : 
     616              :         // This formulation currently does not use W since it returns results that are in J/kg and the
     617              :         //  amount of energy is on a per unit of moisture basis.
     618              : 
     619        15450 :         Real64 const Temperature(max(T, 0.0));                               // input temperature {Celsius} - corrected for >= 0C
     620        15450 :         return (2500940.0 + 1858.95 * Temperature) - (4180.0 * Temperature); // enthalpy of the gas - enthalpy of the fluid
     621              :     }
     622              : 
     623      1105298 :     inline Real64 PsyHgAirFnWTdb([[maybe_unused]] Real64 const w, // humidity ratio {kgWater/kgDryAir} !unused1208
     624              :                                  Real64 const T                   // input temperature {Celsius}
     625              :     )
     626              :     {
     627              : 
     628              :         // FUNCTION INFORMATION:
     629              :         //       AUTHOR         Richard Liesen
     630              :         //       DATE WRITTEN   May, 2001
     631              :         //       MODIFIED       June, 2002
     632              :         //       RE-ENGINEERED  na
     633              : 
     634              :         // PURPOSE OF THIS FUNCTION:
     635              :         // This function provides latent energy of the moisture as a gas in the air as
     636              :         // function of humidity ratio and temperature.
     637              : 
     638              :         // REFERENCES:
     639              :         // see ASHRAE Fundamentals Psychrometric Chapter
     640              :         // USAGE:  hg = PsyHgAirFnWTdb(w,T)
     641              : 
     642              :         // This formulation currently does not use W since it returns results that are in J/kg and the
     643              :         //  amount of energy is on a per unit of moisture basis.
     644              : 
     645      1105298 :         return 2500940.0 + 1858.95 * T; // enthalpy of the gas {units?}
     646              :     }
     647              : 
     648     11272383 :     inline Real64 PsyHFnTdbW(Real64 const TDB, // dry-bulb temperature {C}
     649              :                              Real64 const dW   // humidity ratio
     650              :     )
     651              :     {
     652              :         // FUNCTION INFORMATION:
     653              :         //       AUTHOR         George Shih
     654              :         //       DATE WRITTEN   May 1976
     655              :         //       MODIFIED       na
     656              :         //       RE-ENGINEERED  na
     657              : 
     658              :         // PURPOSE OF THIS FUNCTION:
     659              :         // This function calculates the enthalpy {J/kg} from dry-bulb temperature and humidity ratio.
     660              : 
     661              :         // REFERENCES:
     662              :         // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P100, EQN 32
     663              : 
     664              :         // calculate enthalpy
     665     11272383 :         return 1.00484e3 * TDB + max(dW, 1.0e-5) * (2.50094e6 + 1.85895e3 * TDB); // enthalpy {J/kg}
     666              :     }
     667              : 
     668         8114 :     inline Real64 PsyHFnTdbW_fast(Real64 const TDB, // dry-bulb temperature {C}
     669              :                                   Real64 const dW   // humidity ratio
     670              :     )
     671              :     {
     672              :         // Faster version with humidity ratio already adjusted
     673         8114 :         assert(dW >= 1.0e-5);
     674              : 
     675              :         // calculate enthalpy
     676         8114 :         return 1.00484e3 * TDB + dW * (2.50094e6 + 1.85895e3 * TDB); // enthalpy {J/kg}
     677              :     }
     678              : 
     679      9503596 :     inline Real64 PsyCpAirFnW(Real64 const dw // humidity ratio {kgWater/kgDryAir}
     680              :     )
     681              :     {
     682              :         // FUNCTION INFORMATION:
     683              :         //       AUTHOR         J. C. VanderZee
     684              :         //       DATE WRITTEN   Feb. 1994
     685              :         //       MODIFIED       na
     686              :         //       RE-ENGINEERED  na
     687              : 
     688              :         // PURPOSE OF THIS FUNCTION:
     689              :         // This function provides the heat capacity of air {J/kg-C} as function of humidity ratio.
     690              : 
     691              :         // METHODOLOGY EMPLOYED:
     692              :         // take numerical derivative of PsyHFnTdbW function
     693              : 
     694              :         // REFERENCES:
     695              :         // see PsyHFnTdbW ref. to ASHRAE Fundamentals
     696              :         // USAGE:  cpa = PsyCpAirFnW(w)
     697              : 
     698              :         // Static locals
     699              :         static Real64 dwSave(-100.0);
     700              :         static Real64 cpaSave(-100.0);
     701              : 
     702              :         // check if last call had the same input and if it did just use the saved output
     703      9503596 :         if (dwSave == dw) {
     704      5130226 :             return cpaSave;
     705              :         }
     706              : 
     707              :         // compute heat capacity of air
     708      4373370 :         Real64 const w(max(dw, 1.0e-5));
     709      4373370 :         Real64 const cpa((1.00484e3 + w * 1.85895e3)); // result => heat capacity of moist air {J/kg-C}
     710              : 
     711              :         // save values for next call
     712      4373370 :         dwSave = dw;
     713      4373370 :         cpaSave = cpa;
     714              : 
     715      4373370 :         return cpa;
     716              :     }
     717              : 
     718            0 :     inline Real64 PsyCpAirFnW_fast(Real64 const dw // humidity ratio {kgWater/kgDryAir}
     719              :     )
     720              :     {
     721              :         // Faster version with humidity ratio already adjusted
     722            0 :         assert(dw >= 1.0e-5);
     723              : 
     724              :         // Static locals
     725              :         static Real64 dwSave(-100.0);
     726              :         static Real64 cpaSave(-100.0);
     727              : 
     728              :         // check if last call had the same input and if it did just use the saved output
     729            0 :         if (dwSave == dw) {
     730            0 :             return cpaSave;
     731              :         }
     732              : 
     733              :         // compute heat capacity of air
     734            0 :         Real64 const cpa((1.00484e3 + dw * 1.85895e3)); // result => heat capacity of moist air {J/kg-C}
     735              : 
     736              :         // save values for next call
     737            0 :         dwSave = dw;
     738            0 :         cpaSave = cpa;
     739              : 
     740            0 :         return cpa;
     741              :     }
     742              : 
     743      1523667 :     inline Real64 PsyTdbFnHW(Real64 const H, // enthalpy {J/kg}
     744              :                              Real64 const dW // humidity ratio
     745              :     )
     746              :     {
     747              :         // FUNCTION INFORMATION:
     748              :         //       AUTHOR         J. C. VanderZee
     749              :         //       DATE WRITTEN   Feb. 1994
     750              :         //       MODIFIED       na
     751              :         //       RE-ENGINEERED  na
     752              : 
     753              :         // PURPOSE OF THIS FUNCTION:
     754              :         // This function provides air temperature from enthalpy and humidity ratio.
     755              : 
     756              :         // REFERENCES:
     757              :         // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P100, EQN 32
     758              :         //   by inverting function PsyHFnTdbW
     759              : 
     760      1523667 :         Real64 const W(max(dW, 1.0e-5));                          // humidity ratio
     761      1523667 :         return (H - 2.50094e6 * W) / (1.00484e3 + 1.85895e3 * W); // result=> dry-bulb temperature {C}
     762              :     }
     763              : 
     764            2 :     inline Real64 PsyRhovFnTdbRhLBnd0C(Real64 const Tdb, // dry-bulb temperature {C}
     765              :                                        Real64 const RH   // relative humidity value (0.0-1.0)
     766              :     )
     767              :     {
     768              :         // FUNCTION INFORMATION:
     769              :         //       AUTHOR         R. J. Liesen
     770              :         //       DATE WRITTEN   July 2000
     771              :         //       MODIFIED       Name change to signify derivation and temperatures were used
     772              :         //                      with 0C as minimum; LKL January 2008
     773              :         //       RE-ENGINEERED  na
     774              : 
     775              :         // PURPOSE OF THIS FUNCTION:
     776              :         // This function provides the Vapor Density in air as a
     777              :         // function of dry bulb temperature, and Relative Humidity.
     778              : 
     779              :         // METHODOLOGY EMPLOYED:
     780              :         // ideal gas law
     781              :         // Universal gas const for water vapor 461.52 J/(kg K)
     782              : 
     783              :         // REFERENCES:
     784              :         // ASHRAE handbook 1993 Fundamentals,
     785              : 
     786            2 :         return RH / (461.52 * (Tdb + Constant::Kelvin)) * std::exp(23.7093 - 4111.0 / ((Tdb + Constant::Kelvin) - 35.45)); // Vapor density in air
     787              :     }
     788              : 
     789       244864 :     inline Real64 PsyRhovFnTdbWPb(Real64 const Tdb, // dry-bulb temperature {C}
     790              :                                   Real64 const dW,  // humidity ratio
     791              :                                   Real64 const PB   // Barometric Pressure {Pascals}
     792              :     )
     793              :     {
     794              :         // FUNCTION INFORMATION:
     795              :         //       AUTHOR         R. J. Liesen
     796              :         //       DATE WRITTEN   July 2000
     797              :         //       MODIFIED       na
     798              :         //       RE-ENGINEERED  na
     799              : 
     800              :         // PURPOSE OF THIS FUNCTION:
     801              :         // This function provides the Vapor Density in air as a
     802              :         // function of dry bulb temperature, Humidity Ratio, and Barometric Pressure.
     803              : 
     804              :         // METHODOLOGY EMPLOYED:
     805              :         // ideal gas law
     806              :         // Universal gas const for water vapor 461.52 J/(kg K)
     807              : 
     808              :         // REFERENCES:
     809              :         // ASHRAE handbook 1993 Fundamentals,
     810              : 
     811       244864 :         Real64 const W(max(dW, 1.0e-5)); // humidity ratio
     812       244864 :         return W * PB / (461.52 * (Tdb + Constant::Kelvin) * (W + 0.62198));
     813              :     }
     814              : 
     815            5 :     inline Real64 PsyRhovFnTdbWPb_fast(Real64 const Tdb, // dry-bulb temperature {C}
     816              :                                        Real64 const dW,  // humidity ratio
     817              :                                        Real64 const PB   // Barometric Pressure {Pascals}
     818              :     )
     819              :     {
     820              :         // Faster version with humidity ratio already adjusted
     821            5 :         assert(dW >= 1.0e-5);
     822            5 :         return dW * PB / (461.52 * (Tdb + Constant::Kelvin) * (dW + 0.62198));
     823              :     }
     824              : 
     825              : #ifdef EP_psych_errors
     826              :     void PsyRhFnTdbRhovLBnd0C_error(EnergyPlusData &state,
     827              :                                     Real64 const Tdb,                 // dry-bulb temperature {C}
     828              :                                     Real64 const Rhovapor,            // vapor density in air {kg/m3}
     829              :                                     Real64 const RHValue,             // relative humidity value (0.0-1.0)
     830              :                                     std::string_view const CalledFrom // routine this function was called from (error messages)
     831              :     );
     832              : #endif
     833              : 
     834              :     inline Real64
     835            5 :     PsyRhFnTdbRhovLBnd0C([[maybe_unused]] EnergyPlusData &state,
     836              :                          Real64 const Tdb,                                       // dry-bulb temperature {C}
     837              :                          Real64 const Rhovapor,                                  // vapor density in air {kg/m3}
     838              :                          [[maybe_unused]] std::string_view const CalledFrom = "" // routine this function was called from (error message)
     839              :     )
     840              :     {
     841              :         // FUNCTION INFORMATION:
     842              :         //       AUTHOR         R. J. Liesen
     843              :         //       DATE WRITTEN   July 2000
     844              :         //       MODIFIED       Name change to signify derivation and temperatures were used
     845              :         //                      with 0C as minimum; LKL January 2008
     846              :         //       RE-ENGINEERED  na
     847              : 
     848              :         // PURPOSE OF THIS FUNCTION:
     849              :         // This function provides the Relative Humidity in air as a
     850              :         // function of dry bulb temperature and Vapor Density.
     851              : 
     852              :         // METHODOLOGY EMPLOYED:
     853              :         // ideal gas law
     854              :         // Universal gas const for water vapor 461.52 J/(kg K)
     855              : 
     856              :         // REFERENCES:
     857              :         // ASHRAE handbook 1993 Fundamentals,
     858              : 
     859              : #ifdef EP_psych_stats
     860              :         ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::RhFnTdbRhovLBnd0C)];
     861              : #endif
     862              : 
     863              :         Real64 const RHValue(
     864            5 :             Rhovapor > 0.0 ? Rhovapor * 461.52 * (Tdb + Constant::Kelvin) * std::exp(-23.7093 + 4111.0 / ((Tdb + Constant::Kelvin) - 35.45)) : 0.0);
     865              : 
     866            5 :         if ((RHValue < 0.0) || (RHValue > 1.0)) {
     867              : #ifdef EP_psych_errors
     868            0 :             if ((RHValue < -0.05) || (RHValue > 1.01)) {
     869            0 :                 PsyRhFnTdbRhovLBnd0C_error(state, Tdb, Rhovapor, RHValue, CalledFrom);
     870              :             }
     871              : #endif
     872            0 :             return min(max(RHValue, 0.01), 1.0);
     873              :         } else {
     874            5 :             return RHValue;
     875              :         }
     876              :     }
     877              : 
     878              : #ifdef EP_cache_PsyTwbFnTdbWPb
     879              : 
     880              :     Real64 PsyTwbFnTdbWPb(EnergyPlusData &state,
     881              :                           Real64 const Tdb,                      // dry-bulb temperature {C}
     882              :                           Real64 const W,                        // humidity ratio
     883              :                           Real64 const Pb,                       // barometric pressure {Pascals}
     884              :                           std::string_view const CalledFrom = "" // routine this function was called from (error messages)
     885              :     );
     886              : 
     887              :     Real64 PsyTwbFnTdbWPb_raw(EnergyPlusData &state,
     888              :                               Real64 const TDB,                      // dry-bulb temperature {C}
     889              :                               Real64 const dW,                       // humidity ratio
     890              :                               Real64 const Patm,                     // barometric pressure {Pascals}
     891              :                               std::string_view const CalledFrom = "" // routine this function was called from (error messages)
     892              :     );
     893              : 
     894              : #else
     895              : 
     896              :     Real64 PsyTwbFnTdbWPb(EnergyPlusData &state,
     897              :                           Real64 const TDB,                      // dry-bulb temperature {C}
     898              :                           Real64 const dW,                       // humidity ratio
     899              :                           Real64 const Patm,                     // barometric pressure {Pascals}
     900              :                           std::string_view const CalledFrom = "" // routine this function was called from (error messages)
     901              :     );
     902              : 
     903              : #endif
     904              : 
     905              : #ifdef EP_psych_errors
     906              :     void PsyVFnTdbWPb_error(EnergyPlusData &state,
     907              :                             Real64 const TDB,                 // dry-bulb temperature {C}
     908              :                             Real64 const w,                   // humidity ratio
     909              :                             Real64 const PB,                  // barometric pressure {Pascals}
     910              :                             Real64 const V,                   // specific volume {m3/kg}
     911              :                             std::string_view const CalledFrom // routine this function was called from (error messages)
     912              :     );
     913              : #endif
     914              : 
     915            4 :     inline Real64 PsyVFnTdbWPb([[maybe_unused]] EnergyPlusData &state,
     916              :                                Real64 const TDB,                                       // dry-bulb temperature {C}
     917              :                                Real64 const dW,                                        // humidity ratio
     918              :                                Real64 const PB,                                        // barometric pressure {Pascals}
     919              :                                [[maybe_unused]] std::string_view const CalledFrom = "" // routine this function was called from (error messages)
     920              :     )
     921              :     {
     922              :         // FUNCTION INFORMATION:
     923              :         //       AUTHOR         George Shih
     924              :         //       DATE WRITTEN   May 1976
     925              :         //       MODIFIED       na
     926              :         //       RE-ENGINEERED  na
     927              : 
     928              :         // PURPOSE OF THIS FUNCTION:
     929              :         // This function provides the specific volume from dry-bulb temperature,
     930              :         // humidity ratio and barometric pressure.
     931              : 
     932              :         // REFERENCES:
     933              :         // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P99, EQN 28
     934              : 
     935              : #ifdef EP_psych_stats
     936              :         ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::VFnTdbWPb)];
     937              : #endif
     938              : 
     939            4 :         Real64 const w(max(dW, 1.0e-5));                                           // humidity ratio
     940            4 :         Real64 const V(1.59473e2 * (1.0 + 1.6078 * w) * (1.8 * TDB + 492.0) / PB); // specific volume {m3/kg}
     941              : 
     942              :         // Validity test
     943            4 :         if (V < 0.0) {
     944              : #ifdef EP_psych_errors
     945            0 :             if (V <= -0.01) {
     946            0 :                 PsyVFnTdbWPb_error(state, TDB, w, PB, V, CalledFrom);
     947              :             }
     948              : #endif
     949            0 :             return 0.83; // Fix Was inside the ifdef
     950              :         } else {
     951            4 :             return V;
     952              :         }
     953              :     }
     954              : 
     955              : #ifdef EP_psych_errors
     956              :     void PsyWFnTdbH_error(EnergyPlusData &state,
     957              :                           Real64 const TDB,                 // dry-bulb temperature {C}
     958              :                           Real64 const H,                   // enthalpy {J/kg}
     959              :                           Real64 const W,                   // humidity ratio
     960              :                           std::string_view const CalledFrom // routine this function was called from (error messages)
     961              :     );
     962              : #endif
     963              : 
     964      1789385 :     inline Real64 PsyWFnTdbH([[maybe_unused]] EnergyPlusData &state,
     965              :                              Real64 const TDB,                                        // dry-bulb temperature {C}
     966              :                              Real64 const H,                                          // enthalpy {J/kg}
     967              :                              [[maybe_unused]] std::string_view const CalledFrom = "", // routine this function was called from (error messages)
     968              :                              [[maybe_unused]] bool const SuppressWarnings = false     // if calling function is calculating an intermediate state
     969              :     )
     970              :     {
     971              :         // FUNCTION INFORMATION:
     972              :         //       AUTHOR         George Shih
     973              :         //       DATE WRITTEN   May 1976
     974              :         //       MODIFIED       na
     975              :         //       RE-ENGINEERED  na
     976              : 
     977              :         // PURPOSE OF THIS FUNCTION:
     978              :         // This function provides the humidity ratio from dry-bulb temperature
     979              :         // and enthalpy.
     980              : 
     981              :         // REFERENCES:
     982              :         // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P100, EQN 32
     983              : 
     984              : #ifdef EP_psych_stats
     985              :         ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::WFnTdbH)];
     986              : #endif
     987              : 
     988      1789385 :         Real64 const W((H - 1.00484e3 * TDB) / (2.50094e6 + 1.85895e3 * TDB)); // humidity ratio
     989              : 
     990              :         // Validity test
     991      1789385 :         if (W < 0.0) {
     992              : #ifdef EP_psych_errors
     993         8411 :             if ((W <= -0.0001) && (!SuppressWarnings)) {
     994         8404 :                 PsyWFnTdbH_error(state, TDB, H, W, CalledFrom);
     995              :             }
     996              : #endif
     997         8411 :             return 1.0e-5;
     998              :         } else {
     999      1780974 :             return W;
    1000              :         }
    1001              :     }
    1002              : 
    1003              : #ifdef EP_cache_PsyPsatFnTemp
    1004              : 
    1005              :     Real64 PsyPsatFnTemp_raw(EnergyPlusData &state,
    1006              :                              Real64 const T,                        // dry-bulb temperature {C}
    1007              :                              std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1008              :     );
    1009              : 
    1010              : // we are disabling these warnings on Windows because the cache value lookups are using 64bit integers,
    1011              : // but the () and [] operator overloads for Array1D (which stores the cache) only uses 32bit lookups
    1012              : // this seems ... very bad. This problem will be fixed when we get rid of Array1D
    1013              : // at which time this warning disable should be removed.
    1014              : #    ifdef _MSC_VER
    1015              : #        pragma warning(push)
    1016              : #        pragma warning(disable : 4244)
    1017              : #    endif
    1018              : 
    1019     12384501 :     inline Real64 PsyPsatFnTemp(EnergyPlusData &state,
    1020              :                                 Real64 const T,                        // dry-bulb temperature {C}
    1021              :                                 std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1022              :     )
    1023              :     {
    1024              :         // FUNCTION INFORMATION:
    1025              :         //       AUTHOR         Linda Lawrie
    1026              :         //       DATE WRITTEN   March 2013
    1027              :         //       MODIFIED       na
    1028              :         //       RE-ENGINEERED  na
    1029              : 
    1030              :         // PURPOSE OF THIS FUNCTION:
    1031              :         // Provide a "cache" of results for the given argument (T) and pressure (Pascal) output result.
    1032              : 
    1033              :         // METHODOLOGY EMPLOYED:
    1034              :         // Use grid shifting and masking to provide hash into the cache. Use Equivalence to
    1035              :         // make Fortran ignore "types".
    1036              : 
    1037              :         // FUNCTION PARAMETER DEFINITIONS:
    1038              :         //  integer(i64), parameter :: Grid_Mask=NOT(ISHFT(1_i64, Grid_Shift)-1)
    1039     12384501 :         std::uint64_t constexpr Grid_Shift = 64 - 12 - psatprecision_bits;
    1040              : 
    1041              : #    ifdef EP_psych_stats
    1042              :         ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::PsatFnTemp_cache)];
    1043              : #    endif
    1044              : 
    1045              :         DISABLE_WARNING_PUSH
    1046              :         DISABLE_WARNING_STRICT_ALIASING
    1047              :         // cppcheck-suppress invalidPointerCast
    1048     12384501 :         Int64 Tdb_tag(*reinterpret_cast<Int64 const *>(&T) >> Grid_Shift);
    1049              :         DISABLE_WARNING_POP
    1050     12384501 :         Int64 const hash(Tdb_tag & psatcache_mask);
    1051     12384501 :         auto &cPsat(state.dataPsychCache->cached_Psat[hash]);
    1052              : 
    1053     12384501 :         if (cPsat.iTdb != Tdb_tag) {
    1054      6071424 :             cPsat.iTdb = Tdb_tag;
    1055      6071424 :             Tdb_tag <<= Grid_Shift;
    1056              :             DISABLE_WARNING_PUSH
    1057              :             DISABLE_WARNING_STRICT_ALIASING
    1058              :             // cppcheck-suppress invalidPointerCast
    1059      6071424 :             Real64 Tdb_tag_r = *reinterpret_cast<Real64 const *>(&Tdb_tag);
    1060              :             DISABLE_WARNING_POP
    1061      6071424 :             cPsat.Psat = PsyPsatFnTemp_raw(state, Tdb_tag_r, CalledFrom);
    1062              :         }
    1063              : 
    1064     12384501 :         return cPsat.Psat; // saturation pressure {Pascals}
    1065              :     }
    1066              : 
    1067              : #else
    1068              : 
    1069              :     Real64 PsyPsatFnTemp(EnergyPlusData &state,
    1070              :                          Real64 const T,                        // dry-bulb temperature {C}
    1071              :                          std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1072              :     );
    1073              : 
    1074              : #endif
    1075              : 
    1076              : #ifdef EP_cache_PsyTsatFnHPb
    1077              :     Real64 PsyTsatFnHPb_raw(EnergyPlusData &state,
    1078              :                             Real64 const H,                        // enthalpy {J/kg}
    1079              :                             Real64 const PB,                       // barometric pressure {Pascals}
    1080              :                             std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1081              :     );
    1082      3012661 :     inline Real64 PsyTsatFnHPb(EnergyPlusData &state,
    1083              :                                Real64 const H,
    1084              :                                Real64 const Pb,                       // barometric pressure {Pascals}
    1085              :                                std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1086              :     )
    1087              :     {
    1088              : 
    1089              :         Real64 Tsat_result; // result=> Sat-Temp {C}
    1090              : 
    1091      3012661 :         std::uint64_t constexpr Grid_Shift = 64 - 12 - tsat_hbp_precision_bits;
    1092              : 
    1093              :         // INTERFACE BLOCK SPECIFICATIONS:
    1094              :         // na
    1095              : 
    1096              :         // DERIVED TYPE DEFINITIONS:
    1097              :         // na
    1098              : 
    1099              :         // FUNCTION LOCAL VARIABLE DECLARATIONS:
    1100              : 
    1101              : #    ifdef EP_psych_stats
    1102              :         ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::TwbFnTdbWPb_cache)];
    1103              : #    endif
    1104              :         DISABLE_WARNING_PUSH
    1105              :         DISABLE_WARNING_STRICT_ALIASING
    1106              :         // cppcheck-suppress invalidPointerCast
    1107      3012661 :         Int64 H_tag = *reinterpret_cast<Int64 const *>(&H) >> Grid_Shift;
    1108              :         // cppcheck-suppress invalidPointerCast
    1109      3012661 :         Int64 Pb_tag = *reinterpret_cast<Int64 const *>(&Pb) >> Grid_Shift;
    1110              :         DISABLE_WARNING_POP
    1111      3012661 :         Int64 hash = (H_tag ^ Pb_tag) & Int64(tsat_hbp_cache_size - 1);
    1112      3012661 :         auto &cached_Tsat_HPb = state.dataPsychCache->cached_Tsat_HPb;
    1113      3012661 :         if (cached_Tsat_HPb[hash].iH != H_tag || cached_Tsat_HPb[hash].iPb != Pb_tag) {
    1114      1098425 :             cached_Tsat_HPb[hash].iH = H_tag;
    1115      1098425 :             cached_Tsat_HPb[hash].iPb = Pb_tag;
    1116      1098425 :             cached_Tsat_HPb[hash].Tsat = PsyTsatFnHPb_raw(state, H, Pb, CalledFrom);
    1117              :         }
    1118              : 
    1119      3012661 :         Tsat_result = cached_Tsat_HPb[hash].Tsat;
    1120              : 
    1121      3012661 :         return Tsat_result;
    1122              :     }
    1123              : 
    1124              : #else
    1125              : 
    1126              :     Real64 PsyTsatFnHPb(EnergyPlusData &state,
    1127              :                         Real64 const H,                        // enthalpy {J/kg}
    1128              :                         Real64 const PB,                       // barometric pressure {Pascals}
    1129              :                         std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1130              :     );
    1131              : 
    1132              : #endif
    1133              : 
    1134       244873 :     inline Real64 PsyRhovFnTdbRh(EnergyPlusData &state,
    1135              :                                  Real64 const Tdb,                      // dry-bulb temperature {C}
    1136              :                                  Real64 const RH,                       // relative humidity value (0.0-1.0)
    1137              :                                  std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1138              :     )
    1139              :     {
    1140              :         // FUNCTION INFORMATION:
    1141              :         //       AUTHOR         R. J. Liesen
    1142              :         //       DATE WRITTEN   July 2000
    1143              :         //       MODIFIED       Change temperature range applied (determine pws); Aug 2007; LKL
    1144              :         //                      Function is continuous over temperature spectrum
    1145              :         //       RE-ENGINEERED  na
    1146              : 
    1147              :         // PURPOSE OF THIS FUNCTION:
    1148              :         // This function provides the Vapor Density in air as a
    1149              :         // function of dry bulb temperature, and Relative Humidity.
    1150              : 
    1151              :         // METHODOLOGY EMPLOYED:
    1152              :         // ideal gas law
    1153              :         // Universal gas const for water vapor 461.52 J/(kg K)
    1154              : 
    1155              :         // REFERENCES:
    1156              :         // ASHRAE handbook 1993 Fundamentals, ??
    1157              :         // Used values from Table 2, HOF 2005, Chapter 6, to verify that these values match (at saturation)
    1158              :         // values from PsyRhFnTdbWPb
    1159              : 
    1160       244873 :         return (PsyPsatFnTemp(state, Tdb, CalledFrom) * RH) / (461.52 * (Tdb + Constant::Kelvin)); // Vapor density in air
    1161              :     }
    1162              : 
    1163              : #ifdef EP_psych_errors
    1164              :     void PsyRhFnTdbRhov_error(EnergyPlusData &state,
    1165              :                               Real64 const Tdb,                      // dry-bulb temperature {C}
    1166              :                               Real64 const Rhovapor,                 // vapor density in air {kg/m3}
    1167              :                               Real64 const RHValue,                  // relative humidity
    1168              :                               std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1169              :     );
    1170              : #endif
    1171              : 
    1172           12 :     inline Real64 PsyRhFnTdbRhov(EnergyPlusData &state,
    1173              :                                  Real64 const Tdb,                                       // dry-bulb temperature {C}
    1174              :                                  Real64 const Rhovapor,                                  // vapor density in air {kg/m3}
    1175              :                                  [[maybe_unused]] std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1176              :     )
    1177              :     {
    1178              :         // FUNCTION INFORMATION:
    1179              :         //       AUTHOR         R. J. Liesen
    1180              :         //       DATE WRITTEN   July 2000
    1181              :         //       MODIFIED       Change temperature range applied (determine pws); Aug 2007; LKL
    1182              :         //                      Function is continuous over temperature spectrum
    1183              :         //       RE-ENGINEERED  na
    1184              : 
    1185              :         // PURPOSE OF THIS FUNCTION:
    1186              :         // This function provides the Relative Humidity in air as a
    1187              :         // function of dry bulb temperature and Vapor Density.
    1188              : 
    1189              :         // METHODOLOGY EMPLOYED:
    1190              :         // ideal gas law
    1191              :         // Universal gas const for water vapor 461.52 J/(kg K)
    1192              : 
    1193              :         // REFERENCES:
    1194              :         // ASHRAE handbook 1993 Fundamentals,
    1195              :         // Used values from Table 2, HOF 2005, Chapter 6, to verify that these values match (at saturation)
    1196              :         // values from PsyRhFnTdbWPb
    1197              : 
    1198              : #ifdef EP_psych_stats
    1199              :         ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::RhFnTdbRhov)];
    1200              : #endif
    1201              : 
    1202           12 :         Real64 const RHValue(Rhovapor > 0.0 ? Rhovapor * 461.52 * (Tdb + Constant::Kelvin) /
    1203           12 :                                                   PsyPsatFnTemp(state, Tdb, PsyRoutineNames[static_cast<int>(PsychrometricFunction::RhFnTdbRhov)])
    1204           12 :                                             : 0.0);
    1205              : 
    1206           12 :         if ((RHValue < 0.0) || (RHValue > 1.0)) {
    1207              : #ifdef EP_psych_errors
    1208            0 :             if ((RHValue < -0.05) || (RHValue > 1.01)) {
    1209            0 :                 PsyRhFnTdbRhov_error(state, Tdb, Rhovapor, RHValue, CalledFrom);
    1210              :             }
    1211              : #endif
    1212            0 :             return min(max(RHValue, 0.01), 1.0);
    1213              :         } else {
    1214           12 :             return RHValue;
    1215              :         }
    1216              :     }
    1217              : 
    1218              : #ifdef EP_psych_errors
    1219              :     void PsyRhFnTdbWPb_error(EnergyPlusData &state,
    1220              :                              Real64 const TDB,                 // dry-bulb temperature {C}
    1221              :                              Real64 const W,                   // humidity ratio
    1222              :                              Real64 const RHValue,             // relative humidity (0.0-1.0)
    1223              :                              std::string_view const CalledFrom // routine this function was called from (error messages)
    1224              :     );
    1225              : #endif
    1226              : 
    1227      1057403 :     inline Real64 PsyRhFnTdbWPb(EnergyPlusData &state,
    1228              :                                 Real64 const TDB,                      // dry-bulb temperature {C}
    1229              :                                 Real64 const dW,                       // humidity ratio
    1230              :                                 Real64 const PB,                       // barometric pressure {Pascals}
    1231              :                                 std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1232              :     )
    1233              :     {
    1234              :         // FUNCTION INFORMATION:
    1235              :         //       AUTHOR         Richard J. Liesen
    1236              :         //       DATE WRITTEN   Nov 1988
    1237              :         //       MODIFIED       Aug 1989, Michael J. Witte
    1238              :         //       RE-ENGINEERED  na
    1239              : 
    1240              :         // PURPOSE OF THIS FUNCTION:
    1241              :         // This function provides the relative humidity value (0.0-1.0) as a result of
    1242              :         // dry-bulb temperature, humidity ratio and barometric pressure.
    1243              : 
    1244              :         // REFERENCES:
    1245              :         // ASHRAE HANDBOOK FUNDAMENTALS 1985, P6.12, EQN 10,21,23
    1246              : 
    1247              : #ifdef EP_psych_stats
    1248              :         ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::RhFnTdbWPb)];
    1249              : #endif
    1250              : 
    1251      1057403 :         Real64 const PWS(PsyPsatFnTemp(state,
    1252              :                                        TDB,
    1253      1057403 :                                        (CalledFrom.empty() ? PsyRoutineNames[static_cast<int>(PsychrometricFunction::RhFnTdbWPb)]
    1254              :                                                            : CalledFrom))); // Pressure -- saturated for pure water
    1255              : 
    1256              :         // Find Degree Of Saturation
    1257      1057403 :         Real64 const W(max(dW, 1.0e-5));                  // humidity ratio
    1258      1057403 :         Real64 const U(W / (0.62198 * PWS / (PB - PWS))); // Degree of Saturation
    1259              : 
    1260              :         // Calculate The Relative Humidity
    1261      1057403 :         Real64 const RHValue(U / (1.0 - (1.0 - U) * (PWS / PB)));
    1262              : 
    1263              :         // Validity test
    1264      1057403 :         if ((RHValue < 0.0) || (RHValue > 1.0)) {
    1265              : #ifdef EP_psych_errors
    1266          608 :             if ((RHValue < -0.05) || (RHValue > 1.01)) {
    1267          509 :                 PsyRhFnTdbWPb_error(state, TDB, W, RHValue, CalledFrom);
    1268              :             }
    1269              : #endif
    1270          608 :             return min(max(RHValue, 0.01), 1.0);
    1271              :         } else {
    1272      1056795 :             return RHValue;
    1273              :         }
    1274              :     }
    1275              : 
    1276              : #ifdef EP_psych_errors
    1277              :     void PsyWFnTdpPb_error(EnergyPlusData &state,
    1278              :                            Real64 const TDP,                 // dew-point temperature {C}
    1279              :                            Real64 const PB,                  // barometric pressure {Pascals}
    1280              :                            Real64 const W,                   // humidity ratio
    1281              :                            Real64 const DeltaT,              // Reduced temperature difference of dew point
    1282              :                            std::string_view const CalledFrom // routine this function was called from (error messages)
    1283              :     );
    1284              : #endif
    1285              : 
    1286      1857301 :     inline Real64 PsyWFnTdpPb(EnergyPlusData &state,
    1287              :                               Real64 const TDP,                      // dew-point temperature {C}
    1288              :                               Real64 const PB,                       // barometric pressure {Pascals}
    1289              :                               std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1290              :     )
    1291              :     {
    1292              :         // FUNCTION INFORMATION:
    1293              :         //       AUTHOR         George Shih
    1294              :         //       DATE WRITTEN   May 1976
    1295              :         //       MODIFIED       na
    1296              :         //       RE-ENGINEERED  na
    1297              : 
    1298              :         // PURPOSE OF THIS FUNCTION:
    1299              :         // This function provides the humidity ratio from dew-point temperature
    1300              :         // and barometric pressure.
    1301              : 
    1302              :         // REFERENCES:
    1303              :         // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P99, EQN 22
    1304              : 
    1305              : #ifdef EP_psych_stats
    1306              :         ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::WFnTdpPb)];
    1307              : #endif
    1308              : 
    1309      1857301 :         Real64 const PDEW(PsyPsatFnTemp(state,
    1310              :                                         TDP,
    1311      1857301 :                                         (CalledFrom.empty() ? PsyRoutineNames[static_cast<int>(PsychrometricFunction::WFnTdpPb)]
    1312              :                                                             : CalledFrom))); // saturation pressure at dew-point temperature {Pascals}
    1313      1857301 :         Real64 const W(PDEW * 0.62198 / (PB - PDEW));                        // humidity ratio
    1314              : 
    1315              :         // Validity test
    1316      1857301 :         if (W < 0.0) {
    1317            3 :             Real64 DeltaT = 0.0;
    1318            3 :             Real64 PDEW1 = PDEW;
    1319           25 :             while (PDEW1 >= PB) {
    1320           22 :                 DeltaT++;
    1321           22 :                 PDEW1 = PsyPsatFnTemp(state,
    1322              :                                       TDP - DeltaT,
    1323           22 :                                       (CalledFrom.empty() ? PsyRoutineNames[static_cast<int>(PsychrometricFunction::WFnTdpPb)]
    1324              :                                                           : CalledFrom)); // saturation pressure at dew-point temperature {Pascals}
    1325              :             }
    1326            3 :             Real64 W1 = PDEW1 * 0.62198 / (PB - PDEW1);
    1327              : #ifdef EP_psych_errors
    1328            3 :             if (W <= -0.0001) {
    1329            3 :                 PsyWFnTdpPb_error(state, TDP, PB, W1, DeltaT, CalledFrom);
    1330              :             }
    1331              : #endif
    1332            3 :             return W1;
    1333              :         } else {
    1334      1857298 :             return W;
    1335              :         }
    1336              :     }
    1337              : 
    1338              : #ifdef EP_psych_errors
    1339              :     void PsyWFnTdbRhPb_error(EnergyPlusData &state,
    1340              :                              Real64 const TDB,                 // dry-bulb temperature {C}
    1341              :                              Real64 const RH,                  // relative humidity value (0.0-1.0)
    1342              :                              Real64 const PB,                  // barometric pressure {Pascals}
    1343              :                              Real64 const W,                   // humidity ratio
    1344              :                              std::string_view const CalledFrom // routine this function was called from (error messages)
    1345              :     );
    1346              : #endif
    1347              : 
    1348      1401337 :     inline Real64 PsyWFnTdbRhPb(EnergyPlusData &state,
    1349              :                                 Real64 const TDB,                      // dry-bulb temperature {C}
    1350              :                                 Real64 const RH,                       // relative humidity value (0.0-1.0)
    1351              :                                 Real64 const PB,                       // barometric pressure {Pascals}
    1352              :                                 std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1353              :     )
    1354              :     {
    1355              :         // FUNCTION INFORMATION:
    1356              :         //       AUTHOR         George Shih
    1357              :         //       DATE WRITTEN   May 1976
    1358              :         //       MODIFIED       na
    1359              :         //       RE-ENGINEERED  na
    1360              : 
    1361              :         // PURPOSE OF THIS FUNCTION:
    1362              :         // This function provides the humidity ratio from dry-bulb temperature,
    1363              :         // relative humidty (value) and barometric pressure.
    1364              : 
    1365              :         // REFERENCES:
    1366              :         // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P99, EQN 22
    1367              : 
    1368              : #ifdef EP_psych_stats
    1369              :         ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::WFnTdbRhPb)];
    1370              : #endif
    1371              : 
    1372      1401337 :         Real64 const PDEW(RH * PsyPsatFnTemp(state,
    1373              :                                              TDB,
    1374      1401337 :                                              (CalledFrom.empty() ? PsyRoutineNames[static_cast<int>(PsychrometricFunction::WFnTdbRhPb)]
    1375      1401337 :                                                                  : CalledFrom))); // Pressure at dew-point temperature {Pascals}
    1376              : 
    1377              :         // Numeric error check when the temperature and RH values cause Pdew to equal or exceed
    1378              :         // barometric pressure which is physically impossible. An approach limit of 1000 pascals
    1379              :         // was chosen to keep the numerics stable as the denominator approaches 0.
    1380      1401337 :         Real64 const W(PDEW * 0.62198 / max(PB - PDEW, 1000.0)); // humidity ratio
    1381              :         // THIS EQUATION IN SI UNIT IS FROM ASHRAE HANDBOOK OF FUNDAMENTALS PAGE 99  EQUATION 22
    1382              : 
    1383              :         // Validity test
    1384      1401337 :         if (W < 1.0e-5) {
    1385              : #ifdef EP_psych_errors
    1386          339 :             if (W <= -0.0001) {
    1387            0 :                 PsyWFnTdbRhPb_error(state, TDB, RH, PB, W, CalledFrom);
    1388              :             }
    1389              : #endif
    1390          339 :             return 1.0e-5;
    1391              :         } else {
    1392      1400998 :             return W;
    1393              :         }
    1394              :     }
    1395              : 
    1396              : #ifdef EP_psych_errors
    1397              : 
    1398              :     void PsyWFnTdbTwbPb_temperature_error(EnergyPlusData &state,
    1399              :                                           Real64 const TDB,                 // dry-bulb temperature {C}
    1400              :                                           Real64 const TWB,                 // wet-bulb temperature {C}
    1401              :                                           Real64 const PB,                  // barometric pressure {Pascals}
    1402              :                                           std::string_view const CalledFrom // routine this function was called from (error messages)
    1403              :     );
    1404              : 
    1405              :     void PsyWFnTdbTwbPb_humidity_error(EnergyPlusData &state,
    1406              :                                        Real64 const TDB,                 // dry-bulb temperature {C}
    1407              :                                        Real64 const TWB,                 // wet-bulb temperature {C}
    1408              :                                        Real64 const PB,                  // barometric pressure {Pascals}
    1409              :                                        Real64 const W,                   // humidity ratio
    1410              :                                        std::string_view const CalledFrom // routine this function was called from (error messages)
    1411              :     );
    1412              : 
    1413              : #endif
    1414              : 
    1415      4417661 :     inline Real64 PsyWFnTdbTwbPb(EnergyPlusData &state,
    1416              :                                  Real64 const TDB,                      // dry-bulb temperature {C}
    1417              :                                  Real64 const TWBin,                    // wet-bulb temperature {C}
    1418              :                                  Real64 const PB,                       // barometric pressure {Pascals}
    1419              :                                  std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1420              :     )
    1421              :     {
    1422              :         // FUNCTION INFORMATION:
    1423              :         //       AUTHOR         George Shih
    1424              :         //       DATE WRITTEN   May 1976
    1425              :         //       MODIFIED       na
    1426              :         //       RE-ENGINEERED  na
    1427              : 
    1428              :         // PURPOSE OF THIS FUNCTION:
    1429              :         // This function provides the humidity ratio from dry-bulb temperature,
    1430              :         // wet-bulb temperature and barometric pressure.
    1431              : 
    1432              :         // REFERENCES:
    1433              :         // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P99, EQ 22,35
    1434              : 
    1435              : #ifdef EP_psych_stats
    1436              :         ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::WFnTdbTwbPb)];
    1437              : #endif
    1438              : 
    1439      4417661 :         Real64 TWB(TWBin); // test wet-bulb temperature
    1440              : 
    1441              :         // Validity check
    1442      4417661 :         if (TWB > TDB) {
    1443              : #ifdef EP_psych_errors
    1444         5402 :             if (TWB > TDB + 0.01) {
    1445            2 :                 PsyWFnTdbTwbPb_temperature_error(state, TDB, TWB, PB, CalledFrom);
    1446              :             }
    1447              : #endif
    1448         5402 :             TWB = TDB;
    1449              :         }
    1450              : 
    1451              :         // Calculation
    1452      4417661 :         Real64 const PWET(PsyPsatFnTemp(state,
    1453              :                                         TWB,
    1454      4417661 :                                         (CalledFrom.empty() ? PsyRoutineNames[static_cast<int>(PsychrometricFunction::WFnTdbTwbPb)]
    1455              :                                                             : CalledFrom))); // Pressure at wet-bulb temperature {Pascals}
    1456      4417661 :         Real64 const WET(0.62198 * PWET / (PB - PWET));                      // Humidity ratio at wet-bulb temperature
    1457      4417661 :         Real64 const W(((2501.0 - 2.381 * TWB) * WET - (TDB - TWB)) / (2501.0 + 1.805 * TDB - 4.186 * TWB)); // humidity ratio
    1458              : 
    1459              :         // Validity check
    1460      4417661 :         if (W < 0.0) {
    1461              : #ifdef EP_psych_errors
    1462          185 :             PsyWFnTdbTwbPb_humidity_error(state, TDB, TWB, PB, W, CalledFrom);
    1463              : #endif
    1464          185 :             return PsyWFnTdbRhPb(state, TDB, 0.0001, PB, CalledFrom);
    1465              :         } else {
    1466      4417476 :             return W;
    1467              :         }
    1468              :     }
    1469              : 
    1470       141248 :     inline Real64 PsyHFnTdbRhPb(EnergyPlusData &state,
    1471              :                                 Real64 const TDB,                      // dry-bulb temperature {C}
    1472              :                                 Real64 const RH,                       // relative humidity value (0.0 - 1.0)
    1473              :                                 Real64 const PB,                       // barometric pressure (N/M**2) {Pascals}
    1474              :                                 std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1475              :     )
    1476              :     {
    1477              :         // FUNCTION INFORMATION:
    1478              :         //       AUTHOR         J. C. VanderZee
    1479              :         //       DATE WRITTEN   Feb. 1994
    1480              :         //       MODIFIED       na
    1481              :         //       RE-ENGINEERED  na
    1482              : 
    1483              :         // PURPOSE OF THIS FUNCTION:
    1484              :         // This function provides air enthalpy from temperature and relative humidity.
    1485              : 
    1486              :         // METHODOLOGY EMPLOYED:
    1487              :         // na
    1488              : 
    1489              :         // REFERENCES:
    1490              :         // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P100, EQN 32
    1491              :         //   by using functions PsyWFnTdbRhPb and PsyHFnTdbW
    1492              : 
    1493       141248 :         return PsyHFnTdbW(TDB, max(PsyWFnTdbRhPb(state, TDB, RH, PB, CalledFrom), 1.0e-5)); // enthalpy {J/kg}
    1494              :     }
    1495              : 
    1496              : #ifdef EP_cache_PsyTsatFnPb
    1497              : 
    1498              :     Real64 PsyTsatFnPb_raw(EnergyPlusData &state,
    1499              :                            Real64 const Press,                    // barometric pressure {Pascals}
    1500              :                            std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1501              :     );
    1502              : 
    1503      2421732 :     inline Real64 PsyTsatFnPb(EnergyPlusData &state,
    1504              :                               Real64 const Press,                    // barometric pressure {Pascals}
    1505              :                               std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1506              :     )
    1507              :     {
    1508              : 
    1509      2421732 :         std::uint64_t Grid_Shift = 64 - 12 - state.dataPsychCache->tsatprecision_bits;
    1510              :         DISABLE_WARNING_PUSH
    1511              :         DISABLE_WARNING_STRICT_ALIASING
    1512              :         // cppcheck-suppress invalidPointerCast
    1513      2421732 :         Int64 const Pb_tag(*reinterpret_cast<Int64 const *>(&Press) >> Grid_Shift);
    1514              :         DISABLE_WARNING_POP
    1515              : 
    1516      2421732 :         Int64 const hash(Pb_tag & tsatcache_mask);
    1517      2421732 :         auto &cTsat(state.dataPsychCache->cached_Tsat[hash]);
    1518      2421732 :         if (cTsat.iPb != Pb_tag) {
    1519       133236 :             cTsat.iPb = Pb_tag;
    1520       133236 :             cTsat.Tsat = PsyTsatFnPb_raw(state, Press, CalledFrom);
    1521              :         }
    1522              : 
    1523      2421732 :         return cTsat.Tsat; // saturation temperature
    1524              :     }
    1525              : 
    1526              : #    ifdef _MSC_VER
    1527              : #        pragma warning(pop)
    1528              : #    endif
    1529              : 
    1530              : #else
    1531              :     Real64 PsyTsatFnPb(EnergyPlusData &state,
    1532              :                        Real64 const Press,                    // barometric pressure {Pascals}
    1533              :                        std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1534              :     );
    1535              : #endif
    1536              : 
    1537      2393805 :     inline Real64 PsyTdpFnWPb(EnergyPlusData &state,
    1538              :                               Real64 const W,                        // humidity ratio
    1539              :                               Real64 const PB,                       // barometric pressure (N/M**2) {Pascals}
    1540              :                               std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1541              :     )
    1542              :     {
    1543              :         // FUNCTION INFORMATION:
    1544              :         //       AUTHOR         George Shih
    1545              :         //       DATE WRITTEN   May 1976
    1546              :         //       MODIFIED       na
    1547              :         //       RE-ENGINEERED  na
    1548              : 
    1549              :         // PURPOSE OF THIS FUNCTION:
    1550              :         // This function calculates the dew-point temperature {C} from humidity ratio and pressure.
    1551              : 
    1552              :         // METHODOLOGY EMPLOYED:
    1553              :         // na
    1554              : 
    1555              :         // REFERENCES:
    1556              :         // ASHRAE HANDBOOK OF FUNDAMENTALS, 1972, P.99, EQN 22
    1557              : 
    1558      2393805 :         Real64 const W0(max(W, 1.0e-5));             // limited humidity ratio
    1559      2393805 :         Real64 const PDEW(PB * W0 / (0.62198 + W0)); // pressure at dew point temperature
    1560      2393805 :         return PsyTsatFnPb(state, PDEW, CalledFrom);
    1561              :     }
    1562              : 
    1563              : #ifdef EP_psych_errors
    1564              :     void PsyTdpFnTdbTwbPb_error(EnergyPlusData &state,
    1565              :                                 Real64 const TDB,                 // dry-bulb temperature {C}
    1566              :                                 Real64 const TWB,                 // wet-bulb temperature {C}
    1567              :                                 Real64 const PB,                  // barometric pressure (N/M**2) {Pascals}
    1568              :                                 Real64 const W,                   // humidity ratio
    1569              :                                 Real64 const TDP,                 // dew-point temperature {C}
    1570              :                                 std::string_view const CalledFrom // routine this function was called from (error messages)
    1571              :     );
    1572              : #endif
    1573              : 
    1574            6 :     inline Real64 PsyTdpFnTdbTwbPb(EnergyPlusData &state,
    1575              :                                    Real64 const TDB,                      // dry-bulb temperature {C}
    1576              :                                    Real64 const TWB,                      // wet-bulb temperature {C}
    1577              :                                    Real64 const PB,                       // barometric pressure (N/M**2) {Pascals}
    1578              :                                    std::string_view const CalledFrom = "" // routine this function was called from (error messages)
    1579              :     )
    1580              :     {
    1581              :         // FUNCTION INFORMATION:
    1582              :         //       AUTHOR         George Shih
    1583              :         //       DATE WRITTEN   May 1976
    1584              :         //       MODIFIED       na
    1585              :         //       RE-ENGINEERED  na
    1586              : 
    1587              :         // PURPOSE OF THIS FUNCTION:
    1588              :         // This function calculates the dew-point temperature {C} from dry-bulb, wet-bulb and pressure.
    1589              : 
    1590              : #ifdef EP_psych_stats
    1591              :         ++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::TdpFnTdbTwbPb)];
    1592              : #endif
    1593              : 
    1594            6 :         Real64 const W(max(PsyWFnTdbTwbPb(state, TDB, TWB, PB, CalledFrom), 1.0e-5));
    1595            6 :         Real64 const TDP(PsyTdpFnWPb(state, W, PB, CalledFrom));
    1596              : 
    1597            6 :         if (TDP > TWB) {
    1598              : #ifdef EP_psych_errors
    1599            0 :             if (TDP > TWB + 0.1) {
    1600            0 :                 PsyTdpFnTdbTwbPb_error(state, TDB, TWB, PB, W, TDP, CalledFrom);
    1601              :             }
    1602              : #endif
    1603            0 :             return TWB;
    1604              :         } else {
    1605            6 :             return TDP;
    1606              :         }
    1607              :     }
    1608              : 
    1609      1098436 :     inline Real64 F6(Real64 const X, Real64 const A0, Real64 const A1, Real64 const A2, Real64 const A3, Real64 const A4, Real64 const A5)
    1610              :     {
    1611      1098436 :         return A0 + X * (A1 + X * (A2 + X * (A3 + X * (A4 + X * A5))));
    1612              :     }
    1613              : 
    1614              :     inline Real64
    1615            1 :     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)
    1616              :     {
    1617            1 :         return (A0 + X * (A1 + X * (A2 + X * (A3 + X * (A4 + X * (A5 + X * A6)))))) / 1.0E10;
    1618              :     }
    1619              : 
    1620          578 :     inline Real64 CPCW([[maybe_unused]] Real64 const Temperature // unused1208
    1621              :     )
    1622              :     {
    1623              :         // FUNCTION INFORMATION:
    1624              :         //       AUTHOR         RUSSELL D. TAYLOR
    1625              :         //       DATE WRITTEN   April 1992
    1626              : 
    1627              :         // PURPOSE OF THIS FUNCTION:
    1628              :         // This function provides the specific heat of chilled water. CPCW (J/Kg/k)
    1629              : 
    1630          578 :         return 4180.0;
    1631              :     }
    1632              : 
    1633        13608 :     inline Real64 CPHW([[maybe_unused]] Real64 const Temperature // unused1208
    1634              :     )
    1635              :     {
    1636              :         // FUNCTION INFORMATION:
    1637              :         //       AUTHOR         RUSSELL D. TAYLOR
    1638              :         //       DATE WRITTEN   April 1992
    1639              : 
    1640              :         // PURPOSE OF THIS FUNCTION:
    1641              :         // This function provides the specific heat of hot water. CPHW (J/Kg/k)
    1642              : 
    1643        13608 :         return 4180.0;
    1644              :     }
    1645              : 
    1646       118313 :     inline Real64 RhoH2O(Real64 const TB // Dry bulb temperature. {C}
    1647              :     )
    1648              :     {
    1649              :         // FUNCTION INFORMATION:
    1650              :         //       AUTHOR         SIGSTEINN P. GRETARSSON
    1651              :         //       DATE WRITTEN   April 1992
    1652              : 
    1653              :         // PURPOSE OF THIS FUNCTION:
    1654              :         // This function provides the density of water at a specific temperature.
    1655              : 
    1656              :         // METHODOLOGY EMPLOYED:
    1657              :         //     Density of water [kg/m3]
    1658              :         //     (RANGE: KelvinConv - 423.15 DEG. K) (convert to C first)
    1659              : 
    1660       118313 :         return 1000.1207 + 8.3215874e-04 * TB - 4.929976e-03 * pow_2(TB) + 8.4791863e-06 * pow_3(TB);
    1661              :     }
    1662              : 
    1663       976306 :     inline Real64 PsyDeltaHSenFnTdb2Tdb1W(Real64 const TDB2, // dry-bulb temperature at state 1 {C}
    1664              :                                           Real64 const TDB1, // dry-bulb temperature at state 2 {C}
    1665              :                                           Real64 const W     // humidity ratio (at zone air node or Wmin)
    1666              :     )
    1667              :     {
    1668              :         // When called for zone equipment flow entering a zone (from CalcZoneSensibleLatentOutput or CalcZoneSensibleOutput):
    1669              :         // returns sensible enthalpy difference between equipment supply air (TDB2) and zone air (TDB1) evaluated
    1670              :         // using the zone air node humidity ratio. This enthalpy difference multiplied by supply
    1671              :         // air mass flow rate yields the sensible heat transfer rate in Watts.
    1672              :         // positive value is heating, negative value is cooling
    1673              : 
    1674              :         // When called across a component (from PsyDeltaHSenFnTdb2W2Tdb1W1 by CalcComponentSensibleLatentOutput):
    1675              :         // returns sensible enthalpy difference between state 1 (TDB1) and state 2 (TDB2) using the minimum
    1676              :         // humidity ratio from states 1 and 2. This enthalpy difference multiplied by supply air mass flow
    1677              :         // rate yields the sensible heat transfer rate in Watts.
    1678              :         // positive value is heating, negative value is cooling
    1679              : 
    1680              :         // the following two functions for calculating enthalpy difference are equivalent:
    1681              :         // PsyDeltaHSenFnTdb2Tdb1W() = PsyHFnTdbW(TDB2, W) - PsyHFnTdbW(TDB1, W)
    1682              :         // PsyDeltaHSenFnTdb2Tdb1W() function was derived by simplifying the expression above
    1683              :         // The constant coefficients come from the equation for moist air enthalpy, PsyHFnTdbW()
    1684              : 
    1685       976306 :         return (1.00484e3 + max(1.0e-5, W) * 1.85895e3) * (TDB2 - TDB1);
    1686              :     }
    1687              : 
    1688       512297 :     inline Real64 PsyDeltaHSenFnTdb2W2Tdb1W1(Real64 const TDB2, // dry-bulb temperature at state 2 {C}
    1689              :                                              Real64 const W2,   // humidity ratio at state 2
    1690              :                                              Real64 const TDB1, // dry-bulb temperature at state 1 {C}
    1691              :                                              Real64 const W1    // humidity ratio at state 1
    1692              :     )
    1693              :     {
    1694              :         // returns sensible enthalpy difference of moist air going from state 1 to state 2 (e.g across coils)
    1695              :         // using the minimum humidity ratio state points 1 and 2. This enthalpy difference multiplied by
    1696              :         // supply air mass flow rate yields sensible heat transfer rate across coils in Watts
    1697              :         // positive value is heating, negative value is cooling
    1698              : 
    1699              :         // the following two functions for calculating enthalpy difference are equivalent:
    1700              :         // PsyDeltaHSenFnTdb2W2Tdb1W1() = PsyHFnTdbW(TDB2, min(W1, W2)) - PsyHFnTdbW(TDB1, min(W1,W2))
    1701              :         // PsyDeltaHSenFnTdb2W2Tdb1W1() function was derived by simplifying the above expression
    1702              :         // The constant coefficients came from the equation for moist air enthalpy, PsyHFnTdbW()
    1703              : 
    1704       512297 :         Real64 const Wmin = min(W1, W2);
    1705       512297 :         return PsyDeltaHSenFnTdb2Tdb1W(TDB2, TDB1, Wmin);
    1706              :     }
    1707              :     Real64 CSplineint(int const n, // sample data size
    1708              :                       Real64 x);   // given value of x
    1709              : } // namespace Psychrometrics
    1710              : 
    1711              : struct PsychrometricsData : BaseGlobalStruct
    1712              : {
    1713              :     Real64 iconvTol = 0.0001;
    1714              :     Real64 last_Patm = -99999.0;  // barometric pressure {Pascals}  (last)
    1715              :     Real64 last_tBoil = -99999.0; // Boiling temperature of water at given pressure (last)
    1716              :     Real64 Press_Save = -99999.0;
    1717              :     Real64 tSat_Save = -99999.0;
    1718              :     std::array<int, static_cast<int>(EnergyPlus::PsychrometricFunction::Num)> iPsyErrIndex;
    1719              :     std::string String;
    1720              :     bool ReportErrors = true;
    1721              :     bool useInterpolationPsychTsatFnPb = false;
    1722              : 
    1723         2128 :     void init_constant_state(EnergyPlusData &state) override
    1724              :     {
    1725         2128 :         Psychrometrics::InitializePsychRoutines(state);
    1726         2128 :     }
    1727              : 
    1728         1154 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
    1729              :     {
    1730         1154 :     }
    1731              : 
    1732         2102 :     void clear_state() override
    1733              :     {
    1734         2102 :         iPsyErrIndex.fill(0);
    1735         2102 :         iconvTol = 0.0001;
    1736         2102 :         last_Patm = -99999.0;  // barometric pressure {Pascals}  (last)
    1737         2102 :         last_tBoil = -99999.0; // Boiling temperature of water at given pressure (last)
    1738         2102 :         Press_Save = -99999.0;
    1739         2102 :         tSat_Save = -99999.0;
    1740         2102 :         String = "";
    1741         2102 :         ReportErrors = true;
    1742         2102 :         useInterpolationPsychTsatFnPb = false;
    1743         2102 :     }
    1744              : };
    1745              : 
    1746              : } // namespace EnergyPlus
    1747              : 
    1748              : #endif
        

Generated by: LCOV version 2.0-1