pvlib 0.9.4a1__py3-none-any.whl → 0.10.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pvlib/__init__.py +3 -2
- pvlib/atmosphere.py +23 -173
- pvlib/bifacial/infinite_sheds.py +88 -277
- pvlib/bifacial/utils.py +270 -28
- pvlib/data/adr-library-cec-inverters-2019-03-05.csv +5009 -0
- pvlib/data/precise_iv_curves1.json +10251 -0
- pvlib/data/precise_iv_curves2.json +10251 -0
- pvlib/data/precise_iv_curves_parameter_sets1.csv +33 -0
- pvlib/data/precise_iv_curves_parameter_sets2.csv +33 -0
- pvlib/data/test_psm3_2017.csv +17521 -17521
- pvlib/data/test_psm3_2019_5min.csv +288 -288
- pvlib/data/test_read_psm3.csv +17522 -17522
- pvlib/data/test_read_pvgis_horizon.csv +49 -0
- pvlib/data/variables_style_rules.csv +3 -0
- pvlib/iam.py +207 -51
- pvlib/inverter.py +6 -1
- pvlib/iotools/__init__.py +7 -2
- pvlib/iotools/acis.py +516 -0
- pvlib/iotools/midc.py +4 -4
- pvlib/iotools/psm3.py +59 -42
- pvlib/iotools/pvgis.py +84 -28
- pvlib/iotools/sodapro.py +8 -6
- pvlib/iotools/srml.py +121 -18
- pvlib/iotools/surfrad.py +2 -2
- pvlib/iotools/tmy.py +146 -102
- pvlib/irradiance.py +270 -15
- pvlib/ivtools/sde.py +14 -20
- pvlib/ivtools/sdm.py +31 -20
- pvlib/ivtools/utils.py +127 -6
- pvlib/location.py +3 -2
- pvlib/modelchain.py +67 -70
- pvlib/pvarray.py +225 -0
- pvlib/pvsystem.py +169 -539
- pvlib/shading.py +43 -2
- pvlib/singlediode.py +216 -66
- pvlib/snow.py +36 -15
- pvlib/soiling.py +3 -3
- pvlib/spa.py +327 -368
- pvlib/spectrum/__init__.py +8 -2
- pvlib/spectrum/mismatch.py +335 -0
- pvlib/temperature.py +124 -13
- pvlib/tests/bifacial/test_infinite_sheds.py +44 -106
- pvlib/tests/bifacial/test_utils.py +102 -5
- pvlib/tests/conftest.py +0 -31
- pvlib/tests/iotools/test_acis.py +213 -0
- pvlib/tests/iotools/test_midc.py +6 -6
- pvlib/tests/iotools/test_psm3.py +7 -5
- pvlib/tests/iotools/test_pvgis.py +21 -14
- pvlib/tests/iotools/test_sodapro.py +1 -1
- pvlib/tests/iotools/test_srml.py +71 -6
- pvlib/tests/iotools/test_tmy.py +43 -8
- pvlib/tests/ivtools/test_sde.py +19 -17
- pvlib/tests/ivtools/test_sdm.py +9 -4
- pvlib/tests/ivtools/test_utils.py +96 -1
- pvlib/tests/test_atmosphere.py +8 -64
- pvlib/tests/test_clearsky.py +0 -1
- pvlib/tests/test_iam.py +74 -1
- pvlib/tests/test_irradiance.py +56 -2
- pvlib/tests/test_location.py +1 -1
- pvlib/tests/test_modelchain.py +33 -76
- pvlib/tests/test_pvarray.py +46 -0
- pvlib/tests/test_pvsystem.py +366 -201
- pvlib/tests/test_shading.py +35 -0
- pvlib/tests/test_singlediode.py +306 -29
- pvlib/tests/test_snow.py +84 -1
- pvlib/tests/test_soiling.py +8 -7
- pvlib/tests/test_solarposition.py +7 -7
- pvlib/tests/test_spa.py +6 -7
- pvlib/tests/test_spectrum.py +145 -1
- pvlib/tests/test_temperature.py +29 -11
- pvlib/tests/test_tools.py +41 -0
- pvlib/tests/test_tracking.py +0 -149
- pvlib/tools.py +49 -25
- pvlib/tracking.py +1 -269
- pvlib-0.10.0.dist-info/AUTHORS.md +35 -0
- {pvlib-0.9.4a1.dist-info → pvlib-0.10.0.dist-info}/LICENSE +5 -2
- {pvlib-0.9.4a1.dist-info → pvlib-0.10.0.dist-info}/METADATA +3 -13
- {pvlib-0.9.4a1.dist-info → pvlib-0.10.0.dist-info}/RECORD +80 -75
- {pvlib-0.9.4a1.dist-info → pvlib-0.10.0.dist-info}/WHEEL +1 -1
- pvlib/data/adr-library-2013-10-01.csv +0 -1762
- pvlib/forecast.py +0 -1211
- pvlib/iotools/ecmwf_macc.py +0 -312
- pvlib/tests/iotools/test_ecmwf_macc.py +0 -162
- pvlib/tests/test_forecast.py +0 -228
- pvlib-0.9.4a1.dist-info/AUTHORS.md +0 -32
- {pvlib-0.9.4a1.dist-info → pvlib-0.10.0.dist-info}/top_level.txt +0 -0
pvlib/tests/test_pvsystem.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from collections import OrderedDict
|
|
2
|
+
import itertools
|
|
2
3
|
|
|
3
4
|
import numpy as np
|
|
4
5
|
from numpy import nan, array
|
|
@@ -14,11 +15,14 @@ from pvlib import inverter, pvsystem
|
|
|
14
15
|
from pvlib import atmosphere
|
|
15
16
|
from pvlib import iam as _iam
|
|
16
17
|
from pvlib import irradiance
|
|
18
|
+
from pvlib import spectrum
|
|
17
19
|
from pvlib.location import Location
|
|
18
20
|
from pvlib.pvsystem import FixedMount
|
|
19
21
|
from pvlib import temperature
|
|
20
22
|
from pvlib._deprecation import pvlibDeprecationWarning
|
|
21
23
|
from pvlib.tools import cosd
|
|
24
|
+
from pvlib.singlediode import VOLTAGE_BUILTIN
|
|
25
|
+
from pvlib.tests.test_singlediode import get_pvsyst_fs_495
|
|
22
26
|
|
|
23
27
|
|
|
24
28
|
@pytest.mark.parametrize('iam_model,model_params', [
|
|
@@ -253,28 +257,19 @@ def test_PVSystem_multi_array_sapm(sapm_module_params):
|
|
|
253
257
|
system.sapm(500, temp_cell)
|
|
254
258
|
|
|
255
259
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
])
|
|
261
|
-
def test_sapm_spectral_loss(sapm_module_params, airmass, expected):
|
|
262
|
-
|
|
263
|
-
out = pvsystem.sapm_spectral_loss(airmass, sapm_module_params)
|
|
264
|
-
|
|
265
|
-
if isinstance(airmass, pd.Series):
|
|
266
|
-
assert_series_equal(out, expected, check_less_precise=4)
|
|
267
|
-
else:
|
|
268
|
-
assert_allclose(out, expected, atol=1e-4)
|
|
260
|
+
def test_sapm_spectral_loss_deprecated(sapm_module_params):
|
|
261
|
+
with pytest.warns(pvlibDeprecationWarning,
|
|
262
|
+
match='Use pvlib.spectrum.spectral_factor_sapm'):
|
|
263
|
+
pvsystem.sapm_spectral_loss(1, sapm_module_params)
|
|
269
264
|
|
|
270
265
|
|
|
271
266
|
def test_PVSystem_sapm_spectral_loss(sapm_module_params, mocker):
|
|
272
|
-
mocker.spy(
|
|
267
|
+
mocker.spy(spectrum, 'spectral_factor_sapm')
|
|
273
268
|
system = pvsystem.PVSystem(module_parameters=sapm_module_params)
|
|
274
269
|
airmass = 2
|
|
275
270
|
out = system.sapm_spectral_loss(airmass)
|
|
276
|
-
|
|
277
|
-
|
|
271
|
+
spectrum.spectral_factor_sapm.assert_called_once_with(airmass,
|
|
272
|
+
sapm_module_params)
|
|
278
273
|
assert_allclose(out, 1, atol=0.5)
|
|
279
274
|
|
|
280
275
|
|
|
@@ -302,12 +297,12 @@ def test_PVSystem_multi_array_sapm_spectral_loss(sapm_module_params):
|
|
|
302
297
|
])
|
|
303
298
|
def test_PVSystem_first_solar_spectral_loss(module_parameters, module_type,
|
|
304
299
|
coefficients, mocker):
|
|
305
|
-
mocker.spy(
|
|
300
|
+
mocker.spy(spectrum, 'spectral_factor_firstsolar')
|
|
306
301
|
system = pvsystem.PVSystem(module_parameters=module_parameters)
|
|
307
302
|
pw = 3
|
|
308
303
|
airmass_absolute = 3
|
|
309
304
|
out = system.first_solar_spectral_loss(pw, airmass_absolute)
|
|
310
|
-
|
|
305
|
+
spectrum.spectral_factor_firstsolar.assert_called_once_with(
|
|
311
306
|
pw, airmass_absolute, module_type, coefficients)
|
|
312
307
|
assert_allclose(out, 1, atol=0.5)
|
|
313
308
|
|
|
@@ -744,28 +739,220 @@ def test_Array__infer_cell_type():
|
|
|
744
739
|
assert array._infer_cell_type() is None
|
|
745
740
|
|
|
746
741
|
|
|
742
|
+
def _calcparams_correct_Python_type_numeric_type_cases():
|
|
743
|
+
"""
|
|
744
|
+
An auxilary function used in the unit tests named
|
|
745
|
+
``test_calcparams_*_returns_correct_Python_type``.
|
|
746
|
+
|
|
747
|
+
Returns
|
|
748
|
+
-------
|
|
749
|
+
Returns a list of tuples of functions intended for transforming a
|
|
750
|
+
Python scalar into a numeric type: scalar, np.ndarray, or pandas.Series
|
|
751
|
+
"""
|
|
752
|
+
return list(itertools.product(*(2 * [[
|
|
753
|
+
# scalars (e.g. Python floats)
|
|
754
|
+
lambda x: x,
|
|
755
|
+
# np.ndarrays (0d and 1d-arrays)
|
|
756
|
+
np.array,
|
|
757
|
+
lambda x: np.array([x]),
|
|
758
|
+
# pd.Series (1d-arrays)
|
|
759
|
+
pd.Series
|
|
760
|
+
]])))
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
def _calcparams_correct_Python_type_check(out_value, numeric_args):
|
|
764
|
+
"""
|
|
765
|
+
An auxilary function used in the unit tests named
|
|
766
|
+
``test_calcparams_*_returns_correct_Python_type``.
|
|
767
|
+
|
|
768
|
+
Parameters
|
|
769
|
+
----------
|
|
770
|
+
out_value: numeric
|
|
771
|
+
A value returned by a pvsystem.calcparams_ function.
|
|
772
|
+
|
|
773
|
+
numeric_args: numeric
|
|
774
|
+
An iterable of the numeric-type arguments to the pvsystem.calcparams_
|
|
775
|
+
functions: ``effective_irradiance`` and ``temp_cell``.
|
|
776
|
+
|
|
777
|
+
Returns
|
|
778
|
+
-------
|
|
779
|
+
bool indicating whether ``out_value`` has the correct Python type
|
|
780
|
+
based on the Python types of ``effective_irradiance`` and
|
|
781
|
+
``temp_cell``.
|
|
782
|
+
"""
|
|
783
|
+
if any(isinstance(a, pd.Series) for a in numeric_args):
|
|
784
|
+
return isinstance(out_value, pd.Series)
|
|
785
|
+
elif any(isinstance(a, np.ndarray) for a in numeric_args):
|
|
786
|
+
return isinstance(out_value, np.ndarray) # 0d or 1d-arrays
|
|
787
|
+
return np.isscalar(out_value)
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
@pytest.mark.parametrize('numeric_type_funcs',
|
|
791
|
+
_calcparams_correct_Python_type_numeric_type_cases())
|
|
792
|
+
def test_calcparams_desoto_returns_correct_Python_type(numeric_type_funcs,
|
|
793
|
+
cec_module_params):
|
|
794
|
+
numeric_args = dict(
|
|
795
|
+
effective_irradiance=numeric_type_funcs[0](800.0),
|
|
796
|
+
temp_cell=numeric_type_funcs[1](25),
|
|
797
|
+
)
|
|
798
|
+
out = pvsystem.calcparams_desoto(
|
|
799
|
+
**numeric_args,
|
|
800
|
+
alpha_sc=cec_module_params['alpha_sc'],
|
|
801
|
+
a_ref=cec_module_params['a_ref'],
|
|
802
|
+
I_L_ref=cec_module_params['I_L_ref'],
|
|
803
|
+
I_o_ref=cec_module_params['I_o_ref'],
|
|
804
|
+
R_sh_ref=cec_module_params['R_sh_ref'],
|
|
805
|
+
R_s=cec_module_params['R_s'],
|
|
806
|
+
EgRef=1.121,
|
|
807
|
+
dEgdT=-0.0002677
|
|
808
|
+
)
|
|
809
|
+
|
|
810
|
+
assert all(_calcparams_correct_Python_type_check(a, numeric_args.values())
|
|
811
|
+
for a in out)
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
@pytest.mark.parametrize('numeric_type_funcs',
|
|
815
|
+
_calcparams_correct_Python_type_numeric_type_cases())
|
|
816
|
+
def test_calcparams_cec_returns_correct_Python_type(numeric_type_funcs,
|
|
817
|
+
cec_module_params):
|
|
818
|
+
numeric_args = dict(
|
|
819
|
+
effective_irradiance=numeric_type_funcs[0](800.0),
|
|
820
|
+
temp_cell=numeric_type_funcs[1](25),
|
|
821
|
+
)
|
|
822
|
+
out = pvsystem.calcparams_cec(
|
|
823
|
+
**numeric_args,
|
|
824
|
+
alpha_sc=cec_module_params['alpha_sc'],
|
|
825
|
+
a_ref=cec_module_params['a_ref'],
|
|
826
|
+
I_L_ref=cec_module_params['I_L_ref'],
|
|
827
|
+
I_o_ref=cec_module_params['I_o_ref'],
|
|
828
|
+
R_sh_ref=cec_module_params['R_sh_ref'],
|
|
829
|
+
R_s=cec_module_params['R_s'],
|
|
830
|
+
Adjust=cec_module_params['Adjust'],
|
|
831
|
+
EgRef=1.121,
|
|
832
|
+
dEgdT=-0.0002677
|
|
833
|
+
)
|
|
834
|
+
|
|
835
|
+
assert all(_calcparams_correct_Python_type_check(a, numeric_args.values())
|
|
836
|
+
for a in out)
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
@pytest.mark.parametrize('numeric_type_funcs',
|
|
840
|
+
_calcparams_correct_Python_type_numeric_type_cases())
|
|
841
|
+
def test_calcparams_pvsyst_returns_correct_Python_type(numeric_type_funcs,
|
|
842
|
+
pvsyst_module_params):
|
|
843
|
+
numeric_args = dict(
|
|
844
|
+
effective_irradiance=numeric_type_funcs[0](800.0),
|
|
845
|
+
temp_cell=numeric_type_funcs[1](25),
|
|
846
|
+
)
|
|
847
|
+
out = pvsystem.calcparams_pvsyst(
|
|
848
|
+
**numeric_args,
|
|
849
|
+
alpha_sc=pvsyst_module_params['alpha_sc'],
|
|
850
|
+
gamma_ref=pvsyst_module_params['gamma_ref'],
|
|
851
|
+
mu_gamma=pvsyst_module_params['mu_gamma'],
|
|
852
|
+
I_L_ref=pvsyst_module_params['I_L_ref'],
|
|
853
|
+
I_o_ref=pvsyst_module_params['I_o_ref'],
|
|
854
|
+
R_sh_ref=pvsyst_module_params['R_sh_ref'],
|
|
855
|
+
R_sh_0=pvsyst_module_params['R_sh_0'],
|
|
856
|
+
R_s=pvsyst_module_params['R_s'],
|
|
857
|
+
cells_in_series=pvsyst_module_params['cells_in_series'],
|
|
858
|
+
EgRef=pvsyst_module_params['EgRef']
|
|
859
|
+
)
|
|
860
|
+
|
|
861
|
+
assert all(_calcparams_correct_Python_type_check(a, numeric_args.values())
|
|
862
|
+
for a in out)
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
def test_calcparams_desoto_all_scalars(cec_module_params):
|
|
866
|
+
IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_desoto(
|
|
867
|
+
effective_irradiance=800.0,
|
|
868
|
+
temp_cell=25,
|
|
869
|
+
alpha_sc=cec_module_params['alpha_sc'],
|
|
870
|
+
a_ref=cec_module_params['a_ref'],
|
|
871
|
+
I_L_ref=cec_module_params['I_L_ref'],
|
|
872
|
+
I_o_ref=cec_module_params['I_o_ref'],
|
|
873
|
+
R_sh_ref=cec_module_params['R_sh_ref'],
|
|
874
|
+
R_s=cec_module_params['R_s'],
|
|
875
|
+
EgRef=1.121,
|
|
876
|
+
dEgdT=-0.0002677
|
|
877
|
+
)
|
|
878
|
+
|
|
879
|
+
assert np.isclose(IL, 6.036, atol=1e-4, rtol=0)
|
|
880
|
+
assert np.isclose(I0, 1.94e-9, atol=1e-4, rtol=0)
|
|
881
|
+
assert np.isclose(Rs, 0.094, atol=1e-4, rtol=0)
|
|
882
|
+
assert np.isclose(Rsh, 19.65, atol=1e-4, rtol=0)
|
|
883
|
+
assert np.isclose(nNsVth, 0.473, atol=1e-4, rtol=0)
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
def test_calcparams_cec_all_scalars(cec_module_params):
|
|
887
|
+
IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_cec(
|
|
888
|
+
effective_irradiance=800.0,
|
|
889
|
+
temp_cell=25,
|
|
890
|
+
alpha_sc=cec_module_params['alpha_sc'],
|
|
891
|
+
a_ref=cec_module_params['a_ref'],
|
|
892
|
+
I_L_ref=cec_module_params['I_L_ref'],
|
|
893
|
+
I_o_ref=cec_module_params['I_o_ref'],
|
|
894
|
+
R_sh_ref=cec_module_params['R_sh_ref'],
|
|
895
|
+
R_s=cec_module_params['R_s'],
|
|
896
|
+
Adjust=cec_module_params['Adjust'],
|
|
897
|
+
EgRef=1.121,
|
|
898
|
+
dEgdT=-0.0002677
|
|
899
|
+
)
|
|
900
|
+
|
|
901
|
+
assert np.isclose(IL, 6.036, atol=1e-4, rtol=0)
|
|
902
|
+
assert np.isclose(I0, 1.94e-9, atol=1e-4, rtol=0)
|
|
903
|
+
assert np.isclose(Rs, 0.094, atol=1e-4, rtol=0)
|
|
904
|
+
assert np.isclose(Rsh, 19.65, atol=1e-4, rtol=0)
|
|
905
|
+
assert np.isclose(nNsVth, 0.473, atol=1e-4, rtol=0)
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
def test_calcparams_pvsyst_all_scalars(pvsyst_module_params):
|
|
909
|
+
IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_pvsyst(
|
|
910
|
+
effective_irradiance=800.0,
|
|
911
|
+
temp_cell=50,
|
|
912
|
+
alpha_sc=pvsyst_module_params['alpha_sc'],
|
|
913
|
+
gamma_ref=pvsyst_module_params['gamma_ref'],
|
|
914
|
+
mu_gamma=pvsyst_module_params['mu_gamma'],
|
|
915
|
+
I_L_ref=pvsyst_module_params['I_L_ref'],
|
|
916
|
+
I_o_ref=pvsyst_module_params['I_o_ref'],
|
|
917
|
+
R_sh_ref=pvsyst_module_params['R_sh_ref'],
|
|
918
|
+
R_sh_0=pvsyst_module_params['R_sh_0'],
|
|
919
|
+
R_s=pvsyst_module_params['R_s'],
|
|
920
|
+
cells_in_series=pvsyst_module_params['cells_in_series'],
|
|
921
|
+
EgRef=pvsyst_module_params['EgRef'])
|
|
922
|
+
|
|
923
|
+
assert np.isclose(IL, 4.8200, atol=1e-4, rtol=0)
|
|
924
|
+
assert np.isclose(I0, 1.47e-7, atol=1e-4, rtol=0)
|
|
925
|
+
assert np.isclose(Rs, 0.500, atol=1e-4, rtol=0)
|
|
926
|
+
assert np.isclose(Rsh, 305.757, atol=1e-4, rtol=0)
|
|
927
|
+
assert np.isclose(nNsVth, 1.7961, atol=1e-4, rtol=0)
|
|
928
|
+
|
|
929
|
+
|
|
747
930
|
def test_calcparams_desoto(cec_module_params):
|
|
748
931
|
times = pd.date_range(start='2015-01-01', periods=3, freq='12H')
|
|
749
|
-
|
|
750
|
-
|
|
932
|
+
df = pd.DataFrame({
|
|
933
|
+
'effective_irradiance': [0.0, 800.0, 800.0],
|
|
934
|
+
'temp_cell': [25, 25, 50]
|
|
935
|
+
}, index=times)
|
|
751
936
|
|
|
752
937
|
IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_desoto(
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
938
|
+
df['effective_irradiance'],
|
|
939
|
+
df['temp_cell'],
|
|
940
|
+
alpha_sc=cec_module_params['alpha_sc'],
|
|
941
|
+
a_ref=cec_module_params['a_ref'],
|
|
942
|
+
I_L_ref=cec_module_params['I_L_ref'],
|
|
943
|
+
I_o_ref=cec_module_params['I_o_ref'],
|
|
944
|
+
R_sh_ref=cec_module_params['R_sh_ref'],
|
|
945
|
+
R_s=cec_module_params['R_s'],
|
|
946
|
+
EgRef=1.121,
|
|
947
|
+
dEgdT=-0.0002677
|
|
948
|
+
)
|
|
763
949
|
|
|
764
950
|
assert_series_equal(IL, pd.Series([0.0, 6.036, 6.096], index=times),
|
|
765
951
|
check_less_precise=3)
|
|
766
952
|
assert_series_equal(I0, pd.Series([0.0, 1.94e-9, 7.419e-8], index=times),
|
|
767
953
|
check_less_precise=3)
|
|
768
|
-
|
|
954
|
+
assert_series_equal(Rs, pd.Series([0.094, 0.094, 0.094], index=times),
|
|
955
|
+
check_less_precise=3)
|
|
769
956
|
assert_series_equal(Rsh, pd.Series([np.inf, 19.65, 19.65], index=times),
|
|
770
957
|
check_less_precise=3)
|
|
771
958
|
assert_series_equal(nNsVth, pd.Series([0.473, 0.473, 0.5127], index=times),
|
|
@@ -774,27 +961,31 @@ def test_calcparams_desoto(cec_module_params):
|
|
|
774
961
|
|
|
775
962
|
def test_calcparams_cec(cec_module_params):
|
|
776
963
|
times = pd.date_range(start='2015-01-01', periods=3, freq='12H')
|
|
777
|
-
|
|
778
|
-
|
|
964
|
+
df = pd.DataFrame({
|
|
965
|
+
'effective_irradiance': [0.0, 800.0, 800.0],
|
|
966
|
+
'temp_cell': [25, 25, 50]
|
|
967
|
+
}, index=times)
|
|
779
968
|
|
|
780
969
|
IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_cec(
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
970
|
+
df['effective_irradiance'],
|
|
971
|
+
df['temp_cell'],
|
|
972
|
+
alpha_sc=cec_module_params['alpha_sc'],
|
|
973
|
+
a_ref=cec_module_params['a_ref'],
|
|
974
|
+
I_L_ref=cec_module_params['I_L_ref'],
|
|
975
|
+
I_o_ref=cec_module_params['I_o_ref'],
|
|
976
|
+
R_sh_ref=cec_module_params['R_sh_ref'],
|
|
977
|
+
R_s=cec_module_params['R_s'],
|
|
978
|
+
Adjust=cec_module_params['Adjust'],
|
|
979
|
+
EgRef=1.121,
|
|
980
|
+
dEgdT=-0.0002677
|
|
981
|
+
)
|
|
792
982
|
|
|
793
983
|
assert_series_equal(IL, pd.Series([0.0, 6.036, 6.0896], index=times),
|
|
794
984
|
check_less_precise=3)
|
|
795
985
|
assert_series_equal(I0, pd.Series([0.0, 1.94e-9, 7.419e-8], index=times),
|
|
796
986
|
check_less_precise=3)
|
|
797
|
-
|
|
987
|
+
assert_series_equal(Rs, pd.Series([0.094, 0.094, 0.094], index=times),
|
|
988
|
+
check_less_precise=3)
|
|
798
989
|
assert_series_equal(Rsh, pd.Series([np.inf, 19.65, 19.65], index=times),
|
|
799
990
|
check_less_precise=3)
|
|
800
991
|
assert_series_equal(nNsVth, pd.Series([0.473, 0.473, 0.5127], index=times),
|
|
@@ -840,12 +1031,14 @@ def test_calcparams_cec_extra_params_propagation(cec_module_params, mocker):
|
|
|
840
1031
|
|
|
841
1032
|
def test_calcparams_pvsyst(pvsyst_module_params):
|
|
842
1033
|
times = pd.date_range(start='2015-01-01', periods=2, freq='12H')
|
|
843
|
-
|
|
844
|
-
|
|
1034
|
+
df = pd.DataFrame({
|
|
1035
|
+
'effective_irradiance': [0.0, 800.0],
|
|
1036
|
+
'temp_cell': [25, 50]
|
|
1037
|
+
}, index=times)
|
|
845
1038
|
|
|
846
1039
|
IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_pvsyst(
|
|
847
|
-
effective_irradiance,
|
|
848
|
-
temp_cell,
|
|
1040
|
+
df['effective_irradiance'],
|
|
1041
|
+
df['temp_cell'],
|
|
849
1042
|
alpha_sc=pvsyst_module_params['alpha_sc'],
|
|
850
1043
|
gamma_ref=pvsyst_module_params['gamma_ref'],
|
|
851
1044
|
mu_gamma=pvsyst_module_params['mu_gamma'],
|
|
@@ -861,7 +1054,8 @@ def test_calcparams_pvsyst(pvsyst_module_params):
|
|
|
861
1054
|
IL.round(decimals=3), pd.Series([0.0, 4.8200], index=times))
|
|
862
1055
|
assert_series_equal(
|
|
863
1056
|
I0.round(decimals=3), pd.Series([0.0, 1.47e-7], index=times))
|
|
864
|
-
|
|
1057
|
+
assert_series_equal(
|
|
1058
|
+
Rs.round(decimals=3), pd.Series([0.500, 0.500], index=times))
|
|
865
1059
|
assert_series_equal(
|
|
866
1060
|
Rsh.round(decimals=3), pd.Series([1000.0, 305.757], index=times))
|
|
867
1061
|
assert_series_equal(
|
|
@@ -879,21 +1073,23 @@ def test_PVSystem_calcparams_desoto(cec_module_params, mocker):
|
|
|
879
1073
|
IL, I0, Rs, Rsh, nNsVth = system.calcparams_desoto(effective_irradiance,
|
|
880
1074
|
temp_cell)
|
|
881
1075
|
pvsystem.calcparams_desoto.assert_called_once_with(
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1076
|
+
effective_irradiance,
|
|
1077
|
+
temp_cell,
|
|
1078
|
+
alpha_sc=cec_module_params['alpha_sc'],
|
|
1079
|
+
a_ref=cec_module_params['a_ref'],
|
|
1080
|
+
I_L_ref=cec_module_params['I_L_ref'],
|
|
1081
|
+
I_o_ref=cec_module_params['I_o_ref'],
|
|
1082
|
+
R_sh_ref=cec_module_params['R_sh_ref'],
|
|
1083
|
+
R_s=cec_module_params['R_s'],
|
|
1084
|
+
EgRef=module_parameters['EgRef'],
|
|
1085
|
+
dEgdT=module_parameters['dEgdT']
|
|
1086
|
+
)
|
|
1087
|
+
|
|
892
1088
|
assert_allclose(IL, np.array([0.0, 6.036]), atol=1)
|
|
893
|
-
assert_allclose(I0, 2.0e-9, atol=1.0e-9)
|
|
894
|
-
assert_allclose(Rs, 0.1, atol=0.1)
|
|
1089
|
+
assert_allclose(I0, np.array([2.0e-9, 2.0e-9]), atol=1.0e-9)
|
|
1090
|
+
assert_allclose(Rs, np.array([0.1, 0.1]), atol=0.1)
|
|
895
1091
|
assert_allclose(Rsh, np.array([np.inf, 20]), atol=1)
|
|
896
|
-
assert_allclose(nNsVth, 0.5, atol=0.1)
|
|
1092
|
+
assert_allclose(nNsVth, np.array([0.5, 0.5]), atol=0.1)
|
|
897
1093
|
|
|
898
1094
|
|
|
899
1095
|
def test_PVSystem_calcparams_pvsyst(pvsyst_module_params, mocker):
|
|
@@ -905,23 +1101,24 @@ def test_PVSystem_calcparams_pvsyst(pvsyst_module_params, mocker):
|
|
|
905
1101
|
IL, I0, Rs, Rsh, nNsVth = system.calcparams_pvsyst(effective_irradiance,
|
|
906
1102
|
temp_cell)
|
|
907
1103
|
pvsystem.calcparams_pvsyst.assert_called_once_with(
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1104
|
+
effective_irradiance,
|
|
1105
|
+
temp_cell,
|
|
1106
|
+
alpha_sc=pvsyst_module_params['alpha_sc'],
|
|
1107
|
+
gamma_ref=pvsyst_module_params['gamma_ref'],
|
|
1108
|
+
mu_gamma=pvsyst_module_params['mu_gamma'],
|
|
1109
|
+
I_L_ref=pvsyst_module_params['I_L_ref'],
|
|
1110
|
+
I_o_ref=pvsyst_module_params['I_o_ref'],
|
|
1111
|
+
R_sh_ref=pvsyst_module_params['R_sh_ref'],
|
|
1112
|
+
R_sh_0=pvsyst_module_params['R_sh_0'],
|
|
1113
|
+
R_s=pvsyst_module_params['R_s'],
|
|
1114
|
+
cells_in_series=pvsyst_module_params['cells_in_series'],
|
|
1115
|
+
EgRef=pvsyst_module_params['EgRef'],
|
|
1116
|
+
R_sh_exp=pvsyst_module_params['R_sh_exp']
|
|
1117
|
+
)
|
|
921
1118
|
|
|
922
1119
|
assert_allclose(IL, np.array([0.0, 4.8200]), atol=1)
|
|
923
1120
|
assert_allclose(I0, np.array([0.0, 1.47e-7]), atol=1.0e-5)
|
|
924
|
-
assert_allclose(Rs, 0.5, atol=0.1)
|
|
1121
|
+
assert_allclose(Rs, np.array([0.5, 0.5]), atol=0.1)
|
|
925
1122
|
assert_allclose(Rsh, np.array([1000, 305.757]), atol=50)
|
|
926
1123
|
assert_allclose(nNsVth, np.array([1.6186, 1.7961]), atol=0.1)
|
|
927
1124
|
|
|
@@ -1079,11 +1276,12 @@ def test_v_from_i(fixture_v_from_i, method, atol):
|
|
|
1079
1276
|
IL = fixture_v_from_i['IL']
|
|
1080
1277
|
V_expected = fixture_v_from_i['V_expected']
|
|
1081
1278
|
|
|
1082
|
-
V = pvsystem.v_from_i(
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
assert(V.
|
|
1279
|
+
V = pvsystem.v_from_i(I, IL, I0, Rs, Rsh, nNsVth, method=method)
|
|
1280
|
+
|
|
1281
|
+
assert isinstance(V, type(V_expected))
|
|
1282
|
+
if isinstance(V, np.ndarray):
|
|
1283
|
+
assert isinstance(V.dtype, type(V_expected.dtype))
|
|
1284
|
+
assert V.shape == V_expected.shape
|
|
1087
1285
|
assert_allclose(V, V_expected, atol=atol)
|
|
1088
1286
|
|
|
1089
1287
|
|
|
@@ -1092,7 +1290,7 @@ def test_i_from_v_from_i(fixture_v_from_i):
|
|
|
1092
1290
|
Rsh = fixture_v_from_i['Rsh']
|
|
1093
1291
|
Rs = fixture_v_from_i['Rs']
|
|
1094
1292
|
nNsVth = fixture_v_from_i['nNsVth']
|
|
1095
|
-
|
|
1293
|
+
current = fixture_v_from_i['I']
|
|
1096
1294
|
I0 = fixture_v_from_i['I0']
|
|
1097
1295
|
IL = fixture_v_from_i['IL']
|
|
1098
1296
|
V = fixture_v_from_i['V_expected']
|
|
@@ -1100,15 +1298,17 @@ def test_i_from_v_from_i(fixture_v_from_i):
|
|
|
1100
1298
|
# Convergence criteria
|
|
1101
1299
|
atol = 1.e-11
|
|
1102
1300
|
|
|
1103
|
-
I_expected = pvsystem.i_from_v(
|
|
1301
|
+
I_expected = pvsystem.i_from_v(V, IL, I0, Rs, Rsh, nNsVth,
|
|
1104
1302
|
method='lambertw')
|
|
1105
|
-
assert_allclose(
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1303
|
+
assert_allclose(current, I_expected, atol=atol)
|
|
1304
|
+
|
|
1305
|
+
current = pvsystem.i_from_v(V, IL, I0, Rs, Rsh, nNsVth)
|
|
1306
|
+
|
|
1307
|
+
assert isinstance(current, type(I_expected))
|
|
1308
|
+
if isinstance(current, np.ndarray):
|
|
1309
|
+
assert isinstance(current.dtype, type(I_expected.dtype))
|
|
1310
|
+
assert current.shape == I_expected.shape
|
|
1311
|
+
assert_allclose(current, I_expected, atol=atol)
|
|
1112
1312
|
|
|
1113
1313
|
|
|
1114
1314
|
@pytest.fixture(params=[
|
|
@@ -1197,41 +1397,42 @@ def test_i_from_v(fixture_i_from_v, method, atol):
|
|
|
1197
1397
|
IL = fixture_i_from_v['IL']
|
|
1198
1398
|
I_expected = fixture_i_from_v['I_expected']
|
|
1199
1399
|
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
assert(
|
|
1205
|
-
|
|
1400
|
+
current = pvsystem.i_from_v(V, IL, I0, Rs, Rsh, nNsVth, method=method)
|
|
1401
|
+
|
|
1402
|
+
assert isinstance(current, type(I_expected))
|
|
1403
|
+
if isinstance(current, np.ndarray):
|
|
1404
|
+
assert isinstance(current.dtype, type(I_expected.dtype))
|
|
1405
|
+
assert current.shape == I_expected.shape
|
|
1406
|
+
assert_allclose(current, I_expected, atol=atol)
|
|
1206
1407
|
|
|
1207
1408
|
|
|
1208
1409
|
def test_PVSystem_i_from_v(mocker):
|
|
1209
1410
|
system = pvsystem.PVSystem()
|
|
1210
1411
|
m = mocker.patch('pvlib.pvsystem.i_from_v', autospec=True)
|
|
1211
|
-
args = (
|
|
1412
|
+
args = (7.5049875193450521, 7, 6e-7, 0.1, 20, 0.5)
|
|
1212
1413
|
system.i_from_v(*args)
|
|
1213
1414
|
m.assert_called_once_with(*args)
|
|
1214
1415
|
|
|
1215
1416
|
|
|
1216
1417
|
def test_i_from_v_size():
|
|
1217
1418
|
with pytest.raises(ValueError):
|
|
1218
|
-
pvsystem.i_from_v(
|
|
1419
|
+
pvsystem.i_from_v([7.5] * 3, 7., 6e-7, [0.1] * 2, 20, 0.5)
|
|
1219
1420
|
with pytest.raises(ValueError):
|
|
1220
|
-
pvsystem.i_from_v(
|
|
1421
|
+
pvsystem.i_from_v([7.5] * 3, 7., 6e-7, [0.1] * 2, 20, 0.5,
|
|
1221
1422
|
method='brentq')
|
|
1222
1423
|
with pytest.raises(ValueError):
|
|
1223
|
-
pvsystem.i_from_v(
|
|
1424
|
+
pvsystem.i_from_v([7.5] * 3, np.array([7., 7.]), 6e-7, 0.1, 20, 0.5,
|
|
1224
1425
|
method='newton')
|
|
1225
1426
|
|
|
1226
1427
|
|
|
1227
1428
|
def test_v_from_i_size():
|
|
1228
1429
|
with pytest.raises(ValueError):
|
|
1229
|
-
pvsystem.v_from_i(
|
|
1430
|
+
pvsystem.v_from_i([3.] * 3, 7., 6e-7, [0.1] * 2, 20, 0.5)
|
|
1230
1431
|
with pytest.raises(ValueError):
|
|
1231
|
-
pvsystem.v_from_i(
|
|
1432
|
+
pvsystem.v_from_i([3.] * 3, 7., 6e-7, [0.1] * 2, 20, 0.5,
|
|
1232
1433
|
method='brentq')
|
|
1233
1434
|
with pytest.raises(ValueError):
|
|
1234
|
-
pvsystem.v_from_i(
|
|
1435
|
+
pvsystem.v_from_i([3.] * 3, np.array([7., 7.]), 6e-7, [0.1], 20, 0.5,
|
|
1235
1436
|
method='newton')
|
|
1236
1437
|
|
|
1237
1438
|
|
|
@@ -1250,6 +1451,43 @@ def test_mpp_floats():
|
|
|
1250
1451
|
assert np.isclose(v, expected[k])
|
|
1251
1452
|
|
|
1252
1453
|
|
|
1454
|
+
def test_mpp_recombination():
|
|
1455
|
+
"""test max_power_point"""
|
|
1456
|
+
pvsyst_fs_495 = get_pvsyst_fs_495()
|
|
1457
|
+
IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_pvsyst(
|
|
1458
|
+
effective_irradiance=pvsyst_fs_495['irrad_ref'],
|
|
1459
|
+
temp_cell=pvsyst_fs_495['temp_ref'],
|
|
1460
|
+
alpha_sc=pvsyst_fs_495['alpha_sc'],
|
|
1461
|
+
gamma_ref=pvsyst_fs_495['gamma_ref'],
|
|
1462
|
+
mu_gamma=pvsyst_fs_495['mu_gamma'], I_L_ref=pvsyst_fs_495['I_L_ref'],
|
|
1463
|
+
I_o_ref=pvsyst_fs_495['I_o_ref'], R_sh_ref=pvsyst_fs_495['R_sh_ref'],
|
|
1464
|
+
R_sh_0=pvsyst_fs_495['R_sh_0'], R_sh_exp=pvsyst_fs_495['R_sh_exp'],
|
|
1465
|
+
R_s=pvsyst_fs_495['R_s'],
|
|
1466
|
+
cells_in_series=pvsyst_fs_495['cells_in_series'],
|
|
1467
|
+
EgRef=pvsyst_fs_495['EgRef'])
|
|
1468
|
+
out = pvsystem.max_power_point(
|
|
1469
|
+
IL, I0, Rs, Rsh, nNsVth,
|
|
1470
|
+
d2mutau=pvsyst_fs_495['d2mutau'],
|
|
1471
|
+
NsVbi=VOLTAGE_BUILTIN*pvsyst_fs_495['cells_in_series'],
|
|
1472
|
+
method='brentq')
|
|
1473
|
+
expected_imp = pvsyst_fs_495['I_mp_ref']
|
|
1474
|
+
expected_vmp = pvsyst_fs_495['V_mp_ref']
|
|
1475
|
+
expected_pmp = expected_imp*expected_vmp
|
|
1476
|
+
expected = {'i_mp': expected_imp,
|
|
1477
|
+
'v_mp': expected_vmp,
|
|
1478
|
+
'p_mp': expected_pmp}
|
|
1479
|
+
assert isinstance(out, dict)
|
|
1480
|
+
for k, v in out.items():
|
|
1481
|
+
assert np.isclose(v, expected[k], 0.01)
|
|
1482
|
+
out = pvsystem.max_power_point(
|
|
1483
|
+
IL, I0, Rs, Rsh, nNsVth,
|
|
1484
|
+
d2mutau=pvsyst_fs_495['d2mutau'],
|
|
1485
|
+
NsVbi=VOLTAGE_BUILTIN*pvsyst_fs_495['cells_in_series'],
|
|
1486
|
+
method='newton')
|
|
1487
|
+
for k, v in out.items():
|
|
1488
|
+
assert np.isclose(v, expected[k], 0.01)
|
|
1489
|
+
|
|
1490
|
+
|
|
1253
1491
|
def test_mpp_array():
|
|
1254
1492
|
"""test max_power_point"""
|
|
1255
1493
|
IL, I0, Rs, Rsh, nNsVth = (np.array([7, 7]), 6e-7, .1, 20, .5)
|
|
@@ -1328,8 +1566,8 @@ def test_singlediode_array():
|
|
|
1328
1566
|
|
|
1329
1567
|
sd = pvsystem.singlediode(photocurrent, saturation_current,
|
|
1330
1568
|
resistance_series, resistance_shunt, nNsVth)
|
|
1331
|
-
expected = pvsystem.i_from_v(
|
|
1332
|
-
|
|
1569
|
+
expected = pvsystem.i_from_v(sd['v_mp'], photocurrent, saturation_current,
|
|
1570
|
+
resistance_series, resistance_shunt, nNsVth,
|
|
1333
1571
|
method='lambertw')
|
|
1334
1572
|
assert_allclose(sd['i_mp'], expected, atol=1e-8)
|
|
1335
1573
|
|
|
@@ -1354,8 +1592,9 @@ def test_singlediode_floats():
|
|
|
1354
1592
|
|
|
1355
1593
|
|
|
1356
1594
|
def test_singlediode_floats_ivcurve():
|
|
1357
|
-
|
|
1358
|
-
|
|
1595
|
+
with pytest.warns(pvlibDeprecationWarning, match='ivcurve_pnts'):
|
|
1596
|
+
out = pvsystem.singlediode(7., 6e-7, .1, 20., .5, ivcurve_pnts=3,
|
|
1597
|
+
method='lambertw')
|
|
1359
1598
|
expected = {'i_xx': 4.264060478,
|
|
1360
1599
|
'i_mp': 6.136267360,
|
|
1361
1600
|
'v_oc': 8.106300147,
|
|
@@ -1387,8 +1626,9 @@ def test_singlediode_series_ivcurve(cec_module_params):
|
|
|
1387
1626
|
EgRef=1.121,
|
|
1388
1627
|
dEgdT=-0.0002677)
|
|
1389
1628
|
|
|
1390
|
-
|
|
1391
|
-
|
|
1629
|
+
with pytest.warns(pvlibDeprecationWarning, match='ivcurve_pnts'):
|
|
1630
|
+
out = pvsystem.singlediode(IL, I0, Rs, Rsh, nNsVth, ivcurve_pnts=3,
|
|
1631
|
+
method='lambertw')
|
|
1392
1632
|
|
|
1393
1633
|
expected = OrderedDict([('i_sc', array([0., 3.01079860, 6.00726296])),
|
|
1394
1634
|
('v_oc', array([0., 9.96959733, 10.29603253])),
|
|
@@ -1404,25 +1644,33 @@ def test_singlediode_series_ivcurve(cec_module_params):
|
|
|
1404
1644
|
[3.0107985972, 2.8841320056, 0.],
|
|
1405
1645
|
[6.0072629615, 5.7462022810, 0.]]))])
|
|
1406
1646
|
|
|
1407
|
-
|
|
1408
1647
|
for k, v in out.items():
|
|
1409
1648
|
assert_allclose(v, expected[k], atol=1e-2)
|
|
1410
1649
|
|
|
1411
|
-
|
|
1650
|
+
with pytest.warns(pvlibDeprecationWarning, match='ivcurve_pnts'):
|
|
1651
|
+
out = pvsystem.singlediode(IL, I0, Rs, Rsh, nNsVth, ivcurve_pnts=3)
|
|
1412
1652
|
|
|
1413
|
-
expected['i_mp'] = pvsystem.i_from_v(
|
|
1653
|
+
expected['i_mp'] = pvsystem.i_from_v(out['v_mp'], IL, I0, Rs, Rsh, nNsVth,
|
|
1414
1654
|
method='lambertw')
|
|
1415
|
-
expected['v_mp'] = pvsystem.v_from_i(
|
|
1655
|
+
expected['v_mp'] = pvsystem.v_from_i(out['i_mp'], IL, I0, Rs, Rsh, nNsVth,
|
|
1416
1656
|
method='lambertw')
|
|
1417
|
-
expected['i'] = pvsystem.i_from_v(
|
|
1418
|
-
|
|
1419
|
-
expected['v'] = pvsystem.v_from_i(
|
|
1420
|
-
|
|
1657
|
+
expected['i'] = pvsystem.i_from_v(out['v'].T, IL, I0, Rs, Rsh, nNsVth,
|
|
1658
|
+
method='lambertw').T
|
|
1659
|
+
expected['v'] = pvsystem.v_from_i(out['i'].T, IL, I0, Rs, Rsh, nNsVth,
|
|
1660
|
+
method='lambertw').T
|
|
1421
1661
|
|
|
1422
1662
|
for k, v in out.items():
|
|
1423
1663
|
assert_allclose(v, expected[k], atol=1e-6)
|
|
1424
1664
|
|
|
1425
1665
|
|
|
1666
|
+
@fail_on_pvlib_version('0.11')
|
|
1667
|
+
@pytest.mark.parametrize('method', ['lambertw', 'brentq', 'newton'])
|
|
1668
|
+
def test_singlediode_ivcurvepnts_deprecation_warning(method):
|
|
1669
|
+
with pytest.warns(pvlibDeprecationWarning, match='ivcurve_pnts'):
|
|
1670
|
+
pvsystem.singlediode(7., 6e-7, .1, 20., .5, ivcurve_pnts=3,
|
|
1671
|
+
method=method)
|
|
1672
|
+
|
|
1673
|
+
|
|
1426
1674
|
def test_scale_voltage_current_power():
|
|
1427
1675
|
data = pd.DataFrame(
|
|
1428
1676
|
np.array([[2, 1.5, 10, 8, 12, 0.5, 1.5]]),
|
|
@@ -1481,20 +1729,6 @@ def test_PVSystem_get_ac_sandia(cec_inverter_parameters, mocker):
|
|
|
1481
1729
|
assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))
|
|
1482
1730
|
|
|
1483
1731
|
|
|
1484
|
-
@fail_on_pvlib_version('0.10')
|
|
1485
|
-
def test_PVSystem_snlinverter(cec_inverter_parameters):
|
|
1486
|
-
system = pvsystem.PVSystem(
|
|
1487
|
-
inverter=cec_inverter_parameters['Name'],
|
|
1488
|
-
inverter_parameters=cec_inverter_parameters,
|
|
1489
|
-
)
|
|
1490
|
-
vdcs = pd.Series(np.linspace(0,50,3))
|
|
1491
|
-
idcs = pd.Series(np.linspace(0,11,3))
|
|
1492
|
-
pdcs = idcs * vdcs
|
|
1493
|
-
with pytest.warns(pvlibDeprecationWarning):
|
|
1494
|
-
pacs = system.snlinverter(vdcs, pdcs)
|
|
1495
|
-
assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
1732
|
def test_PVSystem_get_ac_sandia_multi(cec_inverter_parameters, mocker):
|
|
1499
1733
|
inv_fun = mocker.spy(inverter, 'sandia_multi')
|
|
1500
1734
|
system = pvsystem.PVSystem(
|
|
@@ -1637,9 +1871,6 @@ def test_PVSystem_get_ac_invalid(cec_inverter_parameters):
|
|
|
1637
1871
|
def test_PVSystem_creation():
|
|
1638
1872
|
pv_system = pvsystem.PVSystem(module='blah', inverter='blarg')
|
|
1639
1873
|
# ensure that parameter attributes are dict-like. GH 294
|
|
1640
|
-
with pytest.warns(pvlibDeprecationWarning):
|
|
1641
|
-
pv_system.module_parameters['pdc0'] = 1
|
|
1642
|
-
|
|
1643
1874
|
pv_system.inverter_parameters['Paco'] = 1
|
|
1644
1875
|
|
|
1645
1876
|
|
|
@@ -1881,30 +2112,6 @@ def test_Array_get_irradiance(solar_pos):
|
|
|
1881
2112
|
assert_series_equal(expected, expected, check_less_precise=5)
|
|
1882
2113
|
|
|
1883
2114
|
|
|
1884
|
-
@fail_on_pvlib_version('0.10')
|
|
1885
|
-
@pytest.mark.parametrize('attr', ['module_parameters', 'module', 'module_type',
|
|
1886
|
-
'temperature_model_parameters', 'albedo',
|
|
1887
|
-
'surface_tilt', 'surface_azimuth',
|
|
1888
|
-
'racking_model', 'modules_per_string',
|
|
1889
|
-
'strings_per_inverter'])
|
|
1890
|
-
def test_PVSystem_multi_array_attributes(attr):
|
|
1891
|
-
array_one = pvsystem.Array(pvsystem.FixedMount())
|
|
1892
|
-
array_two = pvsystem.Array(pvsystem.FixedMount())
|
|
1893
|
-
system = pvsystem.PVSystem(arrays=[array_one, array_two])
|
|
1894
|
-
with pytest.raises(AttributeError):
|
|
1895
|
-
getattr(system, attr)
|
|
1896
|
-
|
|
1897
|
-
with pytest.raises(AttributeError):
|
|
1898
|
-
setattr(system, attr, 'dummy')
|
|
1899
|
-
|
|
1900
|
-
system = pvsystem.PVSystem()
|
|
1901
|
-
with pytest.warns(pvlibDeprecationWarning):
|
|
1902
|
-
getattr(system, attr)
|
|
1903
|
-
|
|
1904
|
-
with pytest.warns(pvlibDeprecationWarning):
|
|
1905
|
-
setattr(system, attr, 'dummy')
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
2115
|
def test_PVSystem___repr__():
|
|
1909
2116
|
system = pvsystem.PVSystem(
|
|
1910
2117
|
module='blah', inverter='blarg', name='pv ftw',
|
|
@@ -2135,28 +2342,6 @@ def test_PVSystem_pvwatts_losses(pvwatts_system_defaults, mocker):
|
|
|
2135
2342
|
assert out < expected
|
|
2136
2343
|
|
|
2137
2344
|
|
|
2138
|
-
@fail_on_pvlib_version('0.10')
|
|
2139
|
-
def test_PVSystem_pvwatts_ac(pvwatts_system_defaults, mocker):
|
|
2140
|
-
mocker.spy(inverter, 'pvwatts')
|
|
2141
|
-
pdc = 50
|
|
2142
|
-
with pytest.warns(pvlibDeprecationWarning):
|
|
2143
|
-
out = pvwatts_system_defaults.pvwatts_ac(pdc)
|
|
2144
|
-
inverter.pvwatts.assert_called_once_with(
|
|
2145
|
-
pdc, **pvwatts_system_defaults.inverter_parameters)
|
|
2146
|
-
assert out < pdc
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
@fail_on_pvlib_version('0.10')
|
|
2150
|
-
def test_PVSystem_pvwatts_ac_kwargs(pvwatts_system_kwargs, mocker):
|
|
2151
|
-
mocker.spy(inverter, 'pvwatts')
|
|
2152
|
-
pdc = 50
|
|
2153
|
-
with pytest.warns(pvlibDeprecationWarning):
|
|
2154
|
-
out = pvwatts_system_kwargs.pvwatts_ac(pdc)
|
|
2155
|
-
inverter.pvwatts.assert_called_once_with(
|
|
2156
|
-
pdc, **pvwatts_system_kwargs.inverter_parameters)
|
|
2157
|
-
assert out < pdc
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
2345
|
def test_PVSystem_num_arrays():
|
|
2161
2346
|
system_one = pvsystem.PVSystem()
|
|
2162
2347
|
system_two = pvsystem.PVSystem(arrays=[
|
|
@@ -2324,26 +2509,6 @@ def test_Array_dc_ohms_from_percent(mocker):
|
|
|
2324
2509
|
out = array.dc_ohms_from_percent()
|
|
2325
2510
|
|
|
2326
2511
|
|
|
2327
|
-
@pytest.mark.parametrize('funcname', ['sapm_celltemp', 'pvsyst_celltemp',
|
|
2328
|
-
'faiman_celltemp', 'fuentes_celltemp',
|
|
2329
|
-
'noct_sam_celltemp'])
|
|
2330
|
-
def test_PVSystem_temperature_deprecated(funcname):
|
|
2331
|
-
temp_model_params = {
|
|
2332
|
-
'a': -3.47, 'b': -0.0594, 'deltaT': 3, # sapm
|
|
2333
|
-
'noct_installed': 45, # fuentes
|
|
2334
|
-
'module_efficiency': 0.2, 'noct': 45, # noct_sam
|
|
2335
|
-
}
|
|
2336
|
-
system = pvsystem.PVSystem(temperature_model_parameters=temp_model_params)
|
|
2337
|
-
func = getattr(system, funcname)
|
|
2338
|
-
index = pd.date_range('2019-01-01', freq='h', periods=5)
|
|
2339
|
-
temps = pd.Series(25, index)
|
|
2340
|
-
irrads = pd.Series(1000, index)
|
|
2341
|
-
winds = pd.Series(1, index)
|
|
2342
|
-
|
|
2343
|
-
with pytest.warns(pvlibDeprecationWarning):
|
|
2344
|
-
func(irrads, temps, winds)
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
2512
|
@pytest.mark.parametrize('model,keys', [
|
|
2348
2513
|
('sapm', ('a', 'b', 'deltaT')),
|
|
2349
2514
|
('fuentes', ('noct_installed',)),
|