Skip to content

Commit ac13a14

Browse files
committed
Fixed indentation in run_model_from_poa function
1 parent cc75255 commit ac13a14

File tree

1 file changed

+88
-2
lines changed

1 file changed

+88
-2
lines changed

pvlib/modelchain.py

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
# ModelChain, particularly they are used by the methods
4444
# ModelChain.with_pvwatts, ModelChain.with_sapm, etc.
4545

46+
47+
4648
# pvwatts documentation states that it uses the following reference for
4749
# a temperature model: Fuentes, M. K. (1987). A Simplified Thermal Model
4850
# for Flat-Plate Photovoltaic Arrays. SAND85-0330. Albuquerque, NM:
@@ -1713,6 +1715,48 @@ def run_model_from_poa(self, data):
17131715
of Arrays in the PVSystem.
17141716
ValueError
17151717
If the DataFrames in `data` have different indexes.
1718+
Examples
1719+
--------
1720+
Single-array system:
1721+
>>> import pandas as pd
1722+
>>> from pvlib.pvsystem import PVSystem
1723+
>>> from pvlib.location import Location
1724+
>>> from pvlib.modelchain import ModelChain
1725+
>>>
1726+
>>> system = PVSystem(module_parameters={'pdc0': 300})
1727+
>>> location = Location(35, -110)
1728+
>>> mc = ModelChain(system, location)
1729+
>>>
1730+
>>> poa = pd.DataFrame({
1731+
... 'poa_global': [900, 850],
1732+
... 'poa_direct': [600, 560],
1733+
... 'poa_diffuse': [300, 290],
1734+
... },
1735+
... index=pd.date_range("2021-06-01", periods=2, freq="H"))
1736+
>>>
1737+
>>> mc.run_model_from_poa(poa)
1738+
<pvlib.modelchain.ModelChain ...>
1739+
1740+
Multi-array system:
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
-----
@@ -1738,7 +1782,6 @@ def run_model_from_poa(self, data):
17381782
self._run_from_effective_irrad(data)
17391783

17401784
return self
1741-
17421785
def _run_from_effective_irrad(self, data):
17431786
"""
17441787
Executes the temperature, DC, losses and AC models.
@@ -1757,7 +1800,7 @@ def _run_from_effective_irrad(self, data):
17571800
17581801
Notes
17591802
-----
1760-
Assigns attributes:``cell_temperature``, ``dc``, ``ac``, ``losses``,
1803+
Assigns attributes:``cell_temperature, 'dc', ``ac', ``losses``,
17611804
``diode_params`` (if dc_model is a single diode model).
17621805
"""
17631806
self._prepare_temperature(data)
@@ -1798,6 +1841,48 @@ def run_model_from_effective_irradiance(self, data):
17981841
of Arrays in the PVSystem.
17991842
ValueError
18001843
If the DataFrames in `data` have different indexes.
1844+
Examples
1845+
--------
1846+
Single-array system:
1847+
>>> import pandas as pd
1848+
>>> from pvlib.pvsystem import PVSystem
1849+
>>> from pvlib.location import Location
1850+
>>> from pvlib.modelchain import ModelChain
1851+
>>>
1852+
>>> system = PVSystem(module_parameters={'pdc0': 300})
1853+
>>> location = Location(35, -110)
1854+
>>> mc = ModelChain(system, location)
1855+
>>>
1856+
>>> eff = pd.DataFrame({
1857+
... 'effective_irradiance': [900, 920],
1858+
... 'temp_air': [25, 24],
1859+
... 'wind_speed': [2.0, 1.5],
1860+
... },
1861+
... index=pd.date_range("2021-06-01", periods=2, freq="H"))
1862+
>>>
1863+
>>> mc.run_model_from_effective_irradiance(eff)
1864+
<pvlib.modelchain.ModelChain ...>
1865+
1866+
Multi-array system:
1867+
>>> array1 = Array(tilt=30, azimuth=180)
1868+
>>> array2 = Array(tilt=10, azimuth=90)
1869+
>>> system = PVSystem(arrays=[array1, array2],
1870+
... module_parameters={'pdc0': 300})
1871+
>>> mc = ModelChain(system, location)
1872+
>>> eff1 = pd.DataFrame({
1873+
... 'effective_irradiance': [900, 920],
1874+
... 'temp_air': [25, 24],
1875+
... 'wind_speed': [2.0, 1.5],
1876+
... },
1877+
... index=pd.date_range("2021-06-01", periods=2, freq="H"))
1878+
>>> eff2 = pd.DataFrame({
1879+
... 'effective_irradiance': [600, 630],
1880+
... 'temp_air': [26, 25],
1881+
... 'wind_speed': [1.8, 1.2],
1882+
... },
1883+
... index=eff1.index)
1884+
>>> mc.run_model_from_effective_irradiance([eff1, eff2])
1885+
<pvlib.modelchain.ModelChain ...>
18011886
18021887
Notes
18031888
-----
@@ -1836,6 +1921,7 @@ def run_model_from_effective_irradiance(self, data):
18361921
return self
18371922

18381923

1924+
18391925
def _irrad_for_celltemp(total_irrad, effective_irradiance):
18401926
"""
18411927
Determine irradiance to use for cell temperature models, in order

0 commit comments

Comments
 (0)