.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/reliability/risk/plot_02_wash1400_event_tree.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_reliability_risk_plot_02_wash1400_event_tree.py: WASH-1400: event trees (1975) ============================= The Reactor Safety Study (WASH-1400, 1975), led by Norman Rasmussen, was the first attempt to put a number on the risk of a nuclear power plant. Its method worked forward from each initiating event, such as a pipe break, and asked in turn whether each safety system worked. Every path through the resulting *event tree* is an accident sequence. Its frequency is the initiator's frequency times the branch probabilities (:func:`~engineeringkit.reliability.event_tree_probability`). Fault trees supplied those branch probabilities. The study was criticised for its uncertainty bounds, but the Three Mile Island accident of 1979 followed a small-break sequence of the kind it had ranked among the most likely, and probabilistic risk assessment became standard practice. .. GENERATED FROM PYTHON SOURCE LINES 19-24 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.reliability import event_tree_probability .. GENERATED FROM PYTHON SOURCE LINES 25-32 A loss-of-coolant event tree ---------------------------- Illustrative numbers. The initiator is a large pipe break, :math:`10^{-4}` per reactor-year (time unit: years). The tree asks, in order, whether the reactor trips, whether emergency core cooling injects, and whether containment heat removal works. .. GENERATED FROM PYTHON SOURCE LINES 32-42 .. code-block:: Python functions = ["reactor trip", "core cooling", "containment heat removal"] f0 = 1e-4 q = np.array([1e-5, 2e-3, 1e-2]) tree = event_tree_probability(f0, q) for outcome, frequency in zip(tree.outcomes, tree.frequencies): path = "".join("F" if failed else "S" for failed in outcome) print(f"{path} {frequency:.3e} per year") print(tree.summary()) .. rst-class:: sphx-glr-script-out .. code-block:: none SSS 9.880e-05 per year SSF 9.980e-07 per year SFS 1.980e-07 per year SFF 2.000e-09 per year FSS 9.880e-10 per year FSF 9.980e-12 per year FFS 1.980e-12 per year FFF 2.000e-14 per year {'sequences': 8, 'total_frequency': 0.0001, 'all_success_frequency': 9.880101198e-05} .. GENERATED FROM PYTHON SOURCE LINES 43-49 Core damage frequency --------------------- The core is damaged if the trip or the cooling fails. By inclusion and exclusion this is the two single-function frequencies minus their overlap, which must equal :math:`f_0[1 - (1-q_1)(1-q_2)]`. .. GENERATED FROM PYTHON SOURCE LINES 49-68 .. code-block:: Python trip, cooling = tree.frequency([0]), tree.frequency([1]) core_damage = trip + cooling - tree.frequency([0, 1]) print(f"core damage frequency {core_damage:.3e} per reactor-year, one in {1 / core_damage:.2e} years") print(f"containment heat removal also lost: {tree.frequency([1, 2]):.2e} per year") assert np.isclose(tree.frequencies.sum(), f0) assert np.isclose(cooling, f0 * q[1]) assert np.isclose(core_damage, f0 * (1 - (1 - q[0]) * (1 - q[1]))) labels = ["".join("F" if failed else "S" for failed in outcome) for outcome in tree.outcomes] damaged = tree.outcomes[:, 0] | tree.outcomes[:, 1] fig, ax = plt.subplots(figsize=(7, 4.2)) ax.barh(labels, tree.frequencies, color=np.where(damaged, "C3", "C0")) ax.set_xscale("log") ax.invert_yaxis() ax.set(xlabel="sequence frequency [per reactor-year]", ylabel="trip / cooling / heat removal", title="Event tree, red = core damage") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/reliability/risk/images/sphx_glr_plot_02_wash1400_event_tree_001.png :alt: Event tree, red = core damage :srcset: /api/gallery/reliability/risk/images/sphx_glr_plot_02_wash1400_event_tree_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none core damage frequency 2.010e-07 per reactor-year, one in 4.98e+06 years containment heat removal also lost: 2.00e-09 per year .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.037 seconds) .. _sphx_glr_download_api_gallery_reliability_risk_plot_02_wash1400_event_tree.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../../lite/lab/index.html?path=api/gallery/reliability/risk/plot_02_wash1400_event_tree.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_wash1400_event_tree.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_wash1400_event_tree.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_wash1400_event_tree.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_