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,27 @@ 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+ ... }, index=pd.date_range("2021-06-01", periods=2, freq="H"))
1745+ >>>
1746+ >>> mc.run_model_from_poa(poa)
1747+ <pvlib.modelchain.ModelChain ...>
17331748
17341749 Notes
17351750 -----
@@ -1755,7 +1770,6 @@ def run_model_from_poa(self, data):
17551770 self ._run_from_effective_irrad (data )
17561771
17571772 return self
1758-
17591773 def _run_from_effective_irrad (self , data ):
17601774 """
17611775 Executes the temperature, DC, losses and AC models.
@@ -1774,7 +1788,7 @@ def _run_from_effective_irrad(self, data):
17741788
17751789 Notes
17761790 -----
1777- Assigns attributes:``cell_temperature``, ``dc`` , ``ac`` , ``losses``,
1791+ Assigns attributes:``cell_temperature, 'dc' , ``ac' , ``losses``,
17781792 ``diode_params`` (if dc_model is a single diode model).
17791793 """
17801794 self ._prepare_temperature (data )
@@ -1815,6 +1829,25 @@ def run_model_from_effective_irradiance(self, data):
18151829 of Arrays in the PVSystem.
18161830 ValueError
18171831 If the DataFrames in `data` have different indexes.
1832+ Examples
1833+ --------
1834+ >>> import pandas as pd
1835+ >>> from pvlib.pvsystem import PVSystem
1836+ >>> from pvlib.location import Location
1837+ >>> from pvlib.modelchain import ModelChain
1838+ >>>
1839+ >>> system = PVSystem(module_parameters={'pdc0': 300})
1840+ >>> location = Location(35, -110)
1841+ >>> mc = ModelChain(system, location)
1842+ >>>
1843+ >>> eff = pd.DataFrame({
1844+ ... 'effective_irradiance': [900, 920],
1845+ ... 'temp_air': [25, 24],
1846+ ... 'wind_speed': [2.0, 1.5],
1847+ ... })
1848+ >>>
1849+ >>> mc.run_model_from_effective_irradiance(eff)
1850+ <pvlib.modelchain.ModelChain ...>
18181851
18191852 Notes
18201853 -----
@@ -1853,6 +1886,7 @@ def run_model_from_effective_irradiance(self, data):
18531886 return self
18541887
18551888
1889+
18561890def _irrad_for_celltemp (total_irrad , effective_irradiance ):
18571891 """
18581892 Determine irradiance to use for cell temperature models, in order
0 commit comments