Skip to content

Commit 76fb20e

Browse files
Merge pull request #4027 from springfall2008/fix/memory
remove Pvlib that uses 60MB of ram
2 parents 1e3d3e8 + 1ea86a2 commit 76fb20e

2 files changed

Lines changed: 3 additions & 16 deletions

File tree

apps/predbat/solcast.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,8 @@
2323
import pytz
2424
from datetime import datetime, timedelta, timezone
2525

26-
try:
27-
from pvlib.temperature import sapm_cell as _pvlib_sapm_cell
28-
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS as _PVLIB_TEMP_PARAMS
29-
30-
_PVLIB_SAPM_PARAMS = _PVLIB_TEMP_PARAMS["sapm"]["open_rack_glass_glass"]
31-
_HAS_PVLIB = True
32-
except ImportError:
33-
_HAS_PVLIB = False
34-
3526
# PVWatts / SAPM cell temperature model constants (glass/glass, open rack)
27+
# Equivalent to pvlib.temperature.sapm_cell with open_rack_glass_glass parameters
3628
_SAPM_A = -3.47
3729
_SAPM_B = -0.0594
3830
_SAPM_DELTA_T = 3.0
@@ -41,13 +33,9 @@
4133
def pvwatts_cell_temperature(poa_global, temp_air, wind_speed):
4234
"""Compute PV cell temperature using the SAPM (PVWatts) model.
4335
44-
Uses pvlib.temperature.sapm_cell when available; falls back to the
45-
equivalent inline formula otherwise. Parameters correspond to a
46-
glass/glass module on an open rack (the most common residential case).
36+
Parameters correspond to a glass/glass module on an open rack (the most
37+
common residential case). Formula: T_cell = T_air + GTI*exp(a + b*wind) + (GTI/1000)*deltaT
4738
"""
48-
if _HAS_PVLIB:
49-
return float(_pvlib_sapm_cell(poa_global, temp_air, wind_speed, _PVLIB_SAPM_PARAMS["a"], _PVLIB_SAPM_PARAMS["b"], _PVLIB_SAPM_PARAMS["deltaT"]))
50-
# Inline SAPM formula: T_cell = T_air + GTI * exp(a + b*wind) + (GTI/1000) * deltaT
5139
return temp_air + poa_global * math.exp(_SAPM_A + _SAPM_B * wind_speed) + (poa_global / 1000.0) * _SAPM_DELTA_T
5240

5341

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ numpy==2.3.5
77
pre-commit
88
prometheus-client
99
protobuf
10-
pvlib
1110
pyjwt
1211
pytz
1312
requests

0 commit comments

Comments
 (0)