wip sim dashboard

This commit is contained in:
Lucas Tan 2025-07-20 16:15:11 +01:00
parent 6c994e970c
commit 6d1199e37a
3 changed files with 3 additions and 5 deletions

View File

@ -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 = unit["SoC"] - (dt * discharge_energy) / unit["capacity_kWh"]
new_soc = 0 if new_soc < 0 else new_soc new_soc = 0 if new_soc < 0 else new_soc
else: else:
# maintain SoC if not assigned to the site continue
new_soc = unit["SoC"]
# update SoC and current load # update SoC and current load
bess["units"][index]["current_load_kW"] = discharge_power bess["units"][index]["current_load_kW"] = discharge_power

View File

@ -84,11 +84,10 @@ def show_table():
if st.session_state.running: if st.session_state.running:
st.subheader("BESS State of Charge (SoC) and Energy Consumption")
# display BESS data, SoC, Load Consumption # display BESS data, SoC, Load Consumption
show_table() show_table()
time.sleep(1) time.sleep(1)
st.rerun() st.rerun()
else: else:
show_table() show_table()
st.info("Simulation paused.") st.info("Simulation not running")

View File

@ -126,7 +126,7 @@ def simulation_loop():
) )
# small sleep to allow dashboard to refresh / release GIL # small sleep to allow dashboard to refresh / release GIL
time.sleep(0.01) time.sleep(1)
### <<< CONTROL ADDED >>> Control functions ### <<< CONTROL ADDED >>> Control functions