1919from pvlib .tools import _build_kwargs
2020
2121from pvlib ._deprecation import deprecated
22+
2223# Keys used to detect input data and assign values to the appropriate
2324# ModelChain attributes.
2425
25- #: tuple[str]
26- #: Weather-related input columns used by :class:`ModelChain` to populate
27- #: ``ModelChain.weather``. Missing ``temp_air`` or ``wind_speed`` are
28- #: automatically filled (20 °C and 0 m/s).
26+ # Weather-related input columns for ModelChain.weather
2927WEATHER_KEYS = (
3028 'ghi' , # Global Horizontal Irradiance (W/m^2)
3129 'dhi' , # Diffuse Horizontal Irradiance (W/m^2)
3533 'precipitable_water' # Column precipitable water (cm)
3634)
3735
38- #: tuple[str]
39- #: Plane-of-array irradiance components used to populate
40- #: ``ModelChain.total_irrad`` when running from POA input.
36+ # Plane-of-array irradiance input columns for ModelChain.total_irrad
4137POA_KEYS = (
4238 'poa_global' , # Total plane-of-array irradiance (W/m^2)
4339 'poa_direct' , # Direct POA irradiance (W/m^2)
4440 'poa_diffuse' # Diffuse POA irradiance (W/m^2)
4541)
4642
47- #: tuple[str]
48- #: Temperature-related input columns that override or supplement the
49- #: ModelChain temperature model. If ``cell_temperature`` is provided,
50- #: the temperature model is skipped.
43+ # Temperature-related optional input columns for ModelChain
5144TEMPERATURE_KEYS = (
5245 'module_temperature' , # Back-surface module temperature (°C)
5346 'cell_temperature' , # Direct cell temperature input (°C)
5447)
55- #: tuple[str]
56- #: All supported input keys recognized by ModelChain.
48+
49+ # All supported input keys combined
5750DATA_KEYS = WEATHER_KEYS + POA_KEYS + TEMPERATURE_KEYS
51+
5852# these dictionaries contain the default configuration for following
5953# established modeling sequences. They can be used in combination with
6054# ModelChain, particularly they are used by the methods
@@ -1730,6 +1724,49 @@ def run_model_from_poa(self, data):
17301724 of Arrays in the PVSystem.
17311725 ValueError
17321726 If the DataFrames in `data` have different indexes.
1727+ Examples
1728+ --------
1729+ Single-array system:
1730+
1731+ >>> import pandas as pd
1732+ >>> from pvlib.pvsystem import PVSystem
1733+ >>> from pvlib.location import Location
1734+ >>> from pvlib.modelchain import ModelChain
1735+ >>>
1736+ >>> system = PVSystem(module_parameters={'pdc0': 300})
1737+ >>> location = Location(35, -110)
1738+ >>> mc = ModelChain(system, location)
1739+ >>>
1740+ >>> poa = pd.DataFrame({
1741+ ... 'poa_global': [900, 850],
1742+ ... 'poa_direct': [600, 560],
1743+ ... 'poa_diffuse': [300, 290],
1744+ ... },
1745+ ... index=pd.date_range("2021-06-01", periods=2, freq="H"))
1746+ >>>
1747+ >>> mc.run_model_from_poa(poa)
1748+ <pvlib.modelchain.ModelChain ...>
1749+
1750+ Multi-array system:
1751+ >>> array1 = Array(tilt=30, azimuth=180)
1752+ >>> array2 = Array(tilt=10, azimuth=90)
1753+ >>> system = PVSystem(arrays=[array1, array2],
1754+ ... module_parameters={'pdc0': 300})
1755+ >>> mc = ModelChain(system, location)
1756+ >>> poa1 = pd.DataFrame({
1757+ ... 'poa_global': [900, 880],
1758+ ... 'poa_direct': [600, 580],
1759+ ... 'poa_diffuse': [300, 300],
1760+ ... },
1761+ ... index=pd.date_range("2021-06-01", periods=2, freq="H"))
1762+ >>> poa2 = pd.DataFrame({
1763+ ... 'poa_global': [700, 720],
1764+ ... 'poa_direct': [400, 420],
1765+ ... 'poa_diffuse': [300, 300],
1766+ ... },
1767+ ... index=poa1.index)
1768+ >>> mc.run_model_from_poa([poa1, poa2])
1769+ <pvlib.modelchain.ModelChain ...>
17331770
17341771 Notes
17351772 -----
@@ -1755,7 +1792,6 @@ def run_model_from_poa(self, data):
17551792 self ._run_from_effective_irrad (data )
17561793
17571794 return self
1758-
17591795 def _run_from_effective_irrad (self , data ):
17601796 """
17611797 Executes the temperature, DC, losses and AC models.
@@ -1774,7 +1810,7 @@ def _run_from_effective_irrad(self, data):
17741810
17751811 Notes
17761812 -----
1777- Assigns attributes:``cell_temperature``, ``dc`` , ``ac`` , ``losses``,
1813+ Assigns attributes:``cell_temperature, 'dc' , ``ac' , ``losses``,
17781814 ``diode_params`` (if dc_model is a single diode model).
17791815 """
17801816 self ._prepare_temperature (data )
@@ -1815,7 +1851,6 @@ def run_model_from_effective_irradiance(self, data):
18151851 of Arrays in the PVSystem.
18161852 ValueError
18171853 If the DataFrames in `data` have different indexes.
1818-
18191854 Notes
18201855 -----
18211856 Optional ``data`` columns ``'cell_temperature'``,
@@ -1853,6 +1888,7 @@ def run_model_from_effective_irradiance(self, data):
18531888 return self
18541889
18551890
1891+
18561892def _irrad_for_celltemp (total_irrad , effective_irradiance ):
18571893 """
18581894 Determine irradiance to use for cell temperature models, in order
0 commit comments