1313from dataclasses import dataclass , field
1414from typing import Union , Tuple , Optional , TypeVar
1515
16- from pvlib import (atmosphere , clearsky , inverter , pvsystem , solarposition ,
17- temperature , iam )
16+ from pvlib import pvsystem , iam
1817import pvlib .irradiance # avoid name conflict with full import
1918from pvlib .pvsystem import _DC_MODEL_PARAMS
2019from pvlib .tools import _build_kwargs
2120
22- from pvlib ._deprecation import deprecated
23-
2421# keys that are used to detect input data and assign data to appropriate
2522# ModelChain attribute
2623# for ModelChain.weather
4138
4239# these dictionaries contain the default configuration for following
4340# established modeling sequences. They can be used in combination with
44- # basic_chain and ModelChain. They are used by the ModelChain methods
41+ # ModelChain, particularly they are used by the methods
4542# ModelChain.with_pvwatts, ModelChain.with_sapm, etc.
4643
4744# pvwatts documentation states that it uses the following reference for
6259)
6360
6461
65- @deprecated (
66- since = '0.9.1' ,
67- name = 'pvlib.modelchain.basic_chain' ,
68- alternative = ('pvlib.modelchain.ModelChain.with_pvwatts'
69- ' or pvlib.modelchain.ModelChain.with_sapm' ),
70- addendum = 'Note that the with_xyz methods take different model parameters.'
71- )
72- def basic_chain (times , latitude , longitude ,
73- surface_tilt , surface_azimuth ,
74- module_parameters , temperature_model_parameters ,
75- inverter_parameters ,
76- irradiance = None , weather = None ,
77- transposition_model = 'haydavies' ,
78- solar_position_method = 'nrel_numpy' ,
79- airmass_model = 'kastenyoung1989' ,
80- altitude = None , pressure = None ,
81- ** kwargs ):
82- """
83- An experimental function that computes all of the modeling steps
84- necessary for calculating power or energy for a PV system at a given
85- location.
86-
87- Parameters
88- ----------
89- times : DatetimeIndex
90- Times at which to evaluate the model.
91-
92- latitude : float.
93- Positive is north of the equator.
94- Use decimal degrees notation.
95-
96- longitude : float.
97- Positive is east of the prime meridian.
98- Use decimal degrees notation.
99-
100- surface_tilt : numeric
101- Surface tilt angles in decimal degrees.
102- The tilt angle is defined as degrees from horizontal
103- (e.g. surface facing up = 0, surface facing horizon = 90)
104-
105- surface_azimuth : numeric
106- Surface azimuth angles in decimal degrees.
107- The azimuth convention is defined
108- as degrees east of north
109- (North=0, South=180, East=90, West=270).
110-
111- module_parameters : dict or Series
112- Module parameters as defined by the SAPM. See pvsystem.sapm for
113- details.
114-
115- temperature_model_parameters : dict or Series
116- Temperature model parameters as defined by the SAPM.
117- See temperature.sapm_cell for details.
118-
119- inverter_parameters : dict or Series
120- Inverter parameters as defined by the CEC. See
121- :py:func:`inverter.sandia` for details.
122-
123- irradiance : DataFrame, optional
124- If not specified, calculates clear sky data.
125- Columns must be 'dni', 'ghi', 'dhi'.
126-
127- weather : DataFrame, optional
128- If not specified, assumes air temperature is 20 C and
129- wind speed is 0 m/s.
130- Columns must be 'wind_speed', 'temp_air'.
131-
132- transposition_model : str, default 'haydavies'
133- Passed to system.get_irradiance.
134-
135- solar_position_method : str, default 'nrel_numpy'
136- Passed to solarposition.get_solarposition.
137-
138- airmass_model : str, default 'kastenyoung1989'
139- Passed to atmosphere.relativeairmass.
140-
141- altitude : float, optional
142- If not specified, computed from ``pressure``. Assumed to be 0 m
143- if ``pressure`` is also unspecified.
144-
145- pressure : float, optional
146- If not specified, computed from ``altitude``. Assumed to be 101325 Pa
147- if ``altitude`` is also unspecified.
148-
149- **kwargs
150- Arbitrary keyword arguments.
151- See code for details.
152-
153- Returns
154- -------
155- output : (dc, ac)
156- Tuple of DC power (with SAPM parameters) (DataFrame) and AC
157- power (Series).
158- """
159-
160- if altitude is None and pressure is None :
161- altitude = 0.
162- pressure = 101325.
163- elif altitude is None :
164- altitude = atmosphere .pres2alt (pressure )
165- elif pressure is None :
166- pressure = atmosphere .alt2pres (altitude )
167-
168- solar_position = solarposition .get_solarposition (
169- times , latitude , longitude , altitude = altitude , pressure = pressure ,
170- method = solar_position_method , ** kwargs )
171-
172- # possible error with using apparent zenith with some models
173- airmass = atmosphere .get_relative_airmass (
174- solar_position ['apparent_zenith' ], model = airmass_model )
175- airmass = atmosphere .get_absolute_airmass (airmass , pressure )
176- dni_extra = pvlib .irradiance .get_extra_radiation (solar_position .index )
177-
178- aoi = pvlib .irradiance .aoi (surface_tilt , surface_azimuth ,
179- solar_position ['apparent_zenith' ],
180- solar_position ['azimuth' ])
181-
182- if irradiance is None :
183- linke_turbidity = clearsky .lookup_linke_turbidity (
184- solar_position .index , latitude , longitude )
185- irradiance = clearsky .ineichen (
186- solar_position ['apparent_zenith' ],
187- airmass ,
188- linke_turbidity ,
189- altitude = altitude ,
190- dni_extra = dni_extra
191- )
192-
193- total_irrad = pvlib .irradiance .get_total_irradiance (
194- surface_tilt ,
195- surface_azimuth ,
196- solar_position ['apparent_zenith' ],
197- solar_position ['azimuth' ],
198- irradiance ['dni' ],
199- irradiance ['ghi' ],
200- irradiance ['dhi' ],
201- model = transposition_model ,
202- dni_extra = dni_extra )
203-
204- if weather is None :
205- weather = {'wind_speed' : 0 , 'temp_air' : 20 }
206-
207- cell_temperature = temperature .sapm_cell (
208- total_irrad ['poa_global' ], weather ['temp_air' ], weather ['wind_speed' ],
209- temperature_model_parameters ['a' ], temperature_model_parameters ['b' ],
210- temperature_model_parameters ['deltaT' ])
211-
212- effective_irradiance = pvsystem .sapm_effective_irradiance (
213- total_irrad ['poa_direct' ], total_irrad ['poa_diffuse' ], airmass , aoi ,
214- module_parameters )
215-
216- dc = pvsystem .sapm (effective_irradiance , cell_temperature ,
217- module_parameters )
218-
219- ac = inverter .sandia (dc ['v_mp' ], dc ['p_mp' ], inverter_parameters )
220-
221- return dc , ac
222-
223-
22462def get_orientation (strategy , ** kwargs ):
22563 """
22664 Determine a PV system's surface tilt and surface azimuth
@@ -238,7 +76,6 @@ def get_orientation(strategy, **kwargs):
23876 -------
23977 surface_tilt, surface_azimuth
24078 """
241-
24279 if strategy == 'south_at_latitude_tilt' :
24380 surface_azimuth = 180
24481 surface_tilt = kwargs ['latitude' ]
0 commit comments