Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions repyability/rbd/_chain_transient.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,13 @@ def __init__(
#: For the pieces of the integrals: the chain's knots and settling.
self.curve = ChainCurve(chain)

def jump_times(self, stop: float) -> np.ndarray:
"""The times in ``(0, stop)`` at which the chain's states jump
down at exact times: none, as its components fail and are
repaired at rates (a common-cause group's chain jumps at its
members' tests, see ``_ccf_chain.GroupsSystem.jump_times``)."""
return np.empty(0)

def evaluate(self, values: dict, x: np.ndarray):
"""At the times ``x``, with each nested RBD up with the probability
``values[node]`` (an array over ``x``): each nested RBD's Birnbaum
Expand Down
4 changes: 3 additions & 1 deletion repyability/tests/test_chains_over_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,13 @@ def plant(crews):
independent, chained = plant(2), plant(2)
chained._crews_couple = lambda: True # type: ignore[method-assign]
windows = np.array([5.0, 60.0, 400.0])
# Each path integrates by its own quadrature: over the shortest window
# both are within about 2e-6 of the closed form (the chain's closer).
for name in ("system_failures", "system_downtime"):
np.testing.assert_allclose(
chained.expected_events(windows)[name],
independent.expected_events(windows)[name],
rtol=1e-6,
rtol=5e-6,
atol=1e-10,
)
np.testing.assert_allclose(
Expand Down
14 changes: 12 additions & 2 deletions repyability/tests/test_condition_long_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,20 @@ def test_a_threshold_of_0_replaces_at_every_inspection(duration):


def test_a_threshold_no_inspection_reaches_runs_to_failure():
never = RepairableRBD(PAIR, {"a": unit(threshold=1.0), "b": unit()})
# Priced, as the cost analyses refuse a diagram with nothing priced.
never = RepairableRBD(
PAIR, {"a": unit(threshold=1.0, repair_cost=100.0), "b": unit()}
)
plain = RepairableRBD(
PAIR,
{"a": {"reliability": LIFE, "repairability": REPAIR}, "b": unit()},
{
"a": {
"reliability": LIFE,
"repairability": REPAIR,
"repair_cost": 100.0,
},
"b": unit(),
},
)
for name in LONG_RUN:
assert getattr(never, name)() == pytest.approx(
Expand Down
Loading