In this video, we'll discuss what condition monitoring is,
why it's useful and how to develop a condition monitoring
algorithm for fault classification of a triplex
pump system.
Any type of machinery you operate
is subject to deteriorate over time, leading to costly repairs
and maintenance.
Although deterioration is inevitable,
early detection of anomalies and faults by developing condition
monitoring algorithms will help you
reduce costs due to unplanned failures
and unnecessary maintenance.
Condition monitoring also helps reduce downtime
by pinpointing the source of faults more quickly.
So what exactly do we mean by condition monitoring?
Condition monitoring is the process
of collecting and analyzing sensor data from equipment
in order to evaluate its health state during operation.
In condition monitoring, we're dealing with questions like--
is my machine operating normally?
If it's not, why is my machine behaving abnormally?
The algorithms that address these type of questions
include anomaly detection and fault
detection and classification, also known as diagnostics.
What these algorithms have in common
is that they all require large sets of data,
collected from various sensors.
Sensor data enables these algorithms
to evaluate the health state of the equipment
and make decisions accordingly, which
play a critical role in developing
predictive maintenance programs.
Now that we have a clear picture of what condition monitoring
is, let's take a look at how a condition monitoring
algorithm may look like.
If the sensor data you collect from your machine
lets you easily detect anomalies by just looking at the data,
you can perhaps get away with a simple algorithm.
This is the case in this example, which shows
the data collected from a fan.
Here, you would use this command to identify
the parts of the data that experiences
abrupt changes in the motor voltage, fan
speed, and temperature.
The different combinations of these abrupt changes
can help you detect anomalies of this fan system.
But most of the time, the data you've got to deal with
looks much different than this.
Which time domain signal in this case,
do you think contains an anomaly?
It's impossible to tell unless you analyze
the data in frequency domain, which will help with extracting
features such as frequency peaks and amplitudes
that you can use to train anomaly detection algorithms.
And what do you do if your data contains multiple signals
and you've got to deal with lots and lots of data?
Then you will need to extract a variety of features
to see a difference between the normal and anomalous data.
You can then use these features to train machine learning
algorithms.
If you want to check out some anomaly detection examples,
please visit the link given in the video description.
The very first step in developing a condition
monitoring algorithm is data acquisition,
where we collect sensor data describing
our system in a range of healthy and faulty conditions.
Next, we pre-process the raw data to bring it
into a form from which we can extract condition indicators,
or also referred to as features, which help us distinguish
normal from faulty operation.
This step can be completed interactively
with Diagnostic Feature Designer app, which lets you visually
inspect the extracted features.
Note that the next step is optional.
Training is not required, as long
as we can use the extracted features to classify faults,
based on simple thresholding.
Oftentimes, it's not easy to manually evaluate
the condition of a machine based on the extracted features.
That's when we need to train a model using machine
learning methods--
or deep learning techniques-- to automatically detect
anomalies or classify faults.
In this video, we'll use the Classification Learner
app to interact with the train a machine learning
model for fault classification.
After completing these steps, we will have these components
from which we can generate C code for deployment on an edge
device.
We can also deploy condition monitoring algorithms
as production applications to the cloud
or on prem server using MATLAB compiler and MATLAB Production
Server.
This way, whenever we feed new data from our machine
into the deployed algorithm, it will automatically
pre-process the new data, extract features
from the pre-processed data, and compute their values
and finally run these features through the trained model
to predict the condition of our machine.
Next, we're going to use a triplex pump example to walk
you through the workflow steps.
More specifically, we will interactively
extract features from sensor data using Diagnostic Feature
Designer and use the extracted features
to train machine learning models for fault classification
with Classification Learner app.
In this example, we're working with sensor data collected
from a triplex pump.
The data set includes flow and pressure measurements
that represent the pump operation in eight
different fault conditions.
We'll use this live script, along with Diagnostic Feature
Designer and Classification Learner apps
to complete the rest of the workflow steps
for developing a condition monitoring
algorithm for the triplex pump.
The next step is to prepare our raw data for future extraction.
The quotes seen in the section takes
care of pre-processing by removing the transients,
re-sampling the data, and finally creating
an in-memory table with the flow and pressure
measurements and the binary fault code values.
In the next step, will use the pre-processed data
to interactively extract features using the Diagnostic
Feature Designer.
We can launch the app from the app's gallery.
First, we import the in-memory table
that includes pre-processed data of sensor measurements,
along with the fault codes.
Once the data is imported, we can
view the signal trace and also group the data
by different fault codes.
Zooming in on the signal traces reveals periodic patterns
in the data, which are suitable for extracting useful frequency
domain features.
Before doing so, we will first extract time domain features,
which include statistics features such as the mean, RMS,
standard deviations, and others as seen here.
Once the tool computes all these values,
it generates a feature table along with histograms.
As we've discussed before, due to the periodic nature
of this data, we will now extract frequency domain
features.
First, we start by computing the power spectrum of the flow
data.
We'll use the autoregressive model with a model order of 20.
The computed power spectrum clearly
shows some peaks, which we can extract
using the spectral feature step in this menu.
To extract peak frequencies and peak amplitudes,
we specify the options here, along with the frequency band
and click OK.
This generates the spectral features and adds them
to the feature table.
After extracting time and frequency domain features
from flow data, we can repeat the same process
with pressure data to extract additional features.
After doing so, we have a diverse set of features.
Now, we could visually inspect these features
to see if we can clearly distinguish
between different faults.
If we could, then we could add simple thresholding logic
that would compare extracted feature
value to several thresholds.
And based on this evaluation, determine
if the machine is healthy.
And if it's not, what type of fault we have.
In case we can't get away with a simple thresholding logic,
we don't need to train a machine learning or deep learning
model.
However, it's not the case here, as we cannot distinguish
between the different faults without training,
machine learning, or deep learning models.
In our example here, we will use machine learning training
for classifying the different fault types.
We don't know yet which one of these extracted features
are most likely to distinguish between fault types
when we train machine learning models.
To find the most useful features,
we can use feature ranking, which
performs one way ANOVA testing and source
all the features based on the computer test results.
We can then select for example top 20 features
and export them for machine learning training.
Here, we showed you how you can interactively
extract features and select the ones that
are most useful for training machine learning models.
You don't have to repeat this process each time you
get new data from your machine.
Instead, you can generate a MATLAB function,
which you can run periodically on new data
to automate feature extraction.
Let's see how we use this diagnostic features
function in our live script.
The quotes seen here partitions the data set into two,
to use 80% of the data for training and the rest
for testing to validate the trained model.
Here, we pass the training data to the diagnostic features
function to automatically compute
the values of the features which we've just
extracted interactively.
Now, we have this table with computed features,
which we expand by adding the corresponding fault codes.
Now we're ready for training machine learning
models with this data for classifying the different fault
types.
For training, we'll now use the Classification Learner
app, which is available in the app's gallery.
We start by selecting the data set that
includes the extracted features, along with fault codes.
We then click All to train all available crossfires
and see which model gives us the highest validation accuracy
score, which estimates a model's performance on new data
compared to the training data.
Once the training is completed, the best performing model
is highlighted.
Now we can take a look at the confusion matrix
to evaluate predictions by the trained model.
The overall training accuracy is 75%.
While the trained model worked well
for classifying some faults, for some others
it performed poorly.
For example, this fault is predicted
incorrectly 71.4% of the time and identified
as a different file type.
To improve the training accuracy,
you can consider collecting more data with these fault types
and also revisit the previous step
to extract additional features for training.
You can iterate these steps until you're
satisfied with the results of the trained machine learning
model.
Once you're done with training, you can export a trained model
to your workspace.
We will now use this trained model to test it on new data.
In this case, the data that we set aside previously
for testing.
We first ran the diagnostic features function
on the test data to automatically extract
the features which we have done interactively
in the previous step, and then used this syntax
to run the extracted features through the trained model
to make predictions.
We can then display the test data accuracy,
along with confusion matrix, to further evaluate
the results from testing.
With this example, we showed you how
you can create these different components
and combine them to develop your condition monitoring algorithm.
In the next step, you can deploy your algorithm
for continuous monitoring of your assets in operation.
You can deploy your condition monitoring algorithms
as production applications to the cloud
or on prem server using MATLAB Complier and MATLAB Production
Server.
You can also generate C/C++ code from your algorithms to run
them directly on edge devices, such as PLCs.
In addition to condition monitoring algorithms,
you can also develop prognostic algorithms in MATLAB
and create dashboards, as shown here,
to let maintenance crews remotely monitor
and display the live condition of your machine.
In summary, condition monitoring is the process
for collecting and analyzing sensor data from equipment
in order to evaluate its health state during operation.
For condition monitoring you can develop anomaly detection
and fault diagnostics algorithms with MATLAB.
For more information on condition monitoring,
check out this page where you'll find links to additional videos
and resources.