import math
import matplotlib.pyplot as plt
#Variable Decleration
b=0.12 #Breadth of the CS of the beam in m
h=0.2 #Depth of the CS of the beam in m
BM_max=16*10**3 #Maximum Bending Moment in N.m
c=0.1 #Distance of the centroid of the CS from the bottom fibre in m
y1=0.025 #Distance in m
BM=9.28*10**3 #Bending Moment in kN.m
#Calculations
#Preliminary Calculations
I=b*h**3*12**-1 #Moment of Inertia in m^4
#Part 1
sigma_max=(BM_max*c)/(I) #Maximum bending stress in the beam in Pa
#Part 2
#Plot variables
x_plot=[0.00000001,c,c+0.000000011,c+c]
y_plot=[sigma_max,0,0,sigma_max]
#Part 3
y=h*0.5-y1 #Distance of point at which BM is 9.8kN.m
sigma=(BM*y)/I #Bending Stress in Pa
#Result
print "The Bending Stress at maximum Bending Moment in the beam is",sigma_max*10**-6,"MPa"
print "The Bending Stress in part 3 is",-sigma*10**-6,"MPa"
print "The plot for stress distribution is given below"
plt.plot(y_plot,x_plot)
plt.ylabel("Distance from top fibre in m")
plt.xlabel("Stress in MPa")
plt.show()
import math
#Variable Decleration
wf=6 #Width of the top flange in inches
df=0.8 #Depth of the top flange in inches
dw=8 #Depth of the web portion in inches
ww=0.8 #Width of the web portion in inches
Ra=1600 #Reation at point A in lb
Rb=3400 #Reaction at point B in lb
w=400 #Load on the beam in lb/ft
M_4=3200 #Moment at x=4 ft in lb.ft
M_10=4000 #Moment at x=10 ft in lb.ft
#Calculations
#Preliminary Calculations
#Area computation
A1=dw*ww #Area of the web portion in sq.in
A2=wf*df #Area of the top flange in sq.in
y1=dw*0.5 #Centroid from the bottom of the web portion in inches
y2=dw+df*0.5 #Centroid from the bottom of the flange portion in inches
#y_bar computation
y_bar=(A1*y1+A2*y2)/(A1+A2) #centroid of the section in inches from the bottom
#Moment of Inertia computation
I=(ww*dw**3*12**-1)+(A1*(y1-y_bar)**2)+(wf*df**3*12**-1)+(A2*(y2-y_bar)**2) #Moment of inertia in in^4
#Maximum Bending Moment
c_top=dw+df-y_bar #distance of top fibre in inches
c_bot=y_bar #Distance of bottom fibre in inches
#Stress at x=4 ft
sigma_top=-(12*M_4*c_top)*I**-1 #Stress at top fibre in psi
sigma_bot=12*M_4*c_bot*I**-1 #Stress at bottom fibre in psi
#Stress at x=10 ft
sigma_top2=M_10*12*c_top*I**-1 #Stress at the top fibre in psi
sigma_bot2=-M_10*12*c_bot*I**-1 #Stress at the bottom fibre in psi
#Maximum values
sigma_t=max(sigma_bot,sigma_bot2,sigma_top,sigma_top2) #Maximum values for stress in tension
sigma_c=min(sigma_top,sigma_top2,sigma_bot,sigma_bot2) #Maximum values for stress in compression
#Result
print "The maximum values of stress are"
print "Maximum Tension=",round(sigma_t),"psi at x=4ft"
print "Maximum Compression=",round(-sigma_c),"psi at x=10ft"
#NOTE:Answer is differing becuase of the decimal accuracy
import math
#Variable Decleration
L=4 #Length of each section in ft
h_ab=4 #Thickness of the front section in inches
h_bd=6 #Thickness of the back section in inches
P=2000 #Point load acting at point A in lb
M_B=8000 #Moment at 4ft in lb.ft
M_D=16000 #Moment at x=8ft in lb.ft
b=2 #Breadth in inches
#Calculations
S_ab=b*h_ab**2*6**-1 #Sectional Modulus of section AB in in^3
S_bd=b*h_bd**2*6**-1 #Sectional Modulus of section BD in in^3
sigma_B=12*M_B*S_ab**-1 #Maximum bending stress in psi
sigma_D=12*M_D*S_bd**-1 #Maximum bending stress in psi
#Maximum stress
sigma_max=max(sigma_B,sigma_D) #Maximum stress in psi
#Result
print "Comparing the two results we find that the maximum stress is"
print "Sigma_max=",round(sigma_max),"psi"
import math
#Variable Decleration
M=15000 #Maximum bending moment in absolute values in lb.ft
S=42 #Sectional Modulus in in^3
#Calculations
sigma_max=M*12*S**-1 #Maximum stress in the section in psi
#Result
print "The maximum Bending Stress in the section is",round(sigma_max),"psi"
#NOTE:The answer differs due to decimal point accuracy
import math
#Variable Decleration
M_max=60*10**3 #Maximum Bending Moment in kN.m
sigma_w=120*10**6 #Maximum Bending Stress allowed in Pa
M_max_2=61.52*10**3 #max bending moment computed in N.m
#Section details
mass=38.7 #Mass in kg/m
g=9.81 #Acceleration due to gravity in m/s^2
S=549*10**3 #Sectional modulus of the section in mm^3
#Calculations
S_min=M_max*sigma_w**-1*10**9 #Minimum Sectional Modulus required in mm^3
#We selecet section W310x39
w0=mass*g*10**-3 #Weight of the beam in kN/m
sigma_max=M_max_2*S**-1*10**3 #Maximum stress in MPa
#Result
print "The section chosen is W310x39 with maximum stress as",round(sigma_max,1),"MPa"
import math
#Variable Decleration
V_max=24 #Maximum Shear in kN
b=0.160 #Width of the beam in m
h=0.240 #Depth of the beam in m
#Calculations
I=b*h**3*12**-1 #Moment of Inertia of the beam in m^4
#Part 1
Q=b*(h*3**-1)**2 #First moment of Area m^3
tau_max=(V_max*Q)*(I*b)**-1 #Maximum Shear Stress in glue in kPa
#Part 2
tau_max_2=(3.0/2.0)*(V_max/(b*h)) #Shear Stress in kPa
Q_1=b*h*0.5*h*0.25 #First moment about NA in m^3
tau_maxx=(V_max*Q_1)/(I*b) #Shear stress in kPa
#Result
print "The Results agree in both parts"
print "The maximum stress is", round(tau_max_2),"kPa"
import math
#Variable Decleration
I=310 #Moment of inertia in in^4
V=160 #Shear Force in kips
#Dimension defination
tf=0.515 #Thickness of flange in inches
de=11.94 #Effective depth in inches
tw=0.295 #Thickness of web in inches
wf=8.005 #Width of lange in inches
#Calculations
#Part 1
Q=wf*tf*(de-tf)*0.5 #First moment about NA in inch^3
tau_min=(V*Q*10**2)/(I*tw) #Minimum shear stress in web in psi
#Part 2
A_2=(de*0.5-tf)*tw #Area in in^3
y_bar_2=0.5*(de*0.5-tf) #Depth in inches
Q_2=Q+A_2*y_bar_2 #First Moment in inches^3
tau_max=(V*Q_2*10**2)/(I*tw) #Maximum Shear Stress in psi
#Part 3
V_web=10.91*tw*(tau_min+((2*3**-1)*(tau_max-tau_min))) #Shear in the web in lb
perV=(V_web/V)*100 #Percentage shear force in web in %
t_max_final=V*10**3/(10.91*tw)
#result
print "The final shear stress in the web portion is",round(t_max_final),"psi"
#NOTE:Answer differs due to deciaml point accuracy
import math
#Variable Decleration
I=547 #Moment of inertia in inches^4
d=8.9 #NA deoth in inches
V=12 #Shear Force in kips
h=7.3 #Depth of NA
b=2 #Width in inches
t=1.2 #Thickness in inches
h2=7.5 #Depth in inches
#Calculations
#Shear Stress at NA
Q=(b*h)*(h*0.5) #First Moment about NA in in^3
tau=(V*10**3*Q)/(I*b) #Shear stress at NA in psi
#Shear Stress at a-a
Q_1=(t*h2)*(d-h2*0.5) #First moment about NA in in^3
tau1=(V*Q_1)/(I*t) #Shear Stress in psi
#Result
print "Comparing two stresses"
print "The maximum stress is",round(max(tau,tau1)),"psi"
import math
#Variable Decleration
sigma_w=1000 #Working Stress in Bending in psi
tau_w=100 #Working stress in shear in psi
#Dimensions
b_out=8 #Width in inches
h=10 #Depth in inches
b_in=6 #Width in inches
#Calculations
I=((b_out*h**3)-(b_in*b_out**3))*12**-1 #Moment of inertia in in^4
#Design for shear
Q=(b_out*h*0.5*0.25*h)-(b_in*b_out*0.5*0.25*b_out) #First Moment about NA in in^3
#Largest P
P=(tau_w*I*2)/(1.5*Q) #P in shear in lb
#Design for bending
P1=(sigma_w*I)/(60*5) #P in bending in lb
#Result
print "The maximum allowable P value is",round(min(P,P1)),"lb"
import math
#Variable Decleration
A=2630 #Area in mm^2
y_bar=536.6 #Neutral Axis depth from top in mm
tau_w=100 #Allowable stress in MPa
sigma_b_w=280 #Allowable bending stress in MPa
d=0.019 #Diameter of the rivet in m
t_web=0.01 #Thickness of the web in m
I=4140 #Moment of inertia in m^4
V=450 #Max shear allowable in kN
#Calculations
Q=A*y_bar #first moment in mm^3
Fw=(pi*d**2)*tau_w*10**6 #Allowable force in N
Fw_2=d*t_web*sigma_b_w*10**6*0.5 #Allowable force in N
e=Fw_2*I*(V*10**3*Q*10**-3)**-1 #Allowable spacing in m
#Result
print "The maximum spacing allowed is",round(e*1000,1),"mm"