import math
print('MACHINE DESIGN \n Timothy H. Wentzell, P.E. \n EXAMPLE-4.1 Page 66 ')
D=2.; ##[in] Dia. of short column
F=10000.; ##[lb] Load applied
L=15.; ##[in] Length of column
e=2.; ##[in] Offset of load
A=(math.pi*D**2)/4.; ##[in^2] Area of cross section of column
SA=F/A; ##[lb/in^2] Axial Stress
Z=(math.pi*D**3)/32.; ##[in^4] Section modulus for bending
M=F*e; ##[lb*in] Bending moment
SB=M/Z; ##[lb/in^2] Bemding stress
S=-SA-SB; ##S=(+-)SA+(+-)SB Max. stress
##The bending stress and axial stress are added on inner side of column
print'%s %.2f %s '%('\n\n Maximum stress in column is ',S,' lb/in^2.\n')
import math
print('MACHINE DESIGN \n Timothy H. Wentzell, P.E. \n EXAMPLE-4.2 Page 67 ')
F1=800.; ##[lb] Vertical force
F2=600.; ##[lb] Horizontal force
D=0.5; ##[in] Pin diameter
A=(math.pi*D**2)/4.; ##[in^2] Area of cross section of pin
F=math.sqrt(F1**2+F2**2); ##[lb] Resultant force on pin
S=F/A; ##[lb/in^2] Shear stress in pin
##If forces were not perpendicular, they would be added vectorially.
print'%s %.2f %s '%('\n\n Shear stress in pin is ',S,' lb/in^2.');
import math
print('MACHINE DESIGN\n Timothy H. Wentzell, P.E.\n Example 4.3 Page no 68');
P=50.; ##[hp] Power transmitted
N=300.; ##[rpm] Speed
D=10.; ##[in] Effective pitch diameter of sprocket
d=1.; ##[in] Diameter of shaft from figure 4.3
Z=(math.pi*d**3)/16.; ##[in^3] Section modulus of shaft
A=(math.pi*d**2)/4.; ##[in^2] Area of cross section
T=(63000./N)*P; ##[lb*in] Torque required to transmit power
F=T/(D/2.); ##[lb] Driving force in chain
Ss=F/A; ##[lb/in^2] Shear stress in shaft
St=T/Z; ##[lb/in^2] Torsional stress in shaft
S=Ss+St; ##[lb/in^2] Resultant stress
##Note-There is mistake in addition of Ss and St.
##This value would be compared to shear stress allowable for shaft material
print'%s %.2f %s '%('\n\n The combined stress in 1 inch diameter shaft is ',S,' lb/in^2.');
import math
print('MACHINE DESIGN\n Timothy H. Wentzell, P.E.\n Example 4.4 Page no 71')
P=20.; ##[hp] Power transmitted by chain drive
n=500.; ##[rpm] speed
d=8.; ##[in] Pitch diameter of sprocket
fos=2.;
D=1.25; ##[in] Diameter of shaft
L=12.; ##[in] Distance between two supporting bearings
Z1=math.pi*D**3/16.; ##[in^3] Section modulus for torsion
Z2=math.pi*D**3/32.; ##[in^3] Section modulus for bending
T=63000.*P/n; ##[in*lb] Torque on shaft
F=T/(d/2.); ##[lb] Force in chain
M=F*L/4.; ##[in*lb] Bending moment in shaft
Ss=T/Z1; ##[lb/in^2] Torsional shear stress
Sb=M/Z2; ##[lb/in^2] Bending normal stress
##Note- In the book Sb=9860 lb/in^2 is used instead of Sb=9856.7075 lb/in^2
S=(Sb/2.)+math.sqrt(Ss**2.+(Sb/2.)**2); ##[lb/in^2] Combined max. stress
Sy=30000.; ##[lb/in^2]From APPENDIX 4 Page no-470 for AISI 1020 and Hot-rolled steel
FOS=(Sy/2.)/S; ##[]Actual factor of safty
if S < Sy/2.: ##Strength is greater than combined stress so design is safe
print'%s %.2f %s '%('\n\n Design is acceptable and Combined stress is ',S,' lb/in^2');
else:
print('\n\n Design is not acceptable');