From 6ac464287e783bc78a0a8e7a2e7925f04ae96ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Fri, 13 Dec 2024 10:24:32 +0100 Subject: [PATCH 1/3] Update dependencies * PVLib silently removed poa_horizontal_ratio, thus we need to implement it ourselves. (This was easy.) * Pandas reoved DataFrame.append, so it is replaced by concat. * Pandas.date_range now wants "h" instead of "H" for hours. --- .../absorption_heatpump_and_chiller/absorption_chiller.py | 2 +- .../airsource_heatpump_const_max_output.py | 2 +- .../airsource_heatpump_variable_max_output.py | 2 +- .../chiller_cop_as_TimeSeries.py | 2 +- .../groundsource_heatpump.py | 2 +- .../csp_collector_plot_andasol.py | 4 +++- .../investment_fixed_ratio_facade.py | 2 +- .../investment_fixed_ratio_generic_storage.py | 2 +- .../investment_independent_facade.py | 2 +- .../investment_independent_generic_storage.py | 2 +- examples/stratified_thermal_storage/model_validation.py | 2 +- examples/stratified_thermal_storage/operation_facade.py | 2 +- .../operation_generic_storage.py | 2 +- examples/stratified_thermal_storage/plots.py | 2 +- pyproject.toml | 2 +- src/oemof/thermal/concentrating_solar_power.py | 8 +++++++- tests/test_constraints.py | 2 +- 17 files changed, 25 insertions(+), 17 deletions(-) diff --git a/examples/absorption_heatpump_and_chiller/absorption_chiller.py b/examples/absorption_heatpump_and_chiller/absorption_chiller.py index 01ceb14d..8ffa4cba 100644 --- a/examples/absorption_heatpump_and_chiller/absorption_chiller.py +++ b/examples/absorption_heatpump_and_chiller/absorption_chiller.py @@ -14,7 +14,7 @@ def absorption_chiller_example(): solver_verbose = True date_time_index = pd.date_range( - "1/1/2012", periods=number_of_time_steps, freq="H" + "1/1/2012", periods=number_of_time_steps, freq="h" ) energysystem = solph.EnergySystem(timeindex=date_time_index) diff --git a/examples/compression_heatpump_and_chiller/airsource_heatpump_const_max_output.py b/examples/compression_heatpump_and_chiller/airsource_heatpump_const_max_output.py index 5cd5a59f..a214e4bf 100644 --- a/examples/compression_heatpump_and_chiller/airsource_heatpump_const_max_output.py +++ b/examples/compression_heatpump_and_chiller/airsource_heatpump_const_max_output.py @@ -31,7 +31,7 @@ def airource_hp_const_example(): solver_verbose = False date_time_index = pd.date_range( - "1/1/2012", periods=number_of_time_steps, freq="H" + "1/1/2012", periods=number_of_time_steps, freq="h" ) energysystem = solph.EnergySystem(timeindex=date_time_index) diff --git a/examples/compression_heatpump_and_chiller/airsource_heatpump_variable_max_output.py b/examples/compression_heatpump_and_chiller/airsource_heatpump_variable_max_output.py index 510df8d4..0b26f942 100644 --- a/examples/compression_heatpump_and_chiller/airsource_heatpump_variable_max_output.py +++ b/examples/compression_heatpump_and_chiller/airsource_heatpump_variable_max_output.py @@ -33,7 +33,7 @@ def airource_hp_variable_example(): solver_verbose = False date_time_index = pd.date_range( - "1/1/2012", periods=number_of_time_steps, freq="H" + "1/1/2012", periods=number_of_time_steps, freq="h" ) energysystem = solph.EnergySystem(timeindex=date_time_index) diff --git a/examples/compression_heatpump_and_chiller/chiller_cop_as_TimeSeries.py b/examples/compression_heatpump_and_chiller/chiller_cop_as_TimeSeries.py index 8d313aea..93fd761b 100644 --- a/examples/compression_heatpump_and_chiller/chiller_cop_as_TimeSeries.py +++ b/examples/compression_heatpump_and_chiller/chiller_cop_as_TimeSeries.py @@ -42,7 +42,7 @@ def chiller_cop_timeseries_example(): 23, ] - timestamps = pd.date_range("20200101", periods=24, freq="H") + timestamps = pd.date_range("20200101", periods=24, freq="h") # Convert temp_ambient to pandas DataFrame df_temp_ambient = pd.DataFrame(temp_ambient, timestamps) diff --git a/examples/compression_heatpump_and_chiller/groundsource_heatpump.py b/examples/compression_heatpump_and_chiller/groundsource_heatpump.py index a3205349..92e386c6 100644 --- a/examples/compression_heatpump_and_chiller/groundsource_heatpump.py +++ b/examples/compression_heatpump_and_chiller/groundsource_heatpump.py @@ -29,7 +29,7 @@ def groundsource_hp_example(): solver_verbose = False date_time_index = pd.date_range( - "1/1/2012", periods=number_of_time_steps, freq="H" + "1/1/2012", periods=number_of_time_steps, freq="h" ) energysystem = solph.EnergySystem(timeindex=date_time_index) diff --git a/examples/concentrating_solar_power/csp_collector_plot_andasol.py b/examples/concentrating_solar_power/csp_collector_plot_andasol.py index b28b0b8c..d14284bc 100644 --- a/examples/concentrating_solar_power/csp_collector_plot_andasol.py +++ b/examples/concentrating_solar_power/csp_collector_plot_andasol.py @@ -134,7 +134,9 @@ def csp_andasol_example(): E_dir_hor=df_temp_amb_series["E_dir_hor"], ) - df_result = df_result.append(data_precalc_temp_amb, ignore_index=True) + df_result = pd.concat( + [df_result, data_precalc_temp_amb], ignore_index=True + ) _, ax = plt.subplots() ax.plot( diff --git a/examples/stratified_thermal_storage/investment_fixed_ratio_facade.py b/examples/stratified_thermal_storage/investment_fixed_ratio_facade.py index e22d6211..cd07ca10 100644 --- a/examples/stratified_thermal_storage/investment_fixed_ratio_facade.py +++ b/examples/stratified_thermal_storage/investment_fixed_ratio_facade.py @@ -39,7 +39,7 @@ def fixed_ratio_invest_facade_example(): # Set up an energy system model solver = "cbc" periods = 100 - datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="H") + datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="h") demand_timeseries = np.zeros(periods) demand_timeseries[-5:] = 1 heat_feedin_timeseries = np.zeros(periods) diff --git a/examples/stratified_thermal_storage/investment_fixed_ratio_generic_storage.py b/examples/stratified_thermal_storage/investment_fixed_ratio_generic_storage.py index f6c5f0c1..78e0af53 100644 --- a/examples/stratified_thermal_storage/investment_fixed_ratio_generic_storage.py +++ b/examples/stratified_thermal_storage/investment_fixed_ratio_generic_storage.py @@ -74,7 +74,7 @@ def print_parameters(): # Set up an energy system model solver = "cbc" periods = 100 - datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="H") + datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="h") demand_timeseries = np.zeros(periods) demand_timeseries[-5:] = 1 heat_feedin_timeseries = np.zeros(periods) diff --git a/examples/stratified_thermal_storage/investment_independent_facade.py b/examples/stratified_thermal_storage/investment_independent_facade.py index f82c986a..c59e3e37 100644 --- a/examples/stratified_thermal_storage/investment_independent_facade.py +++ b/examples/stratified_thermal_storage/investment_independent_facade.py @@ -42,7 +42,7 @@ def invest_independent_facade_example(): # Set up an energy system model solver = "cbc" periods = 100 - datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="H") + datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="h") demand_timeseries = np.zeros(periods) demand_timeseries[-5:] = 1 heat_feedin_timeseries = np.zeros(periods) diff --git a/examples/stratified_thermal_storage/investment_independent_generic_storage.py b/examples/stratified_thermal_storage/investment_independent_generic_storage.py index 467883b9..a6f8f2e8 100644 --- a/examples/stratified_thermal_storage/investment_independent_generic_storage.py +++ b/examples/stratified_thermal_storage/investment_independent_generic_storage.py @@ -75,7 +75,7 @@ def print_parameters(): # Set up an energy system model solver = "cbc" periods = 100 - datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="H") + datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="h") demand_timeseries = np.zeros(periods) demand_timeseries[-5:] = 1 heat_feedin_timeseries = np.zeros(periods) diff --git a/examples/stratified_thermal_storage/model_validation.py b/examples/stratified_thermal_storage/model_validation.py index 476da7b8..1c34c60a 100644 --- a/examples/stratified_thermal_storage/model_validation.py +++ b/examples/stratified_thermal_storage/model_validation.py @@ -46,7 +46,7 @@ def run_storage_model(initial_storage_level, temp_h, temp_c): # Set up an energy system model periods = 10 - datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="H") + datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="h") demand_timeseries = np.zeros(periods) heat_feedin_timeseries = np.zeros(periods) diff --git a/examples/stratified_thermal_storage/operation_facade.py b/examples/stratified_thermal_storage/operation_facade.py index e3c55e43..7e50f9ef 100644 --- a/examples/stratified_thermal_storage/operation_facade.py +++ b/examples/stratified_thermal_storage/operation_facade.py @@ -58,7 +58,7 @@ def print_parameters(): # Set up an energy system model periods = 100 - datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="H") + datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="h") demand_timeseries = np.zeros(periods) demand_timeseries[-5:] = 1 heat_feedin_timeseries = np.zeros(periods) diff --git a/examples/stratified_thermal_storage/operation_generic_storage.py b/examples/stratified_thermal_storage/operation_generic_storage.py index 3a8c986b..42696541 100644 --- a/examples/stratified_thermal_storage/operation_generic_storage.py +++ b/examples/stratified_thermal_storage/operation_generic_storage.py @@ -87,7 +87,7 @@ def print_parameters(): # Set up an energy system model solver = "cbc" periods = 100 - datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="H") + datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="h") demand_timeseries = np.zeros(periods) demand_timeseries[-5:] = 1 heat_feedin_timeseries = np.zeros(periods) diff --git a/examples/stratified_thermal_storage/plots.py b/examples/stratified_thermal_storage/plots.py index 99ac2673..51f865b1 100644 --- a/examples/stratified_thermal_storage/plots.py +++ b/examples/stratified_thermal_storage/plots.py @@ -85,7 +85,7 @@ def print_results(): # Set up an energy system model solver = "cbc" periods = 800 - datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="H") + datetimeindex = pd.date_range("1/1/2019", periods=periods, freq="h") energysystem = EnergySystem(timeindex=datetimeindex) diff --git a/pyproject.toml b/pyproject.toml index 1dc9ac71..f907aba7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ requires-python = ">=3.9" dependencies = [ 'oemof.solph', 'matplotlib', - 'pvlib <= 0.9.0', + 'pvlib', 'numpy >= 1.16.5', 'pandas >= 0.18.0' ] diff --git a/src/oemof/thermal/concentrating_solar_power.py b/src/oemof/thermal/concentrating_solar_power.py index c9b1ad94..099762a2 100644 --- a/src/oemof/thermal/concentrating_solar_power.py +++ b/src/oemof/thermal/concentrating_solar_power.py @@ -282,9 +282,15 @@ def calc_irradiance( """ if irradiance_method == "horizontal": - poa_horizontal_ratio = pvlib.irradiance.poa_horizontal_ratio( + cos_poa_zen = pvlib.irradiance.aoi_projection( surface_tilt, surface_azimuth, apparent_zenith, azimuth ) + + cos_solar_zenith = pvlib.tools.cosd(apparent_zenith) + + # ratio of tilted and horizontal beam irradiance + poa_horizontal_ratio = cos_poa_zen / cos_solar_zenith + poa_horizontal_ratio[poa_horizontal_ratio < 0] = 0 irradiance_on_collector = irradiance * poa_horizontal_ratio diff --git a/tests/test_constraints.py b/tests/test_constraints.py index fa7b7ba2..861a8e9c 100644 --- a/tests/test_constraints.py +++ b/tests/test_constraints.py @@ -83,7 +83,7 @@ def setup_class(cls): r"^objective.*(?=s\.t\.)", re.DOTALL | re.MULTILINE ) - cls.date_time_index = pd.date_range("1/1/2012", periods=3, freq="H") + cls.date_time_index = pd.date_range("1/1/2012", periods=3, freq="h") cls.tmpdir = helpers.extend_basic_path("tmp") logging.info(cls.tmpdir) From 172ff23d8464dc55453b2bcd7668794b1d250f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Fri, 13 Dec 2024 10:31:08 +0100 Subject: [PATCH 2/3] Add v0.0.8 whatsnew --- docs/whats_new.rst | 1 + docs/whats_new/v0-0-7.rst | 22 ++-------------------- docs/whats_new/v0-0-8.rst | 13 +++++++++++++ 3 files changed, 16 insertions(+), 20 deletions(-) create mode 100644 docs/whats_new/v0-0-8.rst diff --git a/docs/whats_new.rst b/docs/whats_new.rst index bb8882ed..16839115 100644 --- a/docs/whats_new.rst +++ b/docs/whats_new.rst @@ -8,6 +8,7 @@ Discover noteable new features and improvements in each release. :local: :backlinks: top +.. include:: whats_new/v0-0-8.rst .. include:: whats_new/v0-0-7.rst .. include:: whats_new/v0-0-6.rst .. include:: whats_new/v0-0-5.rst diff --git a/docs/whats_new/v0-0-7.rst b/docs/whats_new/v0-0-7.rst index 9f474fe0..c28199c4 100644 --- a/docs/whats_new/v0-0-7.rst +++ b/docs/whats_new/v0-0-7.rst @@ -1,17 +1,5 @@ -v0.0.7.dev (???) -================ - -API Changes ------------ - -New features ------------- - -New components/constraints --------------------------- - -Documentation -------------- +v0.0.7 (November 27, 2024) +========================== Bug fixes --------- @@ -19,12 +7,6 @@ Bug fixes * Improve quality of pip package -Known issues ------------- - -Other changes -------------- - Contributors ------------ diff --git a/docs/whats_new/v0-0-8.rst b/docs/whats_new/v0-0-8.rst new file mode 100644 index 00000000..39017063 --- /dev/null +++ b/docs/whats_new/v0-0-8.rst @@ -0,0 +1,13 @@ +v0.0.8 (December 13, 2024) +========================== + +Other changes +------------- + +* Make compatible to Pandas 2 +* Make compatible to PVLib 0.11 + +Contributors +------------ + +* Patrik Schönfeldt From d32252801acd1d18d18ca4293db53427f429b7eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Fri, 13 Dec 2024 11:53:16 +0100 Subject: [PATCH 3/3] Release v0.0.8 --- src/oemof/thermal/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oemof/thermal/__init__.py b/src/oemof/thermal/__init__.py index 0f76c415..98f44808 100644 --- a/src/oemof/thermal/__init__.py +++ b/src/oemof/thermal/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.0.7.dev0" +__version__ = "0.0.8" __project__ = "oemof.thermal" from . import absorption_heatpumps_and_chillers