# CalculateAvailability

Summary: The recipe adds markup for calculating availability
Version: 1.0
Prerequisites: -
Status: Production
Maintainer: Christian Ridderström
Categories:

## Questions answered by this recipe

How can I use special PmWiki markup to help me calculate (estimate) the availability of a system consisting of components connected in series?

How can I use special PmWiki markup to help me calculate (estimate) the availability of a system based on its parameters for mean time between failure (MTBF) and mean time to repear (MTTR)?

## Description

Special markup for calculating availability

## Notes

• Availability for a system of serially connected components are calculated according to the formula
{$A_{system} = A_1 * A_2 * ... A_n$}
where {$A_{system}$} is the availability of the system, and {$A_i$} is the availability of component i.
• The markup makes it easy to calculate the availability of a single component based on estimates of its MTBF and MTTR according to the formula
{$A = \frac{MTBF}{MTBF + MTTR}$}
• Calculation of availability for components "in parallel" is not supported, although it could be added given a suitable markup.
• Calculation of MTBF from availability and MTTR is not supported, although it could be added given a suitable arkup.

## Installation and use

        include_once("\$FarmD/cookbook/calculate_availability.php");


### Usage

Syntax synopsis:

• Form 1: (:calc-avail <nn>% :)
Example: (:calc-avail 99.99% :)
• Form 2: (:calc-avail mtbf=<MTBF><unit> mttr=<MTTR><unit> :)
Example: (:calc-avail mtbf=5.5y mttr=12h :)
• Form 3: (:calc-avail :)
Example: (:calc-avail :)

The arguments are used as follows

    <nn>      A number 0-100 of availability in percent, e.g. 99.9.
%         The percent sign after the number is mandatory.
<MTBF>    A number (e.g. 12.5) indicating mean time between failure.
<unit>    A mandatory character indicating the unit, where
'y'  = Year (365 days per week)
'm'  = Month (30 days per week)
'w'  = Week (7 days/per week)
'd'  = Day
'h'  = Hour (24 hours per day)
<MTTR>    A number (e.g. .5) indicating mean time to repeair.
<unit>    A character indicating the unit, same as described above.


The first form, e.g. (:calc-avail 99%:) simply "adds" another component with an availability to the combined availability. Mathematically it just multiplies 99% (in this example) with the accmulated availability.

The second form works like the first form, except that instead of specifying the availability in percent, you specify it in terms of MTBF and MTTR.

The third form prints the accumulated availability, and then resets the accumulated availability to 1 so that a new calculation can be started.

## Examples

Two examples of how to use the markup.

### Example 1

Simple example, calculating availability of two components in series with availabilities of 99.9% and 99.5% respectively.

### Result

* Availability of component 1:
(:calc-avail 99.9% :)
* Availability of component 2:
(:calc-avail 99.5% :)
* Combined availability: (:calc-avail :)

• Availability of component 1: (:calc-avail 99.9% :)
• Availability of component 2: (:calc-avail 99.5% :)
• Combined availability: (:calc-avail :)

### Result

* Calculating availability of component 1:
(:calc-avail mtbf=5y mttr=44h :)
* Calculating availability of component 2:
(:calc-avail mtbf=33400h mttr=7d :)
* Combined availability:
(:calc-avail :)

• Calculating availability of component 1: (:calc-avail mtbf=5y mttr=44h :)
• Calculating availability of component 2: (:calc-avail mtbf=33400h mttr=7d :)
• Combined availability: (:calc-avail :)

## Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

2006-12-02
Release 1 - probably the only release. I wrote this for a one-time use and don't think I will need further functionality. Others are of course welcome to use and expand on this work.