|
14 | 14 | from typing import Union, Tuple, Optional, TypeVar |
15 | 15 |
|
16 | 16 | from pvlib import (atmosphere, clearsky, inverter, pvsystem, solarposition, |
17 | | - temperature, tools) |
18 | | -from pvlib.tracking import SingleAxisTracker |
| 17 | + temperature) |
19 | 18 | import pvlib.irradiance # avoid name conflict with full import |
20 | 19 | from pvlib.pvsystem import _DC_MODEL_PARAMS |
21 | 20 | from pvlib._deprecation import pvlibDeprecationWarning |
@@ -465,13 +464,6 @@ class ModelChain: |
465 | 464 | Name of ModelChain instance. |
466 | 465 | """ |
467 | 466 |
|
468 | | - # list of deprecated attributes |
469 | | - _deprecated_attrs = ['solar_position', 'airmass', 'total_irrad', |
470 | | - 'aoi', 'aoi_modifier', 'spectral_modifier', |
471 | | - 'cell_temperature', 'effective_irradiance', |
472 | | - 'dc', 'ac', 'diode_params', 'tracking', |
473 | | - 'weather', 'times', 'losses'] |
474 | | - |
475 | 467 | def __init__(self, system, location, |
476 | 468 | clearsky_model='ineichen', |
477 | 469 | transposition_model='haydavies', |
@@ -503,26 +495,6 @@ def __init__(self, system, location, |
503 | 495 |
|
504 | 496 | self.results = ModelChainResult() |
505 | 497 |
|
506 | | - def __getattr__(self, key): |
507 | | - if key in ModelChain._deprecated_attrs: |
508 | | - msg = f'ModelChain.{key} is deprecated and will' \ |
509 | | - f' be removed in v0.10. Use' \ |
510 | | - f' ModelChain.results.{key} instead' |
511 | | - warnings.warn(msg, pvlibDeprecationWarning) |
512 | | - return getattr(self.results, key) |
513 | | - # __getattr__ is only called if __getattribute__ fails. |
514 | | - # In that case we should check if key is a deprecated attribute, |
515 | | - # and fail with an AttributeError if it is not. |
516 | | - raise AttributeError |
517 | | - |
518 | | - def __setattr__(self, key, value): |
519 | | - if key in ModelChain._deprecated_attrs: |
520 | | - msg = f'ModelChain.{key} is deprecated from v0.9. Use' \ |
521 | | - f' ModelChain.results.{key} instead' |
522 | | - warnings.warn(msg, pvlibDeprecationWarning) |
523 | | - setattr(self.results, key, value) |
524 | | - else: |
525 | | - super().__setattr__(key, value) |
526 | 498 |
|
527 | 499 | @classmethod |
528 | 500 | def with_pvwatts(cls, system, location, |
@@ -1535,27 +1507,11 @@ def prepare_inputs(self, weather): |
1535 | 1507 | self._prep_inputs_solar_pos(weather) |
1536 | 1508 | self._prep_inputs_airmass() |
1537 | 1509 | self._prep_inputs_albedo(weather) |
| 1510 | + self._prep_inputs_fixed() |
1538 | 1511 |
|
1539 | | - # PVSystem.get_irradiance and SingleAxisTracker.get_irradiance |
1540 | | - # and PVSystem.get_aoi and SingleAxisTracker.get_aoi |
1541 | | - # have different method signatures. Use partial to handle |
1542 | | - # the differences. |
1543 | | - if isinstance(self.system, SingleAxisTracker): |
1544 | | - self._prep_inputs_tracking() |
1545 | | - get_irradiance = partial( |
1546 | | - self.system.get_irradiance, |
1547 | | - self.results.tracking['surface_tilt'], |
1548 | | - self.results.tracking['surface_azimuth'], |
1549 | | - self.results.solar_position['apparent_zenith'], |
1550 | | - self.results.solar_position['azimuth']) |
1551 | | - else: |
1552 | | - self._prep_inputs_fixed() |
1553 | | - get_irradiance = partial( |
1554 | | - self.system.get_irradiance, |
1555 | | - self.results.solar_position['apparent_zenith'], |
1556 | | - self.results.solar_position['azimuth']) |
1557 | | - |
1558 | | - self.results.total_irrad = get_irradiance( |
| 1512 | + self.results.total_irrad = self.system.get_irradiance( |
| 1513 | + self.results.solar_position['apparent_zenith'], |
| 1514 | + self.results.solar_position['azimuth'], |
1559 | 1515 | _tuple_from_dfs(self.results.weather, 'dni'), |
1560 | 1516 | _tuple_from_dfs(self.results.weather, 'ghi'), |
1561 | 1517 | _tuple_from_dfs(self.results.weather, 'dhi'), |
@@ -1636,10 +1592,7 @@ def prepare_inputs_from_poa(self, data): |
1636 | 1592 | self._prep_inputs_solar_pos(data) |
1637 | 1593 | self._prep_inputs_airmass() |
1638 | 1594 |
|
1639 | | - if isinstance(self.system, SingleAxisTracker): |
1640 | | - self._prep_inputs_tracking() |
1641 | | - else: |
1642 | | - self._prep_inputs_fixed() |
| 1595 | + self._prep_inputs_fixed() |
1643 | 1596 |
|
1644 | 1597 | return self |
1645 | 1598 |
|
|
0 commit comments