Downtime for Maintenance Simulation

[This article was first published on R – Steffen Ruefer, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Downtime, or non-productive time, commonly abbreviated as NPT, is usually used as a measure of time where there is no progress during drilling operations. However, I am using it here as a term to measure the time that an oil or gas well is not producing because of a maintenance event. In my previous article I used Monte Carlo simulation to simulate the production rate of an oilfield. Here I will used it to estimate downtime, and hence, lost production.


To integrate maintenance events into a field model, a sub model is needed that captures the distribution of such events. A maintenance event can be modeled by using multiple input parameters that can be derived from experience or captured maintenance history files. The Monte Carlo model then creates a distribution that reflects the field downtime; it can then be integrated in more complex field models.

Model Idea

The model idea used is based on the maintenance event model as shown in my introductory article about Predictive Maintenance. Each event consists of a series of sub events that must be completed before moving to the next step.

Repair Sequence of Events

The basic idea is to provide for each maintenance step a time distribution as input and run a Monte Carlo simulation over the sum of all steps; this will result in an probabilistic maintenance period, i.e. a distribution showing the various downtime periods, attached to probabilities.


There are several assumptions that need to adhered to for this model idea; in reality, many of such assumptions are incorrect, or can only be fulfilled partially. No model is perfect – but that does not mean that it cannot be useful.

Sequential Events: A maintenance event contains multiple steps, and each step has to be completed in order before the next step can be commenced. This is fairly straight forward.

Independence of Steps: Each step is independent of the next one – i.e. the time it takes to complete the first step has no influence on the second or subsequent steps. This is often not the case. If for example finding a maintenance solution is complex, then getting the required spare parts and assigning a more specialized repair team is likely to take more time, too. There can also be other reasons for such correlations – e.g. bad weather in an offshore environment.

For the sake of this simple model though we will ignore such cases and assume independence.


For each maintenance step, the inputs are: 1) Select the distribution type to simulate the duration, and 2) distribution parameters.

There are three distributions available to choose from:

  • Uniform: Equal probability between a Minimum and a Maximum value
  • Normal: The standard normal distribution, with Mean and Standard Deviation
  • Triangular: Good for asymmetric cases, with Minimum, Maximum and Most Likely values

Input Visualization

To see the estimate based on given data for each step so far, the duration plot shows an estimate on how long, on average, the maintenance event will last.

duration estimate plot

For the default settings, the plot shows that the estimated downtime is 51.5 days.

Simulation Results

The simulation results are two plots: the duration distribution plot, and the CDF plot.

duration distribution plot

The distribution plot shows that the average time is not 51.5 days as assumed earlier, but is in fact 56 days. While the difference is not very large, it is still approximately 10% longer than anticipated in the planning phase. However, as this is the average, there is still a probability of 50% that the actual downtime will be longer than 56 days.

CDF plot

The CDF plot shows that probabilities attached to different downtime duration. There is a 90% probability that the downtime will be anywhere between 44 and 69 days. There is only a 5% probability that it will be below 44 days.


Maintenance can take much longer than anticipated, especially if it is unscheduled. Using Monte Carlo to get a better estimate of downtime during the planning phase is a first step to improve. Feel free to experiment with the Monte Carlo Simulator on my apps website.

References and Links

Monte Carlo Simulator on my Apps Website
Uniform Distribution on Wikipedia
Normal Distribution on Wikipedia
Triangular Distribution on Wikipedia

To leave a comment for the author, please follow the link and comment on their blog: R – Steffen Ruefer. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)