|
|
|
|
@ -527,23 +527,18 @@ async def get_forecast_eaf(
|
|
|
|
|
except Exception:
|
|
|
|
|
oh_date = datetime(now.year, 1, 1).replace(tzinfo=None)
|
|
|
|
|
|
|
|
|
|
# 3. Calculate Age in Hours (Offset)
|
|
|
|
|
offset_hours = hours_between(oh_date, now)
|
|
|
|
|
|
|
|
|
|
# 4. Define Forecast Window
|
|
|
|
|
duration = 168 if time_range == "weekly" else 720
|
|
|
|
|
|
|
|
|
|
start_date = oh_date
|
|
|
|
|
end_date = now + timedelta(hours=duration)
|
|
|
|
|
duration_simulation = hours_between(oh_date, end_date)
|
|
|
|
|
project = await get_project(db_session=db_session)
|
|
|
|
|
|
|
|
|
|
# 5. Create Simulation Request
|
|
|
|
|
sim_in = SimulationInput(
|
|
|
|
|
SchematicName="- TJB - Unit 3 -",
|
|
|
|
|
SimulationName=f"Simulation_{time_range}_{now.strftime('%Y%m%d')}",
|
|
|
|
|
SimDuration=duration,
|
|
|
|
|
SimDuration=duration_simulation,
|
|
|
|
|
DurationUnit="UHour",
|
|
|
|
|
OffSet=offset_hours,
|
|
|
|
|
OffSet=0,
|
|
|
|
|
SimSeed=1,
|
|
|
|
|
SimNumRun=1,
|
|
|
|
|
IsDefault=False
|
|
|
|
|
|