Skip to content

Shocks in a repairable diagram: simulated, for members of any lives - #500

Merged
derrynknife merged 6 commits into
devfrom
build/shocks-repairable
Nov 21, 2026
Merged

derrynknife merged 6 commits into
devfrom
build/shocks-repairable

Conversation

@derrynknife

Copy link
Copy Markdown
Owner

Summary

A RepairableRBD now accepts CCFGroup(members, Shocks(rate, p, lethal_rate)). The members can have any lives and do not have to be alike. Shocks arrive at their own rate, and each one fails each member with probability p; lethal shocks fail every member. When a shock strikes, the members it names that are up fail in the group's order, which is stated as the rule for members struck at the same instant. Each failed member is then repaired on its own. A tested member's failure stays hidden until its test, and a test that can miss uses one coin for all the failures from one strike.

  • Causes. The loop's shared causes (_ccf_groups._shared_causes, from Shocks.causes) carry the group's causes at their own rates, on the existing cause streams. Each member draws its own life from its own model. For exponential members, a seeded run gives exactly the same result as the equivalent rate-split group, strike for strike. No existing seeded result changes.
  • Compiled engine. It already hands any diagram with common-cause groups to Python, so the two engines agree.
  • Exact and numerical methods refuse and point to the simulation. This happens through _ccf_rates and, for a member's own values, a new _requirements._require_own_failures. That covers node_availability, spares_demand and spares_stock, because a member's own life no longer gives its failures; spares_demand(method="simulate") still counts them. analysis_routes() reports the same refusals.
  • Refused by name: scheduled maintenance, imperfect repair or a maintenance group on a member, and a tested member started from a state.
  • Levers: ccf_rate, ccf_p and ccf_lethal_rate, with ranges.
  • Catalogue: two new kinds, "shocks, revealed" (Weibull members with different repairs) and "shocks, tested".
  • Docs: README simulation table, guide (common-cause, common-cause ages), CLAUDE.md note and CHANGELOG.
  • A NonRepairableRBD already expands the same model to shock_nodes, matching it to the last bit (test_shock_nodes.py).

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / tooling
  • Breaking change

Checklist

  • Tests added/updated (test_repairable_shocks.py: same seeded run as BetaFactor for revealed and tested members, the alpha-factor chain's exact value against a plain simulation, a Weibull member against a renewal simulation written in the test, the strike order, refusals, save and load)
  • black, isort, flake8 and mypy pass on the package; I ran only the targeted tests, without xdist
  • analysis_routes, catalogue, levers, README table and capability matrices updated (regenerating the matrices changes nothing)
  • CHANGELOG.md updated under [Unreleased]
  • Monte-Carlo tests are seeded

Notes for reviewers

Tests run: 94 passed and 4 skipped (the numba engine cases; numba is not installed here). They cover the shock tests, test_shock_nodes, test_messages, and -k shock across the routes, catalogue, levers and engine tests, plus the README routes check. Doctests of the touched modules: 5 passed. After the last merge of dev I re-ran the shocks, routes and levers subset: 25 passed. I did not run the full suite or catalogue-wide runs.

The general problem of ordering failures that tie at one instant is not addressed here. The rule above only covers the members of one strike.


Generated by Claude Code

A RepairableRBD takes CCFGroup(members, Shocks(rate, p, lethal_rate)):
every set of members a shock can fail is a shared cause on the cause
streams, at a rate of its own, and each member keeps its own life. A
strike fails the members it names that are up, in the group's order;
each is repaired, or found at its test, on its own. Every exact method
refuses, naming the simulation. For exponential members a seeded run is
the equivalent rate-split group's; no existing seeded result changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6RpnXB87vwhYETeh7ihtA
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6RpnXB87vwhYETeh7ihtA
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6RpnXB87vwhYETeh7ihtA
Its own life no longer gives its failures, which the group's shocks
add to: node_availability, spares_demand and spares_stock refuse,
saying to simulate, as analysis_routes() reports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6RpnXB87vwhYETeh7ihtA
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6RpnXB87vwhYETeh7ihtA
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6RpnXB87vwhYETeh7ihtA
@derrynknife
derrynknife merged commit ba6189b into dev Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants