The application consists of two parts: a MATLAB Motor Health app that displays the status of a given motor and a MATLAB Production Server predictive maintenance analytics application containing the two predictive maintenance algorithms. This client-server architecture separates functional responsibilities: the client app manages data access and display, while the server algorithms analyze the data. The client depends on the application programming interface (API) provided by the server but neither needs, nor has access to, the implementation.
The Server: Algorithms and Interface
Each algorithm applies a different machine learning technique to the time-series data produced by each motor sensor. The RUL algorithm estimates time to failure using a linear regression model and the predict function from Predictive Maintenance Toolbox™. The anomaly detection algorithm classifies sensor events as normal or anomalous using a custom one-class support vector machine (SVM) and a linear solver from Statistics and Machine Learning Toolbox™. Both algorithms use incremental learning to update their models continuously, accommodating drift in the sensor data caused by wear-related motor degradation. As a result, neither model needs to be trained before deployment.
Since the end user applies both algorithms to the same data stream, the server provides one entry point, processMotorData. For each element in the time-series data, processMotorData returns an RUL estimate and a flag indicating whether an anomaly occurred.
function [rul, anomaly] = processMotorData(data, initialize)
c = mps.cache.connect('MotorData','Connection','LocalRedis');
if initialize
c.AnomalyModel = initAnomalyData();
c.RULModel = initMotorRULData();
end
[anomaly, c.AnomalyModel] = detectAnomaly(data, c.AnomalyModel);
[rul, c.RULModel] = remainingMotorLife(data, c.RULModel);
end
A client typically calls processMotorData multiple times while processing a stream of data, breaking the stream into time-ordered windows and sending each window as it becomes available. MATLAB Production Server has a stateless architecture: it resets the execution state after each call to prevent data leaking between clients. Since the algorithms use incremental learning, they improve by updating their models after processing each window. But execution state resets will erase these changes from MATLAB Production Server memory. To preserve changes for the next call, we save them in an external data cache created by mps.cache.connect. The deployed algorithm breaks the stream into groups based on motor ID and maintains a data cache and machine learning model for each motor.
The Client: Accessing Algorithms and Visualizing Data
We make processMotorData available to client developers by deploying it to an instance of MATLAB Production Server in an archive named MotorAnalytics. To call processMotorData from MATLAB, you install a MATLAB add-on from MotorAnalytics, using MATLAB Client for MATLAB Production Server.
>> prodserver.addon.install('MotorAnalytics','localhost',9910)
Installing the add-on places a processMotorData function on the MATLAB path. Calling processMotorData sends a request to the MATLAB Production Server hosted processMotorData, which implements the predictive maintenance algorithms. Each client that installs the add-on accesses the same predictive maintenance algorithms, as shown in Figure 2.