From 6d1199e37ab15351de3273c85d673d16c9977149 Mon Sep 17 00:00:00 2001 From: Lucas Tan Date: Sun, 20 Jul 2025 16:15:11 +0100 Subject: [PATCH] wip sim dashboard --- Utilities/BESS.py | 3 +-- dashboard.py | 3 +-- main.py | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Utilities/BESS.py b/Utilities/BESS.py index 25c33ac..fa46610 100644 --- a/Utilities/BESS.py +++ b/Utilities/BESS.py @@ -34,8 +34,7 @@ def discharge_bess(bess, site_name, dt, discharge_power): new_soc = unit["SoC"] - (dt * discharge_energy) / unit["capacity_kWh"] new_soc = 0 if new_soc < 0 else new_soc else: - # maintain SoC if not assigned to the site - new_soc = unit["SoC"] + continue # update SoC and current load bess["units"][index]["current_load_kW"] = discharge_power diff --git a/dashboard.py b/dashboard.py index a028ced..af7f1e9 100644 --- a/dashboard.py +++ b/dashboard.py @@ -84,11 +84,10 @@ def show_table(): if st.session_state.running: - st.subheader("BESS State of Charge (SoC) and Energy Consumption") # display BESS data, SoC, Load Consumption show_table() time.sleep(1) st.rerun() else: show_table() - st.info("Simulation paused.") + st.info("Simulation not running") diff --git a/main.py b/main.py index 5b225db..8ac36bd 100644 --- a/main.py +++ b/main.py @@ -126,7 +126,7 @@ def simulation_loop(): ) # small sleep to allow dashboard to refresh / release GIL - time.sleep(0.01) + time.sleep(1) ### <<< CONTROL ADDED >>> Control functions