#Given
#Entire area - hallow area
l_e = 60.0 #mm - length of the entire area
b_e = 40 #mm - width of the entire area
l_h = 30 #mm - length of the hallow area
b_h = 20 #mm - width of the hallow area
A_e = l_e*b_e #mm2 - The entire area
A_h = -l_h*b_h #mm2 - The hallow area '-' because its hallow
A_re = A_e + A_h #mm2 resultant area
y_e = l_e/2 # mm com from bottom
y_h = 20+l_h/2 #mm com from bottom
y_com = (A_e*y_e + A_h*y_h)/A_re
#moment of inertia caliculatins - bh3/12 +ad2
I_e = b_e*(l_e**3)/12 + A_e*((y_e-y_com)**2) #Parallel axis theorm
I_h = b_h*(l_h**3)/12 - A_h*((y_h-y_com)**2) #Parallel axis theorm
I_total = I_e - I_h
print "The moment of inertia of total system is ",I_total,"mm4"
#Given
l = 400 #mm - Length
b = 300 #mm - breath
F = 20 #KN _ the force applied on the beam
F_d = 0.75 #KN-m - The force distribution
d = 2 #mt - the point of interest from the free end
#caliculations
#From moment diagram
M = F*d - F_d*d*1
I = b*(l**3)/12 #mm4 - Bending moment diagram
c = l/2 # the stress max at this C
S = I/c #The maximum shear stress
shear_max = M*(10**6)/S #MPA - the maximum stress
print "The maximum stress at 2 mt is",round(shear_max,2),"Mpa"
#Given
#We will divide this into three parts
F = 8 #k - force applied
d = 16 #inch -distance
l_1 = 1 #in
l_2 = 3 #in
b_1 = 4 #in
b_2 = 1 #in
A_1 = l_1* b_1 #in2 - area of part_1
y_1 = 0.5 #in com distance from ab
A_2 =l_2*b_2 #in2 - area of part_1
y_2 = 2.5 #in com distance from ab
A_3 = l_2*b_2 #in2 - area of part_1
y_3 = 2.5 #in com distance from ab
y_net = (A_1*y_1 +A_2*y_2 + A_3*y_3)/(A_1+A_2+A_3) #in - The com of the whole system
c_max = (4-y_net) #in - The maximum distace from com to end
c_min = y_net #in - the minimum distance from com to end
I_1 = b_1*(l_1**3)/12 + A_1*((y_1-y_net)**2) #Parallel axis theorm
I_2 = b_2*(l_2**3)/12 + A_2*((y_2-y_net)**2)
I_3 = b_2*(l_2**3)/12 + A_2*((y_2-y_net)**2)
I_net = I_1 + I_2 + I_3 #in4 - the total moment of inertia
M_c = F*d*c_max
stress_cmax = M_c/I_net #Ksi - The maximum compressive stress
M_t= F*d*c_min
stress_tmax = M_t/I_net #Ksi - The maximum tensile stress
print "The maximum tensile stress",stress_tmax ,"Ksi"
print "The maximum compressive stress",round(stress_cmax,1) ,"Ksi"
#Given
#Given
#We will divide this into two parts
E_w = 10.0 #Gpa - Youngs modulus of wood
E_s = 200.0 #Gpa - Youngs modulus of steel
M = 30.0 #K.N-m _ applied bending moment
n = E_s/E_w
l_1 = 250 #mm
l_2 = 10 #mm
b_1 = 150.0 #mm
b_2 = 150.0*n #mm
A_1 = l_1* b_1 #mm2 - area of part_1
y_1 = 125.0 #mm com distance from top
A_2 =l_2*b_2 #mm2 - area of part_1
y_2 = 255.0 #mm com distance from top
y_net = (A_1*y_1 +A_2*y_2)/(A_1+A_2) #mm - The com of the whole system from top
I_1 = b_1*(l_1**3)/12.0 + A_1*((y_1-y_net)**2) #Parallel axis theorm
I_2 = b_2*(l_2**3)/12.0 + A_2*((y_2-y_net)**2)
I_net = I_1 + I_2 #mm4 - the total moment of inertia
c_s= y_net # The maximum distance in steel
stress_steel = M*(10.0**6)*c_s/I_net #Mpa - The maximum stress in steel
c_w= l_1+l_2-y_net # The maximum distance in wood
stress_wood = n*M*(10.0**6)*c_w/I_net #MPa - The maximum stress in wood
print "The maximum stress in steel ",round(stress_steel,2) ,"Mpa"
print "The maximum stress in wood",round(stress_wood,2) ,"Mpa"
#Given
M = 50000 #ft-lb , positive bending moment applied
N = 9 # number of steel bars
n = 15 # The ratio of steel to concrete
A_s = 30 #in2 area of steel in concrete
#(10*y)*(y/2) = 30*(20-y)
#y**2 + 6*y -120
#solving quadractic equation
import math
a = 1
b = 6
c = -120
# calculate the discriminant
d = (b**2) - (4*a*c)
# find two solutions
sol1 = (-b-math.sqrt(d))/(2*a)
sol2 = (-b+math.sqrt(d))/(2*a)
y = sol2 # Nuetral axis is found
l_1 = y #in- the concrete below nuetral axis is not considered
b_1 = 10 #in - width
A_1 = l_1* b_1 #in2 - area of concrete
y_1 = y/2 #in com of the concrete
y_2 = 20-y #in com of the transformed steel
I_1 = b_1*(l_1**3)/12.0 + A_1*((y_1-y)**2) #in4 parallel axis theorm
I_2 = A_s*((y_2)**2) #in4 first part is neglected
I_net = I_1 + I_2 #in4 - the total moment of inertia
c_c= y #in The maximum distance in concrete
stress_concrete = M*12*c_c/I_net #psi - The maximum stress in concrete
c_s= 20- y
stress_steel =n*M*12*c_s/I_net #psi - The maximum stress in concrete
print "The maximum stress in concrete ",round(stress_concrete,2) ,"psi"
print "The stress in steel",round(stress_steel,2) ,"psi"
#Given
l = 50.0 #mm - the length of the beam
b = 50.0 #mm - the width of the beam
M = 2083 #Nm
A = l*b #mm2 - The area
#straight beam
I = b*(l**3)/12.0 #mm4 - The moment of inertia of the beam
c_1= l/2 # the distance where the stress is maximum
c_2 = -l/2 # the distance where the stress is maximum
s_1 = I/c_1
s_2 = I/c_2
stress_max_1 = M*(10**3)/s_1 #Mpa - the maximum strss recorded in the crossection
stress_max_2 = M*(10**3)/s_2 #Mpa - the maximum strss recorded in the crossection
print "The maximum stress upward in straight case is",stress_max_1,"Mpa"
print "The maximum stress downward in straight case is",stress_max_2,"Mpa"
#curved beam
import math
r = 250.0 #mm Radius of beam curved
r_0 = r - l/2 # inner radius
r_1 = r + l/2 # outer radius
R = l/(math.log(r_1/r_0)) #mm
e = r - R
stressr_max_1 = M*(10**3)*(R-r_0)/(r_0*A*e)
stressr_max_2 = M*(10**3)*(R-r_1)/(r_1*A*e)
print "The maximum stress upward in curved case is",stressr_max_1,"Mpa"
print "The maximum stress downward in curved case is",stressr_max_2,"Mpa"
#curved beam _2
import math
r = 75.0 #mm Radius of beam curved
r_0 = r - l/2 # inner radius
r_1 = r + l/2 # outer radius
R = l/(math.log(r_1/r_0)) #mm
e = r - R
stressr_max_1 = M*(10**3)*(R-r_0)/(r_0*A*e)
stressr_max_2 = M*(10**3)*(R-r_1)/(r_1*A*e)
print "The maximum stress upward in curved case2 is",stressr_max_1,"Mpa"
print "The maximum stress downward in curved case2 is",stressr_max_2,"Mpa"
#given
#from example 6.9
St_ul = 2500 #psi - ultimate strength
st_yl = 40000 #psi _ yielding strength
b = 10 #in - width from example
A = 2 #in2 The area of the steel
d = 20
t_ul = st_yl*A #ultimate capasity
y = t_ul/(St_ul*b*0.85) #in 0.85 because its customary
M_ul = t_ul*(d-y/2)/12 #ft-lb Plastic moment
print "The plastic moment of the system is ",M_ul,"ft-lb"
#Given
#From example 5.8
W = 4.0 #N/m - The force distribution
L = 3 # m - The length of the force applied
M = W*L/8.0 # KN.m The moment due to force distribution
o = 30 # the angle of force applid to horizantal
l = 150.0 #mm length of the crossection
b = 100.0 #mm - width of the crossection
import math
M_z = M*(math.cos(3.14/6))
M_y = M*(math.sin(math.pi/6))
I_z = b*(l**3)/12.0
I_y = l*(b**3)/12.0
#tanb = I_z /I_y *tan30
b = math.atan(math.radians(I_z*math.tan(3.14/6.0)/I_y ))
print "The angle at which nuetral axis locates is",b,"radians"
import math
M = 10 #KN.m - The moment applied
I_max = 23.95*(10**6) #mm4 - I_z The moment of inertia
I_min = 2.53*(10**6) #mm4 - I_y The moment of inertia
o = 14.34 # degress the principle axis rotated
#Coponents of M in Y,Z direction
M_z = M*(10**6)*math.cos(math.radians(o))
M_y = M*(10**6)*math.sin(math.radians(o))
#tanb = I_z /I_y *tan14.34
b = math.atan((I_max*math.tan(math.radians(o))/I_min ))
B = math.degrees(b)
y_p = 122.9 # mm - principle axis Y cordinate
z_p = -26.95 #mm - principle axis z cordinate
stress_B = - M_z*y_p/I_max + M_y*z_p/I_min #Mpa - Maximum tensile stress
y_f = -65.97 # mm - principle axis Y cordinate
z_f = 41.93 #mm - principle axis z cordinate
stress_f = - M_z*y_f/I_max + M_y*z_f/I_min #Mpa - Maximum compressive stress
print "The maximum tensile stress",round(stress_B,2) ,"Mpa"
print "The maximum compressive stress",round(stress_f,2),"Mpa"
l = 50 #mm - The length of the beam
b = 50 #mm - The width of the beam
A = l*b #mm2 - The area of the beam
p = 8.33 #KN - The force applied on the beam
stress_max = p*(10**3)/A #Mpa After cutting section A--b
print "The maximum stress in the beam",stress_max ,"Mpa "
import math
M = 10 #KN.m - The moment applied
I_max = 23.95*(10**6) #mm4 - I_z The moment of inertia
I_min = 2.53*(10**6) #mm4 - I_y The moment of inertia
o = 14.34 # degress the principle axis rotated
#Coponents of M in Y,Z direction
M_z = M*(10**6)*math.cos(math.radians(o))
M_y = M*(10**6)*math.sin(math.radians(o))
#tanb = I_z /I_y *tan14.34
b = math.atan((I_max*math.tan(math.radians(o))/I_min ))
B = math.degrees(b)
y_p = 122.9 # mm - principle axis Y cordinate
z_p = -26.95 #mm - principle axis z cordinate
stress_B = - M_z*y_p/I_max + M_y*z_p/I_min #Mpa - Maximum tensile stress
y_f = -65.97 # mm - principle axis Y cordinate
z_f = 41.93 #mm - principle axis z cordinate
stress_f = - M_z*y_f/I_max + M_y*z_f/I_min #Mpa - Maximum compressive stress
#location of nuetral axis To show these stresses are max and minimum
#tanB = MzI_z + MzI_yz/MyI_y +M_YI_yz
I_z = 22.64 *(10**6) #mm4 moment of inertia in Z direction
I_y = 3.84 *(10**6) #mm4 moment of inertia in Y direction
I_yz =5.14 *(10**6) #mm4 moment of inertia in YZ direction
M_y = M #KN.m bending moment in Y dorection
M_z = M #KN.m bending moment in Y dorection
B = math.atan(( M_z*I_yz)/(M_z*I_y )) #radians location on neutral axis
beta = math.degrees(B)
print "By sketching the line with angle",round(beta,1),"degrees The farthest point associated with B and F"