Calculate OEE, track machine performance, and identify efficiency losses.
import pandas as pd
def calculate_oee(machine_id, period_days=30):
data = pd.read_sql("SELECT * FROM production_logs WHERE machine_id = ? AND date >= NOW() - ?", (machine_id, period_days))
planned = data['planned_runtime'].sum()
downtime = data['downtime'].sum()
availability = (planned - downtime) / planned
ideal_cycle = data['ideal_cycle_time'].mean()
actual_cycle = data['actual_cycle_time'].mean()
performance = ideal_cycle / actual_cycle
good = data['good_parts'].sum()
total = (data['good_parts'] + data['defect_parts']).sum()
quality = good / total if total > 0 else 0
return {'OEE': availability * performance * quality * 100, 'Availability': availability * 100, 'Performance': performance * 100, 'Quality': quality * 100}Basic Package
Special SME traction programme by AINNA.
Limited starter website offer. AI usage, hosting, maintenance and custom integrations depend on the confirmed scope.
View SME Offer β
Ask about AINNA pages, services and articles.
AINNA sources only Β· up to 5 lines Β· 20 questions/hour
No section data available yet.
Sites with documented sections will appear here.
We value your privacy
We use browser storage to remember your choice. Optional analytics runs only after you allow it; your choice is recorded with an anonymous ID. Privacy Policy