Stress-strength interference¶
stress_strength ¶
Stress-strength interference: the chance a strength exceeds a stress.
A part fails when the stress put on it reaches its strength. Both are
random: the strength varies from part to part, and the stress from use to
use. With a strength Y and a stress X that are independent, the
reliability of the part is
``R = P(Y > X) = integral of f_X(x) S_Y(x) dx``
where f_X is the stress's density and S_Y the strength's survival
function (the chance the strength is above a level). If the part has to
withstand n independent applications of the stress, it survives when
the strength is above the largest of them:
``R_n = P(Y > max(X_1..X_n)) = integral of n f_X F_X^(n-1) S_Y dx``
This is pure probability. RePyability takes the two models as given, fitted
in surpyval (or anything with the methods named in stress_strength),
and fits nothing. It says nothing about where a strength comes from (no
fatigue, wear or crack-growth law): to let the strength change with age,
give the model it has at each age (stress_strength_over_time).
The models share one unit. Strength and stress must be in the same unit (both in MPa, both in newtons, both in hours of cycles, ...). RePyability does not check units; a model in the wrong unit gives a wrong answer.
How R is worked out:
- Closed forms where they exist, for models with no offset, no limited
failure population and no zero inflation: both Normal, both LogNormal, both
Exponential, and both Weibull with the same shape (and, for
nloads, both Exponential or both Weibull with the same shape). - Quadrature otherwise. With
u = F_X(x)the integral is over the stress's probability from 0 to 1, ofn u^(n-1) S_Y(Q_X(u)), a smooth function between 0 and 1, which the Gauss-Kronrod (7, 15) rule of the mean-lifetime integral (rbd/_mean_lifetime.py) splits at the probabilities where the strength's quantiles fall, and halves until its error is withinRTOL, relative. - Simulation on request (
method="simulate").
stress_strength ¶
stress_strength(strength, stress, n_loads=1, method='auto', uncertainty=None, n_draws=DEFAULT_DRAWS, confidence=0.95, mc_samples=DEFAULT_SAMPLES, seed=None)
The reliability of a part whose strength must exceed its stress:
R = P(strength > stress), for independent strength and stress.
In plain words: the strength varies from part to part, the stress from
use to use, and the part fails in a use whose stress is above its
strength. R is the chance a randomly chosen part survives a randomly
chosen use. With n_loads uses in a row (each stress drawn
independently, the strength fixed for the part), the part survives
when its strength is above the largest of them. Strength and stress are
random variables in the same unit, which is not checked. Exponentials
and normals with the same mean and spread give very different answers
from the single "factor of safety" of their means: this is the whole
distribution's answer. See the user guide for formulas and a worked
example.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strength
|
model
|
The strength: a fitted surpyval model, or anything with |
required |
stress
|
model
|
The stress: a fitted surpyval model, or anything with |
required |
n_loads
|
int
|
The number of independent applications of the stress the strength must survive. The default is 1. |
1
|
method
|
str
|
|
'auto'
|
uncertainty
|
str
|
|
None
|
n_draws
|
int
|
The number of draws of the parameters for |
DEFAULT_DRAWS
|
confidence
|
float
|
The confidence level of the bounds, strictly between 0 and 1. |
0.95
|
mc_samples
|
int
|
The number of simulated draws of the strength and the stress when
|
DEFAULT_SAMPLES
|
seed
|
int
|
Seeds the simulation and the draws of the parameters. The same seed gives the same results. |
None
|
Returns:
| Type | Description |
|---|---|
StressStrengthResult
|
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If a model lacks the methods it needs, or is a surpyval distribution itself rather than a model of it. |
ValueError
|
If an argument is out of range, a model is a fixed probability or has a share that never occurs, or the uncertainty cannot be drawn. |
stress_strength_over_time ¶
stress_strength_over_time(strength_at, stress, times, n_loads=1, method='auto')
The reliability of a part whose strength changes with age, against a
stress that does not: R(t) = P(strength at age t > stress).
RePyability has no law for how a strength changes (that is the user's
knowledge of the part, or a model fitted in surpyval): give the model it
has at each age. The result is the interference reliability of each
age's model against the stress, worked out as stress_strength does.
It is the chance that a part of that age survives one use (or
n_loads uses in a row), not that it survives from new to that age.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strength_at
|
callable
|
A function of an age (a float) that returns the strength's model at
that age, such as |
required |
stress
|
model
|
The stress's model, as in |
required |
times
|
array_like
|
The ages, finite numbers, in the unit |
required |
n_loads
|
int
|
The number of independent applications of the stress at each age. |
1
|
method
|
str
|
|
'auto'
|
Returns:
| Type | Description |
|---|---|
StressStrengthCurve
|
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If an argument is out of range. |
stress_strength_over_time ¶
stress_strength_over_time(strength_at, stress, times, n_loads=1, method='auto')
The reliability of a part whose strength changes with age, against a
stress that does not: R(t) = P(strength at age t > stress).
RePyability has no law for how a strength changes (that is the user's
knowledge of the part, or a model fitted in surpyval): give the model it
has at each age. The result is the interference reliability of each
age's model against the stress, worked out as stress_strength does.
It is the chance that a part of that age survives one use (or
n_loads uses in a row), not that it survives from new to that age.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strength_at
|
callable
|
A function of an age (a float) that returns the strength's model at
that age, such as |
required |
stress
|
model
|
The stress's model, as in |
required |
times
|
array_like
|
The ages, finite numbers, in the unit |
required |
n_loads
|
int
|
The number of independent applications of the stress at each age. |
1
|
method
|
str
|
|
'auto'
|
Returns:
| Type | Description |
|---|---|
StressStrengthCurve
|
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If an argument is out of range. |