Skip to content

Commit e73a4e8

Browse files
committed
Add examples for run_model_from_poa and run_model_from_effective_irradiance
1 parent be59498 commit e73a4e8

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

pvlib/modelchain.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,50 @@ def run_model_from_poa(self, data):
17131713
of Arrays in the PVSystem.
17141714
ValueError
17151715
If the DataFrames in `data` have different indexes.
1716+
Examples
1717+
--------
1718+
Single-array system:
1719+
1720+
>>> import pandas as pd
1721+
>>> from pvlib.pvsystem import PVSystem
1722+
>>> from pvlib.location import Location
1723+
>>> from pvlib.modelchain import ModelChain
1724+
>>>
1725+
>>> system = PVSystem(module_parameters={'pdc0': 300})
1726+
>>> location = Location(35, -110)
1727+
>>> mc = ModelChain(system, location)
1728+
>>>
1729+
>>> poa = pd.DataFrame({
1730+
... 'poa_global': [900, 850],
1731+
... 'poa_direct': [600, 560],
1732+
... 'poa_diffuse': [300, 290],
1733+
... },
1734+
... index=pd.date_range("2021-06-01", periods=2, freq="H"))
1735+
>>>
1736+
>>> mc.run_model_from_poa(poa)
1737+
<pvlib.modelchain.ModelChain ...>
1738+
1739+
Multi-array system:
1740+
1741+
>>> array1 = Array(tilt=30, azimuth=180)
1742+
>>> array2 = Array(tilt=10, azimuth=90)
1743+
>>> system = PVSystem(arrays=[array1, array2],
1744+
... module_parameters={'pdc0': 300})
1745+
>>> mc = ModelChain(system, location)
1746+
>>> poa1 = pd.DataFrame({
1747+
... 'poa_global': [900, 880],
1748+
... 'poa_direct': [600, 580],
1749+
... 'poa_diffuse': [300, 300],
1750+
... },
1751+
... index=pd.date_range("2021-06-01", periods=2, freq="H"))
1752+
>>> poa2 = pd.DataFrame({
1753+
... 'poa_global': [700, 720],
1754+
... 'poa_direct': [400, 420],
1755+
... 'poa_diffuse': [300, 300],
1756+
... },
1757+
... index=poa1.index)
1758+
>>> mc.run_model_from_poa([poa1, poa2])
1759+
<pvlib.modelchain.ModelChain ...>
17161760
17171761
Notes
17181762
-----
@@ -1798,6 +1842,50 @@ def run_model_from_effective_irradiance(self, data):
17981842
of Arrays in the PVSystem.
17991843
ValueError
18001844
If the DataFrames in `data` have different indexes.
1845+
Examples
1846+
--------
1847+
Single-array system:
1848+
1849+
>>> import pandas as pd
1850+
>>> from pvlib.pvsystem import PVSystem
1851+
>>> from pvlib.location import Location
1852+
>>> from pvlib.modelchain import ModelChain
1853+
>>>
1854+
>>> system = PVSystem(module_parameters={'pdc0': 300})
1855+
>>> location = Location(35, -110)
1856+
>>> mc = ModelChain(system, location)
1857+
>>>
1858+
>>> eff = pd.DataFrame({
1859+
... 'effective_irradiance': [900, 920],
1860+
... 'temp_air': [25, 24],
1861+
... 'wind_speed': [2.0, 1.5],
1862+
... },
1863+
... index=pd.date_range("2021-06-01", periods=2, freq="H"))
1864+
>>>
1865+
>>> mc.run_model_from_effective_irradiance(eff)
1866+
<pvlib.modelchain.ModelChain ...>
1867+
1868+
Multi-array system:
1869+
1870+
>>> array1 = Array(tilt=30, azimuth=180)
1871+
>>> array2 = Array(tilt=10, azimuth=90)
1872+
>>> system = PVSystem(arrays=[array1, array2],
1873+
... module_parameters={'pdc0': 300})
1874+
>>> mc = ModelChain(system, location)
1875+
>>> eff1 = pd.DataFrame({
1876+
... 'effective_irradiance': [900, 920],
1877+
... 'temp_air': [25, 24],
1878+
... 'wind_speed': [2.0, 1.5],
1879+
... },
1880+
... index=pd.date_range("2021-06-01", periods=2, freq="H"))
1881+
>>> eff2 = pd.DataFrame({
1882+
... 'effective_irradiance': [600, 630],
1883+
... 'temp_air': [26, 25],
1884+
... 'wind_speed': [1.8, 1.2],
1885+
... },
1886+
... index=eff1.index)
1887+
>>> mc.run_model_from_effective_irradiance([eff1, eff2])
1888+
<pvlib.modelchain.ModelChain ...>
18011889
18021890
Notes
18031891
-----

0 commit comments

Comments
 (0)