Industrial Alarm Monitoring Application with LightningChart Python

Tutorial

Assisted by AI

Learn how to create a Python industrial alarm monitoring application with real-time and high-performance charts.
Soroush Sohrabian

Soroush Sohrabian

Software Developer

LinkedIn icon
Open-Meteo-Weather-Application-Cover

Introduction to the Project

In the industrial field, we always have a huge amount of data through different events like alarms. It is crucial for them to monitor these events to maintain standards, detect anomalies and keeping everything safe. This article demonstrates an industrial alarm monitoring application using LightningChart Python to visualize static and real-time streaming alarm data through different charts and dashboards.

LightningChart Python

LightningChart Python is a powerful visualization library that is capable of visualizing real-time and interactive charts with large datasets efficiently. For this project, LightningChart provided visual insight into alarm severity, machine learning analysis and uncertainty bands through different interesting charts like line series, heatmaps, stacked bar charts, bubble charts, pie chart and 3D area chart.

LCPython1

Setting Up Python Environment

Before running the project, install Python and the other required libraries using:

pip install pandas numpy scikit-learn xgboost shap lightningchart smote-variants

Several Python libraries were employed in this article:

  • Pandas: For loading, cleaning, and structuring data..
  • NumPy: For numerical operations.
  • Scikit-learn: Provided machine learning tools like XGBoost for classification, SMOTE for handling imbalanced datasets, Isolation Forest for anomaly detection, and RobustScaler for data normalization.
  • LightningChart: To create interactive visualizations.

Setting Up Your Development Environment

  1. Set up a virtual environment:
python -m venv env
source env/bin/activate  # On Windows use `env\Scripts\activate`
  1. Use Visual Studio Code (VSCode) for a streamlined development experience.

Visualizing Data with LightningChart Python

Here are some examples codes and charts that shows how we created key visualizations:

Real-Time Alarm Prediction with XGBoost

In the first row of dashboard, we can see real time prediction chart, it first starts predicting two values and connect them with the red line. after a few seconds it would show actual values with yellow line and at the same time model turns the old red line to orange and start predicting two new values and connecting them. In the right side we have alarm counter and below it we can see level of alarm severity. In the second row we can see the real-time certainty heatmap.

xgb_model = XGBClassifier(random_state=42, use_label_encoder=False, eval_metric='logloss')
xgb_model.fit(X_train_clean, y_train_clean)
y_pred = xgb_model.predict(X_test)

Ensemble Model & Uncertainty Visualization

Here in this dashboard, we can see uncertainty chart for different classes.

seeds = [42, 123, 999, 31415, 2718]
models_list = []
for seed in seeds:
    model_ens = XGBClassifier(random_state=seed, subsample=0.8, colsample_bytree=0.8)
    model_ens.fit(X_boot, y_boot)
    models_list.append(model_ens)
Industrial-alarm-monitoring-application-video-uncertainty-band

Exploratory Data Visualization Dashboard

Charts in dashboard focus on showing alarm severity in different ways. We have alarm severity distribution in pie chart, stacked bar charts show alarm class distribution, heatmap demonstrates alarms by day and hour, bubble chart showing severity over time and 3D surface chart displaying alarm frequency by day of week and hour.

severity_counts = df["AlarmSeverityName"].value_counts()
pie_chart.add_slices([{'name': sev, 'value': int(count)} for sev, count in severity_counts.items()])
Industrial-alarm-monitoring-application-video-dashboard

Conclusion

This project demonstrates how we could use LightningChart Python to visualize and monitor industrial alarm data. This approach gives us a powerful insight into system behaviors, alarm severity levels, and maintenance needs. Benefits of LightningChart Python specifically in this project include:

  • Real-time visualization capabilities allowing live monitoring.
  • Versatile chart options facilitating detailed and multi-dimensional data analysis.
  • High-performance rendering suited for complex and large datasets specially in industrial environments.

Continue learning with LightningChart

Data Visualization Template for Electron JS | LightningChart®

Updated on April 4th, 2025 | Written by humanAre you already building cross-platform applications with Electron JS?  In some of our previous articles, we’ve worked on TypeScript projects where we created pie charts and vibration chart applications. And as we...

Bar chart race JavaScript

Bar chart race JavaScript

Updated on April 14th, 2025 | Written by humanBar chart race JavaScript  When I wrote this article, the COVID-19 pandemic was at its peak point. Today, things are much better thanks to vaccinations that continued their steady positive global effect. With this bar...

A brief look into ‘performance’ in Web Data Visualization

A brief look into ‘performance’ in Web Data Visualization  Introduction  Throughout the existence of humankind, we’ve been trying to present data in various visual forms. Therefore, it is quite accurate to say that the concept of data visualization is...