LMTD
Excel Usage
=LMTD(Thi, Tho, Tci, Tco, counterflow)
Thi(float, required): Inlet temperature of hot fluid (K)Tho(float, required): Outlet temperature of hot fluid (K)Tci(float, required): Inlet temperature of cold fluid (K)Tco(float, required): Outlet temperature of cold fluid (K)counterflow(bool, optional, default: true): True for counterflow, False for co-current. Default True.
Returns (float): LMTD (K)
Examples
Example 1: Counterflow LMTD
Inputs:
| Thi | Tho | Tci | Tco |
|---|---|---|---|
| 100 | 60 | 30 | 40.2 |
Excel formula:
=LMTD(100, 60, 30, 40.2)
Expected output:
43.20041
Example 2: Parallel flow LMTD
Inputs:
| Thi | Tho | Tci | Tco | counterflow |
|---|---|---|---|---|
| 100 | 60 | 30 | 40.2 | false |
Excel formula:
=LMTD(100, 60, 30, 40.2, FALSE)
Expected output:
39.75251
Example 3: Equal temperature differences
Inputs:
| Thi | Tho | Tci | Tco |
|---|---|---|---|
| 100 | 60 | 60 | 20 |
Excel formula:
=LMTD(100, 60, 60, 20)
Expected output:
80
Example 4: Crossflow LMTD case
Inputs:
| Thi | Tho | Tci | Tco |
|---|---|---|---|
| 150 | 100 | 80 | 120 |
Excel formula:
=LMTD(150, 100, 80, 120)
Expected output:
24.66303
Python Code
from ht.core import LMTD
def lmtd(Thi, Tho, Tci, Tco, counterflow=True):
"""
Log-mean temperature difference.
See: https://ht.readthedocs.io/en/latest/ht.core.html#ht.core.LMTD
This example function is provided as-is without any representation of accuracy.
Args:
Thi (float): Inlet temperature of hot fluid (K)
Tho (float): Outlet temperature of hot fluid (K)
Tci (float): Inlet temperature of cold fluid (K)
Tco (float): Outlet temperature of cold fluid (K)
counterflow (bool, optional): True for counterflow, False for co-current. Default True. Default is True.
Returns:
float: LMTD (K)
"""
try:
return float(LMTD(Thi=float(Thi), Tho=float(Tho), Tci=float(Tci), Tco=float(Tco), counterflow=counterflow))
except Exception as e:
return f"Error: {str(e)}"