Skip to content

Commit

Permalink
Merge branch 'develop' into 420-check-and-improve-help-texts
Browse files Browse the repository at this point in the history
  • Loading branch information
wingechr authored Jun 19, 2024
2 parents cd13127 + 049321d commit 9dbeace
Show file tree
Hide file tree
Showing 17 changed files with 4,372 additions and 4,341 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.8.3
current_version = 0.9.0
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
uses: docker/build-push-action@v5
with:
push: true
tags: wingechr/ptx-boa:0.8.3
tags: wingechr/ptx-boa:0.9.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM python:3.10-slim
LABEL version="0.8.3"
LABEL version="0.9.0"

RUN apt-get update
RUN apt-get install -y git
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ scp -r ptxboa2:ptx-boa_offline_optimization/optimization_cache/* .
# connect to server
ssh ptxboa
# pull latest image from dockerhub
VERSION=0.8.3
VERSION=0.9.0
docker pull wingechr/ptx-boa:$VERSION
# stop and delete the currently running container "app"
docker stop app
Expand Down
14 changes: 8 additions & 6 deletions app/layout_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,10 @@ def display_footer():
st.markdown(
"""
##### On behalf of
Agora Energiewende<br/>
Agora Industry<br/>
Anna-Louisa-Karsch-Str. 2<br/>
D-10178 Berlin<br/>
www.agora-industry.org<br/>
www.agora-energiewende.org
www.agora-industry.org
""",
unsafe_allow_html=True,
)
Expand All @@ -192,13 +191,16 @@ def display_footer():
)

# TODO: fix uneven height and vertical alignment of logos
c1, c2, c3, c4 = st.columns(4, gap="medium")
c0, c1, c2, c3, c4, c5 = st.columns(
[1, 2, 2, 2, 2, 1],
gap="large",
)
with c1:
st.image("img/oeko_logo_612x306.png")
st.image("img/Agora_Industry_logo_612x306.png")
with c2:
st.image("img/agora-energiewende_logo_612x306.png")
with c3:
st.image("img/Agora_Industry_logo_612x306.png")
st.image("img/oeko_logo_612x306.png")
with c4:
st.image("img/PtX-Hub_Logo_international_612x306.png")

Expand Down
25 changes: 19 additions & 6 deletions app/plot_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,11 @@ def add_trace_to_figure(
df_plot = df[(df["Component"] == component)]
df_plot = df_plot[(df_plot["Parameter"] == parameter)]
if fill:
if df_plot["MW (MWh for SOC)"].sum() > 0:
if df_plot["MW"].sum() > 0:
fig.add_trace(
go.Scatter(
x=df_plot["time"],
y=df_plot["MW (MWh for SOC)"],
y=df_plot["MW"],
mode="lines",
name=component,
line_color=color,
Expand All @@ -597,7 +597,7 @@ def add_trace_to_figure(
fig.add_trace(
go.Scatter(
x=df_plot["time"],
y=df_plot["MW (MWh for SOC)"],
y=df_plot["MW"],
mode="lines",
name=component,
line_color=color,
Expand All @@ -612,7 +612,7 @@ def transform_time_series(
res = df.reset_index().melt(
id_vars=["timestep", "period"],
var_name="Component",
value_name="MW (MWh for SOC)",
value_name="MW",
)
res["Parameter"] = parameter
return res
Expand All @@ -623,9 +623,9 @@ def transform_time_series(
df_gen = transform_time_series(df_gen)
df_links = -n.links_t["p1"]
df_links = transform_time_series(df_links)
df_store = n.stores_t["e"]
df_store = n.stores_t["p"]
df_store = transform_time_series(df_store)
df_storageunit = n.storage_units_t["state_of_charge"]
df_storageunit = n.storage_units_t["p"]
df_storageunit = transform_time_series(df_storageunit)

df = pd.concat([df_p_max_pu, df_gen, df_links, df_store, df_storageunit])
Expand Down Expand Up @@ -711,12 +711,24 @@ def create_profile_figure_generation(df_sel: pd.DataFrame) -> go.Figure:
parameter="Power",
color="#408B2E",
)
add_trace_to_figure(
df_sel,
fig,
component="Electricity storage",
parameter="Power",
color="#D05094",
)

add_trace_to_figure(
df_sel, fig, component="H2 storage", parameter="Power", color="#733E88"
)

add_vertical_lines(fig)

fig.update_layout(
xaxis={"title": "time (h)"},
yaxis={"title": "output (MW)"},
legend={"traceorder": "normal"},
)

return fig
Expand Down Expand Up @@ -757,6 +769,7 @@ def create_profile_figure_soc(df_sel: pd.DataFrame) -> go.Figure:
fig.update_layout(
xaxis={"title": "time (h)"},
yaxis={"title": "state of charge (MWh)"},
legend={"traceorder": "normal"},
)

return fig
Expand Down
4 changes: 2 additions & 2 deletions app/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

@st.cache_resource()
def sidebar_logo():
st.image("img/agora-energiewende_logo_612x306.png")
st.image("img/Agora_Industry_logo_612x306.png")


def make_sidebar(api: PtxboaAPI):
st.logo(
image="img/transparent_10x10.png", # placeholder when sidebar is expanded
icon_image="img/agora-energiewende_logo_612x306.png",
icon_image="img/Agora_Industry_logo_612x306.png",
)

with st.sidebar:
Expand Down
4 changes: 4 additions & 0 deletions ptxboa/api_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,16 +809,20 @@ def _get_calculation_data(
chain, transport_distances
)

used_flows = set()
for process_step in chain_steps_main:
process_code = chain[process_step]
res = pg.get_process_params(process_code)
res["step"] = process_step
res["process_code"] = process_code
result["main_process_chain"].append(res)
used_flows = used_flows | set(res["CONV"])

for flow_code, process_code in secondary_processes.items():
if not process_code:
continue
if flow_code not in used_flows:
continue
res = pg.get_process_params(process_code)
res["process_code"] = process_code
result["secondary_process"][flow_code] = res
Expand Down
Loading

0 comments on commit 9dbeace

Please sign in to comment.