Skip to content

Commit c960191

Browse files
committed
Add tests for effective irradiance behavior in noct_sam
1 parent 45912cc commit c960191

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import numpy as np
2+
from pvlib.temperature import noct_sam
3+
4+
def test_noct_sam_effective_irr_reduces_temp():
5+
# Effective irradiance should lower predicted module temp
6+
t_full = noct_sam(
7+
poa_global=800, temp_air=20, wind_speed=2,
8+
noct=45, module_efficiency=0.20
9+
)
10+
11+
t_eff_600 = noct_sam(
12+
poa_global=800, temp_air=20, wind_speed=2,
13+
noct=45, module_efficiency=0.20,
14+
effective_irradiance=600
15+
)
16+
17+
t_eff_200 = noct_sam(
18+
poa_global=800, temp_air=20, wind_speed=2,
19+
noct=45, module_efficiency=0.20,
20+
effective_irradiance=200
21+
)
22+
23+
assert t_eff_600 < t_full
24+
assert t_eff_200 < t_eff_600
25+
26+
27+
def test_noct_sam_oc_case_reduces_temp():
28+
# Open-circuit (efficiency=0) should still respond to effective irradiance
29+
t_oc_full = noct_sam(
30+
poa_global=800, temp_air=20, wind_speed=2,
31+
noct=45, module_efficiency=0.0
32+
)
33+
34+
t_oc_eff = noct_sam(
35+
poa_global=800, temp_air=20, wind_speed=2,
36+
noct=45, module_efficiency=0.0,
37+
effective_irradiance=300
38+
)
39+
40+
assert t_oc_eff < t_oc_full
41+
42+
43+
def test_noct_sam_not_below_ambient_for_small_eff():
44+
# Very small effective irradiance should not predict cooling below ambient
45+
t_small = noct_sam(
46+
poa_global=800, temp_air=20, wind_speed=2,
47+
noct=45, module_efficiency=0.20,
48+
effective_irradiance=1.0
49+
)
50+
51+
assert t_small >= 20.0 - 1e-6 # small numerical tolerance

0 commit comments

Comments
 (0)