From e20159db851a06c663e559749e179cf87022409d Mon Sep 17 00:00:00 2001 From: "j.aschauer" Date: Tue, 13 Aug 2024 17:06:55 +0200 Subject: [PATCH 1/2] show OPEX (fix) for RE generation in Input Data tab Fixes #544 --- app/layout_elements.py | 14 +++++++++++++- app/plot_functions.py | 15 ++++++++++++--- app/ptxboa_functions.py | 8 +++++--- app/tab_input_data.py | 9 ++++++--- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/app/layout_elements.py b/app/layout_elements.py index 5061316..b4631ae 100644 --- a/app/layout_elements.py +++ b/app/layout_elements.py @@ -276,6 +276,7 @@ def display_and_edit_input_data( "conversion_coefficients", "dac_and_desalination", "storage", + "OPEX (fix)", ], scope: Literal["world", "Argentina", "Morocco", "South Africa"], key: str, @@ -294,7 +295,8 @@ def display_and_edit_input_data( the data type which should be selected. Needs to be one of "electricity_generation", "conversion_processes", "transportation_processes", "reconversion_processes", "CAPEX", "full load hours", "WACC", - "specific costs", "conversion_coefficients" and "dac_and_desalination" + "specific costs", "conversion_coefficients", "dac_and_desalination" + and "OPEX (fix)". scope : Literal[None, "world", "Argentina", "Morocco", "South Africa"] The regional scope. Is automatically set to None for data of data type "conversion_processes" and "transportation_processes" which is not @@ -400,6 +402,16 @@ def display_and_edit_input_data( for c in df.columns } + if data_type == "OPEX (fix)": + index = "source_region_code" + columns = "process_code" + missing_index_name = "parameter_code" + missing_index_value = "OPEX (fix)" + column_config = { + c: st.column_config.NumberColumn(format="%.2f USD/kW", min_value=0) + for c in df.columns + } + if data_type == "full load hours": index = "source_region_code" columns = "process_code" diff --git a/app/plot_functions.py b/app/plot_functions.py index 1da972f..d76d6c1 100644 --- a/app/plot_functions.py +++ b/app/plot_functions.py @@ -100,7 +100,7 @@ def plot_costs_on_map( def plot_input_data_on_map( api: PtxboaAPI, - data_type: Literal["CAPEX", "full load hours", "WACC"], + data_type: Literal["CAPEX", "full load hours", "WACC", "OPEX (fix)"], color_col: Literal[ "PV tilted", "Wind Offshore", @@ -132,7 +132,12 @@ def plot_input_data_on_map( """ input_data = get_data_type_from_input_data(api, data_type=data_type, scope=None) - units = {"CAPEX": "USD/kW", "full load hours": "h/a", "WACC": "%"} + units = { + "CAPEX": "USD/kW", + "full load hours": "h/a", + "WACC": "%", + "OPEX (fix)": "USD/kW", + } if data_type == "WACC": assert color_col == "WACC" @@ -146,13 +151,17 @@ def plot_input_data_on_map( "PV tilted (hybrid)", ] custom_data_func_kwargs = {"float_precision": 0} - if data_type == "CAPEX": + if data_type in ["CAPEX", "OPEX (fix)"]: assert color_col in [ "PV tilted", "Wind Offshore", "Wind Onshore", ] + + if data_type == "CAPEX": custom_data_func_kwargs = {"float_precision": 0} + if data_type == "OPEX (fix)": + custom_data_func_kwargs = {"float_precision": 2} custom_data_func_kwargs["unit"] = units[data_type] custom_data_func_kwargs["data_type"] = data_type diff --git a/app/ptxboa_functions.py b/app/ptxboa_functions.py index c7716ad..2d06c61 100644 --- a/app/ptxboa_functions.py +++ b/app/ptxboa_functions.py @@ -284,6 +284,7 @@ def get_data_type_from_input_data( "conversion_coefficients", "dac_and_desalination", "storage", + "OPEX (fix)", ], scope: Literal[None, "world", "Argentina", "Morocco", "South Africa"], ) -> pd.DataFrame: @@ -302,7 +303,8 @@ def get_data_type_from_input_data( the data type which should be selected. Needs to be one of "electricity_generation", "conversion_processes", "transportation_processes", "reconversion_processes", "CAPEX", "full load hours", "WACC", - "specific costs", "conversion_coefficients" and "dac_and_desalination". + "specific costs", "conversion_coefficients", "dac_and_desalination" + and "OPEX (fix)". scope : Literal[None, "world", "Argentina", "Morocco", "South Africa"] The regional scope. Is automatically set to None for data of data type "conversion_processes" and "transportation_processes" which is not @@ -426,7 +428,7 @@ def get_data_type_from_input_data( processes["is_transport"] & processes["is_transformation"], "process_name" ].to_list() - if data_type in ["CAPEX", "WACC"]: + if data_type in ["CAPEX", "WACC", "OPEX (fix)"]: source_region_code = None parameter_code = [data_type] index = "source_region_code" @@ -435,7 +437,7 @@ def get_data_type_from_input_data( columns = "parameter_code" process_code = [""] - if data_type == "CAPEX": + if data_type in ["CAPEX", "OPEX (fix)"]: columns = "process_code" process_code = [ "Wind Onshore", diff --git a/app/tab_input_data.py b/app/tab_input_data.py index 08e32fa..f40733b 100644 --- a/app/tab_input_data.py +++ b/app/tab_input_data.py @@ -31,13 +31,13 @@ def content_input_data(api: PtxboaAPI) -> None: data_selection = st.radio( "Select data type", - ["CAPEX", "full load hours", "WACC"], + ["CAPEX", "full load hours", "WACC", "OPEX (fix)"], horizontal=True, ) with st.expander("**Map**", expanded=True): - if data_selection in ["full load hours", "CAPEX"]: + if data_selection in ["full load hours", "CAPEX", "OPEX (fix)"]: if data_selection == "full load hours": select_options = [ "Wind Onshore", @@ -46,7 +46,7 @@ def content_input_data(api: PtxboaAPI) -> None: "Wind Onshore (hybrid)", "PV tilted (hybrid)", ] - if data_selection == "CAPEX": + if data_selection in ["CAPEX", "OPEX (fix)"]: select_options = [ "Wind Onshore", "Wind Offshore", @@ -82,6 +82,9 @@ def content_input_data(api: PtxboaAPI) -> None: if data_selection == "CAPEX": ylabel = "CAPEX (USD/kW)" hover_name = "process_code" + if data_selection == "OPEX (fix)": + ylabel = "OPEX (fix) (USD/kW)" + hover_name = "process_code" if data_selection == "full load hours": ylabel = "full load hours (h/a)" hover_name = "res_gen" From 58b35031f6d1001799bd4b571b9632c4151d6ac5 Mon Sep 17 00:00:00 2001 From: "j.aschauer" Date: Tue, 13 Aug 2024 17:11:09 +0200 Subject: [PATCH 2/2] adapt changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8352801..55b1788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG.md +## unreleased (xxxx-xx-xx) + +- show region specific OPEX (fix) data for RE generation in input data tab ([#545](https://github.com/agoenergy/ptx-boa/pull/545)) + ## 2.0.3 (2024-07-15) - upgrade pypsa requirements to 0.28