How-to
How to calculate OEE from historian data by time
Short answer
Yes, when events and schedule context are recorded with timestamps: rebuild run and stop intervals with lead/lag logic, take counts from counter deltas over the window, and multiply Availability × Performance × Quality. A worked 8-hour shift with 405 run minutes out of 450 planned, 7,200 parts and 6,840 good lands at 76.0% OEE.
On this page
- Can you calculate OEE from historian data alone?
- What inputs does the OEE formula need?
- How do you turn state changes into run and stop intervals?
- Does interpolated retrieval distort the OEE result?
- How do you join counts and reasons to the right minutes?
- Can you calculate OEE through an OPC-DA link to an external historian?
- What does a worked shift look like end to end?
- How do you verify the numbers before anyone acts on them?
- Questions asked
Yes — OEE comes out of historian data alone when the calculation is built on intervals rather than pushed rows. Availability = Run Time / Planned Production Time, Performance = (Ideal Cycle Time × Total Count) / Run Time, and Quality = Good Count / Total Count need only timestamps, state changes, counts and a schedule, all of which a historian can hold. The work is rebuilding one timeline: each recorded state is active until the next event, counts come from counter deltas over the window, and sources are combined by time slices, never by equal timestamps. The worked 8-hour shift below lands at 76.0%.
Can you calculate OEE from historian data alone? #
Yes, when two things are recorded in enough detail: the events themselves — state changes, count updates, quality and reason entries — and the production schedule that decides which minutes count as planned production time.
The formula does not change when the source does. A relational event push hands you rows already shaped as intervals and totals; historian data hands you values with timestamps, and you reconstruct the intervals at those timestamps with window functions. What decides success is whether each of the five inputs exists with usable time alignment. If quality counts or downtime reasons never reached the historian, no query recovers them — record the assumption on the report or add the missing source. Reprocessing also depends on retention: pruning that cuts history shorter than your longest reporting backfill makes the re-run silently incomplete, so set that boundary deliberately — setting historian pruning and retention for Ignition tag history shows where the limit is configured.
What inputs does the OEE formula need? #
Five inputs decide all three factors: planned production time, run time, total count, good count and the product's ideal cycle time, combined as Availability = Run Time / Planned Production Time, Performance = (Ideal Cycle Time × Total Count) / Run Time, and Quality = Good Count / Total Count.
Planned production time is scheduled time minus planned stops — breaks and planned maintenance. That exclusion is exactly what separates OEE from OOE and TEEP, which widen the denominator toward all operating time and then full calendar time; how OEE, OOE and TEEP differ sets the three side by side. The ideal cycle time belongs to the product and must come from product data, never from the historian itself. Decision rule: if one of the five inputs is absent, that factor is not computable from history — show it as unknown rather than substituting a default rate or assuming all output was good.
How do you turn state changes into run and stop intervals? #
Treat each recorded state as active until the next recorded event: with LEAD(event_time) over the ordered timestamps, every row gains its interval end, and run time is the sum of the RUN interval durations that fall inside the planned window.
-- illustrative: state_events(event_time TIMESTAMPTZ, state TEXT)
SELECT
event_time,
state,
LEAD(event_time) OVER (ORDER BY event_time) AS interval_end
FROM state_events;
Three rules keep the sums honest. First, intervals are half-open — [event_time, interval_end) — so an event belongs to the interval it starts, applied identically at every boundary. Second, at the window edges, carry in the last event at or before the window start, and close the final interval at the window end. Third, duplicate timestamps need a documented tie-break, such as last record wins by insertion order. Sampling precision matters as much as the logic: a state logged once a minute places each transition inside a 60-second band, so three stops in a shift bound the run-time error near ±3 minutes, about ±0.7 percentage points of Availability on a 450-minute denominator.
Does interpolated retrieval distort the OEE result? #
Yes, whenever it is allowed to place transitions: durations must come from recorded events with carry-forward state, because interpolation between two samples invents a transition time that may not have occurred, and that error lands directly in Availability.
Historians and their retrieval tools typically offer both modes: recorded values, which are what was actually stored, and interpolated values, synthesized at whatever timestamps you request. Interpolation is the right tool when a display needs a value at a chosen time; it is the wrong one for deciding when a run started or a stop ended. For discrete run/stop states, use recorded events with stair-step carry-forward. The same discipline applies to counters: read the recorded counter value at each interval boundary, not an interpolated one, and compute counts as differences between recorded values.
How do you join counts and reasons to the right minutes? #
Split the reporting window at every event timestamp from every source, so each slice inherits the state, count delta, reason and product in force during it — a temporal join — because an equality join matches almost nothing when sources sample at different rates.
Production state, count changes, schedule boundaries and operator or reason entries almost never share a timestamp, so matching on equality produces empty or accidental pairs. After splitting the window at the union of event times, take the total count as the counter delta across the window and the good count as total minus rejects, from whichever source holds quality. Validate any nearest-timestamp rule for reasons against a hand-checked period before trusting it; where validation fails, report the reason as unknown instead of borrowing a nearby entry. When the product changes mid-window, compute run time per product, because each product carries its own ideal cycle time into Performance.
Can you calculate OEE through an OPC-DA link to an external historian? #
Not with OPC-DA alone: it returns current values, so history-based OEE needs a path that retrieves stored values — historical access support on the connection, or a database or file export from the historian — or you must collect your own history from now on.
Before blaming the calculation, separate the three failure classes: values absent or wrong at the provider; values present but not retrieved or mapped by the consumer; values correct but the interval logic wrong. Comparing one known tag's provider-side history with what the consuming application actually receives picks the class. The architecture worth committing to keeps acquisition and aggregation separable: a collector writing to the historian survives an OEE application crash, and the application catches up from retained history on restart, the same store-and-forward trade-off worked through in choosing an edge data path for periodic records. When you would rather not own the interval logic at all, a packaged OEE data collection implementation moves the problem to configuration.
What does a worked shift look like end to end? #
One 8-hour shift from 06:00 to 14:00 with a 30-minute break, 450 minutes planned, 405 minutes run, 7,200 total parts, 6,840 good and an ideal cycle time of 0.05 minutes per part gives Availability 90.0%, Performance 88.9%, Quality 95.0% and OEE 76.0%.
The historian recorded these state events, with the 06:00 state carried in from before the window:
| Event time | State | Until | Minutes |
|---|---|---|---|
| 06:00 | RUN | 07:15 | 75 |
| 07:15 | STOP | 07:32 | 17 |
| 07:32 | RUN | 09:04 | 92 |
| 09:04 | STOP | 09:18 | 14 |
| 09:18 | RUN | 10:00 | 42 |
| 10:00 | break | 10:30 | 30 |
| 10:30 | RUN | 12:41 | 131 |
| 12:41 | STOP | 12:55 | 14 |
| 12:55 | RUN | 14:00 | 65 |
The arithmetic, in order:
- Planned production time: 480 min − 30 min break = 450 min.
- Downtime: 17 + 14 + 14 = 45 min; run time: 75 + 92 + 42 + 131 + 65 = 405 min.
- Availability: 405 / 450 = 0.900 → 90.0%.
- Performance: (0.05 min/part × 7,200 parts) / 405 min = 360 / 405 = 0.889 → 88.9%.
- Quality: 6,840 / 7,200 = 0.950 → 95.0%.
- OEE: 0.900 × 0.889 × 0.950 = 0.760 → 76.0%.
The counter read 4,100 at 06:00 and 11,300 at 14:00, so 11,300 − 4,100 = 7,200 total parts; the shift's reject log holds 360 entries, so good count = 7,200 − 360 = 6,840.
How do you verify the numbers before anyone acts on them? #
Three checks catch the usual faults: interval durations must sum to the window length, the factored result must equal the direct identity, and one hand-checked shift must match the report — here 405 + 45 + 30 = 480 minutes and 342/450 = 0.760.
- Sum check: run time + downtime + excluded planned stops must equal the full window; a mismatch means a gap, a duplicate, or a boundary rule that changed mid-report.
- Identity check: (Good Count × Ideal Cycle Time) / Planned Production Time must equal Availability × Performance × Quality.
- Count check: compare the counter-derived total against an independent tally — operator count, packaging count or the ERP receipt — before Performance is believed.
- Boundary test: run one window that crosses a scheduled break and one product change; confirm the break is excluded and each product's run time picks up its own cycle time.
- Timestamp convention: confirm writer and reader use the same time-zone or UTC basis; a mismatch slides events across window edges and appears as phantom downtime at shift change.
The decision: commit to historian-only OEE when events and schedule detail are recorded and retention covers reprocessing; when reason codes or quality counts never reach the historian, keep them in their own timestamped source and join by time rather than forcing the calculation onto history alone.
Questions asked
How do you handle counter resets when total count comes from a counter tag?
Treat any falling counter value as a reset, not as negative production: sum only the positive deltas and start again from the value after the drop. A counter reading 6,000, then 6,200, then 5, then 300 produced 200 + 300 = 500 parts, not a loss of 5,900.
Where should the ideal cycle time come from?
From versioned product data or a validated standard rate for each product. Never derive it from the fastest interval in the historian, because that locks one best shift into every later Performance figure and quietly lowers scores that were actually normal.
How much historian retention does OEE reporting need?
At least your longest reprocessing window plus margin. If corrected reports can be re-run 90 days after month end, retention below that makes the backfill quietly incomplete. Set the pruning boundary from the reporting policy, not from storage habit.
Why does joining on equal timestamps return no downtime reasons?
Because sources almost never share timestamps: a stop logged at 07:15:00 and a reason entered at 07:16:12 do not match, and periodic sources sampling at 1 second and 5 minutes overlap almost nowhere. Join by interval, meaning which state and reason were in force over each slice, instead of by equal times.