Why is Pump Failure Detection important?
A pump is a device that moves fluids by mechanical action, typically converted from electrical energy into hydraulic energy. There are different types of pumps depending upon the method that is used for moving the fluid. In India, pumps are one of the main reasons for the growth of the economy, as India is an agriculture-based country and the requirement of water pumps is huge in the case of agriculture.
Hence, it is very important to detect the failures in pump machines beforehand to ensure smooth operation. We generally take the help of sensor data to detect the failure caused in pumps.
In this article, we will learn about a MLP (Multilayer perception), that predicts whether a water pump will fail in a future time window or not.
The input for the MLP is a time window of some specified length of the pump sensor data (52 sensors, called “sensor_00” till “sensor_51”)and, the output is a single output neuron.
OUTPUT STATUS :
> 0 means: there will be no failure (machine status “NORMAL”)
>1 means: there will be a pump failure (machine status “BROKEN”/”RECOVERING”).
We will prepare 2000 random samples, out of which 2000/2 = 1000 random samples (x,y) will be used for training and the other 1000 random samples(x,y) will be used for testing the model.
Note: Here ‘x’ denotes the input vector taken from the input window, and ‘y’ denotes the output vector which is calculated by checking whether in the following time window the pump failed or not.
Reading the Sensor and Status data
As defined earlier, we have taken 52 sensors, called “sensor_00” till “sensor_51”.
>First line of Code!
> Checking machine_status!
Previously defined, our output is designed for three machine_status i.e Normal, Broken, and Recovering.
Calculating the percentage value for machine_status = Normal:
Similarly, we can calculate percentage values for Broken and Recovering status. The obtained graph will be somewhat like :
Prepare data for training and testing
Scale data column-wise to feature range [0,1]. If all inputs are in the same range, it makes it easier for a MLP to learn.
A single_input_window contains data for 60 minutes for each of the 52 sensors. Next, we map the window to a vector since we need a 1D input for the MLP.
Check whether the pump failed in some time window after the input window
Prepare Example Data
The training pairs are further stored into a data matrix D for the further splitting of training and testing samples. The shape of matrix D is (2000,3121).
Creating the matrix D!
Train Test Split
Build MLP and train it
The model to be created consists of 3 fully connected layers, ReLU activation function is present in every layer except the last layer. We will train the model for 3000 epochs, in which we have taken MeanSquaredError as our loss function and SGD optimizer for compilation.
Testing the Final MLP
Testing the final MLP we can conclude that the MLP can predict 972 out of 1000 test examples with an accuracy of 97.20%.
True negative: 943
> The Accuracy graph :
Compiling with deepC:
Here’s the link to the complete notebook: https://cainvas.ai-tech.systems/use-cases/pump-failure-detection-app/
Also Read: ASL Recognition with TinyML devices