Association rule mining in Refinery Upset Events
Data science in the refinery #3
How data science can expose the real story behind alarm floods
Modern refinery units like the FCCU, CRU, or Hydrocracker are complex, tightly integrated systems. When something goes wrong, it rarely goes wrong in isolation. A compressor trip might be preceded by a reactor temperature surge. A pressure spike in one zone may trigger downstream flow instabilities. Operators often see these events only as alarm floods on the console, arriving too quickly and too chaotically to interpret in real time.
This is one of the reasons root cause analysis in refineries is so challenging. Events do not simply occur one by one. They come in clusters, patterns, and sequences. The truth is that most upsets have a signature, even if it is not immediately obvious to a human operator.
This is where data science, specifically association rule mining, offers a powerful new lens.
Why do we need pattern discovery in refinery alarms?
Refinery processes are inherently multivariable. A single upset in one part of the system can propagate through several equipment sections, creating a cascade of alarms. The traditional approach to alarm analysis focuses on individual events: identify the alarm, acknowledge it, troubleshoot it, and move on.
But what if the most important information lies not in the individual alarms, but in the combinations?
Consider scenarios like:
- A reactor high temperature alarm followed by elevated delta pressure and eventually a wet gas compressor trip
- A feed surge that consistently precedes high regenerator temperature alarms
- A sequence of hydrogen purity alerts that foreshadow catalyst deactivation issues
Operators usually know some of these patterns informally, but the underlying combinations are far more complex and frequent than can be tracked manually.
Association rule mining gives us a systematic way to discover these relationships. This is similar to a market basket analysis.
What exactly is association rule mining?
Association rule mining is a classic data science technique originally used in retail analytics (the famous “customers who buy beer also buy diapers” example). But the same logic applies beautifully to refinery event data.
Instead of items in a shopping basket, we look at alarms or events within a time window. Each window becomes a “transaction,” and the algorithm looks for combinations that occur together more often than would be expected by chance.
The method we use is Apriori, which outputs three important measures:
- Support: How often a combination actually occurs
- Confidence: If event A happens, how likely is event B to follow
- Lift: How much stronger the association is compared to random coincidence
If lift is greater than 1, the association may be meaningful. If it is greater than 3, operators should absolutely pay attention.
How the data is prepared
Historian systems record events with timestamps, unit names, and descriptions. To use association rule mining, we group events into time windows, such as:
- 30 minute intervals
- per operator shift
- per incident window defined by domain experts
In each window, we collect all alarms that occurred and treat them as a “basket” of co-occurring events. For training material or demonstration purposes, we can simulate around 3000 such records spanning six months of operation.
Typical fields look like:
- Event ID
- Timestamp
- Event description (e.g., Reactor High Temperature)
- Process unit name
Once grouped, each basket is ready for Apriori.
What the analysis reveals
Running Apriori on refinery event logs often uncovers insights such as:
- Reactor Pressure High is frequently followed by Wet Gas Compressor Trip
- Catalyst Circulation Drop often co-occurs with Riser Outlet Temperature Low
- Regenerator Air Flow Low is consistently seen along with CO Boiler Temperature High
Some rules highlight early-warning patterns that operators may not be tracking systematically. Others validate long-held operator intuition, giving engineers quantitative evidence to support alarm rationalization or SOP improvements.
Get Kausik Sen’s stories in your inbox
Join Medium for free to get updates from this writer.
High-confidence, high-lift rules are particularly valuable. They point to combinations that frequently trigger bigger issues and can be used to:
- Strengthen preventive maintenance programs
- Tune alarm thresholds and suppression logic
- Improve troubleshooting speed during real upsets
- Build predictive early-warning dashboards
In real deployments, identifying and acting on these patterns can prevent cascading shutdowns worth crores of rupees in lost production and equipment damage.
How to visualize these patterns
Visualization is essential for engineers and operators to interpret results. Common techniques include:
- Bar charts showing the most frequent pairs or triplets of events
- Network graphs where events are nodes and associations are edges
- Heatmaps showing lift values across event combinations
These visual tools help the plant team quickly understand the structure of event relationships in their unit.
Caveats and operational realities
As with any statistical method, context matters. A few things to keep in mind:
- The quality of analysis depends heavily on clean timestamps and proper event categorization
- Very frequent low-impact alarms may generate misleading patterns unless filtered
- Missing data or inconsistent alarm naming can distort support and confidence metrics
- Association rules do not indicate causation, only co-occurrence
Despite these limitations, the technique offers a powerful complement to traditional methods.
A gentle introduction through Colab Notebook
A simple colab notebook with simulated data shows how the concept can be applied in practice. The notebook contains:
- Simulated refinery event-log transactions (3000 windows across ~6 months)
- Apriori frequent itemset mining and association rule extraction (mlxtend)
- Visualizations: top events bar chart, rule network, lift heatmap
- Conclusions and next steps for real deployment
Use this link to open the colab notebook : https://tinyurl.com/7sdvu4vp. You need to click on ‘open in colab’ on the top right to see it in action. You may need to change the runtime to Python 3.11 in order to run the example. The QR code for the link is also given below:
Where this can go next
Once refineries start using co-occurrence analysis, several extensions become natural next steps:
- Identifying sequential patterns (A happens before B) using algorithms like PrefixSpan
- Detecting real-time event clusters using sliding window analysis
- Integrating rules into anomaly detection dashboards
- Combining association rules with ML models to predict corrective actions
This foundation can evolve toward a much more intelligent, operator-assistive alarm system.
Final Thoughts
Refineries generate vast amounts of alarm and event data every day. Hidden inside this data are patterns that can prevent shutdowns, improve reliability, and enhance safety. Association rule mining brings these patterns to the surface, giving operations teams a clearer view of how their units behave under stress.
This use case is simple enough to teach and powerful enough to matter. It is a great introduction to how traditional data science methods can deliver real value in heavy industry.








