## Introduction

gold Here is an eTCL console program for spare parts in warranty period based on poisson distribution, lamda=1. Calculate spare parts in warranty period for 95% confidence level (eg. > 95%C). Calculations estimate spare parts or spare drives for a cloud backup system. This report references both the poisson and normal distributions, as implemented in TCL.

### Pseudocode and Equations

```     #pseudocode can be developed from rules of thumb.
#pseudocode: some problems can be solved by proportions (rule of three), to some order of magnitude
#pseudocode: enter quantity1,  quantity2, quantity3 and expected output (quantity4) for testcases.
#pseudocode: enter time in years, number of remaining items
#pseudocode: output fraction of (remaining items) over (items at time zero)
#pseudocode: ouput remaining items as fraction or percent
#pseudocode: output fraction of (quantity4 ) over ( quantity1 at time zero)
#pseudocode: output fraction of (quantity2) * (quantity3 ) over (quantity1 at time zero)
#pseudocode: outputs should be in compatible units.
#pseudocode: rules of thumb can be 3 to 15 percent off, partly since g..in g..out.
#pseudocode: need test cases > small,medium, giant
#pseudocode: need testcases within range of expected operation.
#pseudocode: are there any cases too small or large to be solved?```

### Testcases Section

#### Testcase 1

table 1, Spare Parts for one operating device from iterative poisson solutionprinted in tcl wiki format
quantity value comment, if any
testcase number:1 iterative solution from poisson
400. :warranty hours or expected lifetime, MTBF hours mean time between failures
0.003534 :failure rate per hours usually given in specs
95 :percentile for iterative solution usually 95
282.965 :answers: MTTF hours from givens mean time to failure
117.034 :MTTR hours from givens, mean time to repair MTTR=MTBF-MTTF
0.7074 :availability without spares A0=MTTF/MTBF
565.930 :MTTFD without spares, mean time to dangerous failure MTTFD=2*MTTF
0.963 :experimental availability from probability with spares A0=experimental formula
260.0 :experimental MTTF from exponential model
0.00385 :experimental failure_rate_per_hours from exponential model
1.4136 :average failures across warranty period
1.4136 :simple replacement of average failures with spares, approx. 50%C
2.0 :rounded up simple replacement of average failures
0.973 :probability on last iteration
4 :iterations for solution from poisson distribution
4 :poisson spare parts from iterative solution

textbook table solution gives 4 spares warranty=400 hours 1.4 failures in 400 hours 0.003534 f/hr 16 days interval MTTF=283 hours
from real_life problem poi. & nor. distributions from CRC rubber & textbook tables
probability of X row >>> p(0) p(1) p(2) p(3) p(4)
textbook poisson cdf,L=1 .3679 .7358 .9197 .9810 .9963
textbook poisson pdf,L=1 .3679 .3679 .1839 .0613 .0153
textbook normal cdf,S=1 .5000 .8413 .9773 .9987 1.0
textbook normal pdf,S=1 .3989 .2420 .0540 .0044 .0001
solution of 4 spares > 95% 4 spares col. ^^^^
% difference in cum. curves 14.3% 6.2% 1.8% 0.37%

#### Testcase 2

table 2, Spare Parts for one operating device from iterative poisson solutionprinted in tcl wiki format
quantity value comment, if any
testcase number:2 iterative solution from poisson
400. :warranty hours or expected lifetime, MTBF hours mean time between failures
0.003534 :failure rate per hours usually given in specs
90 :percentile for iterative solution usually 95
282.965 :answers: MTTF hours from givens mean time to failure
117.0345 :MTTR hours from givens, mean time to repair MTTR=MTBF-MTTF
0.7074 :availability without spares A0=MTTF/MTBF
565.930 :MTTFD without spares, mean time to dangerous failure MTTFD=2*MTTF
0.9630 :experimental availability from probability with spares A0=experimental formula
260.0 :experimental MTTF from exponential model
0.00385 :experimental failure_rate_per_hours from exponential model
1.4136 :average failures across warranty period
1.4136 :simple replacement of average failures with spares, approx. 50%C
2.0 :rounded up simple replacement of average failures
0.973 :probability on last iteration
4 :iterations for solution from poisson distribution
4 :poisson spare parts from iterative solution

#### Testcase 3

table 3, Spare Parts for one operating device from iterative poisson solutionprinted in tcl wiki format
quantity value comment, if any
testcase number:3 iterative solution from poisson
400. :warranty hours or expected lifetime, MTBF hours mean time between failures
0.003534 :failure rate per hours usually given in specs
60 :percentile for iterative solution usually 95
282.965 :answers: MTTF hours from givens mean time to failure
117.0345 :MTTR hours from givens, mean time to repair MTTR=MTBF-MTTF
0.707 :availability without spares A0=MTTF/MTBF
565.930 :MTTFD without spares, mean time to dangerous failure MTTFD=2*MTTF
0.7197 :experimental availability from probability with spares A0=experimental formula
260.0 :experimental MTTF from exponential model
0.00385 :experimental failure_rate_per_hours from exponential model
1.4136 :average failures across warranty period
1.4136 :simple replacement of average failures with spares, approx. 50%C
2.0 :rounded up simple replacement of average failures
0.729 :probability on last iteration
3 :iterations for solution from poisson distribution
3 :poisson spare parts from iterative solution

### References:

• Find The Right Fit With Probability Distributions By David Harper
• Hard drive reliability to the test by Peter Bright,Technology Editor at [L1 ]
• Math Encounters Blog, Spare Parts Math, 27feb2012, Mark Biegert
• Assurance. Related Technologies. Volume 9, Number 1. Application of the Poisson Distribution
• [L2 ]
• MIST: MATLAB Introductory Statistical Toolbox
• Poisson distribution calculator, Assurance. Related Technologies
• Disk problems contribute to 20% to 55% of storage subsystem failures, Mary Brandel, Computerworld

## Appendix Code

### appendix TCL programs and scripts

```        # pretty print from autoindent and ased editor
# written on Windows XP on eTCL
# working under TCL version 8.6.2 and_or eTCL 1.0.1
# gold on TCL WIKI, 5nov2014
# Console program for spare parts in warranty period
# based on poisson distribution, lamda=1
# calculate spare parts for 95% confidence level (eg. > 95%C).
package require Tk
namespace path {::tcl::mathop ::tcl::mathfunc}
console show
global side1 side2 side3 side4 side5
global side6 side7 side8 spares_95
global side9 side10 side11 side12 side13
global testcase_number iteration_number
foreach item { 1 2 3 4 5 6 7 8 9 10 11 12} {
set side\$item 0 }
proc fuzzy_round_up {args } {
set lister {}
foreach item \$args {
if { \$item > [int \$item ] &&  \$item > 0. } { lappend lister [+ [int \$item ] 1.]}
if { \$item == [int \$item ] } { lappend lister [* \$item 1.] }
if { \$item < [int \$item ] &&  \$item < 0. } { lappend lister [+ [int \$item ] -1.]}
}
return \$lister }
proc MTTF_exponential_model {warranty_hours } {
set MTTF [* \$warranty_hours [- [exp .5 ] 1. ] 1. ]
return \$MTTF }
proc AFR_exponential_model {warranty_hours } {
set AFR [/ 1. [* \$warranty_hours [- [exp .5 ] 1. ] 1. ] ]
return \$AFR }
proc extra_credit  {  } {
global side1 side2 side3 side4 side5
global side6 side7 side8
global side9 side10 side11 side12 side13
global side14
global warranty_hours failure_rate_hours percentile
global testcase_number
set side4 [/ 1. \$side2]
set side5 [ fuzzy_round_up [ MTTF_exponential_model \$side1 ] ]
set side7 [ AFR_exponential_model \$side1 ]
set side8 [/ \$side1 [/ 1. \$side2] ]
set side9 [ fuzzy_round_up [/ \$side1 [/ 1. \$side2] ] ]
set side11 [- \$side1 \$side4 ]
set side12 [/ \$side4 \$side1  ]
set side13 [* 2. \$side4 ]
return 1 }
proc poissonx {warranty_hours failure_rate_hours percentile} {
global side1 side2 side3 side4 side5
global side6 side7 side8
global side9 side10 side11 side12
global side13 side14
global testcase_number iteration_number
incr testcase_number
set side1 \$warranty_hours
set side2 \$failure_rate_hours
set side3 \$percentile
extra_credit
set parts_prob 0
set percentile_factor [* \$percentile 1.E-2 ]
foreach item { 1 2 3 4 5 6 7 8 9 10 } {
incr iteration_number
set exponent [* \$warranty_hours \$failure_rate_hours -1. ]
set parts_prob [+ \$parts_prob [exp \$exponent ] ]
puts "
spares \$item prob.  \$parts_prob   \n
product warranty_hours  \$warranty_hours \n
failure_rate_per_hours \$failure_rate_hours \n "
set side10 \$parts_prob
if { \$iteration_number > 9 } { puts "testcase \$testcase_number, \$iteration_number iterations exceeded & short of solution"; return \$item}
if { \$parts_prob > 1. } { puts "testcase \$testcase_number, \$iteration_number iterations exceed prob. unity & short of solution"; return \$item}
if { \$parts_prob > \$percentile_factor } {reportx ; set iteration_number 0 ; return \$item  } }
return  0 }
proc reportx {} {
global side1 side2 side3 side4 side5
global side6 side7 side8
global side9 side10 side11 side12 side13
global side14
global testcase_number iteration_number
set spares95 \$iteration_number
set availability_with_spares_experimental [* [- [* \$side10 1.E2 1. ] 1. ] 1.E-2 ]
puts "%|table \$testcase_number, Spare Parts for one operating device from iterative poisson solution|printed in| tcl wiki format|% "
puts "%| quantity| value| comment, if any|% "
puts "&| testcase number:|\$testcase_number | iterative solution from poisson|&"
puts "&| \$side1 :|warranty hours or expected lifetime, MTBF hours | mean time between failures   |&"
puts "&| \$side2 :|failure rate per hours | usually given in specs |& "
puts "&| \$side3 :|percentile for iterative solution | usually 95 |& "
puts "&| \$side4 :|answers: MTTF hours from givens  | mean time to failure |&"
puts "&| \$side11 :|MTTR hours from givens, mean time to repair | MTTR=MTBF-MTTF  |&"
puts "&| \$side12 :|availability without spares  | A0=MTTF/MTBF  |&"
puts "&| \$side13 :|MTTFD without spares, mean time to dangerous failure  | MTTFD=2*MTTF  |&"
puts "&| \$availability_with_spares_experimental :|experimental availability from probability with spares  | A0=experimental formula  |&"
puts "&| \$side5 :|experimental MTTF from exponential model |  |&"
puts "&| \$side7 :|experimental failure_rate_per_hours from exponential model |  |&"
puts "&| \$side8 :|average failures across warranty period |  |&"
puts "&| \$side8 :|simple replacement of average failures with spares, approx. 50%C |  |& "
puts "&| \$side9 :|rounded up simple replacement of average failures  |   |&"
puts "&| \$side10 :|probability on last iteration |& "
puts "&| \$spares95 :|iterations for solution from poisson distribution|  |& "
puts "&| \$spares95 :|poisson spare parts from iterative solution  |  |& "
}
puts " poisson spare parts from home_brew [ poissonx 400. 0.003534 95  ]  "
puts " 4 spares are required for above 95 percent confidence level "
puts " poisson spare parts from home_brew [ poissonx 400. 0.003534 90  ]  "
puts " poisson spare parts from home_brew [ poissonx 400. 0.003534 60  ]  "
```

### Initial Console program for spare parts

```        # pretty print from autoindent and ased editor
# written on Windows XP on eTCL
# working under TCL version 8.6.2 and_or eTCL 1.0.1
# gold on TCL WIKI, 5nov2014
# Initial Console program for spare parts in warranty period
# based on poisson distribution, lamda=1
# calculate spare parts for 95% confidence level (eg. > 95%C).
package require Tk
namespace path {::tcl::mathop ::tcl::mathfunc}
console show
proc poissonx {warranty_hours failure_rate_hours percentile} {
set parts_prob 0
set percentile_factor [* \$percentile 1.E-2 ]
foreach item { 1 2 3 4 5 6 7 8 9 10 } {
set exponent [* \$warranty_hours \$failure_rate_hours -1. ]
set parts_prob [+ \$parts_prob [exp \$exponent ] ]
puts "spares \$item prob.  \$parts_prob   /n
product warranty_hours  \$warranty_hours /n
failure_rate_per_hours \$failure_rate_hours MTTF=1/L=283 hours /n
average failures across warranty period is 400/283 or 1.4 /n
simple replacement would rounded 1.4 or 2 spares at approx. 50%C /n
additional spares needed for 95%C "
if { \$parts_prob > \$percentile_factor } { return \$item } }
return  0 }
puts " poisson spare parts from home_brew [ poissonx 400. 0.003534 95  ]  "
puts " 4 spares are required for above 95 percent confidence level "
```