From 62fd1a45bc619ecd9260d9ce56f27459b2793d11 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 24 Dec 2024 19:38:28 -0500 Subject: [PATCH] expm1 --- src/EnergyPlus/WaterToAirHeatPumpSimple.cc | 2 +- src/EnergyPlus/WaterUse.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/WaterToAirHeatPumpSimple.cc b/src/EnergyPlus/WaterToAirHeatPumpSimple.cc index a236032ff54..45c830aef69 100644 --- a/src/EnergyPlus/WaterToAirHeatPumpSimple.cc +++ b/src/EnergyPlus/WaterToAirHeatPumpSimple.cc @@ -3768,7 +3768,7 @@ namespace WaterToAirHeatPumpSimple { To1 = aa + LatentCapacityTimeConstant; Error = 1.0; while (Error > 0.001) { - To2 = aa - LatentCapacityTimeConstant * (std::exp(-To1 / LatentCapacityTimeConstant) - 1.0); + To2 = aa - LatentCapacityTimeConstant * std::expm1(-To1 / LatentCapacityTimeConstant); Error = std::abs((To2 - To1) / To1); To1 = To2; } diff --git a/src/EnergyPlus/WaterUse.cc b/src/EnergyPlus/WaterUse.cc index 41e4a92d20f..76f3fcc5aeb 100644 --- a/src/EnergyPlus/WaterUse.cc +++ b/src/EnergyPlus/WaterUse.cc @@ -1497,7 +1497,7 @@ namespace WaterUse { case HeatRecovHX::CrossFlow: { // Unmixed Real64 CapacityRatio = MinCapacityRate / max(DrainCapacityRate, HXCapacityRate); Real64 NTU = this->HXUA / MinCapacityRate; - this->Effectiveness = 1.0 - std::exp((std::pow(NTU, 0.22) / CapacityRatio) * (std::exp(-CapacityRatio * std::pow(NTU, 0.78)) - 1.0)); + this->Effectiveness = 1.0 - std::exp((std::pow(NTU, 0.22) / CapacityRatio) * std::expm1(-CapacityRatio * std::pow(NTU, 0.78))); } break; default: break;