|
19 | 19 | from pvlib.tools import _build_kwargs
|
20 | 20 |
|
21 | 21 |
|
| 22 | +# these dictionaries contain the default configuration for following |
| 23 | +# established modeling sequences. They can be used in combination with |
| 24 | +# basic_chain and ModelChain. They are used by the ModelChain methods |
| 25 | +# ModelChain.with_pvwatts, ModelChain.with_sapm, etc. |
22 | 26 | PVWATTS_CONFIG = dict(
|
23 | 27 | dc_model='pvwatts', ac_model='pvwatts', losses_model='pvwatts',
|
24 | 28 | transposition_model='perez', aoi_model='physical',
|
25 | 29 | spectral_model='no_loss'
|
26 | 30 | )
|
27 |
| - |
28 | 31 | SAPM_CONFIG = dict(
|
29 | 32 | dc_model='sapm', ac_model='sandia', losses_model='no_loss',
|
30 | 33 | aoi_model='sapm', spectral_model='sapm'
|
31 | 34 | )
|
| 35 | +# update when full pvsyst models are known |
| 36 | +PVSYST_CONFIG = dict( |
| 37 | + dc_model='pvsyst' |
| 38 | +) |
32 | 39 |
|
33 | 40 |
|
34 | 41 | def basic_chain(times, latitude, longitude,
|
@@ -528,6 +535,93 @@ def with_sapm(cls, system, location,
|
528 | 535 | **kwargs
|
529 | 536 | )
|
530 | 537 |
|
| 538 | + # update when full pvsyst models are known |
| 539 | + @classmethod |
| 540 | + def with_pvsyst(cls, system, location, |
| 541 | + orientation_strategy=None, |
| 542 | + clearsky_model='ineichen', |
| 543 | + transposition_model='haydavies', |
| 544 | + solar_position_method='nrel_numpy', |
| 545 | + airmass_model='kastenyoung1989', |
| 546 | + name=None, |
| 547 | + **kwargs): |
| 548 | + """ |
| 549 | + ModelChain that follows the Sandia Array Performance Model |
| 550 | + (SAPM) methods. |
| 551 | +
|
| 552 | + Parameters |
| 553 | + ---------- |
| 554 | + system : PVSystem |
| 555 | + A :py:class:`~pvlib.pvsystem.PVSystem` object that represents |
| 556 | + the connected set of modules, inverters, etc. |
| 557 | +
|
| 558 | + location : Location |
| 559 | + A :py:class:`~pvlib.location.Location` object that represents |
| 560 | + the physical location at which to evaluate the model. |
| 561 | +
|
| 562 | + orientation_strategy : None or str, default None |
| 563 | + The strategy for aligning the modules. If not None, sets the |
| 564 | + ``surface_azimuth`` and ``surface_tilt`` properties of the |
| 565 | + ``system``. Allowed strategies include 'flat', |
| 566 | + 'south_at_latitude_tilt'. Ignored for SingleAxisTracker systems. |
| 567 | +
|
| 568 | + clearsky_model : str, default 'ineichen' |
| 569 | + Passed to location.get_clearsky. |
| 570 | +
|
| 571 | + transposition_model : str, default 'haydavies' |
| 572 | + Passed to system.get_irradiance. |
| 573 | +
|
| 574 | + solar_position_method : str, default 'nrel_numpy' |
| 575 | + Passed to location.get_solarposition. |
| 576 | +
|
| 577 | + airmass_model : str, default 'kastenyoung1989' |
| 578 | + Passed to location.get_airmass. |
| 579 | +
|
| 580 | + name: None or str, default None |
| 581 | + Name of ModelChain instance. |
| 582 | +
|
| 583 | + **kwargs |
| 584 | + Arbitrary keyword arguments. Included for compatibility, but not |
| 585 | + used. |
| 586 | +
|
| 587 | + Examples |
| 588 | + -------- |
| 589 | + >>> mods = pvlib.pvsystem.retrieve_sam('sandiamod') |
| 590 | + >>> invs = pvlib.pvsystem.retrieve_sam('cecinverter') |
| 591 | + >>> module_parameters = mods['Canadian_Solar_CS5P_220M___2009_'] |
| 592 | + >>> inverter_parameters = invs['ABB__MICRO_0_25_I_OUTD_US_240__240V_'] |
| 593 | + >>> system = PVSystem(surface_tilt=30, surface_azimuth=180, |
| 594 | + ... module_parameters=module_parameters, |
| 595 | + ... inverter_parameters=inverter_parameters) |
| 596 | + >>> location = Location(32.2, -110.9) |
| 597 | + >>> ModelChain.with_pvsyst(system, location) |
| 598 | + ModelChain: |
| 599 | + name: None |
| 600 | + orientation_strategy: None |
| 601 | + clearsky_model: ineichen |
| 602 | + transposition_model: haydavies |
| 603 | + solar_position_method: nrel_numpy |
| 604 | + airmass_model: kastenyoung1989 |
| 605 | + dc_model: sapm |
| 606 | + ac_model: snlinverter |
| 607 | + aoi_model: sapm_aoi_loss |
| 608 | + spectral_model: sapm_spectral_loss |
| 609 | + temperature_model: sapm_temp |
| 610 | + losses_model: no_extra_losses |
| 611 | + """ |
| 612 | + |
| 613 | + kwargs.update(PVSYST_CONFIG) |
| 614 | + return ModelChain( |
| 615 | + system, location, |
| 616 | + orientation_strategy=orientation_strategy, |
| 617 | + clearsky_model=clearsky_model, |
| 618 | + transposition_model=transposition_model, |
| 619 | + solar_position_method=solar_position_method, |
| 620 | + airmass_model=airmass_model, |
| 621 | + name=name, |
| 622 | + **kwargs |
| 623 | + ) |
| 624 | + |
531 | 625 | def __repr__(self):
|
532 | 626 | attrs = [
|
533 | 627 | 'name', 'orientation_strategy', 'clearsky_model',
|
@@ -1157,73 +1251,3 @@ def run_model(self, weather, times=None):
|
1157 | 1251 | self.ac_model()
|
1158 | 1252 |
|
1159 | 1253 | return self
|
1160 |
| - |
1161 |
| - |
1162 |
| -# delete this if we agree factory methods are preferable |
1163 |
| -class PVWatts(ModelChain): |
1164 |
| - """ |
1165 |
| - PVWatts version of ModelChain. |
1166 |
| -
|
1167 |
| - Parameters |
1168 |
| - ---------- |
1169 |
| - system : PVSystem |
1170 |
| - A :py:class:`~pvlib.pvsystem.PVSystem` object that represents |
1171 |
| - the connected set of modules, inverters, etc. |
1172 |
| -
|
1173 |
| - location : Location |
1174 |
| - A :py:class:`~pvlib.location.Location` object that represents |
1175 |
| - the physical location at which to evaluate the model. |
1176 |
| -
|
1177 |
| - orientation_strategy : None or str, default None |
1178 |
| - The strategy for aligning the modules. If not None, sets the |
1179 |
| - ``surface_azimuth`` and ``surface_tilt`` properties of the |
1180 |
| - ``system``. Allowed strategies include 'flat', |
1181 |
| - 'south_at_latitude_tilt'. Ignored for SingleAxisTracker systems. |
1182 |
| -
|
1183 |
| - clearsky_model : str, default 'ineichen' |
1184 |
| - Passed to location.get_clearsky. |
1185 |
| -
|
1186 |
| - airmass_model : str, default 'kastenyoung1989' |
1187 |
| - Passed to location.get_airmass. |
1188 |
| -
|
1189 |
| - temperature_model: None, str or function, default None |
1190 |
| - Valid strings are 'sapm', 'pvsyst', and 'faiman'. The ModelChain |
1191 |
| - instance will be passed as the first argument to a user-defined |
1192 |
| - function. |
1193 |
| -
|
1194 |
| - name: None or str, default None |
1195 |
| - Name of ModelChain instance. |
1196 |
| -
|
1197 |
| - **kwargs |
1198 |
| - Arbitrary keyword arguments. Included for compatibility, but not |
1199 |
| - used. |
1200 |
| -
|
1201 |
| - Examples |
1202 |
| - -------- |
1203 |
| - >>> module_parameters = dict(gamma_pdc=-0.003, pdc0=1) |
1204 |
| - >>> inverter_parameters = dict(pac0=1) |
1205 |
| - >>> system = PVSystem(surface_tilt=30, surface_azimuth=180, |
1206 |
| - ... module_parameters=module_parameters, |
1207 |
| - ... inverter_parameters=inverter_parameters) |
1208 |
| - >>> location = Location(32.2, -110.9) |
1209 |
| - >>> PVWatts(system, location) |
1210 |
| - """ |
1211 |
| - |
1212 |
| - def __init__(self, system, location, |
1213 |
| - orientation_strategy=None, |
1214 |
| - clearsky_model='ineichen', |
1215 |
| - airmass_model='kastenyoung1989', |
1216 |
| - temperature_model=None, |
1217 |
| - name=None, |
1218 |
| - **kwargs): |
1219 |
| - |
1220 |
| - kwargs.update(PVWATTS_CONFIG) |
1221 |
| - super().__init__( |
1222 |
| - system, location, |
1223 |
| - orientation_strategy=orientation_strategy, |
1224 |
| - clearsky_model=clearsky_model, |
1225 |
| - airmass_model=airmass_model, |
1226 |
| - temperature_model=temperature_model, |
1227 |
| - name=name, |
1228 |
| - **kwargs |
1229 |
| - ) |
|
0 commit comments