diff --git a/docs/sphinx/source/whatsnew/v0.3.1.txt b/docs/sphinx/source/whatsnew/v0.3.1.txt index d2b91c2e77..b874b078fc 100644 --- a/docs/sphinx/source/whatsnew/v0.3.1.txt +++ b/docs/sphinx/source/whatsnew/v0.3.1.txt @@ -15,8 +15,18 @@ Enhancements Bug fixes ~~~~~~~~~ - - +* Fixes night tare issue in snlinverter. When the DC input power (p_dc) + to an inverter is below the inversion startup power (Ps0), the model + should set the AC output (ac_power) to the night tare value (Pnt). + The night tare power indicates the power consumed by the inverter to + sense PV array voltage. The model was erroneously comparing Ps0 with + the AC output power (ac_power), rather than the DC input power (p_dc). + +* Fixed the azimuth calculation of rotated PV panel in function + pvlib.tracking.singleaxis(...) so that the results are consistent + with PVsyst Contributors ~~~~~~~~~~~~ +* ejmiller2 +* Yudong Ma diff --git a/pvlib/pvsystem.py b/pvlib/pvsystem.py index bc158b8652..3c9eb03aed 100644 --- a/pvlib/pvsystem.py +++ b/pvlib/pvsystem.py @@ -1662,7 +1662,7 @@ def snlinverter(inverter, v_dc, p_dc): ac_power = (Paco/(A-B) - C*(A-B)) * (p_dc-B) + C*((p_dc-B)**2) ac_power[ac_power > Paco] = Paco - ac_power[ac_power < Pso] = - 1.0 * abs(Pnt) + ac_power[p_dc < Pso] = - 1.0 * abs(Pnt) if len(ac_power) == 1: ac_power = ac_power.ix[0] diff --git a/pvlib/test/test_pvsystem.py b/pvlib/test/test_pvsystem.py index f2b4974a47..7253dfcbbb 100644 --- a/pvlib/test/test_pvsystem.py +++ b/pvlib/test/test_pvsystem.py @@ -384,6 +384,17 @@ def test_snlinverter_float(): assert_almost_equals(pacs, 132.004278, 5) +def test_snlinverter_Pnt_micro(): + inverters = sam_data['cecinverter'] + testinv = 'Enphase_Energy__M250_60_2LL_S2x___ZC____NA__208V_208V__CEC_2013_' + vdcs = pd.Series(np.linspace(0,50,3)) + idcs = pd.Series(np.linspace(0,11,3)) + pdcs = idcs * vdcs + + pacs = pvsystem.snlinverter(inverters[testinv], vdcs, pdcs) + assert_series_equal(pacs, pd.Series([-0.043000, 132.545914746, 240.000000])) + + def test_PVSystem_creation(): pv_system = pvsystem.PVSystem(module='blah', inverter='blarg') diff --git a/pvlib/test/test_tracking.py b/pvlib/test/test_tracking.py index 488edf65a6..f77a33d7e4 100644 --- a/pvlib/test/test_tracking.py +++ b/pvlib/test/test_tracking.py @@ -107,7 +107,7 @@ def test_axis_tilt(): max_angle=90, backtrack=True, gcr=2.0/7.0) - expect = pd.DataFrame({'aoi': 7.286245, 'surface_azimuth': 37.3427, + expect = pd.DataFrame({'aoi': 7.286245, 'surface_azimuth': 142.65730, 'surface_tilt': 35.98741, 'tracker_theta': -20.88121}, index=[0], dtype=np.float64) @@ -118,7 +118,7 @@ def test_axis_tilt(): max_angle=90, backtrack=True, gcr=2.0/7.0) - expect = pd.DataFrame({'aoi': 47.6632, 'surface_azimuth': 129.0303, + expect = pd.DataFrame({'aoi': 47.6632, 'surface_azimuth': 50.96969, 'surface_tilt': 42.5152, 'tracker_theta': 31.6655}, index=[0], dtype=np.float64) @@ -188,12 +188,32 @@ def test_SingleAxisTracker_tracking(): tracker_data = system.singleaxis(apparent_zenith, apparent_azimuth) - expect = pd.DataFrame({'aoi': 7.286245, 'surface_azimuth': 37.3427, + expect = pd.DataFrame({'aoi': 7.286245, 'surface_azimuth': 142.65730 , 'surface_tilt': 35.98741, 'tracker_theta': -20.88121}, index=[0], dtype=np.float64) assert_frame_equal(expect, tracker_data) + ### results calculated using PVsyst + pvsyst_solar_azimuth = 7.1609 + pvsyst_solar_height = 27.315 + pvsyst_axis_tilt = 20. + pvsyst_axis_azimuth = 20. + pvsyst_system = tracking.SingleAxisTracker(max_angle=60., + axis_tilt=pvsyst_axis_tilt, + axis_azimuth=180+pvsyst_axis_azimuth, + backtrack=False) + # the definition of azimuth is different from PYsyst + apparent_azimuth = pd.Series([180+pvsyst_solar_azimuth]) + apparent_zenith = pd.Series([90-pvsyst_solar_height]) + tracker_data = pvsyst_system.singleaxis(apparent_zenith, apparent_azimuth) + expect = pd.DataFrame({'aoi': 41.07852 , 'surface_azimuth': 180-18.432 , + 'surface_tilt': 24.92122 , 'tracker_theta': -15.18391}, + index=[0], dtype=np.float64) + + assert_frame_equal(expect, tracker_data) + + def test_LocalizedSingleAxisTracker_creation(): localized_system = tracking.LocalizedSingleAxisTracker(latitude=32, @@ -254,7 +274,7 @@ def test_get_irradiance(): surface_azimuth=tracker_data['surface_azimuth']) expected = pd.DataFrame(data=np.array( - [[ 142.71652464, 87.50125991, 55.21526473, 44.68768982, + [[ 961.80070, 815.94490, 145.85580, 135.32820, 10.52757492], [ nan, nan, nan, nan, nan]]), diff --git a/pvlib/tracking.py b/pvlib/tracking.py index 0b37224a60..4feee28706 100644 --- a/pvlib/tracking.py +++ b/pvlib/tracking.py @@ -485,7 +485,7 @@ def singleaxis(apparent_zenith, apparent_azimuth, # 4. Rotate 0 reference from panel's x axis to it's y axis and # then back to North. - surface_azimuth += 90 + axis_azimuth + surface_azimuth = 90-surface_azimuth + axis_azimuth # 5. Map azimuth into [0,360) domain. surface_azimuth[surface_azimuth<0] += 360