diff --git a/.github/workflows/mac_build.yml b/.github/workflows/mac_build.yml new file mode 100644 index 00000000000..6051d8aa61c --- /dev/null +++ b/.github/workflows/mac_build.yml @@ -0,0 +1,172 @@ +name: Mac Build + +on: [push] + +jobs: + python_no_psychcach: + runs-on: macos-10.15 + + steps: + - uses: actions/checkout@v2 +# + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Create Build Directory + run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/EnergyPlus/build + run: cmake -DCMAKE_BUILD_TYPE=Release -DLINK_WITH_PYTHON=ON -DUSE_PSYCHROMETRICS_CACHING=OFF .. + + - name: Build EnergyPlus + working-directory: ${{runner.workspace}}/EnergyPlus/build + shell: bash + run: cmake --build . --target energyplus -j 2 + + no_python_psychcach: + runs-on: macos-10.15 + + steps: + - uses: actions/checkout@v2 + # + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Create Build Directory + run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/EnergyPlus/build + run: cmake -DCMAKE_BUILD_TYPE=Release -DLINK_WITH_PYTHON=OFF -DUSE_PSYCHROMETRICS_CACHING=ON .. + + - name: Build EnergyPlus + working-directory: ${{runner.workspace}}/EnergyPlus/build + shell: bash + run: cmake --build . --target energyplus -j 2 + + no_python_no_psychcach: + runs-on: macos-10.15 + + steps: + - uses: actions/checkout@v2 + # + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Create Build Directory + run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/EnergyPlus/build + run: cmake -DCMAKE_BUILD_TYPE=Release -DLINK_WITH_PYTHON=OFF -DUSE_PSYCHROMETRICS_CACHING=OFF .. + + - name: Build EnergyPlus + working-directory: ${{runner.workspace}}/EnergyPlus/build + shell: bash + run: cmake --build . --target energyplus -j 2 + + no_glcol_cache: + runs-on: macos-10.15 + + steps: + - uses: actions/checkout@v2 + # + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Create Build Directory + run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/EnergyPlus/build + run: cmake -DCMAKE_BUILD_TYPE=Release -DUSE_GLYCOL_CACHING=OFF .. + + - name: Build EnergyPlus + working-directory: ${{runner.workspace}}/EnergyPlus/build + shell: bash + run: cmake --build . --target energyplus -j 2 + + no_opengl: + runs-on: macos-10.15 + + steps: + - uses: actions/checkout@v2 + # + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Create Build Directory + run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/EnergyPlus/build + run: cmake -DCMAKE_BUILD_TYPE=Release -OPENGL_REQUIRED=OFF .. + + - name: Build EnergyPlus + working-directory: ${{runner.workspace}}/EnergyPlus/build + shell: bash + run: cmake --build . --target energyplus -j 2 + + use_psych_stats: + runs-on: macos-10.15 + + steps: + - uses: actions/checkout@v2 + # + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Create Build Directory + run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/EnergyPlus/build + run: cmake -DCMAKE_BUILD_TYPE=Release -USE_PSYCH_STATS=ON .. + + - name: Build EnergyPlus + working-directory: ${{runner.workspace}}/EnergyPlus/build + shell: bash + run: cmake --build . --target energyplus -j 2 + + no_use_psych_errors: + runs-on: macos-10.15 + + steps: + - uses: actions/checkout@v2 + # + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Create Build Directory + run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/EnergyPlus/build + run: cmake -DCMAKE_BUILD_TYPE=Release -USE_PSYCH_ERRORS=OFF .. + + - name: Build EnergyPlus + working-directory: ${{runner.workspace}}/EnergyPlus/build + shell: bash + run: cmake --build . --target energyplus -j 2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6407fc2856f..ba698b0f52c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,10 @@ endif() option( BUILD_PACKAGE "Build package" OFF ) option( BUILD_TESTING "Build testing targets" OFF ) option( BUILD_FORTRAN "Build Fortran stuff" OFF ) +option( USE_PSYCHROMETRICS_CACHING "Use psychrometrics cashing routines" ON ) +option( USE_GLYCOL_CACHING "Use glycol cashing routines" ON ) +option( USE_PSYCH_STATS "Compute psychrometric stats" OFF ) +option( USE_PSYCH_ERRORS "Report psychrometric errors " ON ) ####################################################################### @@ -392,3 +396,7 @@ mark_as_advanced(BUILD_GMOCK) mark_as_advanced(BUILD_GTEST) mark_as_advanced(gmock_build_tests) mark_as_advanced(BUILD_WCE_TESTING) +mark_as_advanced(USE_PSYCHROMETRICS_CACHING) +mark_as_advanced(USE_GLYCOL_CACHING) +mark_as_advanced(USE_PSYCH_STATS) +mark_as_advanced(USE_PSYCH_ERRORS) diff --git a/src/EnergyPlus/CMakeLists.txt b/src/EnergyPlus/CMakeLists.txt index 75a16febec5..e1cd33659bf 100644 --- a/src/EnergyPlus/CMakeLists.txt +++ b/src/EnergyPlus/CMakeLists.txt @@ -15,6 +15,24 @@ else() add_definitions("-DLINK_WITH_PYTHON=0") endif() +if(USE_PSYCHROMETRICS_CACHING) + # Caching defaulted ON +else() + add_definitions("-DEP_nocache_Psychrometrics") +endif() + +if(USE_GLYCOL_CACHING) + add_definitions("-DEP_cache_GlycolSpecificHeat") +endif() + +if(USE_PSYCH_STATS) + add_definitions("-DEP_psych_stats") +endif() + +if(USE_PSYCH_ERRORS) + add_definitions("-DEP_psych_errors") +endif() + SET( SRC "${PROJECT_SOURCE_DIR}/third_party/milo/dtoa.h" "${PROJECT_SOURCE_DIR}/third_party/milo/itoa.h" diff --git a/src/EnergyPlus/FluidProperties.cc b/src/EnergyPlus/FluidProperties.cc index 3171161f7ac..68a34ca2251 100644 --- a/src/EnergyPlus/FluidProperties.cc +++ b/src/EnergyPlus/FluidProperties.cc @@ -62,8 +62,6 @@ #include #include -#define EP_cache_GlycolSpecificHeat - namespace EnergyPlus { namespace FluidProperties { diff --git a/src/EnergyPlus/FluidProperties.hh b/src/EnergyPlus/FluidProperties.hh index ae3a090bfad..99b7289d5c6 100644 --- a/src/EnergyPlus/FluidProperties.hh +++ b/src/EnergyPlus/FluidProperties.hh @@ -60,9 +60,6 @@ #include #include -#define EP_cache_GlycolSpecificHeat - - namespace EnergyPlus { // Forward declarations @@ -551,7 +548,8 @@ namespace FluidProperties { return cTsh.sh; // saturation pressure {Pascals} } #else - Real64 GetSpecificHeatGlycol(std::string const &Glycol, // carries in substance name + Real64 GetSpecificHeatGlycol(EnergyPlusData &state, + std::string const &Glycol, // carries in substance name Real64 const Temperature, // actual temperature given as input int &GlycolIndex, // Index to Glycol Properties std::string const &CalledFrom // routine this function was called from (error messages) diff --git a/src/EnergyPlus/PluginManager.cc b/src/EnergyPlus/PluginManager.cc index f41d96266a4..69d0151a761 100644 --- a/src/EnergyPlus/PluginManager.cc +++ b/src/EnergyPlus/PluginManager.cc @@ -132,7 +132,7 @@ namespace PluginManagement { return "Linked to Python Version: \"" + sVersion + "\""; } #else - std::string pythonStringForUsage(EnergyPlusData &state) + std::string pythonStringForUsage([[maybe_unused]] EnergyPlusData &state) { return "This version of EnergyPlus not linked to Python library."; } @@ -1093,7 +1093,7 @@ namespace PluginManagement { } } #else - void PluginManager::addToPythonPath([[maybe_unused]] EnergyPlusData &state, const std::string &EP_UNUSED(path), bool EP_UNUSED(userDefinedPath)) + void PluginManager::addToPythonPath([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const std::string &path, [[maybe_unused]] bool userDefinedPath) { } #endif @@ -1135,8 +1135,8 @@ namespace PluginManagement { } #else int PluginManager::getGlobalVariableHandle([[maybe_unused]] EnergyPlusData &state, - const std::string &EP_UNUSED(name), - bool const EP_UNUSED(suppress_warning)) + [[maybe_unused]] const std::string &name, + [[maybe_unused]] bool const suppress_warning) { return -1; } @@ -1306,7 +1306,7 @@ namespace PluginManagement { return 0.0; } #else - Real64 PluginManager::getGlobalVariableValue([[maybe_unused]] EnergyPlusData &state, int EP_UNUSED(handle)) + Real64 PluginManager::getGlobalVariableValue([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] int handle) { return 0.0; } @@ -1328,7 +1328,7 @@ namespace PluginManagement { } } #else - void PluginManager::setGlobalVariableValue([[maybe_unused]] EnergyPlusData &state, int EP_UNUSED(handle), Real64 EP_UNUSED(value)) + void PluginManager::setGlobalVariableValue([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] int handle, [[maybe_unused]] Real64 value) { } #endif diff --git a/src/EnergyPlus/Psychrometrics.cc b/src/EnergyPlus/Psychrometrics.cc index b86bef5255d..9bac2a5ae37 100644 --- a/src/EnergyPlus/Psychrometrics.cc +++ b/src/EnergyPlus/Psychrometrics.cc @@ -72,7 +72,6 @@ namespace EnergyPlus { #define EP_cache_PsyTsatFnPb #define EP_cache_PsyTsatFnHPb #endif -#define EP_psych_errors namespace Psychrometrics { // Module containing the Psychometric simulation routines @@ -98,7 +97,7 @@ namespace Psychrometrics { // more research on hfg calc // Using/Aliasing - #ifdef EP_psych_errors +#ifdef EP_psych_errors using namespace DataEnvironment; #endif @@ -107,31 +106,6 @@ namespace Psychrometrics { #endif - // Data - // MODULE PARAMETER DEFINITIONS: - static std::string const BlankString; - // call for recurring errors - int const iPsyTdpFnTdbTwbPb(1); - int const iPsyRhFnTdbWPb(2); - int const iPsyTwbFnTdbWPb(3); - int const iPsyTwbFnTdbWPb2(14); - int const iPsyTwbFnTdbWPb3(15); // convergence - int const iPsyVFnTdbWPb(4); - int const iPsyWFnTdpPb(5); - int const iPsyWFnTdbH(6); - int const iPsyWFnTdbTwbPb(7); - int const iPsyWFnTdbTwbPb2(16); - int const iPsyWFnTdbRhPb(8); - int const iPsyPsatFnTemp(9); - int const iPsyTsatFnHPb(10); - int const iPsyTsatFnPb(11); - int const iPsyTsatFnPb2(17); // iterations - int const iPsyRhFnTdbRhov(12); - int const iPsyRhFnTdbRhovLBnd0C(13); - int const iPsyTwbFnTdbWPb_cache(18); - int const iPsyPsatFnTemp_cache(19); - int const NumPsychMonitors(19); // Parameterization of Number of psychrometric routines that - std::string const blank_string; #ifdef EP_psych_stats Array1D_string const PsyRoutineNames(NumPsychMonitors, {"PsyTdpFnTdbTwbPb", @@ -184,28 +158,6 @@ namespace Psychrometrics { // PsyTwbFnTdbWPb_raw (raw calc) | PsyPsatFnTemp_cache 19 - PsyPsatFnTemp_raw (raw calc) #endif -#ifndef EP_psych_errors - Real64 const KelvinConv(273.15); -#endif - -#ifdef EP_cache_PsyTwbFnTdbWPb - int const twbcache_size(1024 * 1024); - int const twbprecision_bits(20); -#endif -#ifdef EP_cache_PsyPsatFnTemp - int const psatcache_size(1024 * 1024); - int const psatprecision_bits(24); // 28 // 24 // 32 - Int64 const psatcache_mask(psatcache_size - 1); -#endif -#ifdef EP_cache_PsyTsatFnPb - int const tsatcache_size(1024 * 1024); - int const tsatprecision_bits(24); - Int64 const tsatcache_mask(tsatcache_size - 1); -#endif -#ifdef EP_cache_PsyTsatFnHPb - int const tsat_hbp_cache_size(1024 * 1024); - int const tsat_hbp_precision_bits(28); -#endif // MODULE VARIABLE DECLARATIONS: // na @@ -218,19 +170,6 @@ namespace Psychrometrics { Array1D_int NumIterations(NumPsychMonitors, 0); #endif - // Object Data -#ifdef EP_cache_PsyTwbFnTdbWPb - Array1D cached_Twb; // DIMENSION(0:twbcache_size) -#endif -#ifdef EP_cache_PsyPsatFnTemp - Array1D cached_Psat; // DIMENSION(0:psatcache_size) -#endif -#ifdef EP_cache_PsyTsatFnPb - Array1D cached_Tsat; // DIMENSION(0:tsatcache_size) -#endif -#ifdef EP_cache_PsyTsatFnHPb - Array1D cached_Tsat_HPb; // DIMENSION(0:tsat_hbp_cache_size) -#endif // Subroutine Specifications for the Module // Functions @@ -309,9 +248,9 @@ namespace Psychrometrics { } #ifdef EP_psych_stats - void ShowPsychrometricSummary(OutputFile &auditFile) + void ShowPsychrometricSummary(InputOutputFile &auditFile) #else - void ShowPsychrometricSummary(InputOutputFile &) + void ShowPsychrometricSummary([[maybe_unused]] InputOutputFile &auditFile) #endif { @@ -368,7 +307,8 @@ namespace Psychrometrics { } #ifdef EP_psych_errors - void PsyRhoAirFnPbTdbW_error(EnergyPlusData &state, Real64 const pb, // barometric pressure (Pascals) + void PsyRhoAirFnPbTdbW_error(EnergyPlusData &state, + Real64 const pb, // barometric pressure (Pascals) Real64 const tdb, // dry bulb temperature (Celsius) Real64 const dw, // humidity ratio (kgWater/kgDryAir) Real64 const rhoair, // density of air @@ -391,7 +331,8 @@ namespace Psychrometrics { #endif #ifdef EP_psych_errors - void PsyRhFnTdbRhovLBnd0C_error(EnergyPlusData &state, Real64 const Tdb, // dry-bulb temperature {C} + void PsyRhFnTdbRhovLBnd0C_error(EnergyPlusData &state, + Real64 const Tdb, // dry-bulb temperature {C} Real64 const Rhovapor, // vapor density in air {kg/m3} Real64 const RHValue, // relative humidity value (0.0-1.0) std::string const &CalledFrom // routine this function was called from (error messages) @@ -445,7 +386,8 @@ namespace Psychrometrics { #ifdef EP_cache_PsyTwbFnTdbWPb - Real64 PsyTwbFnTdbWPb(EnergyPlusData &state, Real64 const Tdb, // dry-bulb temperature {C} + Real64 PsyTwbFnTdbWPb(EnergyPlusData &state, + Real64 const Tdb, // dry-bulb temperature {C} Real64 const W, // humidity ratio Real64 const Pb, // barometric pressure {Pascals} std::string const &CalledFrom // routine this function was called from (error messages) @@ -527,7 +469,8 @@ namespace Psychrometrics { return Twb_result; } - Real64 PsyTwbFnTdbWPb_raw(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + Real64 PsyTwbFnTdbWPb_raw(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const dW, // humidity ratio Real64 const Patm, // barometric pressure {Pascals} std::string const &CalledFrom // routine this function was called from (error messages) @@ -535,7 +478,8 @@ namespace Psychrometrics { #else - Real64 PsyTwbFnTdbWPb(Real64 const TDB, // dry-bulb temperature {C} + Real64 PsyTwbFnTdbWPb(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const dW, // humidity ratio Real64 const Patm, // barometric pressure {Pascals} std::string const &CalledFrom // routine this function was called from (error messages) @@ -692,7 +636,7 @@ namespace Psychrometrics { // If converged, leave iteration loop. if (icvg == 1) break; - // Error Trap for the Discontinious nature of PsyPsatFnTemp function (Sat Press Curve) at ~0 Deg C. + // Error Trap for the Discontinuous nature of PsyPsatFnTemp function (Sat Press Curve) at ~0 Deg C. if ((PSatstar > 611.000) && (PSatstar < 611.25) && (std::abs(error) <= 0.0001) && (iter > 4)) break; } // End of Iteration Loop @@ -745,7 +689,8 @@ namespace Psychrometrics { } #ifdef EP_psych_errors - void PsyVFnTdbWPb_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyVFnTdbWPb_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const w, // humidity ratio Real64 const PB, // barometric pressure {Pascals} Real64 const V, // specific volume {m3/kg} @@ -774,7 +719,8 @@ namespace Psychrometrics { #endif #ifdef EP_psych_errors - void PsyWFnTdbH_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyWFnTdbH_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const H, // enthalpy {J/kg} Real64 const W, // humidity ratio std::string const &CalledFrom // routine this function was called from (error messages) @@ -802,9 +748,9 @@ namespace Psychrometrics { #ifdef EP_cache_PsyPsatFnTemp - Real64 PsyPsatFnTemp_raw(EnergyPlusData &state, + Real64 PsyPsatFnTemp_raw([[maybe_unused]] EnergyPlusData &state, Real64 const T, // dry-bulb temperature {C} - std::string const &CalledFrom // routine this function was called from (error messages) + [[maybe_unused]] std::string const &CalledFrom // routine this function was called from (error messages) ) #else @@ -930,7 +876,8 @@ namespace Psychrometrics { } #ifdef EP_psych_errors - void PsyWFnTdbTwbPb_temperature_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyWFnTdbTwbPb_temperature_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const TWB, // wet-bulb temperature {C} Real64 const PB, // barometric pressure {Pascals} std::string const &CalledFrom // routine this function was called from (error messages) @@ -958,7 +905,8 @@ namespace Psychrometrics { #endif #ifdef EP_psych_errors - void PsyWFnTdbTwbPb_humidity_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyWFnTdbTwbPb_humidity_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const TWB, // wet-bulb temperature {C} Real64 const PB, // barometric pressure {Pascals} Real64 const W, // humidity ratio @@ -988,7 +936,8 @@ namespace Psychrometrics { #endif #ifdef EP_psych_errors - void PsyTdpFnTdbTwbPb_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyTdpFnTdbTwbPb_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const TWB, // wet-bulb temperature {C} Real64 const PB, // barometric pressure (N/M**2) {Pascals} Real64 const W, // humidity ratio @@ -1019,12 +968,14 @@ namespace Psychrometrics { #ifdef EP_cache_PsyTsatFnHPb - Real64 PsyTsatFnHPb_raw(EnergyPlusData &state, Real64 const H, // enthalpy {J/kg} + Real64 PsyTsatFnHPb_raw(EnergyPlusData &state, + Real64 const H, // enthalpy {J/kg} Real64 const PB, // barometric pressure {Pascals} - std::string const &CalledFrom // routine this function was called from (error messages) + [[maybe_unused]] std::string const &CalledFrom // routine this function was called from (error messages) ) #else - Real64 PsyTsatFnHPb(Real64 const H, // enthalpy {J/kg} + Real64 PsyTsatFnHPb(EnergyPlusData &state, + Real64 const H, // enthalpy {J/kg} Real64 const PB, // barometric pressure {Pascals} std::string const &CalledFrom // routine this function was called from (error messages) ) @@ -1183,7 +1134,8 @@ namespace Psychrometrics { } #ifdef EP_psych_errors - void PsyRhFnTdbRhov_error(EnergyPlusData &state, Real64 const Tdb, // dry-bulb temperature {C} + void PsyRhFnTdbRhov_error(EnergyPlusData &state, + Real64 const Tdb, // dry-bulb temperature {C} Real64 const Rhovapor, // vapor density in air {kg/m3} Real64 const RHValue, // relative humidity value (0.0-1.0) std::string const &CalledFrom // routine this function was called from (error messages) @@ -1236,7 +1188,8 @@ namespace Psychrometrics { #endif #ifdef EP_psych_errors - void PsyRhFnTdbWPb_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyRhFnTdbWPb_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const W, // humidity ratio Real64 const RHValue, // relative humidity (0.0-1.0) std::string const &CalledFrom // routine this function was called from (error messages) @@ -1289,7 +1242,8 @@ namespace Psychrometrics { #endif #ifdef EP_psych_errors - void PsyWFnTdpPb_error(EnergyPlusData &state, Real64 const TDP, // dew-point temperature {C} + void PsyWFnTdpPb_error(EnergyPlusData &state, + Real64 const TDP, // dew-point temperature {C} Real64 const PB, // barometric pressure {Pascals} Real64 const W, // humidity ratio Real64 const DeltaT, // Reduced temperature difference of dew point @@ -1315,7 +1269,8 @@ namespace Psychrometrics { #endif #ifdef EP_psych_errors - void PsyWFnTdbRhPb_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyWFnTdbRhPb_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const RH, // relative humidity value (0.0-1.0) Real64 const PB, // barometric pressure {Pascals} Real64 const W, // humidity ratio @@ -1345,12 +1300,14 @@ namespace Psychrometrics { #ifdef EP_cache_PsyTsatFnPb - Real64 PsyTsatFnPb_raw(EnergyPlusData &state, Real64 const Press, // barometric pressure {Pascals} + Real64 PsyTsatFnPb_raw(EnergyPlusData &state, + Real64 const Press, // barometric pressure {Pascals} std::string const &CalledFrom // routine this function was called from (error messages) ) #else - Real64 PsyTsatFnPb(Real64 const Press, // barometric pressure {Pascals} + Real64 PsyTsatFnPb(EnergyPlusData &state, + Real64 const Press, // barometric pressure {Pascals} std::string const &CalledFrom // routine this function was called from (error messages) ) #endif diff --git a/src/EnergyPlus/Psychrometrics.hh b/src/EnergyPlus/Psychrometrics.hh index 676c5204d68..15d791269af 100644 --- a/src/EnergyPlus/Psychrometrics.hh +++ b/src/EnergyPlus/Psychrometrics.hh @@ -71,40 +71,41 @@ struct EnergyPlusData; #undef EP_cache_PsyTwbFnTdbWPb #undef EP_cache_PsyPsatFnTemp #undef EP_cache_PsyTsatFnPb +#undef EP_cache_PsyTsatFnHPb #else #define EP_cache_PsyTwbFnTdbWPb #define EP_cache_PsyPsatFnTemp #define EP_cache_PsyTsatFnPb #define EP_cache_PsyTsatFnHPb #endif -#define EP_psych_errors namespace Psychrometrics { // Data // MODULE PARAMETER DEFINITIONS: // call for recurring errors - extern int const iPsyTdpFnTdbTwbPb; - extern int const iPsyRhFnTdbWPb; - extern int const iPsyTwbFnTdbWPb; - extern int const iPsyTwbFnTdbWPb2; - extern int const iPsyTwbFnTdbWPb3; // convergence - extern int const iPsyVFnTdbWPb; - extern int const iPsyWFnTdpPb; - extern int const iPsyWFnTdbH; - extern int const iPsyWFnTdbTwbPb; - extern int const iPsyWFnTdbTwbPb2; - extern int const iPsyWFnTdbRhPb; - extern int const iPsyPsatFnTemp; - extern int const iPsyTsatFnHPb; - extern int const iPsyTsatFnPb; - extern int const iPsyTsatFnPb2; // iterations - extern int const iPsyRhFnTdbRhov; - extern int const iPsyRhFnTdbRhovLBnd0C; - extern int const iPsyTwbFnTdbWPb_cache; - extern int const iPsyPsatFnTemp_cache; - extern int const NumPsychMonitors; // Parameterization of Number of psychrometric routines that - extern std::string const blank_string; + constexpr int iPsyTdpFnTdbTwbPb = 1; + constexpr int iPsyRhFnTdbWPb = 2; + constexpr int iPsyTwbFnTdbWPb = 3; + constexpr int iPsyTwbFnTdbWPb2 = 14; + constexpr int iPsyTwbFnTdbWPb3 = 15; // convergence + constexpr int iPsyVFnTdbWPb = 4; + constexpr int iPsyWFnTdpPb = 5; + constexpr int iPsyWFnTdbH = 6; + constexpr int iPsyWFnTdbTwbPb = 7; + constexpr int iPsyWFnTdbTwbPb2 = 16; + constexpr int iPsyWFnTdbRhPb = 8; + constexpr int iPsyPsatFnTemp = 9; + constexpr int iPsyTsatFnHPb = 10; + constexpr int iPsyTsatFnPb = 11; + constexpr int iPsyTsatFnPb2 = 17; // iterations + constexpr int iPsyRhFnTdbRhov = 12; + constexpr int iPsyRhFnTdbRhovLBnd0C = 13; + constexpr int iPsyTwbFnTdbWPb_cache = 18; + constexpr int iPsyPsatFnTemp_cache = 19; + constexpr int NumPsychMonitors = 19; // Parameterization of Number of psychrometric routines that + + std::string const blank_string; #ifdef EP_psych_stats extern Array1D_string const PsyRoutineNames; // 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 - HR | 15 - max iter | 16 - HR | 17 - // max iter | 18 - PsyTwbFnTdbWPb_raw (raw calc) | 19 - PsyPsatFnTemp_raw (raw calc) @@ -118,26 +119,25 @@ namespace Psychrometrics { #endif #ifndef EP_psych_errors - extern Real64 const KelvinConv; #endif #ifdef EP_cache_PsyTwbFnTdbWPb - extern int const twbcache_size; - extern int const twbprecision_bits; + constexpr int twbcache_size = 1024 * 1024; + constexpr int twbprecision_bits = 20; #endif #ifdef EP_cache_PsyPsatFnTemp - extern int const psatcache_size; - extern int const psatprecision_bits; // 28 //24 //32 - extern Int64 const psatcache_mask; + constexpr int psatcache_size = 1024 * 1024; + constexpr int psatprecision_bits = 24; // 28 //24 //32 + constexpr Int64 psatcache_mask = psatcache_size - 1; #endif #ifdef EP_cache_PsyTsatFnPb - extern int const tsatcache_size; - extern int const tsatprecision_bits; - extern Int64 const tsatcache_mask; + constexpr int tsatcache_size = 1024 * 1024; + constexpr int tsatprecision_bits = 24; + constexpr Int64 tsatcache_mask = tsatcache_size - 1; #endif #ifdef EP_cache_PsyTsatFnHPb - extern int const tsat_hbp_cache_size; - extern int const tsat_hbp_precision_bits; + constexpr int tsat_hbp_cache_size = 1024 * 1024; + constexpr int tsat_hbp_precision_bits = 28; #endif // MODULE VARIABLE DECLARATIONS: @@ -213,16 +213,16 @@ namespace Psychrometrics { #endif // Object Data #ifdef EP_cache_PsyTwbFnTdbWPb - extern Array1D cached_Twb; // DIMENSION(0:twbcache_size) + inline Array1D cached_Twb; // DIMENSION(0:twbcache_size) #endif #ifdef EP_cache_PsyPsatFnTemp - extern Array1D cached_Psat; // DIMENSION(0:psatcache_size) + inline Array1D cached_Psat; // DIMENSION(0:psatcache_size) #endif #ifdef EP_cache_PsyTsatFnPb - extern Array1D cached_Tsat; // DIMENSION(0:tsatcache_size) + inline Array1D cached_Tsat; // DIMENSION(0:tsatcache_size) #endif #ifdef EP_cache_PsyTsatFnHPb - extern Array1D cached_Tsat_HPb; // DIMENSION(0:tsat_hbp_cache_size) + inline Array1D cached_Tsat_HPb; // DIMENSION(0:tsat_hbp_cache_size) #endif // Subroutine Specifications for the Module @@ -235,7 +235,8 @@ namespace Psychrometrics { void ShowPsychrometricSummary(InputOutputFile &auditFile); #ifdef EP_psych_errors - void PsyRhoAirFnPbTdbW_error(EnergyPlusData &state, Real64 const pb, // barometric pressure (Pascals) + void PsyRhoAirFnPbTdbW_error(EnergyPlusData &state, + Real64 const pb, // barometric pressure (Pascals) Real64 const tdb, // dry bulb temperature (Celsius) Real64 const dw, // humidity ratio (kgWater/kgDryAir) Real64 const rhoair, // density of air @@ -243,10 +244,11 @@ namespace Psychrometrics { ); #endif - inline Real64 PsyRhoAirFnPbTdbW(EnergyPlusData &state, Real64 const pb, // barometric pressure (Pascals) + inline Real64 PsyRhoAirFnPbTdbW([[maybe_unused]] EnergyPlusData &state, + Real64 const pb, // barometric pressure (Pascals) Real64 const tdb, // dry bulb temperature (Celsius) Real64 const dw, // humidity ratio (kgWater/kgDryAir) - std::string const &CalledFrom = blank_string // routine this function was called from (error messages) !unused1208 + [[maybe_unused]] std::string const &CalledFrom = blank_string // routine this function was called from (error messages) !unused1208 ) { // FUNCTION INFORMATION: @@ -275,7 +277,8 @@ namespace Psychrometrics { return rhoair; } - inline Real64 PsyRhoAirFnPbTdbW_fast(EnergyPlusData &state, Real64 const pb, // barometric pressure (Pascals) + inline Real64 PsyRhoAirFnPbTdbW_fast([[maybe_unused]] EnergyPlusData &state, + Real64 const pb, // barometric pressure (Pascals) Real64 const tdb, // dry bulb temperature (Celsius) Real64 const dw // humidity ratio (kgWater/kgDryAir) ) @@ -518,16 +521,18 @@ namespace Psychrometrics { } #ifdef EP_psych_errors - void PsyRhFnTdbRhovLBnd0C_error(EnergyPlusData &state, Real64 const Tdb, // dry-bulb temperature {C} + void PsyRhFnTdbRhovLBnd0C_error(EnergyPlusData &state, + Real64 const Tdb, // dry-bulb temperature {C} Real64 const Rhovapor, // vapor density in air {kg/m3} Real64 const RHValue, // relative humidity value (0.0-1.0) std::string const &CalledFrom // routine this function was called from (error messages) ); #endif - inline Real64 PsyRhFnTdbRhovLBnd0C(EnergyPlusData &state, Real64 const Tdb, // dry-bulb temperature {C} + inline Real64 PsyRhFnTdbRhovLBnd0C([[maybe_unused]] EnergyPlusData &state, + Real64 const Tdb, // dry-bulb temperature {C} Real64 const Rhovapor, // vapor density in air {kg/m3} - std::string const &CalledFrom = blank_string // routine this function was called from (error messages) + [[maybe_unused]] std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ) { // FUNCTION INFORMATION: @@ -569,13 +574,15 @@ namespace Psychrometrics { #ifdef EP_cache_PsyTwbFnTdbWPb - Real64 PsyTwbFnTdbWPb(EnergyPlusData &state, Real64 const Tdb, // dry-bulb temperature {C} + Real64 PsyTwbFnTdbWPb(EnergyPlusData &state, + Real64 const Tdb, // dry-bulb temperature {C} Real64 const W, // humidity ratio Real64 const Pb, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ); - Real64 PsyTwbFnTdbWPb_raw(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + Real64 PsyTwbFnTdbWPb_raw(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const dW, // humidity ratio Real64 const Patm, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) @@ -583,7 +590,8 @@ namespace Psychrometrics { #else - Real64 PsyTwbFnTdbWPb(Real64 const TDB, // dry-bulb temperature {C} + Real64 PsyTwbFnTdbWPb(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const dW, // humidity ratio Real64 const Patm, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) @@ -592,7 +600,8 @@ namespace Psychrometrics { #endif #ifdef EP_psych_errors - void PsyVFnTdbWPb_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyVFnTdbWPb_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const w, // humidity ratio Real64 const PB, // barometric pressure {Pascals} Real64 const V, // specific volume {m3/kg} @@ -600,10 +609,11 @@ namespace Psychrometrics { ); #endif - inline Real64 PsyVFnTdbWPb(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + inline Real64 PsyVFnTdbWPb([[maybe_unused]] EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const dW, // humidity ratio Real64 const PB, // barometric pressure {Pascals} - std::string const &CalledFrom = blank_string // routine this function was called from (error messages) + [[maybe_unused]] std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ) { // FUNCTION INFORMATION: @@ -638,17 +648,19 @@ namespace Psychrometrics { } #ifdef EP_psych_errors - void PsyWFnTdbH_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyWFnTdbH_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const H, // enthalpy {J/kg} Real64 const W, // humidity ratio std::string const &CalledFrom // routine this function was called from (error messages) ); #endif - inline Real64 PsyWFnTdbH(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + inline Real64 PsyWFnTdbH([[maybe_unused]] EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const H, // enthalpy {J/kg} - std::string const &CalledFrom = blank_string, // routine this function was called from (error messages) - bool const SuppressWarnings = false // if calling function is calculating an intermediate state + [[maybe_unused]] std::string const &CalledFrom = blank_string, // routine this function was called from (error messages) + [[maybe_unused]] bool const SuppressWarnings = false // if calling function is calculating an intermediate state ) { // FUNCTION INFORMATION: @@ -742,11 +754,13 @@ namespace Psychrometrics { #endif #ifdef EP_cache_PsyTsatFnHPb - Real64 PsyTsatFnHPb_raw(EnergyPlusData &state, Real64 const H, // enthalpy {J/kg} + Real64 PsyTsatFnHPb_raw(EnergyPlusData &state, + Real64 const H, // enthalpy {J/kg} Real64 const PB, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ); - inline Real64 PsyTsatFnHPb(EnergyPlusData &state, Real64 const H, + inline Real64 PsyTsatFnHPb(EnergyPlusData &state, + Real64 const H, Real64 const Pb, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ) @@ -789,14 +803,16 @@ namespace Psychrometrics { #else - Real64 PsyTsatFnHPb(Real64 const H, // enthalpy {J/kg} + Real64 PsyTsatFnHPb(EnergyPlusData &state, + Real64 const H, // enthalpy {J/kg} Real64 const PB, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ); #endif - inline Real64 PsyRhovFnTdbRh(EnergyPlusData &state, Real64 const Tdb, // dry-bulb temperature {C} + inline Real64 PsyRhovFnTdbRh(EnergyPlusData &state, + Real64 const Tdb, // dry-bulb temperature {C} Real64 const RH, // relative humidity value (0.0-1.0) std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ) @@ -825,16 +841,18 @@ namespace Psychrometrics { } #ifdef EP_psych_errors - void PsyRhFnTdbRhov_error(EnergyPlusData &state, Real64 const Tdb, // dry-bulb temperature {C} + void PsyRhFnTdbRhov_error(EnergyPlusData &state, + Real64 const Tdb, // dry-bulb temperature {C} Real64 const Rhovapor, // vapor density in air {kg/m3} Real64 const RHValue, // relative humidity std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ); #endif - inline Real64 PsyRhFnTdbRhov(EnergyPlusData &state, Real64 const Tdb, // dry-bulb temperature {C} + inline Real64 PsyRhFnTdbRhov(EnergyPlusData &state, + Real64 const Tdb, // dry-bulb temperature {C} Real64 const Rhovapor, // vapor density in air {kg/m3} - std::string const &CalledFrom = blank_string // routine this function was called from (error messages) + [[maybe_unused]] std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ) { // FUNCTION INFORMATION: @@ -879,14 +897,16 @@ namespace Psychrometrics { } #ifdef EP_psych_errors - void PsyRhFnTdbWPb_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyRhFnTdbWPb_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const W, // humidity ratio Real64 const RHValue, // relative humidity (0.0-1.0) std::string const &CalledFrom // routine this function was called from (error messages) ); #endif - inline Real64 PsyRhFnTdbWPb(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + inline Real64 PsyRhFnTdbWPb(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const dW, // humidity ratio Real64 const PB, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) @@ -935,7 +955,8 @@ namespace Psychrometrics { } #ifdef EP_psych_errors - void PsyWFnTdpPb_error(EnergyPlusData &state, Real64 const TDP, // dew-point temperature {C} + void PsyWFnTdpPb_error(EnergyPlusData &state, + Real64 const TDP, // dew-point temperature {C} Real64 const PB, // barometric pressure {Pascals} Real64 const W, // humidity ratio Real64 const DeltaT, // Reduced temperature difference of dew point @@ -943,7 +964,8 @@ namespace Psychrometrics { ); #endif - inline Real64 PsyWFnTdpPb(EnergyPlusData &state, Real64 const TDP, // dew-point temperature {C} + inline Real64 PsyWFnTdpPb(EnergyPlusData &state, + Real64 const TDP, // dew-point temperature {C} Real64 const PB, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ) @@ -994,7 +1016,8 @@ namespace Psychrometrics { } #ifdef EP_psych_errors - void PsyWFnTdbRhPb_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyWFnTdbRhPb_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const RH, // relative humidity value (0.0-1.0) Real64 const PB, // barometric pressure {Pascals} Real64 const W, // humidity ratio @@ -1002,7 +1025,8 @@ namespace Psychrometrics { ); #endif - inline Real64 PsyWFnTdbRhPb(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + inline Real64 PsyWFnTdbRhPb(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const RH, // relative humidity value (0.0-1.0) Real64 const PB, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) @@ -1049,13 +1073,15 @@ namespace Psychrometrics { #ifdef EP_psych_errors - void PsyWFnTdbTwbPb_temperature_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyWFnTdbTwbPb_temperature_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const TWB, // wet-bulb temperature {C} Real64 const PB, // barometric pressure {Pascals} std::string const &CalledFrom // routine this function was called from (error messages) ); - void PsyWFnTdbTwbPb_humidity_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyWFnTdbTwbPb_humidity_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const TWB, // wet-bulb temperature {C} Real64 const PB, // barometric pressure {Pascals} Real64 const W, // humidity ratio @@ -1064,7 +1090,8 @@ namespace Psychrometrics { #endif - inline Real64 PsyWFnTdbTwbPb(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + inline Real64 PsyWFnTdbTwbPb(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const TWBin, // wet-bulb temperature {C} Real64 const PB, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) @@ -1116,7 +1143,8 @@ namespace Psychrometrics { } } - inline Real64 PsyHFnTdbRhPb(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + inline Real64 PsyHFnTdbRhPb(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const RH, // relative humidity value (0.0 - 1.0) Real64 const PB, // barometric pressure (N/M**2) {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) @@ -1143,11 +1171,13 @@ namespace Psychrometrics { #ifdef EP_cache_PsyTsatFnPb - Real64 PsyTsatFnPb_raw(EnergyPlusData &state, Real64 const Press, // barometric pressure {Pascals} + Real64 PsyTsatFnPb_raw(EnergyPlusData &state, + Real64 const Press, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ); - inline Real64 PsyTsatFnPb(EnergyPlusData &state, Real64 const Press, // barometric pressure {Pascals} + inline Real64 PsyTsatFnPb(EnergyPlusData &state, + Real64 const Press, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ) { @@ -1167,12 +1197,14 @@ namespace Psychrometrics { } #else - Real64 PsyTsatFnPb(Real64 const Press, // barometric pressure {Pascals} + Real64 PsyTsatFnPb(EnergyPlusData &state, + Real64 const Press, // barometric pressure {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ); #endif - inline Real64 PsyTdpFnWPb(EnergyPlusData &state, Real64 const W, // humidity ratio + inline Real64 PsyTdpFnWPb(EnergyPlusData &state, + Real64 const W, // humidity ratio Real64 const PB, // barometric pressure (N/M**2) {Pascals} std::string const &CalledFrom = blank_string // routine this function was called from (error messages) ) @@ -1198,7 +1230,8 @@ namespace Psychrometrics { } #ifdef EP_psych_errors - void PsyTdpFnTdbTwbPb_error(EnergyPlusData &state, Real64 const TDB, // dry-bulb temperature {C} + void PsyTdpFnTdbTwbPb_error(EnergyPlusData &state, + Real64 const TDB, // dry-bulb temperature {C} Real64 const TWB, // wet-bulb temperature {C} Real64 const PB, // barometric pressure (N/M**2) {Pascals} Real64 const W, // humidity ratio @@ -1343,4 +1376,4 @@ namespace Psychrometrics { } // namespace EnergyPlus -#endif +#endif \ No newline at end of file diff --git a/tst/EnergyPlus/unit/CMakeLists.txt b/tst/EnergyPlus/unit/CMakeLists.txt index f0927578254..af707f6fc23 100644 --- a/tst/EnergyPlus/unit/CMakeLists.txt +++ b/tst/EnergyPlus/unit/CMakeLists.txt @@ -1,3 +1,11 @@ +if(USE_GLYCOL_CACHING) + add_definitions("-DEP_cache_GlycolSpecificHeat") +endif() + +if(USE_PSYCH_ERRORS) + add_definitions("-DEP_psych_errors") +endif() + set( test_src TestHelpers/IdfParser.cc TestHelpers/IdfParser.hh