System
– System building and description¶
-
class
fiabilipy.
System
(graph=None)[source]¶ Describe a system with different components.
The components are linked together thanks to a reliability diagram. This reliability diagram is represented by a graph. This graph must have two special nodes called E and S. E represents the start of the system and S its end (names stand for “Entrée” (start) and “Sortie” (end) in French).
Examples
Let’s have a look to the following system:
| -- C0 -- | E -- | | -- C2 -- S | -- C1 -- |
Thus, to represent such a system, you must create the three components C0, C1 and C2 and link them.
>>> C = [Component(i, 1e-4) for i in xrange(3)] >>> S = System() >>> S['E'] = [C[0], C[1]] >>> S[C[0]] = [C[2]] >>> S[C[1]] = [C[2]] >>> S[C[2]] = ['S']
So, you can use the System object as a simple python dictionnary where each key is a component and the value associated it the list of the component’s successors.
-
availability
(t)[source]¶ Compute the availability of the whole system
This method compute the availability of the system at t.
Parameters: t (float or Symbol) Returns: out (float or symbolic expression) – The availability calculated for the given t Examples
>>> motor = Component('M', 1e-4, 3e-2) >>> power = Component('P', 1e-6, 2e-4) >>> t = Symbol('t', positive=True) >>> S = System() >>> S['E'] = [power] >>> S[power] = [motor] >>> S[motor] = 'S' >>> S.availability(t) (200/201 + exp(-201*t/1000000)/201)*(300/301 + exp(-301*t/10000)/301) >>> S.availability(1000) 0.995774842225189
-
components
¶ The list of the components used by the system
Returns: out (list) – the list of the components used by the system, except E and S
-
copy
()[source]¶ Return a copy of the system.
Returns: out (System) – A copy of the current system Notes
The components are the same (same reference). Only the internal graph is new
-
draw
()[source]¶ Draw the system
Draw the system with graphviz.
Examples
>>> import pylab as p >>> motor = Component('M', 1e-4, 3e-2) >>> powers = [Component('P{}'.format(i), 1e-6, 2e-4) for i in (0,1)] >>> S = System() >>> S['E'] = [powers[0], powers[1]] >>> S[powers[0]] = S[powers[1]] = [motor] >>> S[motor] = 'S' >>> S.draw() >>> p.show()
-
faulttreeanalysis
(output=None, order=2)[source]¶ Build the fault tree analysis of the system
Print (or write) the content of the dot file needed to draw the fault tree of the system.
Parameters: - output (file-like object, optional) – If output is given, then the content is written into this
file. output must have a
write()
method. - order (int, optional) – This is the maximum order of the minimal cuts the function looks for.
Notes
Please, see the Graphviz <http://graphviz.org/> website for more information about how to transform the ouput code into a nice picture.
- output (file-like object, optional) – If output is given, then the content is written into this
file. output must have a
-
findallpaths
(start='E', end='S')[source]¶ Find all paths between two components in the reliability diagram
Parameters: - start (Component, optional) – find paths from this component
- end (Component, optional) – find paths to this component
Returns: out (iterator) – an iterator on the paths from start to stop
Examples
>>> motor = Component('M', 1e-4, 3e-2) >>> powers = [Component('P{}'.format(i), 1e-6, 2e-4) for i in (0,1)] >>> S = System() >>> S['E'] = [powers[0], powers[1]] >>> S[powers[0]] = S[powers[1]] = [motor] >>> S[motor] = 'S' >>> list(S.findallpaths(start=powers[0])) [[Component(P0), Component(M), 'S']]
-
maintainability
(t)[source]¶ Compute the maintainability of the whole system
This method compute the maintainability of the system at t.
Parameters: t (float or Symbol) Returns: out (float or symbolic expression) – The maintainability calculated for the given t Examples
>>> motor = Component('M', 1e-4, 3e-2) >>> power = Component('P', 1e-6, 2e-4) >>> t = Symbol('t', positive=True) >>> S = System() >>> S['E'] = [power] >>> S[power] = [motor] >>> S[motor] = 'S' >>> S.maintainability(t) (1 - exp(-3*t/100))*(1 - exp(-t/5000)) >>> S.maintainability(1000) 0.181269246922001
-
minimalcuts
(order=1)[source]¶ List the minimal cuts of the system of order <= order
A minimal cut of order \(n\), is a set of \(n\) components, such as if there all unavailable, the whole system is unavailable.
This function aims to find out every minimal cuts of order inferior to order.
Parameters: order (int, optional) – The maximal order to look for. Returns: out (list of frozensets) – each frozenset contains the components that constitute a minimal cut Examples
>>> motor = Component('M', 1e-4, 3e-2) >>> powers = [Component('P{}'.format(i), 1e-6, 2e-4) for i in (0,1)] >>> S = System() >>> S['E'] = [powers[0], powers[1]] >>> S[powers[0]] = S[powers[1]] = [motor] >>> S[motor] = 'S' >>> S.minimalcuts(order=1) [frozenset(...)] >>> S.minimalcuts(order=2) [frozenset(...), frozenset(...)]
-
mttf
¶ Compute the Mean-Time-To-Failure of the system
- The MTTF is defined as :
- \(MTTF = \int_{0}^{\infty} R(t)dt\)
Returns: out (float) – The system MTTF Examples
>>> motor = Component('M', 1e-4, 3e-2) >>> power = Component('P', 1e-6, 2e-4) >>> S = System() >>> S['E'] = [power] >>> S[power] = [motor] >>> S[motor] = 'S' >>> S.mttf 1000000/101
-
mttr
¶ Compute the Mean-Time-To-Repair of the system
- The MTTR is defined as :
- \(MTTF = \int_{0}^{\infty} 1 - M(t)dt\)
Returns: out (float) – The system MTTR Examples
>>> motor = Component('M', 1e-4, 3e-2) >>> power = Component('P', 1e-6, 2e-4) >>> S = System() >>> S['E'] = [power] >>> S[power] = [motor] >>> S[motor] = 'S' >>> S.mttr 2265100/453
-
reliability
(t)[source]¶ Compute the reliability of the whole system
This method compute the reliability of the system at t.
Parameters: t (float or Symbol) Returns: out (float or symbolic expression) – The reliability calculated for the given t Examples
>>> motor = Component('M', 1e-4, 3e-2) >>> power = Component('P', 1e-6, 2e-4) >>> t = Symbol('t', positive=True) >>> S = System() >>> S['E'] = [power] >>> S[power] = [motor] >>> S[motor] = 'S' >>> S.reliability(t) exp(-101*t/1000000) >>> S.reliability(1000) 0.903933032885864
-
successpaths
¶ Return all the success paths of the reliability diagram
A success path is defined as a path from ‘E’ to ‘S’.
Returns: out (list of paths) – the list of all the success paths. A path, is defined as a list of components Examples
>>> motor = Component('M', 1e-4, 3e-2) >>> powers = [Component('P{}'.format(i), 1e-6, 2e-4) for i in (0,1)] >>> S = System() >>> S['E'] = [powers[0], powers[1]] >>> S[powers[0]] = S[powers[1]] = [motor] >>> S[motor] = 'S' >>> S.successpaths [['E', Component(P0), Component(M), 'S'], ['E', Component(P1), Component(M), 'S']]
-