MES Module
Manufacturing Execution System with real-time CNC monitoring, OEE reporting, shift-based analytics, and production run tracking.
Base URL: https://app.proign.com/[tenant]/mes/api
Overview
The MES module connects to CNC machines via MTConnect to provide real-time production visibility across your entire shop floor:
- Live machine status monitoring with sub-second updates
- OEE (Overall Equipment Effectiveness) calculation per machine and aggregate
- Alarm tracking, categorization, and notifications
- Production run analytics with cycle time breakdowns
- Shift-based reporting and machine utilization metrics
- Historical data retention with configurable policies
MTConnect Configuration
Machines communicate with the MES module through the MTConnect standard. Each CNC machine runs an MTConnect adapter that translates machine-native data into a standardized XML format. An MTConnect agent aggregates data from one or more adapters and exposes it over HTTP.
Adapter Setup
The adapter runs on or near the CNC controller and maps internal signals (FANUC FOCAS, Siemens OPC-UA, Haas MDC, etc.) to MTConnect data items. A typical adapter configuration:
# adapter.cfg — runs on the machine controller
host = 0.0.0.0
port = 7878
machine_id = HAAS-VF2-001
# Data items mapped from controller registers
[data_items]
spindle_speed = R100 # RPM
feed_rate = R101 # mm/min
execution_state = R200 # ACTIVE | IDLE | STOPPED
emergency_stop = R201 # TRIGGERED | ARMED
program_name = R300 # Current G-code program
part_count = R400 # Parts completed this cycle
Agent Configuration
The MTConnect agent collects data from all adapters on the shop floor and provides a single HTTP endpoint that the MES module polls:
# agent.cfg
Devices = ./devices.xml
Port = 5000
BufferSize = 131072
CheckpointFrequency = 1000
Adapters {
HAAS-VF2-001 {
Host = 192.168.1.101
Port = 7878
}
HAAS-VF2-002 {
Host = 192.168.1.102
Port = 7878
}
DMG-NLX-2500 {
Host = 192.168.1.103
Port = 7878
}
}Data Items
The MES module tracks the following MTConnect data item categories:
- Samples — Numeric values: spindle speed, feed rate, axis positions, spindle load, temperatures
- Events — State changes: execution state, controller mode, program name, tool ID, part count
- Conditions — Machine health: alarms, warnings, faults with severity and native code
Registering a Machine
After the adapter and agent are running, register the machine with the MES module so it begins collecting data:
POST /api/[tenant]/mes/machines
Content-Type: application/json
{
"name": "Haas VF-2 #001",
"machine_id": "HAAS-VF2-001",
"agent_url": "http://192.168.1.10:5000",
"type": "milling",
"location": "Bay A, Position 3",
"poll_interval_ms": 1000
}Key Features
Machine Monitoring
Real-time status for all connected CNC machines:
- Status — Active, idle, alarm, offline
- Spindle — Speed (RPM), load (%), override (%)
- Feeds — Feed rate (mm/min), rapid override (%)
- Program — Current program name, block number, line
- Axes — X, Y, Z positions and work offsets
- Tool — Active tool ID, tool life remaining
OEE Formula
Overall Equipment Effectiveness is the gold standard for measuring manufacturing productivity. The MES module calculates OEE automatically from machine data using three components:
OEE = Availability x Performance x Quality
Availability — Was the machine running when scheduled?
(Planned Production Time - Downtime) / Planned Production Time
Downtime includes unplanned stops (alarms, breakdowns) and planned stops (setup, changeover). Shift schedules define planned production time.
Performance — Was the machine running at full speed?
(Ideal Cycle Time x Total Parts Produced) / Run Time
Accounts for slow cycles, micro-stops, and reduced feed rates. The ideal cycle time is set per part program.
Quality — Were all parts good?
Good Parts / Total Parts Produced
Rejected parts and rework count against quality. Parts can be marked as rejected via the API or operator interface.
World-class OEE is considered to be 85% or higher. The MES module provides per-machine and aggregate OEE with configurable date ranges, shift filters, and trend comparisons.
- Real-time OEE — Updates every polling interval based on the current shift
- Historical OEE — Daily, weekly, monthly rollups with trend lines
- Benchmarks — Compare machines, shifts, or time periods side by side
Shift Definitions
Shifts define the planned production windows used in OEE calculations and reporting. Each tenant configures their own shift schedule:
POST /api/[tenant]/mes/shifts
Content-Type: application/json
{
"shifts": [
{
"name": "First Shift",
"start": "06:00",
"end": "14:00",
"break_minutes": 30,
"days": ["mon", "tue", "wed", "thu", "fri"]
},
{
"name": "Second Shift",
"start": "14:00",
"end": "22:00",
"break_minutes": 30,
"days": ["mon", "tue", "wed", "thu", "fri"]
},
{
"name": "Third Shift",
"start": "22:00",
"end": "06:00",
"break_minutes": 30,
"days": ["mon", "tue", "wed", "thu", "fri"]
}
]
}Shift-based reporting provides:
- Per-shift OEE — Compare productivity across first, second, and third shifts
- Shift handoff reports — Automatically generated at shift boundaries with machine status summaries
- Break deduction — Break minutes are excluded from planned production time in OEE calculations
- Overnight shifts — Shifts that cross midnight (like third shift) are handled correctly
Alarm Codes
The MES module captures and categorizes CNC alarms from MTConnect condition data items. Alarms are classified by category and severity:
Alarm Categories
- Emergency Stop — Operator or safety-triggered E-stop. Machine halts all motion immediately. Requires manual reset.
- Axis Errors — Position deviation, servo overload, or encoder faults on X, Y, Z, or rotary axes. Often indicates mechanical issues or collision.
- Spindle Alarms — Spindle overload, overheating, or orientation failure. May indicate tool breakage or excessive cutting parameters.
- Tool Change — ATC (Automatic Tool Changer) errors, tool not found, magazine position faults, or tool breakage detection.
- Hydraulic / Pneumatic — Low pressure, filter clogged, or coolant system faults.
- Communication — Loss of connection to adapter, agent timeout, or network errors.
Severity Levels
CRITICAL — Machine stopped, immediate attention required (E-stop, servo fault)
WARNING — Degraded operation, machine may continue (high spindle load, temp warning)
INFO — Advisory condition, no action needed (tool life low, filter reminder)
Alarms trigger downtime tracking automatically. The time between alarm onset and clearance is recorded as unplanned downtime and reduces the Availability component of OEE.
Production Runs
A production run represents a batch of parts being manufactured on a specific machine. Runs are tracked from start to completion and provide the foundation for cycle time analysis:
Run Lifecycle
setup → running → paused → running → completedStarting a Run
POST /api/[tenant]/mes/runs
Content-Type: application/json
{
"machine_id": "HAAS-VF2-001",
"job_number": "JOB-2026-0145",
"part_number": "PN-4820",
"program_name": "O0145",
"planned_quantity": 500,
"ideal_cycle_time_sec": 42
}Cycle Time Analysis
During a production run, the MES module tracks individual cycle times based on the part count data item from MTConnect:
- Ideal cycle time — The target time per part, set when the run is created
- Actual cycle time — Measured time between consecutive part count increments
- Average cycle time — Running average across all completed parts in the run
- Cycle time distribution — Histogram showing variance to identify outliers and slow cycles
Runs also track reject counts, operator notes, and setup time separately from production time for accurate OEE calculations.
API Endpoints
Machines
GET /api/[tenant]/mes/machines # List all machines
POST /api/[tenant]/mes/machines # Register a new machine
GET /api/[tenant]/mes/machines/[id] # Get machine details
PATCH /api/[tenant]/mes/machines/[id] # Update machine config
GET /api/[tenant]/mes/machines/[id]/status # Live machine status
OEE
GET /api/[tenant]/mes/oee # Aggregate OEE summary
GET /api/[tenant]/mes/oee/[machineId] # Per-machine OEE
GET /api/[tenant]/mes/oee/history # Historical OEE data
Alarms
GET /api/[tenant]/mes/alarms # List active alarms
GET /api/[tenant]/mes/alarms/history # Alarm history with filters
POST /api/[tenant]/mes/alarms/[id]/ack # Acknowledge an alarm
Production Runs
GET /api/[tenant]/mes/runs # List production runs
POST /api/[tenant]/mes/runs # Start a new run
GET /api/[tenant]/mes/runs/[id] # Get run details
PATCH /api/[tenant]/mes/runs/[id] # Update run (pause, resume, complete)
GET /api/[tenant]/mes/runs/[id]/cycles # Cycle time data for a run
Shifts
GET /api/[tenant]/mes/shifts # Get shift schedule
POST /api/[tenant]/mes/shifts # Create/update shift schedule
GET /api/[tenant]/mes/shifts/current # Get current active shift
Request Examples
Query Machine Status
GET /api/[tenant]/mes/machines/HAAS-VF2-001/status
Authorization: Bearer <token>
Response:
{
"data": {
"machine_id": "HAAS-VF2-001",
"name": "Haas VF-2 #001",
"status": "ACTIVE",
"last_updated": "2026-02-21T14:32:01Z",
"spindle": {
"speed_rpm": 8500,
"load_pct": 34,
"override_pct": 100
},
"feed": {
"rate_mm_min": 2400,
"override_pct": 100
},
"program": {
"name": "O0145",
"block": "N1240",
"comment": "FINISH PASS OD"
},
"axes": {
"x": -45.230,
"y": 12.005,
"z": -85.100
},
"active_tool": {
"id": "T12",
"life_remaining_pct": 72
},
"current_run": {
"id": "run_abc123",
"job_number": "JOB-2026-0145",
"parts_completed": 312,
"planned_quantity": 500
}
}
}Query OEE with Filters
GET /api/[tenant]/mes/oee/HAAS-VF2-001?from=2026-02-01&to=2026-02-21&shift=First+Shift
Authorization: Bearer <token>
Response:
{
"data": {
"machine_id": "HAAS-VF2-001",
"period": {
"from": "2026-02-01T00:00:00Z",
"to": "2026-02-21T23:59:59Z"
},
"shift": "First Shift",
"oee": 0.782,
"availability": 0.91,
"performance": 0.88,
"quality": 0.976,
"details": {
"planned_time_min": 9600,
"run_time_min": 8736,
"downtime_min": 864,
"total_parts": 12480,
"good_parts": 12181,
"rejected_parts": 299,
"ideal_cycle_time_sec": 42,
"avg_cycle_time_sec": 47.8
}
}
}Complete a Production Run
PATCH /api/[tenant]/mes/runs/run_abc123
Content-Type: application/json
Authorization: Bearer <token>
{
"status": "completed",
"actual_quantity": 500,
"rejected_quantity": 8,
"operator_notes": "Tool T12 replaced at part 290, slight chatter on finish pass"
}Data Retention
The MES module stores different data types with different retention periods. Raw high-frequency data is downsampled over time while aggregated metrics are kept long-term:
- Raw machine samples (spindle speed, feed rate, axis positions) — 30 days at full resolution, then downsampled to 1-minute averages
- Machine events (status changes, program changes, tool changes) — 90 days at full detail
- Alarm history — 1 year with full context (native code, severity, duration, resolution)
- OEE rollups (hourly, daily, weekly, monthly) — 2 years
- Production run records — 2 years including cycle time distributions
- Shift reports — 2 years
Retention policies can be adjusted per tenant. Data approaching its retention limit is automatically archived before deletion.