Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import pulp
|
|
| 5 |
import plotly.graph_objs as go
|
| 6 |
import plotly.express as px
|
| 7 |
import numpy as np
|
|
|
|
| 8 |
|
| 9 |
# Function to fetch renewable energy data
|
| 10 |
def get_json():
|
|
@@ -12,7 +13,7 @@ def get_json():
|
|
| 12 |
open data.json
|
| 13 |
"""
|
| 14 |
with open('data.json') as f:
|
| 15 |
-
|
| 16 |
if not data:
|
| 17 |
return None, "No data found."
|
| 18 |
|
|
@@ -24,7 +25,7 @@ def get_json():
|
|
| 24 |
values = energy_data['y']
|
| 25 |
result_df[f"{energy_type} hourly capacity factor"] = values
|
| 26 |
|
| 27 |
-
return
|
| 28 |
|
| 29 |
# Function to optimize the energy system and create visualizations
|
| 30 |
def optimize_energy_system(solar_cost, onshore_wind_cost, offshore_wind_cost, river_cost, battery_cost, yearly_demand, solar_range, wind_range, river_range, offshore_wind_range):
|
|
|
|
| 5 |
import plotly.graph_objs as go
|
| 6 |
import plotly.express as px
|
| 7 |
import numpy as np
|
| 8 |
+
import json
|
| 9 |
|
| 10 |
# Function to fetch renewable energy data
|
| 11 |
def get_json():
|
|
|
|
| 13 |
open data.json
|
| 14 |
"""
|
| 15 |
with open('data.json') as f:
|
| 16 |
+
data = json.load(f)
|
| 17 |
if not data:
|
| 18 |
return None, "No data found."
|
| 19 |
|
|
|
|
| 25 |
values = energy_data['y']
|
| 26 |
result_df[f"{energy_type} hourly capacity factor"] = values
|
| 27 |
|
| 28 |
+
return result_df
|
| 29 |
|
| 30 |
# Function to optimize the energy system and create visualizations
|
| 31 |
def optimize_energy_system(solar_cost, onshore_wind_cost, offshore_wind_cost, river_cost, battery_cost, yearly_demand, solar_range, wind_range, river_range, offshore_wind_range):
|