{
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  },
  "name": "",
  "signature": "sha256:5ef00909be24a2b4d65cd7f64da2e07a8b79e5ac34c1eea3e4cbb11c87e75590"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Stress, Axial loads and Safety concepts"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1 page number 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "import math\n",
      "d_bolt = 20.0       #mm,diameter,This is not the minimum area\n",
      "d_bolt_min = 16.0   #mm This is at the roots of the thread \n",
      "#This yealds maximum stress \n",
      "A_crossection = (math.pi)*(d_bolt**2)/4         #mm*2\n",
      "A_crossection_min = (math.pi)*(d_bolt_min**2)/4 #mm*2 ,This is minimum area which yeilds maximum stress\n",
      "load = 10.0 #KN\n",
      "BC = 1.0    #m\n",
      "CF = 2.5    #m\n",
      "contact_area = 200*200  # mm*2 , The contact area at c\n",
      "\n",
      "#caliculations \n",
      "#Balancing forces in the x direction:\n",
      "# Balncing the moments about C and B:\n",
      "Fx = 0 \n",
      "R_cy = load*(BC+CF)   #KN , Reaction at C in y-direction\n",
      "R_by = load*(CF)      #KN , Reaction at B in y-direction\n",
      "#Because of 2 bolts\n",
      "stress_max = (R_by/(2*A_crossection_min))*(10**3)  # MPA,maximum stess records at minimum area\n",
      "stress_shank = (R_by/(2*A_crossection))*(10**3)    # MPA\n",
      "Bearing_stress_c = (R_cy/contact_area)*(10**3)     #MPA, Bearing stress at C\n",
      "\n",
      "print\"The bearing stress at C  is  \",(Bearing_stress_c) ,\"MPA\"\n",
      "print\"The maximum normal stress in BD bolt is: \",round(stress_max),\"MPA\"\n",
      "print\"The tensile strss at shank of the bolt is: \",round(stress_shank),\"MPA\"\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The bearing stress at C  is   0.875 MPA\n",
        "The maximum normal stress in BD bolt is:  62.0 MPA\n",
        "The tensile strss at shank of the bolt is:  40.0 MPA\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2 page number 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "load_distributed = 20 #KN/m*2, This is the load distributed over the pier\n",
      "H = 2          # m, Total height \n",
      "h = 1          #m , point of investigation \n",
      "base = 1.5     #m The length of crossection in side veiw \n",
      "top = 0.5      #m ,The length where load is distributed on top\n",
      "base_inv = 1   #m , the length at the point of investigation \n",
      "area = 0.5*1   #m ,The length at a-a crossection \n",
      "density_conc = 25 #KN/m*2\n",
      "#caliculation of total weight \n",
      "\n",
      "v_total = ((top+base)/2)*top*H       #m*2 ,The total volume \n",
      "w_total = v_total* density_conc  #KN , The total weight\n",
      "R_top = (top**2)*load_distributed    #KN , THe reaction force due to load distribution \n",
      "reaction_net = w_total + R_top\n",
      "\n",
      "#caliculation of State of stress at 1m \n",
      "v_inv = ((top+base_inv)/2)*top*h    #m*2 ,The total volume from 1m to top\n",
      "w_inv = v_inv*density_conc          #KN , The total weight from 1m to top\n",
      "reaction_net = w_inv + R_top        #KN\n",
      "Stress = reaction_net/area           #KN/m*2\n",
      "print\"The total weight of pier is\",w_total,\"KN\"\n",
      "print\"The stress at 1 m above is\",Stress,\"MPA\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total weightof pier:  25.0 KN\n",
        "The stress at 1 m above is   28.75 MPA\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3 page number 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "from math import pow\n",
      "d_pins = 0.375 #inch\n",
      "load = 3      #Kips\n",
      "AB_x = 6      #inch,X-component\n",
      "AB_y = 3      #inch,Y-component  \n",
      "BC_y = 6      #inch,Y-component\n",
      "BC_x = 6      #inch,X-component\n",
      "area_AB = 0.25*0.5                #inch*2 \n",
      "area_net = 0.20*2*(0.875-0.375) #inch*2 \n",
      "area_BC = 0.875*0.25              #inch*2 \n",
      "area_pin = d_pins*2*0.20           #inch*2 \n",
      "area_pin_crossection = 3.14*((d_pins/2)**2)\n",
      "#caliculations\n",
      "\n",
      "slope = AB_y/ AB_x   #For AB\n",
      "slope =  BC_y/ BC_x  #For BC\n",
      "\n",
      "#momentum at point C:\n",
      "F_A_x = (load*AB_x )/(BC_y + AB_y ) #Kips, F_A_x X-component of F_A\n",
      "\n",
      "#momentum at point A:\n",
      "F_C_x = -(load*BC_x)/(BC_y + AB_y ) #Kips, F_C_x X-component of F_c\n",
      "\n",
      "#X,Y components of F_A\n",
      "F_A= (pow(5,0.5)/2)*F_A_x  #Kips\n",
      "F_A_y = 0.5*F_A_x          #Kips\n",
      "\n",
      "#X,Y components of F_C  \n",
      "F_C= pow(2,0.5)*F_C_x    #Kips\n",
      "F_C_y = F_C_x            #Kips\n",
      "\n",
      "T_stress_AB = F_A/area_AB                 #Ksi , Tensile stress in main bar AB\n",
      "stress_clevis = F_A/area_net              #Ksi ,Tensile stress in clevis of main bar AB\n",
      "c_strees_BC = F_C/area_BC                 #Ksi , Comprensive stress in main bar BC\n",
      "B_stress_pin = F_C/area_pin               #Ksi , Bearing stress in pin at C\n",
      "To_stress_pin =  F_C/area_pin_crossection #Ksi , torsion stress in pin at C\n",
      "\n",
      "print\"Tensile stress in main bar AB:\",round(T_stress_AB,2),\"Ksi\"\n",
      "print\"Tensile stress in clevis of main bar AB:\",round(stress_clevis,2),\"Ksi\"\n",
      "print\"Comprensive stress in main bar BC:\",round(-c_strees_BC,2),\"Ksi\"\n",
      "print\"Bearing stress in pin at C:\",round(-B_stress_pin,2),\"Ksi\"\n",
      "print\"torsion stress in pin at C:\",round(To_stress_pin,2),\"Ksi\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Tensile stress in main bar AB: 17.89 Ksi\n",
        "Tensile stress in clevis of main bar AB: 11.18 Ksi\n",
        "Comprensive stress in main bar BC: 12.93 Ksi\n",
        "Bearing stress in pin at C: 18.86 Ksi\n",
        "torsion stress in pin at C: -25.62 Ksi\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4 page number 38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "strength_steel = 120 #Ksi\n",
      "factor = 2.5\n",
      "F_C =   2.23 #Ksi\n",
      "\n",
      "#caliculations\n",
      "\n",
      "stress_allow = strength_steel/factor #Ksi\n",
      "A_net = F_C/strength_steel           #in*2 , \n",
      "#lets adopt 0.20x0.25 in*2 and check wether we are correct or not? \n",
      "\n",
      "A_net_assumption = 0.25*0.20            #in*2 , this is assumed area which is near to A_net\n",
      "stress = 2.23/A_net_assumption          #Ksi\n",
      "factor_assumed = strength_steel/stress \n",
      "\n",
      "if factor_assumed > factor :\n",
      "    print \"The factor\",factor,\"is less than assumed factor\",round(factor_assumed,1),\"so this can be considered\"\n",
      "else:\n",
      "    print \"The assumed factor\",factor, \"is more than assumed factor\",factor_assumed,\"factor_assumed\"\n",
      " \n",
      "    \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The factor 2.5 is less than assumed factor 2.7 so this can be considered\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6 page number 35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "mass = 5       #Kg\n",
      "frequency = 10 #Hz\n",
      "stress_allow = 200 #MPa\n",
      "R = 0.5        #m\n",
      "\n",
      "#caliculations \n",
      "from math import pi\n",
      "w = 2*pi*frequency #rad/sec\n",
      "a = (w**2)*R       #m*2/sec\n",
      "F = mass*a         #N\n",
      "A_req = F/stress_allow  #m*2 , The required area for aloowing stress\n",
      "print\"The required size of rod is:\",round(A_req,2),\"m*2\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The required size of rod is: 49.35 m*2\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7 page number 45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "D_n = 5.0           #kips, dead load\n",
      "L_n_1 = 1.0         #kips ,live load 1\n",
      "L_n_2 = 15          #kips ,live load 2\n",
      "stress_allow = 22   #ksi\n",
      "phi = 0.9           #probalistic coefficients\n",
      "y_stress = 36       #ksi,Yeild strength\n",
      "#According to AISR \n",
      "\n",
      "#a\n",
      "p_1 = D_n + L_n_1 #kips since the total load is sum of dead load and live load\n",
      "p_2 = D_n + L_n_2 #kips, For second live load\n",
      "\n",
      "Area_1 = p_1/stress_allow  #in*2 ,the allowable area for the allowed stress\n",
      "Area_2 = p_2/stress_allow  #in*2\n",
      "print \"the allowable area for live load\",L_n_1,\"is\",round(Area_1,3),\"in*2\"\n",
      "print \"the allowable area for live load\",L_n_2,\"is\",round(Area_2,3),\"in*2\"\n",
      "\n",
      "#b\n",
      "#area_crossection= (1.2*D_n +1.6L_n)/(phi*y_stress)\n",
      "\n",
      "area_crossection_1= (1.2*D_n +1.6*L_n_1)/(phi*y_stress) #in*2,crossection area for first live load\n",
      "area_crossection_2= (1.2*D_n +1.6*L_n_2)/(phi*y_stress) #in*2,crossection area for second live load\n",
      "print \"the crossection area for live load\",L_n_1,\"is\",round(area_crossection_1,3),\"in*2\"\n",
      "print \"the crossection area for live load\",L_n_2,\"is\",round(area_crossection_2,3),\"in*2\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the allowable area for live load 1.0 is 0.273 in*2\n",
        "the allowable area for live load 15 is 0.909 in*2\n",
        "the crossection area for live load 1.0 is 0.235 in*2\n",
        "the crossection area for live load 15 is 0.926 in*2\n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.8 page number 51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "A_angle = 2              #in*2 \n",
      "stress_allow = 20        #ksi, The maximum alowable stress\n",
      "F = stress_allow*A_angle #K, The maximum force\n",
      "AD = 3                   #in, from the figure\n",
      "DC = 1.06                #in, from the figure\n",
      "strength_AWS = 5.56 # kips/in,Allowable strength according to AWS\n",
      "\n",
      "#caliculations \n",
      "#momentum at point \"d\" is equal to 0\n",
      "R_1 = (F*DC)/AD      #k,Resultant force developed by the weld\n",
      "R_2 = (F*(AD-DC))/AD #k,Resultant force developed by the weld\n",
      "\n",
      "l_1 = R_1/strength_AWS #in,Length of the Weld 1\n",
      "l_2 = R_2/strength_AWS #in,Length of the Weld 2\n",
      "       \n",
      "print \"Length of the Weld 1:\",round(l_1,2),\"in\"\n",
      "print \"Length of the Weld 2:\",round(l_2,2),\"in\"      \n",
      "       \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Length of the Weld 1: 2.54 in\n",
        "Length of the Weld 2: 4.65 in\n"
       ]
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "code",
     "collapsed": true,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "ename": "IOError",
       "evalue": "[Errno 2] No such file or directory: 'arr'",
       "output_type": "pyerr",
       "traceback": [
        "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIOError\u001b[0m                                   Traceback (most recent call last)",
        "\u001b[1;32m<ipython-input-1-7d69e32f0cee>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mload\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'arr'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
        "\u001b[1;32mC:\\Users\\Kowshik\\AppData\\Local\\Enthought\\Canopy\\User\\lib\\site-packages\\numpy\\lib\\npyio.pyc\u001b[0m in \u001b[0;36mload\u001b[1;34m(file, mmap_mode)\u001b[0m\n\u001b[0;32m    367\u001b[0m     \u001b[0mown_fid\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mFalse\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    368\u001b[0m     \u001b[1;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfile\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mbasestring\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 369\u001b[1;33m         \u001b[0mfid\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfile\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"rb\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    370\u001b[0m         \u001b[0mown_fid\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mTrue\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    371\u001b[0m     \u001b[1;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfile\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mgzip\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mGzipFile\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
        "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'arr'"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}