Cizz22 5 months ago
parent 1b325ad65a
commit 66c670c715

@ -236,7 +236,7 @@ async def save_simulation_result(
ideal_production=result["idealProduction"]
)
efor = (result["totalDowntime"] / (result["totalDowntime"] + result["totalUpTime"])*100) if (result["totalDowntime"] + result["totalUpTime"]) > 0 else 0
efor = (result["totalDowntime"] / (result["totalDowntime"] + result["totalUpTime"]))*100 if (result["totalDowntime"] + result["totalUpTime"]) > 0 else 0
calc_result = AerosSimulationCalcResult(
aeros_simulation_id=simulation_id,

@ -18,18 +18,23 @@ def calculate_eaf(
Returns:
Dictionary with EAF result and breakdown
"""
# Calculate lost production
lost_production = ideal_production - actual_production
estimated_max_capacity = ideal_production / period_hours if period_hours > 0 else 0
try:
# Calculate lost production
lost_production = ideal_production - actual_production
print(ideal_production, actual_production, lost_production)
# Calculate total equivalent derate hours
total_equivalent_derate_hours = lost_production / estimated_max_capacity
estimated_max_capacity = ideal_production / period_hours if period_hours > 0 else 0
# Calculate EAF
effective_available_hours = available_hours - total_equivalent_derate_hours
return (effective_available_hours / period_hours) * 100, total_equivalent_derate_hours
# Calculate total equivalent derate hours
total_equivalent_derate_hours = lost_production / estimated_max_capacity if estimated_max_capacity > 0 else 0
# Calculate EAF
effective_available_hours = available_hours - total_equivalent_derate_hours
return (effective_available_hours / period_hours) * 100 if period_hours > 0 else 0, total_equivalent_derate_hours
except Exception as e:
print("Error calculating EAF:", str(e))
raise
# def calculate_efor(
# forced_outage_hours: float,

Loading…
Cancel
Save