Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from app_backend import fetch_weather, generate_synthetic_data, optimize_load
|
|
5 |
|
6 |
# Constants
|
7 |
API_KEY = "84e26811a314599e940f343b4d5894a7"
|
8 |
-
LOCATION = "
|
9 |
|
10 |
# Sidebar
|
11 |
st.sidebar.title("Smart Grid Dashboard")
|
@@ -39,9 +39,9 @@ with tabs[0]:
|
|
39 |
st.bar_chart(grid_health_counts)
|
40 |
|
41 |
# Optimization recommendations
|
42 |
-
current_demand = data["
|
43 |
-
current_solar = data["
|
44 |
-
current_wind = data["
|
45 |
recommendation = optimize_load(current_demand, current_solar, current_wind)
|
46 |
|
47 |
st.subheader("Recommendations")
|
@@ -55,13 +55,13 @@ with tabs[1]:
|
|
55 |
|
56 |
# Total energy stored
|
57 |
total_storage = 500 # Example of total energy storage
|
58 |
-
st.subheader(f"Total Energy Stored: {total_storage}
|
59 |
|
60 |
# Energy storage contribution from different sources
|
61 |
st.subheader("Energy Storage Contributions")
|
62 |
energy_sources = pd.DataFrame({
|
63 |
"Source": ["Wind", "Solar", "Turbine"],
|
64 |
-
"Energy (
|
65 |
})
|
66 |
st.bar_chart(energy_sources.set_index("Source"))
|
67 |
|
@@ -79,13 +79,13 @@ with tabs[1]:
|
|
79 |
st.plotly_chart(fig)
|
80 |
|
81 |
with tabs[2]:
|
82 |
-
st.title("
|
83 |
|
84 |
# Energy cubes
|
85 |
st.subheader("Energy Cubes Stored")
|
86 |
energy_cubes = pd.DataFrame({
|
87 |
-
"Country": ["
|
88 |
-
"Energy (
|
89 |
"Shareable": [True, True, False]
|
90 |
})
|
91 |
|
@@ -96,5 +96,5 @@ with tabs[2]:
|
|
96 |
# Visualization of energy that can be shared
|
97 |
st.subheader("Energy Trading Visualization")
|
98 |
st.markdown("The following energy amounts are available for sharing with different countries.")
|
99 |
-
trading_fig = px.bar(energy_cubes, x="Country", y="Energy (
|
100 |
st.plotly_chart(trading_fig)
|
|
|
5 |
|
6 |
# Constants
|
7 |
API_KEY = "84e26811a314599e940f343b4d5894a7"
|
8 |
+
LOCATION = "New York"
|
9 |
|
10 |
# Sidebar
|
11 |
st.sidebar.title("Smart Grid Dashboard")
|
|
|
39 |
st.bar_chart(grid_health_counts)
|
40 |
|
41 |
# Optimization recommendations
|
42 |
+
current_demand = data["total_consumption_kwh"].iloc[-1]
|
43 |
+
current_solar = data["solar_output_kw"].iloc[-1]
|
44 |
+
current_wind = data["wind_output_kw"].iloc[-1]
|
45 |
recommendation = optimize_load(current_demand, current_solar, current_wind)
|
46 |
|
47 |
st.subheader("Recommendations")
|
|
|
55 |
|
56 |
# Total energy stored
|
57 |
total_storage = 500 # Example of total energy storage
|
58 |
+
st.subheader(f"Total Energy Stored: {total_storage} kWh")
|
59 |
|
60 |
# Energy storage contribution from different sources
|
61 |
st.subheader("Energy Storage Contributions")
|
62 |
energy_sources = pd.DataFrame({
|
63 |
"Source": ["Wind", "Solar", "Turbine"],
|
64 |
+
"Energy (kW/min)": [5, 7, 10]
|
65 |
})
|
66 |
st.bar_chart(energy_sources.set_index("Source"))
|
67 |
|
|
|
79 |
st.plotly_chart(fig)
|
80 |
|
81 |
with tabs[2]:
|
82 |
+
st.title("Energy Trading Overview")
|
83 |
|
84 |
# Energy cubes
|
85 |
st.subheader("Energy Cubes Stored")
|
86 |
energy_cubes = pd.DataFrame({
|
87 |
+
"Country": ["Country A", "Country B", "Country C"],
|
88 |
+
"Energy (kWh)": [100, 200, 300],
|
89 |
"Shareable": [True, True, False]
|
90 |
})
|
91 |
|
|
|
96 |
# Visualization of energy that can be shared
|
97 |
st.subheader("Energy Trading Visualization")
|
98 |
st.markdown("The following energy amounts are available for sharing with different countries.")
|
99 |
+
trading_fig = px.bar(energy_cubes, x="Country", y="Energy (kWh)", color="Shareable", title="Energy Trading")
|
100 |
st.plotly_chart(trading_fig)
|