Overview

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” [1]. 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.

[1] 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:

Prerequisites

Download the RemainingUsefulLifeDemoProject.zip file which contains the scripts and sample data set used in this demo.

This requires the following:

Getting started

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 c_device_source and c_device_pred.

CONFIG.json
{
	c_url:https://yourtenant.cumulocity.com
	c_user:user@company.com
	c_pass:password
	c_device_source:deviceID
	c_device_pred:deviceID
}

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:

  1. Open the TrainRULModel.ipynb file in the Code folder of the project.

  2. 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.

  3. After all steps are completed, click the refresh icon Refresh at the top of Tabs to list the newly created RUL_rf.pmml with model name RULRFRegressor in the Model folder.

Train Model using Jupyter Notebook

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.

  1. Open it and click the edit icon Edit.
  2. 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.
  3. 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.

Download

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.

  1. Open it and click the edit icon Edit.
  2. Execute each cell one by one. Upon successful execution, predicted_RUL values are 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.

Download

Create Widgets

For this demo we created a number of widgets to show the Cumulocity IoT display capabilities:

See screenshot below and follow the description in Cockpit in the User guide.

Download