@@ -566,8 +566,13 @@ def test_PVSystem_multi_array_celltemp_functions(celltemp, two_array_system):
566
566
irrad_two = pd .Series (500 , index = times )
567
567
temp_air = pd .Series (25 , index = times )
568
568
wind_speed = pd .Series (1 , index = times )
569
+ kwargs = {}
570
+ if celltemp == pvsystem .PVSystem .fuentes_celltemp :
571
+ kwargs ['surface_tilt' ] = 30
572
+
569
573
temp_one , temp_two = celltemp (
570
- two_array_system , (irrad_one , irrad_two ), temp_air , wind_speed )
574
+ two_array_system , (irrad_one , irrad_two ), temp_air , wind_speed ,
575
+ ** kwargs )
571
576
assert (temp_one != temp_two ).all ()
572
577
573
578
@@ -583,18 +588,24 @@ def test_PVSystem_multi_array_celltemp_multi_temp(celltemp, two_array_system):
583
588
temp_air_one = pd .Series (25 , index = times )
584
589
temp_air_two = pd .Series (5 , index = times )
585
590
wind_speed = pd .Series (1 , index = times )
591
+ kwargs = {}
592
+ if celltemp == pvsystem .PVSystem .fuentes_celltemp :
593
+ kwargs ['surface_tilt' ] = 30
594
+
586
595
temp_one , temp_two = celltemp (
587
596
two_array_system ,
588
597
(irrad , irrad ),
589
598
(temp_air_one , temp_air_two ),
590
- wind_speed
599
+ wind_speed ,
600
+ ** kwargs
591
601
)
592
602
assert (temp_one != temp_two ).all ()
593
603
temp_one_swtich , temp_two_switch = celltemp (
594
604
two_array_system ,
595
605
(irrad , irrad ),
596
606
(temp_air_two , temp_air_one ),
597
- wind_speed
607
+ wind_speed ,
608
+ ** kwargs
598
609
)
599
610
assert_series_equal (temp_one , temp_two_switch )
600
611
assert_series_equal (temp_two , temp_one_swtich )
@@ -612,18 +623,24 @@ def test_PVSystem_multi_array_celltemp_multi_wind(celltemp, two_array_system):
612
623
temp_air = pd .Series (25 , index = times )
613
624
wind_speed_one = pd .Series (1 , index = times )
614
625
wind_speed_two = pd .Series (5 , index = times )
626
+ kwargs = {}
627
+ if celltemp == pvsystem .PVSystem .fuentes_celltemp :
628
+ kwargs ['surface_tilt' ] = 30
629
+
615
630
temp_one , temp_two = celltemp (
616
631
two_array_system ,
617
632
(irrad , irrad ),
618
633
temp_air ,
619
- (wind_speed_one , wind_speed_two )
634
+ (wind_speed_one , wind_speed_two ),
635
+ ** kwargs
620
636
)
621
637
assert (temp_one != temp_two ).all ()
622
638
temp_one_swtich , temp_two_switch = celltemp (
623
639
two_array_system ,
624
640
(irrad , irrad ),
625
641
temp_air ,
626
- (wind_speed_two , wind_speed_one )
642
+ (wind_speed_two , wind_speed_one ),
643
+ ** kwargs
627
644
)
628
645
assert_series_equal (temp_one , temp_two_switch )
629
646
assert_series_equal (temp_two , temp_one_swtich )
@@ -703,18 +720,21 @@ def test_PVSystem_fuentes_celltemp(mocker):
703
720
temps = pd .Series (25 , index )
704
721
irrads = pd .Series (1000 , index )
705
722
winds = pd .Series (1 , index )
706
- out = system .fuentes_celltemp (irrads , temps , winds )
723
+
724
+ out = system .fuentes_celltemp (irrads , temps , winds , surface_tilt = 0 )
707
725
assert_series_equal (spy .call_args [0 ][0 ], irrads )
708
726
assert_series_equal (spy .call_args [0 ][1 ], temps )
709
727
assert_series_equal (spy .call_args [0 ][2 ], winds )
728
+ assert spy .call_args [1 ]['surface_tilt' ] == 0
710
729
assert spy .call_args [1 ]['noct_installed' ] == noct_installed
711
730
assert_series_equal (out , pd .Series ([52.85 , 55.85 , 55.85 ], index ,
712
731
name = 'tmod' ))
713
732
714
733
715
734
def test_PVSystem_fuentes_celltemp_override (mocker ):
716
735
# test that the surface_tilt value in the cell temp calculation can be
717
- # overridden but defaults to the surface_tilt attribute of the PVSystem
736
+ # overridden but defaults to the surface_tilt value in
737
+ # array.temperature_model_parameters
718
738
spy = mocker .spy (temperature , 'fuentes' )
719
739
720
740
noct_installed = 45
@@ -724,38 +744,33 @@ def test_PVSystem_fuentes_celltemp_override(mocker):
724
744
winds = pd .Series (1 , index )
725
745
726
746
# uses default value
727
- temp_model_params = {'noct_installed' : noct_installed }
728
- system = pvsystem .PVSystem (temperature_model_parameters = temp_model_params ,
729
- surface_tilt = 20 )
747
+ temp_model_params = {'noct_installed' : noct_installed , 'surface_tilt' : 20 }
748
+ system = pvsystem .PVSystem (temperature_model_parameters = temp_model_params )
730
749
system .fuentes_celltemp (irrads , temps , winds )
731
750
assert spy .call_args [1 ]['surface_tilt' ] == 20
732
751
733
- # can be overridden
734
- temp_model_params = {'noct_installed' : noct_installed , 'surface_tilt' : 30 }
735
- system = pvsystem .PVSystem (temperature_model_parameters = temp_model_params ,
736
- surface_tilt = 20 )
737
- system .fuentes_celltemp (irrads , temps , winds )
738
- assert spy .call_args [1 ]['surface_tilt' ] == 30
752
+ # if no default, uses the user-specified values
753
+ temp_model_params = {'noct_installed' : noct_installed }
754
+ system = pvsystem .PVSystem (temperature_model_parameters = temp_model_params )
755
+ system .fuentes_celltemp (irrads , temps , winds , surface_tilt = 40 )
756
+ assert spy .call_args [1 ]['surface_tilt' ] == 40
739
757
740
758
741
759
def test_Array__infer_temperature_model_params ():
742
- array = pvsystem .Array (mount = pvsystem .FixedMount (0 , 180 ),
760
+ array = pvsystem .Array (mount = pvsystem .FixedMount (0 , 180 , racking_model = 'open_rack' ),
743
761
module_parameters = {},
744
- racking_model = 'open_rack' ,
745
762
module_type = 'glass_polymer' )
746
763
expected = temperature .TEMPERATURE_MODEL_PARAMETERS [
747
764
'sapm' ]['open_rack_glass_polymer' ]
748
765
assert expected == array ._infer_temperature_model_params ()
749
- array = pvsystem .Array (mount = pvsystem .FixedMount (0 , 180 ),
766
+ array = pvsystem .Array (mount = pvsystem .FixedMount (0 , 180 , racking_model = 'freestanding' ),
750
767
module_parameters = {},
751
- racking_model = 'freestanding' ,
752
768
module_type = 'glass_polymer' )
753
769
expected = temperature .TEMPERATURE_MODEL_PARAMETERS [
754
770
'pvsyst' ]['freestanding' ]
755
771
assert expected == array ._infer_temperature_model_params ()
756
- array = pvsystem .Array (mount = pvsystem .FixedMount (0 , 180 ),
772
+ array = pvsystem .Array (mount = pvsystem .FixedMount (0 , 180 , racking_model = 'insulated' ),
757
773
module_parameters = {},
758
- racking_model = 'insulated' ,
759
774
module_type = None )
760
775
expected = temperature .TEMPERATURE_MODEL_PARAMETERS [
761
776
'pvsyst' ]['insulated' ]
@@ -1881,10 +1896,9 @@ def test_PVSystem___repr__():
1881
1896
name: pv ftw
1882
1897
Array:
1883
1898
name: None
1884
- mount: FixedMount(surface_tilt=0, surface_azimuth=180)
1899
+ mount: FixedMount(surface_tilt=0, surface_azimuth=180, racking_model=None, module_height=None )
1885
1900
module: blah
1886
1901
albedo: 0.25
1887
- racking_model: None
1888
1902
module_type: None
1889
1903
temperature_model_parameters: {'a': -3.56}
1890
1904
strings: 1
@@ -1906,49 +1920,46 @@ def test_PVSystem_multi_array___repr__():
1906
1920
name: None
1907
1921
Array:
1908
1922
name: None
1909
- mount: FixedMount(surface_tilt=30, surface_azimuth=100)
1923
+ mount: FixedMount(surface_tilt=30, surface_azimuth=100, racking_model=None, module_height=None )
1910
1924
module: None
1911
1925
albedo: 0.25
1912
- racking_model: None
1913
1926
module_type: None
1914
1927
temperature_model_parameters: {}
1915
1928
strings: 1
1916
1929
modules_per_string: 1
1917
1930
Array:
1918
1931
name: foo
1919
- mount: FixedMount(surface_tilt=20, surface_azimuth=220)
1932
+ mount: FixedMount(surface_tilt=20, surface_azimuth=220, racking_model=None, module_height=None )
1920
1933
module: None
1921
1934
albedo: 0.25
1922
- racking_model: None
1923
1935
module_type: None
1924
1936
temperature_model_parameters: {}
1925
1937
strings: 1
1926
1938
modules_per_string: 1
1927
- inverter: blarg"""
1939
+ inverter: blarg""" # noqa: E501
1928
1940
assert expected == system .__repr__ ()
1929
1941
1930
1942
1931
1943
def test_Array___repr__ ():
1932
1944
array = pvsystem .Array (
1933
- mount = pvsystem .FixedMount (surface_tilt = 10 , surface_azimuth = 100 ),
1945
+ mount = pvsystem .FixedMount (surface_tilt = 10 , surface_azimuth = 100 ,
1946
+ racking_model = 'close_mount' ),
1934
1947
albedo = 0.15 , module_type = 'glass_glass' ,
1935
1948
temperature_model_parameters = {'a' : - 3.56 },
1936
- racking_model = 'close_mount' ,
1937
1949
module_parameters = {'foo' : 'bar' },
1938
1950
modules_per_string = 100 ,
1939
1951
strings = 10 , module = 'baz' ,
1940
1952
name = 'biz'
1941
1953
)
1942
1954
expected = """Array:
1943
1955
name: biz
1944
- mount: FixedMount(surface_tilt=10, surface_azimuth=100)
1956
+ mount: FixedMount(surface_tilt=10, surface_azimuth=100, racking_model='close_mount', module_height=None )
1945
1957
module: baz
1946
1958
albedo: 0.15
1947
- racking_model: close_mount
1948
1959
module_type: glass_glass
1949
1960
temperature_model_parameters: {'a': -3.56}
1950
1961
strings: 10
1951
- modules_per_string: 100"""
1962
+ modules_per_string: 100""" # noqa: E501
1952
1963
assert array .__repr__ () == expected
1953
1964
1954
1965
0 commit comments