from math import sqrt, pi, atan, acos, cos
d=40#
r=d/2#
P=6*10**3#
N=350#
sigyt=380#
A=pi*12**2/2#
theta=pi-(2*atan(4/12))#
alpha=180-(theta*pi/180)#
l=2*12*cos(19.5*pi/180)#
A1=l*4/2#
Abcd=(A*141/180)-A1#
A2=A-Abcd#
A3=8*l#
w=2*pi*N/60#
T=P/w#
Pt=T*10**3/r#
sigb=Pt/A2#
#Let shear stress developed in key Tk
Tk=Pt/A3#
FOS1=sigyt/sigb#
FOS2=0.577*sigyt/Tk#
print " FOS1 is %0.3f "%(FOS1)#
print "\n FOS2 is %0.2f "%(FOS2)#
from math import sqrt, pi
n=12#
phi=360*pi/(180*12*2)#
R1=45/2#
R2=50/2#
l=60#
Rm=(R1+R2)/2#
p=6.5#
Pn=(R2-R1)*l*p#
T=Pn*Rm#
T=T*n#
N=400#
w=2*pi*N/60#
P=T*w#
A=(pi*R1*l)/n#
Ts=Pn/A#
Ah=(pi*R2*l)/n#
Th=Pn/Ah#
print " Ts is %0.2f N/mm**2 "%(Ts)#
print "\n Th is %0.2f N/mm**2 "%(Th)#
from math import sqrt, pi
N=360#
w=2*pi*N/60#
sigyt=380#
r=25#
P=40*10**3#
FOS=3#
T=P/w#
Pt=T*10**3/(2*r)#
siga=380/3#
Ta=0.577*380/3#
l1=Pt/(sqrt(2)*12*Ta)#
l2=Pt*sqrt(2)/(siga*12)#
print " l1 is %0.0f mm "%(l1)#
print "\n l2 is %0.2f mm "%(l2)#
from math import sqrt, pi
N=300#
w=2*pi*N/60#
P=12*10**3#
Ks=1.25#
Pd=P*Ks#
T=Pd/w#
Tas=50#
d=16*T*10**3/(pi*Tas)#
d=d**(1/3)#
d=40#
Ts=10#
d1=(2*d)+13#
x=(d1**4-d**4)/d1#
#Let the shear stress in the key be Tsh
Tsh=T*10**3*16/(pi*x)#
l=3.5*d#
Ft=T*2*10**3/d#
l1=70#
sigak=50#
b=Ft/(l1*sigak)#
t=2*Ft/(100*l1)#
print " d is %0.0f mm "%(d)#
print "\n Tsh is %0.2f MPa "%(Tsh)#
print "\n b is %0.0f mm "%(b)#
print "\n t is %0.0f mm "%(t)#
from math import sqrt, pi
P=36*10**3#
N=200#
w=2*pi*N/60#
T=P/w#
Tas=45#
d=16*T*10**3/(pi*Tas)#
d=d**(1/3)#
d=60#
d1=(2*d)+13#
l=3.5*d#
Ftk=T*2/d#
lk=l/2#
Tak=40#
sigack=90#
b=Ftk*10**3/(lk*Tak)#
t=2*Ftk*10**3/(sigack*lk)#
n=4#
sigatb=60#
u=0.25#
dr=16*T*10**3/(u*pi**2*sigatb*n*d)#
dr=sqrt(dr)#
print " d is %0.0f mm "%(d)#
print "\n b is %0.1f mm "%(b)#
print "\n t is %0.0f mm "%(t)#
print "\n dr is %0.3f mm "%(dr)#
from math import sqrt, pi
P=16*10**3#
N=1000#
w=2*pi*N/60#
T=P/w#
Ks=1.4#
Td=T*Ks#
Tas=40#
d=16*T*10**3/(pi*Tas)#
d=d**(1/3)#
d=32#
d1=2*d#
l=1.5*d#
ds=1.5*d#
Tak=40#
sigack=70#
Ftk=Td*2/d#
b=Ftk*10**3/(l*Tak)#
t=2*Ftk*10**3/(sigack*l)#
Taf=10#
tf=Td*10**3*2/(pi*Taf*d1**2)#
Ftb=Td*10**3/(1.5*d*4)#
Tab=40#
db=sqrt(Ftb*4/(Tab*pi))#
D=4*d#
trp=d/6#
Ftb1=Td*10**3/(45*4)#
db1=sqrt(Ftb1*4/(Tab*pi))#
print " d is %0.0f mm "%(d)#
print "\n b is %0.0f mm "%(b)#
print "\n t is %0.0f mm "%(t)#
print "\n db is %0.2f mm "%(db)#
print "\n db1 is %0.2f mm "%(db1)#
#The answer to Key thickness 't' is calculated incorrectly in the book.
from math import sqrt, pi
P=30*10**3#
N=1440#
w=2*pi*N/60#
T=P/w#
d=36#
d1=30#
d2=2*d#
d3=d1*2#
l=1.5*d#
Dp=3.5*d#
n=6#
Ft=(2*T)/(Dp*n)#
p=0.5#
A=Ft/p#
Lf=d#
dp=A/Lf#
M=Ft*10**3*(5+(Lf/2))#
db=(32*M/(pi*40))**(1/3)#
db=15#
T=(4*526)/(pi*db**2)#
sigb=32*M/(pi*db**3)#
sigmax=(sigb/2)+sqrt(((sigb/2)**2)+(T**2))#
b=d/4#
t=6#
Lf=36#
La=10#
Do=126+30+(2*(5+1))+(2*6)#
print " sigmax is %0.2f MPa "%(sigmax)#
print "\n b is %0.0f mm "%(b)#
print "\n t is %0.0f mm "%(t)#
print "\n Lf is %0.0f mm "%(Lf)#
print "\n Do is %0.0f mm "%(Do)#