|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
from datetime import timedelta
|
|
|
|
from collections import defaultdict
|
|
|
|
from collections import defaultdict
|
|
|
|
from datetime import datetime
|
|
|
|
from datetime import datetime
|
|
|
|
import io
|
|
|
|
import io
|
|
|
|
@ -529,6 +530,9 @@ async def get_forecast_eaf(
|
|
|
|
# Using the helper from utils.py
|
|
|
|
# Using the helper from utils.py
|
|
|
|
offset_hours = hours_between(oh_date, now)
|
|
|
|
offset_hours = hours_between(oh_date, now)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#start date is oh + offset
|
|
|
|
|
|
|
|
start_date = oh_date + timedelta(hours=offset_hours)
|
|
|
|
|
|
|
|
|
|
|
|
# 4. Define Forecast Window
|
|
|
|
# 4. Define Forecast Window
|
|
|
|
duration = 168 if time_range == "weekly" else 720
|
|
|
|
duration = 168 if time_range == "weekly" else 720
|
|
|
|
|
|
|
|
|
|
|
|
@ -578,7 +582,7 @@ async def get_forecast_eaf(
|
|
|
|
"sim_duration_hours": duration,
|
|
|
|
"sim_duration_hours": duration,
|
|
|
|
"reference_oh_date": oh_date_str
|
|
|
|
"reference_oh_date": oh_date_str
|
|
|
|
},
|
|
|
|
},
|
|
|
|
message="Forecast generated successfully"
|
|
|
|
message=f"Forecast generated successfully, start date: {start_date.strftime('%Y-%m-%d %H:%M:%S')}, end_date: {(start_date + timedelta(hours=duration)).strftime('%Y-%m-%d %H:%M:%S')}"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
|