.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/reliability/systems/plot_04_birnbaum_importance.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_systems_plot_04_birnbaum_importance.py: Birnbaum's component importance (1969) ====================================== Which component should be improved first? Birnbaum (1969) defined a component's importance as the rate at which system reliability changes with its reliability, :math:`I_i = \partial R_s/\partial R_i`. In a series system that is the product of all the *other* reliabilities (:func:`~engineeringkit.reliability.birnbaum_importance_series`), so the weakest link is the most important. The example checks the derivative numerically and shows that improving the most important component buys the most. .. GENERATED FROM PYTHON SOURCE LINES 16-21 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.reliability import birnbaum_importance_series, series_reliability .. GENERATED FROM PYTHON SOURCE LINES 22-24 Importance of each stage of a pumping train ------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 24-38 .. code-block:: Python names = ["intake screen", "pump", "motor", "control valve", "flow meter"] R = np.array([0.99, 0.90, 0.97, 0.95, 0.995]) importance = np.array([birnbaum_importance_series(R, i) for i in range(R.size)]) eps = 1e-6 numerical = [] for i in range(R.size): up, down = R.copy(), R.copy() up[i] += eps down[i] -= eps numerical.append((series_reliability(*up) - series_reliability(*down)) / (2 * eps)) for name, I, d in zip(names, importance, numerical): print(f"{name:14s} I = {I:.4f} (finite difference {d:.4f})") .. rst-class:: sphx-glr-script-out .. code-block:: none intake screen I = 0.8252 (finite difference 0.8252) pump I = 0.9077 (finite difference 0.9077) motor I = 0.8422 (finite difference 0.8422) control valve I = 0.8599 (finite difference 0.8599) flow meter I = 0.8211 (finite difference 0.8211) .. GENERATED FROM PYTHON SOURCE LINES 39-43 Spend a fixed improvement on each component in turn --------------------------------------------------- Remove 0.02 of unreliability from one component at a time. .. GENERATED FROM PYTHON SOURCE LINES 43-60 .. code-block:: Python gain = [] for i in range(R.size): better = R.copy() better[i] = min(1.0, better[i] + 0.02) gain.append(series_reliability(*better) - series_reliability(*R)) fig, ax = plt.subplots(figsize=(6.5, 3.5)) ax.bar(names, importance, alpha=0.6, label="Birnbaum importance") ax.plot(names, np.array(gain) / 0.02, "ko", label="gain per unit improvement") ax.set(ylabel="dR_system / dR_i", title=f"System reliability {series_reliability(*R):.4f}") ax.legend() fig.tight_layout() assert np.allclose(importance, numerical) assert names[int(np.argmax(importance))] == "pump" == names[int(np.argmax(gain))] plt.show() .. image-sg:: /api/gallery/reliability/systems/images/sphx_glr_plot_04_birnbaum_importance_001.png :alt: System reliability 0.8170 :srcset: /api/gallery/reliability/systems/images/sphx_glr_plot_04_birnbaum_importance_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.028 seconds) .. _sphx_glr_download_api_gallery_reliability_systems_plot_04_birnbaum_importance.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/systems/plot_04_birnbaum_importance.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_04_birnbaum_importance.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_04_birnbaum_importance.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_04_birnbaum_importance.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_