The key to highly profitable equipment is to proactively detect required maintenance early and to properly estimate the remaining useful life of the machine parts. There are two common scenarios: Either, equipment gets replaced far too early before the end of life is reached. Or failure is detected too late, so that unplanned and costly downtimes occur. Therefore, it is vital to estimate the remaining useful life of equipment accurately. The term “remaining useful life” (RUL) is defined as “the length from the current time to the end of the useful life” . RUL helps estimate the inspection or maintenance period and minimize excessive inventory by reducing unplanned failure.
The most common RUL estimator models are similarity, survival, and degradation models. Similarity models are used to estimate RUL when complete histories from similar machines are available. However, if only data from the time of failure is available, survival models are used. If failure data is not available but one has knowledge of a safety threshold, one can use degradation models.
For this demo we are using a popular data set from NASA, called CMAPSS. CMAPSS stands for Commercial Modular Aero-Propulsion System Simulation and it is a tool for the simulation of realistic large commercial turbofan engine data. Each turbofan data has measurements from 21 sensors and starts with data from normal operation to the point of failure. The parameters for each flight are the flight conditions, health indicators, measurement temperatures and pressure measurements.
 X.-S. Si, W. Wang, C.-H. Hu and D.-H. Zhou, “Remaining useful life estimation—A review on the statistical data driven approaches”, Eur. J. Oper. Res., vol. 213, no. 1, pp. 1-14, Aug. 2011.
To start the demo, complete the following steps:
- Train a machine learning model via a Jupyter Notebook in MLW.
- Create a demo device in Cumulocity IoT that mimics an actual engine.
- Simulate measurements for the demo device.
- Generate remaining useful life estimates based on the simulated data.
- Display the predictions in a number of Cumulocity IoT widgets.
Download the RemainingUsefulLifeDemoProject.zip file which contains the scripts and sample data set used in this demo.
This requires the following:
- Prior experience with Python, Jupyter Notebook, JSON, REST and understanding of data science processes.
- Familiarity with Cumulocity IoT and its in-built apps.
- Subscription of the MLW microservice (10.13.0.x.x or higher), the Zementis microservice (10.6.0.x.x or higher), the Nyoka microservice (10.6.0.x.x or higher), the Machine Learning Workbench application and the Machine Learning application on the tenant.
A new CONFIG.json file is now attached to the ZIP file. This file is meant for capturing the tenant details and credentials which will be used by the demo scripts.
Execute the following steps:
Update the CONFIG.json with the appropriate values and save it. Replace
c_url with your tenant URL,
c_user with your tenant username and
c_pass with your tenant password. Leave the
Remaining Useful Life Estimates using a demo device
A fully functional Remaining Useful Life Estimate demo can be prepared with the help of a demo device. For this, use the artifacts provided as part of the project RemainingUsefulLifeDemoProject.zip file.
Start with Machine Learning Workbench
Follow the steps described in Machine Learning Workbench > Upload a project and upload the RemainingUsefulLifeDemoProject.zip project to MLW. This creates a new project named RemainingUsefulLifeDemoProject_uuid, with a number of resources. You will get .txt and .csv files in the Data folder and notebooks in the Code folder.
Train the PMML model
For this use case, we are building a Random Forest machine learning model to predict a remaining useful life (RUL) value for jet engines.
The integrated Jupyter Notebook feature within Cumulocity IoT Machine Learning Workbench helps in writing the code that creates the Random Forest model in PMML format using the training data train_FD001.csv contained in the Data folder. The script uses the scikit-learn framework (https://scikit-learn.org) to train a Random Forest model.
Once your created the model, convert the scikit-learn object to PMML format using the Nyoka library https://github.com/nyoka-pmml/nyoka.
The following steps illustrate the training of a machine learning model using the Jupyter Notebook:
Open the TrainRULModel.ipynb file in the Code folder of the project.
Follow the steps described in Machine Learning Workbench > Jupyter Notebook > Editing and executing a notebook and execute the existing code snippets in each cell of the TrainRULModel.ipynb to train an Random Forest PMML model. Make sure to uncomment the first two lines in the first cell to install seaborn and matplotlib, in case they are not already installed. See image of the notebook below.
After all steps are completed, click the refresh icon at the top of Tabs to list the newly created RUL_rf.pmml with model name RULRFRegressor in the Model folder.
Model deployment and predictions
Once the model is available in the Model folder, it can be deployed to Machine Learning Engine for predictions.
Follow the steps described in Machine Learning Workbench > Automated ML > Model deployment and predictions and deploy the RUL_rf.pmml model to Machine Learning Engine. Predict test_FD001.csv data available in the Data folder, using the RULRFRegressor PMML model.
Register a demo device on the platform
Instead of registering an actual device for the remaining useful life estimate use case, a demo device can be registered. This device can be used as a replica of an actual device. To do so, follow the steps below: We have added a script RegisterDevice.ipynb which registers a demo device in Cumulocity IoT.
- Open it and click the edit icon .
- Execute each cell one by one and you will have a registered device in Cumulocity IoT. Upon successful execution, a device named “RemainingUsefulLifeDemo” is registered in Cumulocity IoT.
- Once registered, try to get the device ID by looking up your device on the All Devices page of your tenant’s Device management application (see image below). The device ID is already updated by the code and is saved in the CONFIG.json file.
Register a second demo device to receive the predictions
Use the script RegisterDeviceForPrediction.ipynb to register the second demo device named “RULPredictionDevice”. This device is used to receive the predictions. Follow the steps as described for the first demo device.
Simulate measurements for the demo device
Use SimulateData.ipynb for simulating the measurements for the demo device.
- Open it and click the edit icon .
- Execute each cell one by one. Upon successful execution,
predicted_RUL valuesare sent to Cumulocity IoT on behalf of the demo device every 60 seconds.
Schedule scoring the simulated data
Use the Python script SchedulePrediction.py to score the simulated data and send the predictions to the second demo device “RULPredictionDevice”. In order to execute the script on a schedule, follow the steps described in Machine Learning Workbench > Task Scheduler. As part of this demo we configured the schedule as shown in the below screenshot.
For this demo we created a number of widgets to show the Cumulocity IoT display capabilities:
- A KPI Widget displaying the last measurement value of a device.
- A data points list, which is a table display of a collection of data points.
- A data points graph displaying a collection of data points.
See screenshot below and follow the description in Cockpit in the User guide.