fix sof efor calculation

main
Cizz22 3 months ago
parent afdba57174
commit 21d07a5824

@ -267,6 +267,19 @@ async def get_custom_parameters_controller(db_session: DbSession):
}
@router.get("/metrics/{simulation_id}", response_model=StandardResponse[list])
async def get_custom_parameters_controller(db_session: DbSession, simulation_id:UUID):
"""Get simulation result."""
results = await calculate_plant_eaf(db_session, simulation_id, 0, 1200, 15000, 0)
return {
"data": results,
"status": "success",
"message": "Simulation result retrieved successfully",
}
airflow_router = APIRouter()
@ -373,24 +386,3 @@ async def calculate_contribution(
)
# @router.get("/status/{simulation_id}", response_model=StandardResponse[None])
# async def get_simulation_status(simulation_id: str):
# """Get simulation status."""
# if simulation_id not in active_simulations:
# raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Simulation not found")
# return active_simulations[simulation_id]
# @router.post("/cancel/{simulation_id}", response_model=StandardResponse[None])
# async def cancel_simulation(simulation_id: str):
# """Cancel simulation."""
# if simulation_id not in active_simulations:
# raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Simulation not found")
# active_simulations[simulation_id].update({
# "status": "cancelled",
# "cancelled_at": datetime.now()
# })
# return active_simulations[simulation_id]

@ -263,14 +263,16 @@ async def calculate_plant_eaf(
plant_calc_data.total_uptime + plant_calc_data.total_downtime + offset
) > oh_interval
# Calculate outages
if is_oh_from_aeros:
seasonal_outage = (mo_downtime + po_downtime) * 24
forced_outage = max(0, plant_calc_data.total_downtime - (po_downtime * 24))
seasonal_outage = (mo_downtime) * 24 + po_downtime
forced_outage = max(0, plant_calc_data.total_downtime - (po_downtime))
else:
seasonal_outage = mo_downtime * 24
forced_outage = max(0, plant_calc_data.total_downtime)
# Adjust uptime
total_uptime = max(0, plant_calc_data.total_uptime - (mo_downtime * 24))
@ -287,6 +289,7 @@ async def calculate_plant_eaf(
)
plant_calc_data.total_mo_downtime = mo_downtime
plant_calc_data.total_po_downtime = po_downtime
plant_calc_data.eaf = eaf

Loading…
Cancel
Save