|
|
|
|
@ -7,6 +7,7 @@ def calculate_eaf(
|
|
|
|
|
actual_production: float,
|
|
|
|
|
ideal_production: float,
|
|
|
|
|
downtime_hours,
|
|
|
|
|
plot_data = None
|
|
|
|
|
):
|
|
|
|
|
"""
|
|
|
|
|
Calculate EAF using the time-based method from PLN document
|
|
|
|
|
@ -25,15 +26,13 @@ def calculate_eaf(
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
# Calculate lost production
|
|
|
|
|
lost_production = ideal_production - actual_production
|
|
|
|
|
max_capacity = 660
|
|
|
|
|
derate_production = ideal_production - actual_production - (max_capacity * downtime_hours)
|
|
|
|
|
# Calculate total equivalent derate and outage hours
|
|
|
|
|
total_equivalent_derate_and_outage_hours = lost_production / max_capacity if max_capacity > 0 else 0
|
|
|
|
|
total_equivalent_derate = total_equivalent_derate_and_outage_hours - downtime_hours
|
|
|
|
|
|
|
|
|
|
derate_equivalent_hours = derate_production / max_capacity if max_capacity > 0 else 0
|
|
|
|
|
# Calculate EAF
|
|
|
|
|
effective_available_hours = available_hours - total_equivalent_derate
|
|
|
|
|
return (effective_available_hours / period_hours) * 100 if period_hours > 0 else 0, total_equivalent_derate
|
|
|
|
|
effective_available_hours = available_hours - derate_equivalent_hours
|
|
|
|
|
return (effective_available_hours / period_hours) * 100 if period_hours > 0 else 0, derate_equivalent_hours
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print("Error calculating EAF:", e)
|
|
|
|
|
raise
|
|
|
|
|
|