# How to calculate the ideal maintaining time of a machine?

I have a question regarding a cost calculation problem:

I have the following curve, which shows, that with increasing number of tasks without maintaining a machine, the error probability for the produced parts increases.

The x-Axis represents the counter of tasks without maintaining the machine. This means the point (10;0.2) says: When the machine wasn’t maintained the last 10 cycles, the error rate is 20%.

Maintaining the machine costs, let’s say 1000 € and one error 15 €. Now I need to find out the perfect maintaining counter, when to maintain the machine.

I thought about multiplying the curve with 15€ and then integrating the function, to take into account the already increased probability of the previous cycles at a specific count. However, I am not sure about this integration step.

Maybe anyone else has any idea how to handle this problem.

• Interesting question, but could you clarify "error". I can think of two interpretations: a) if an error occurs in a cycle, the machine continues to perform in subsequent cycles, subject to the error rate defined by the chart; b) if an error occurs in a cycle, the machine fails in all subsequent cycles until maintenance is carried out. I think you probably mean (a), but it would be helpful to be sure. – Adam Bailey Nov 2 '20 at 13:04
• Ah i am sorry. With an error i mean that the machine creates a workpiece which is faulty. The machine still continues, the workpiece just has an error. – user31069 Nov 2 '20 at 13:10
• Is number of tasks a continuous variable or discrete? – Dayne Nov 2 '20 at 16:31
• Also please add a self study tag if this is homework. – Dayne Nov 2 '20 at 16:33

Suppose the probability of an error in the $$n$$th cycle since the most recent maintenance is $$a+bn$$, and let the number of tasks (cycles) between maintenance be $$x$$. I'm assuming here that the tasks can be treated as discrete.

The way I would approach the optimization is to calculate both the total maintenance cost and the expected total error cost over some fairly large number of cycles - say 1,000. What number is chosen here is arbitrary, but I find it more intuitive to think of total costs in that context than averages per cycle, although each should lead to the same result.

Total maintenance costs are:

$$\frac{1000}{x}\times 1000=\frac{1000000}{x}$$

Expected error costs between two successive maintenance events, using the triangle number formula to sum the $$b$$'s, are:

$$\sum_{n=1}^x 15(a+bn)=15\Big(ax+b\Big(\frac{x(x+1)}{2}\Big)\Big)$$

Hence total expected error costs are:

$$\frac{1000}{x}\times 15\Big(ax+b\Big(\frac{x(x+1)}{2}\Big)\Big)=15000\Big(a+\Big(b\frac{x+1}{2}\Big)\Big)$$

Total costs $$TC$$ (including both maintenance and expected error costs) are therefore:

$$TC = \frac{1000000}{x} + 15000\Big(a+\Big(b\frac{x+1}{2}\Big)\Big)$$

Setting the first derivative equal to zero to find the minimum:

$$\frac{dTC}{dx}=\frac{-1000000}{x^2}+15000\Big(\frac{b}{2}\Big)=0$$

$$-2000000+15000bx^2=0$$

$$-400+3bx^2=0$$

$$x=\sqrt{\frac{400}{3b}}$$

To confirm this is a minimum:

$$\frac{d^2TC}{dx^2}=\frac{2000000}{x^3}>0$$

Putting (as approximately suggested by the chart) $$a=0.18, b=0.001$$, this yields:

$$x=\sqrt{\frac{400}{0.003}}\approx365$$

Note that in this case $$a+bx=0.18+(0.001\times365)=0.545 < 1$$. The formula would need modifying should the values imply a probability of error exceeding 1 before reaching the next maintenance event.

$$\int_0^x 15(a+bn)dn=15\Big(ax+\frac{bx^2}{2}\Big)$$
This has $$x^2$$ where the calculation above has $$x(x+1)$$. However, this difference vanishes on differentiating TC since:
$$\frac{d(bx)}{dx}=\frac{d(b(x+1))}{dx}=b$$
Thus this approach leads to the same optimum value for $$x$$.