largely working dashboard
This commit is contained in:
		
							parent
							
								
									6d1199e37a
								
							
						
					
					
						commit
						d3dbd9c9f3
					
				| @ -31,7 +31,7 @@ def discharge_bess(bess, site_name, dt, discharge_power): | |||||||
|             continue |             continue | ||||||
| 
 | 
 | ||||||
|         if unit["site"] == site_name: |         if unit["site"] == site_name: | ||||||
|             new_soc = unit["SoC"] - (dt * discharge_energy) / unit["capacity_kWh"] |             new_soc = unit["SoC"] - 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: | ||||||
|             continue |             continue | ||||||
|  | |||||||
| @ -26,6 +26,11 @@ def format_dataframe( | |||||||
|         current_load = bess_data["units"][index]["current_load_kW"] |         current_load = bess_data["units"][index]["current_load_kW"] | ||||||
|         unit_name = bess_data["units"][index]["name"] |         unit_name = bess_data["units"][index]["name"] | ||||||
|         predicted_swap_time = swap_time.get(unit_name, "N/A") |         predicted_swap_time = swap_time.get(unit_name, "N/A") | ||||||
|  |         # convert predicted_swap_time to a readable format | ||||||
|  |         if isinstance(predicted_swap_time, float): | ||||||
|  |             predicted_swap_time = pd.to_datetime( | ||||||
|  |                 predicted_swap_time, unit="s" | ||||||
|  |             ).strftime("%Y-%m-%d %H:%M:%S") | ||||||
| 
 | 
 | ||||||
|         status_df = pd.concat( |         status_df = pd.concat( | ||||||
|             [ |             [ | ||||||
|  | |||||||
							
								
								
									
										15
									
								
								dashboard.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								dashboard.py
									
									
									
									
									
								
							| @ -63,7 +63,7 @@ def show_table(): | |||||||
|                 "SoC (%)": st.column_config.ProgressColumn( |                 "SoC (%)": st.column_config.ProgressColumn( | ||||||
|                     "State of Charge", |                     "State of Charge", | ||||||
|                     help="State of Charge of the BESS unit", |                     help="State of Charge of the BESS unit", | ||||||
|                     format="%d%%", |                     format="%.1f%%", | ||||||
|                     min_value=0, |                     min_value=0, | ||||||
|                     max_value=100, |                     max_value=100, | ||||||
|                 ), |                 ), | ||||||
| @ -84,9 +84,20 @@ def show_table(): | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| if st.session_state.running: | if st.session_state.running: | ||||||
|  |     # display simulation start time | ||||||
|  |     st.metric( | ||||||
|  |         "Simulation Start Time", | ||||||
|  |         value=pd.to_datetime(main.c["sim_start_time"], unit="s").strftime( | ||||||
|  |             "%Y-%m-%d %H:%M:%S" | ||||||
|  |         ), | ||||||
|  |     ) | ||||||
|  |     st.metric( | ||||||
|  |         "Time Elapsed in DD:HH:MM:SS", | ||||||
|  |         value=str(pd.to_timedelta(main.sim_i * main.dt, unit="s")), | ||||||
|  |     ) | ||||||
|     # display BESS data, SoC, Load Consumption |     # display BESS data, SoC, Load Consumption | ||||||
|     show_table() |     show_table() | ||||||
|     time.sleep(1) |     time.sleep(3) | ||||||
|     st.rerun() |     st.rerun() | ||||||
| else: | else: | ||||||
|     show_table() |     show_table() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user