{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d92fcd40",
   "metadata": {},
   "source": [
    "# General stress strength model"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c66fcc01",
   "metadata": {},
   "source": [
    "<a href=\"../handbook/reliability_prediction/structural_method_input.html?highlight=stress%20strength#stress-strength-methods-for-structural-items\" class=\"back-forward-button\">Go to handbook</a>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5ff83f3e",
   "metadata": {},
   "source": [
    "## Model description\n",
    "\n",
    "The stress strength model is a very general model that can be used to assess the reliability of mechanical components. Typically, the “strength” or resistance $X_{1}$  and the “stress” or load $X_{2}$ are the only two variables considered. The limit state function for this model can be written as follows:\n",
    "\n",
    "$$\n",
    "g\\left( X_1, X_2 \\right) = X_1 - X_2\n",
    "$$\n",
    "\n",
    "A summary of these variables and their meaning is given in {numref}`stress_strength_model_inputs_table`.\n",
    "\n",
    "```{list-table} Input variables for reliability analysis\n",
    ":header-rows: 1\n",
    ":widths: 15 45 20\n",
    ":name: stress_strength_model_inputs_table\n",
    "\n",
    "* - Name\n",
    "  - Description\n",
    "  - Unit\n",
    "* - $X_1$/X_1\n",
    "  - Strength\n",
    "  - same as $X_2$\n",
    "* - $X_2$/X_2\n",
    "  - Stresses\n",
    "  - same as $X_1$\n",
    "* - $\\rho_{X_1,X_2}$/rho_X1_X2\n",
    "  - Correlation between $X_1$ and $X_2$\n",
    "  - $-$\n",
    "```\n",
    "\n",
    "## Interactive reliability prediction\n",
    "\n",
    "This page offers an interactive reliability prediction that lets the user specify the properties of all variables listed in {numref}`stress_strength_model_inputs_table`. The variables are characterized by:\n",
    "- _Distribution_ denoted by \"Dist\" and can be choosen from a set of parametric probability distributions;\n",
    "- _Mean_ value denoted by \"E\" and can be selected with a slider;\n",
    "- _Coefficient of variation_ denoted by \"C.o.V.\" and can be selected with a slider.\n",
    "\n",
    "```{note}\n",
    "To run the interactive reliability prediction on this page, click the {fa}`rocket` --> {guilabel}`Live Code` button on the top of the page. Wait a few seconds until the Kernel has loaded and run the cell below with {guilabel}`Run`.\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f241b1d5-0047-4063-83ac-68b90a366dbf",
   "metadata": {
    "tags": [
     "thebe-init",
     "remove-output"
    ]
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "a44f1b127a524a229fbf4677db77fd21",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "VBox(children=(HBox(children=(VBox(children=(Dropdown(description='Dist X1', layout=Layout(align_items='flex-s…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "b08c253da08b4edb965440ab28cf1169",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Output()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from nrpmint.booktools import stress_strength\n",
    "\n",
    "# start the web user-interface\n",
    "stress_strength.web_ui()"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Tags",
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
