# Calculate the MTBF

## Recommended Posts

Hi,

I would like to calculate the MTBF (Mean Time Between Failures) of a compressor. I have the running hours signal and captured capsules for failures. I want to create a trend showing the MTBF over time (MTBF= [current running hour - running hours at the beginning of the year]/the number of failures during the running year).

Q1: I used \$Capsule.aggregate(count(),years(),startkey()).toStep() to display failures trend (it should be increasing over a year with the new failures) but this gives me the total over that year without showing step change against the next failure capsule.

Q2: how can I implement the MTBF formula in my calculation?

Thanks

##### Share on other sites

• Seeq Team

Hi Yassine - Below is one way to approach this problem:

Q1:  Refer to the below linked article on how to create a running count of capsules.

For your use case, start by creating a Yearly Periodic Condition in your time zone of choice.

Next, create a signal with a set sample rate (I picked 1 day in this case, but you can make it shorter):

Then create a signal from condition to count each Maintenance Interval using the average of the signal during the maintenance capsule (which will be 1, so effectively, you're counting a single instance for each maintenance interval):

Finally, create a running sum of the capsules over the yearly period w/ max interpolation of 1 year:

This will result in a step signal with a continuing count of maintenance intervention capsules:

Q2: To perform your yearly MTBF calculation, you can create a signal for your current running hours and start of year running hours by using the Max and Min Aggregation in Signal to condition:

With those signals available, Yearly MTBF can be calculated using Formula:

Edited by Patrick
fixed images
• 1
• 1
##### Share on other sites

Perfect.. it works.. the only thing I changed from your approach is that I used for Current_hours as the running run-hours from the compressor itself and not the created signal max_run_hours so the MTBF 1 trend looks sloped compared to the  MTBF you proposed. That works pretty fine.

Thanks Patrick

##### Share on other sites

• Seeq Team

Excellent tweak - that makes sense!