# Predictive maintenace model to identify indication of failure before it happens

Situation

I'm working on a problem where I'm using sensor data to predict machine failure before the failure happens and I need some advice on which methods to explore.

Specifically, I want to identify indications of impending failure prior to the failure actually happening. Ideally this would be with enough lead time that we could fix whatever happened before it causes failure.

Problem

The conceptual road block that I'm at is that I know that I could fit various classification models (logistic regression, decision tree, nearest neighbor, etc.) to the data to identify the probability of failure given specific parameters at that time. However, I can't figure out how to identify the indication of an upcoming failure with enough time to actually do something about it.

Possible Approaches

I am familiar with Survival Analysis, but given that I don't have data from multiple machines, and it's not as though after a repair the machine is back to 100%, I don't feel like that is a good fit necessarily.

I've also thought about taking the time that a failure happens, shifting it back 1 hour, and seeing how accurate I can predict that point. If I'm able to, move the target back another hour and see how much lead time I can confidently predict. But I'm not sure if it's appropriate to do this.

Available Data

The data that I have is recorded from one machine over a 1 year period. There are approximately 60 sensors that are recorded every two minutes. These sensors measures variables such as the temperatures of different components that make up the machine (including thermostat setting vs actual temp), the speed that the machine is running at, steam pressures throughout the machine, fan speeds, whether or not the machine is running, etc.

In addition to the sensor readings, I have enriched the data set to also include the reason that the machine is not running (e.g.: shift change, preventative maintenance, failure). I've included a condensed example of what the data looks like at the bottom of this post. I've altered the example to capture some of the variety captured in the whole dataset. In reality, when the machine stops running, it's down for anywhere from 2 minutes to 2 days, depending on the reason. Also, the variables don't necessarily change quite as rapidly as seen in the example below, but I wanted to provide some variety.

+-----------------+----------+-------------+------------+------------+-------+-------+-----+--------------------------+------------+
|    Datetime     | CircFan  | CircFanAct  | EntrySpeed | ExhaustFan | Speed | Temp1 | Run |          Reason          | TimeBtwRun |
+-----------------+----------+-------------+------------+------------+-------+-------+-----+--------------------------+------------+
| 2009-10-19 0:00 |      100 |         600 |        461 |         40 |    45 |  1126 |   1 |                          | NA         |
| 2009-10-19 0:02 |      100 |         600 |          0 |         39 |    45 |  1120 |   0 | shift change             | 0:00       |
| 2009-10-19 0:04 |      100 |         600 |          0 |         39 |    45 |  1118 |   0 | shift change             | 0:02       |
| 2009-10-19 0:06 |       95 |         600 |        461 |         39 |    45 |  1119 |   1 |                          | 0:00       |
| 2009-10-19 0:08 |       95 |         599 |        461 |         40 |    45 |  1120 |   1 |                          | 0:02       |
| 2009-10-19 0:10 |       95 |         598 |        461 |         40 |    45 |  1120 |   1 |                          | 0:04       |
| 2009-10-19 0:12 |       95 |         597 |        461 |         40 |    45 |  1130 |   1 |                          | 0:06       |
| 2009-10-19 0:14 |      100 |         597 |          0 |         40 |    45 |   699 |   0 | failure                  | 0:00       |
| 2009-10-19 0:16 |      100 |         597 |          0 |         40 |    45 |   659 |   0 | failure                  | 0:02       |
| 2009-10-19 0:18 |      100 |         597 |          0 |         40 |    45 |   640 |   0 | failure                  | 0:04       |
| 2009-10-19 0:20 |      100 |         600 |        461 |         40 |    45 |  1145 |   1 |                          | 0:00       |
| 2009-10-19 0:22 |      100 |         600 |        461 |         40 |    45 |  1144 |   1 |                          | 0:02       |
| 2009-10-19 0:24 |       80 |         600 |        461 |         40 |    45 |  1138 |   1 |                          | 0:04       |
| 2009-10-19 0:26 |       80 |         600 |        461 |         41 |    45 |  1133 |   1 |                          | 0:06       |
| 2009-10-19 0:28 |       80 |         600 |        461 |         41 |    45 |  1134 |   1 |                          | 0:08       |
| 2009-10-19 0:30 |      100 |         600 |        461 |         41 |    45 |  1134 |   1 |                          | 0:10       |
| 2009-10-19 0:31 |      100 |         600 |        461 |         41 |    45 |  1133 |   1 |                          | 0:11       |
| 2009-10-19 0:34 |      100 |         600 |        461 |         40 |    45 |  1140 |   1 |                          | 0:13       |
| 2009-10-19 0:36 |      100 |         600 |        100 |         40 |    45 |   788 |   0 | preventative maintenance | 0:00       |
| 2009-10-19 0:38 |      100 |         600 |        100 |         40 |    45 |   769 |   0 | preventative maintenance | 0:02       |
+-----------------+----------+-------------+------------+------------+-------+-------+-----+--------------------------+------------+

• Which kind of machine/Industry are you dealing with? Feb 22 '17 at 21:23

That's a nicely asked and interesting question.

I have some questions :

• Do you already have insights about the feasibility of your goal ? (anticipate some failures) Did you identify variable that augur a failure ?
• What is the typical time before failure ?

I think the natural way to study such a problem would be to use survival analysis. And being familiar with it will be plus !

What I would do (despite I'm not aware all specificity of your problem) :

• Compute your time of interest variable ($y$) and occurrence of event variable ($delta$) : in this step you may :

• consider the failure time as event
• consider the preventive maintenance time as censoring variable
• skip the shift time for the computation of failure time and censoring
• Fit a Cox model on this data :

• Remark : you have time changing covariates (there is at this address a vignette about how to handle time dependent covariates in the Cox model : https://cran.r-project.org/web/packages/survival/vignettes/timedep.pdf )
• This step may not be easy (I don't know I'm not a specialist of time dependent covariates). For instance I'm thinking you may be in trouble because you may have too much change points in your data (time when one of the covariate changes)
• Then, to use you model (and see if you can predict that a failure will occur in the future (enough time before)), you should use your Cox model :

• The Cox model will give you an estimation of the hazard rate. So the simplest thing you may do to use your model is to compute an online prediction as your machine is running, and decide to stop the machine when the hazard rate exceed a threshold)

Though the natural way to study your problem would be to use survival analysis, you may use classification methods especially if the time before failure is short (this way you are analyzing past data and you will not be disturbed by censoring). In this case, I think the overall approach would be quite similar.