Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show OPEX (fix) for RE generation in Input Data tab #545

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 13 additions & 1 deletion app/layout_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down
15 changes: 12 additions & 3 deletions app/plot_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down
8 changes: 5 additions & 3 deletions app/ptxboa_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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",
Expand Down
9 changes: 6 additions & 3 deletions app/tab_input_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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"
Expand Down
Loading