from __future__ import division
from math import sqrt,pi
# Given Data
Fmin=250## N
Fmax=300## N
Del=8## mm
C=8## spring index
tau_d=420## MPa
G=84## GPa
# 1. Wahl's correction factor
Kw=(4*C-1)/(4*C-4)+0.615/C## Wahl's correction factor
print "\n Wahl's correction factor = %.3f "%(Kw)
# 2. Wire diameter
# tau_d=Kw*8*Fmax*C/pi/d**2
d=sqrt(Kw*8*Fmax*C/pi/tau_d)## mm
print ' \n Wire diameter = %.2f mm. Use 4.25 mm.'%(d)
d=4.25## mm
# 3. Mean coil diameter
Dm=8*d## mm
print ' \n Mean coil diameter = %.f mm.'%(Dm)
# 4. Stiffness of spring
k=(Fmax-Fmin)/Del## N/mm
# 5. no. of active turns
n = G*10**3*d/8/C**3/k ## no. of active turns
print ' \n no. of active turns = %.f'%(n)
# 6. total no. of turns for squared and ground ends
nt=n+2## total no. of turns for squared and ground ends
print ' \n total no. of turns for squared and ground ends = %.f'%(nt)
# 7. Free length of spring
#lf=l_s+del_max+clashallowance(=0.15*del_max)
del_max=Del*Fmax/(Fmax-Fmin)##mm
l_s=nt*d## mm
lf=l_s+del_max+0.15*del_max## mm
print ' \n Free length of spring = %.1f mm Use 124 mm'%(lf)
lf=124##mm
# 8. Pitch of coils
p=lf/(nt-1)##mm
print ' \n Pitch of coils = %.2f mm'%(p)
# 9. Check for buckling
print ' \n Check for buckling - '
m=lf/Dm## > 2.6 provided guide
print ' \n ratio lf/Dm = %.3f > 2.6. So, Providing guide is necessary.'%(m)
kl_1=0.22## for hinged ends
kl_2=0.62## for fixed ends
Fcr_1=k*kl_1*lf##N (for hinged ends)
Fcr_2=k*kl_2*lf##N (for fixed ends)
print ' \n Critical load for buckling - '
print ' \n Fcr = %.1f N for hinged ends < Fmax'%(Fcr_1)
print ' \n Fcr = %.1f N for fixed ends > Fmax'%(Fcr_2)
print ' \n From above two calculatio, it can be seen that spring is safe in buckling for fixed ends.'
# 10. Lowest natural frequency for both ends fixed
rau=7800## N/mm.cube. (Density of spring material)
fn=d/(pi*n*Dm**2)*sqrt(G*10**3/8/(rau*10**-9))##
print ' \n\n Lowest natural frequency for both ends fixed, fn = %.3f Hz'%(fn)
from __future__ import division
from math import sqrt,pi
# Given Data
Fmin=60## N
Fmax=140## N
d=3## mm
Dm=18## mm
Sut=1430## MPa
C=Dm/d## spring index
Kw=(4*C-1)/(4*C-4)+0.615/C## Wahl's correction factor
Ks=1+0.5/C## Shear Stress factor
Fm=(Fmax+Fmin)/2## N
Fa=(Fmax-Fmin)/2## N
tau_m=Ks*(8*Fm*C)/(pi*d**2)## MPa
tau_a=Kw*(8*Fa*C)/(pi*d**2)## MPa
Ses_dash=0.22*Sut## MPa
Sys=0.45*Sut## MPa
#tau_m/Sys+tua_a/Ses_dash*(2-Ses_dash/Sys)=1/n
n=1/(tau_m/Sys+tau_a/Ses_dash*(2-Ses_dash/Sys))## factor of safety
print ' \n factor of safety = %.2f'%(n)
from __future__ import division
from math import sqrt,pi
# Given Data
Fi=40## N
d=3## mm
C=6## spring index
n=15## factor of safety
tau=650## N/mm.sq.
G=84## kN/mm.sq.
# Wahl's correction factor
Kw=(4*C-1)/(4*C-4)+0.615/C## Wahl's correction factor
print "\n Wahl's correction factor = %.4f "%Kw
# Initial tortional shear stress
tau_i=Kw*(8*Fi*C)/(pi*d**2)## MPa
print ' \n Initial tortional shear stress = %.2f MPa'%(tau_i)
k=G*10**3*d/(8*C**3*n)## spring stiffness
print ' \n spring stiffness = %.2f N/mm'%(k)
# Spring load to cause yielding
#tau=Kw*(8*Fi*C)/(pi*d**2)
F=tau/(Kw*(8*C)/(pi*d**2))
print ' \n Spring load to cause yielding = %.1f N'%(F)
from __future__ import division
from math import sqrt,pi,ceil
# Given Data
Fmin=500## N
Fmax=1200## N
C=6## spring index
n=1.5## factor of safety
Sys=760## MPa
Ses_dash=350## MPa
Del=25## mm
G=82## kN/mm.sq.
Kw=(4*C-1)/(4*C-4)+0.615/C## Wahl's correction factor
Ks=1+0.5/C## Shear stress factor
Fm=(Fmax+Fmin)/2## N
Fa=(Fmax-Fmin)/2## N
tau_m_into_d_sq=Ks*(8*Fm*C)/(pi)## where tau_m_into_d_sq = tau_m*d**2
tau_a_into_d_sq=Kw*(8*Fa*C)/(pi)## where tau_a_into_d_sq = tau_a*d**2
#(tau_m-tau_a)/Sys+2*tua_a/Ses_dash=1/n
d=sqrt(n)*sqrt((tau_m_into_d_sq-tau_a_into_d_sq)/Sys+2*tau_a_into_d_sq/Ses_dash)## mm
print ' \n diameter of spring wire = %.2f mm or %.f mm'%(d, ceil(d))
d=ceil(d)## mm
Dm=C*d## mm
print ' \n Mean coil diameter = %.f mm'%( Dm)
#del=8*Fmax*Ci**3/(G*d)
i=(Del/(8*Fmax*C**3/(G*10**3*d)))## no. of active coils
i=ceil(i)## no. of active coils
print ' \n no. of active coils = %.f'%(i)
nt=i+2## no. of active coils (for square & ground ends)
lf=nt*d+1.15*Del## mm
print ' \n free length of spring = %.2f mm'%(lf)
from __future__ import division
from math import sqrt,pi,ceil
# Given Data
p=125## MPa
dv=60## mm
del1=40## mm
del2=20## mm
tau_max=600## MPa
G=85## kN/mm.sq.
C=6## spring index
Fv=(pi/4)*dv**2*p/100## N (Force on the valve)
del_max=del1+del2## mm (Max. deflection)
Fmax=Fv*dv/del1## N (Max. force)
Kw=(4*C-1)/(4*C-4)+0.615/C## Wahl's correction factor
# tau = 8*Fmax*C*Kw/(pi*d**2)
d=sqrt((8*Fmax*C*Kw/(pi))/tau_max)## mm (Diameter of spring wire)
Dm=6*d## mm (Mean coil diameter)
n=G*10**3*d*del_max/(8*Fmax*C**3)## no. of turns
n = ceil(n)## no. of turns
nt=n+2## total no. of turns
lf=nt*d+1.15*del_max## mm (Free length)
p=lf/(nt-1)## mm (Pitch of coil)
print ' \n Force on the valve = %.1f N'%(Fv)
print ' \n Maximum deflection = %.f mm'%( del_max)
print ' \n Maximum force = %.1f N'%( Fmax)
print ' \n Wahl''s correction factor = %.4f '%(Kw)
print ' \n Diameter of spring wire = %.f mm'%(d)
print ' \n Mean coil diameter = %.f mm'%( Dm)
print ' \n number of turns = %.f '%(n)
print ' \n Total number of turns for square & ground ends = %.f '%(nt)
print ' \n Free length = %.f mm. Use 200 mm'%(lf)
print ' \n Pitch of coil = %.1f mm'%(p)
from __future__ import division
from math import sqrt,pi,ceil
from numpy.linalg import solve
# Given Data
dv=30## mm
Wv=10## N
Wl=25## N
lf=100## mm
del1=20## mm
p=3.5## N/mm.sq.
valve_lift=2## mm
C=6## spring index
tau=500## N/mm.sq.
G=0.84*10**5## N/mm.sq.
W=(pi/4)*dv**2*p## N (load on the valve at operating condition)
W1=W-Wv##N (Net load on the valve at operating condition)
#W1*100=Wl*150+S1*200+P*300 # taking momens about the fulcrum
#S1*200+P*300=W1*100-Wl*150 ...eqn(1)
valve_lift=20*100/200## mm #from figure (when spring is extended by 20 mm)
spring_extension=2*200/100## mm # from figure (when valve is lifted 2 mm)
valve_load=W*12/10## N # (when valve is lifted 2 mm)
W2=valve_load-Wv## N # (when valve is lifted 2 mm)
del2=del1+4## mm (when valve is lifted)
#S2=S1*del2/del1## spring force when valve is lifted
#S1*del2/del1-s2=0 ... eqn(1)
#W2*100=Wl*150+S2*200+P*300 # taking momens about the fulcrum
#S2*200+P*300 =W2*100-Wl*150 ... eqn(2)
#S1*200+P*300=W1*100-Wl*150 ...eqn(3)
# solving above 3 eqn. by matrix method
A=[[del2/del1, -1, 0],[200, 0, 300],[0, 200, 300]]
B=[[0],[W1*100-Wl*150],[W2*100-Wl*150]]
X=solve(A,B)## solution matrix
S1=X[0]## N
S2=X[1]## N
print ' \n Spring force when valve is lifted = %.1f N'%(S2)
print ' \n\n Design of spring - '
k=(S2-S1)/(del2-del1)## N/mm (Spring stiffness)
print ' \n Spring stiffness = %.2f N/mm'%(k)
Kw=(4*C-1)/(4*C-4)+0.615/C## Wahl's correction factor
print " \n Wahl's correction factor = %.4f"%(Kw)
# tau=Kw*8*S2*C/pi/d**2 max. shear stress
d=sqrt(Kw*8*S2*C/pi/tau)## mm (spring diameter)
print ' \n spring diameter = %.2f mm or %.f mm'%(d,d)
d=ceil(d)## mm
# k=G*d/(8*C**3*n) (Spring stiffness)
n=G*d/(8*C**3*k)## no. of active coils
print ' \n no. of active coils = %.2f. Use n=7'%(n)
n=ceil(n)## rounding
nt=n+1## total no. of active coils
print ' \n total no. of active coils = %.f'%(nt)
p=lf/(n-1)## mm (pitch of coils)
print ' \n pitch of coils = %.2f mm'%(p)
from __future__ import division
from math import pi
# Given Data
Fmin=0## N
Fmax=1000## N
Del=80## mm
Do=25## mm
n=30## no. of turns
G=85## kN/mm.sq.
k=(Fmax-Fmin)/Del## N/mm (Spring stiffness)
print ' \n Spring stiffness = %.1f N/mm'%(k)
# k=G*d/(8*C**3*n) (Spring stiffness)
C_cube_BY_d=G*10**3/(k*8*n)##
def hitntrial(c3d,Do):
from numpy import arange
for C in arange(5.0,4.5,-0.1):
d=C**3/(c3d)#
Doo=d*C+C#
if Doo<Do :
break
return [C,d]
[C,d]=hitntrial(C_cube_BY_d,Do)
print ' \n By hit and trial method and using value of C**3/d -'
print ' \n value of Spring Index, C = %.1f '%(C)
print ' \n value of wire diameter, d = %.1f mm'%(d)
print ' \n But we adopt d=4 mm.'
d=4## mm (adopted for design)
C=(C_cube_BY_d*d)**(1/3)## Spring index
print ' Hence, Spring Index = %.2f '%(C)
Dm=C*d## mm
print ' \n Mean coil diameter = %.2f mm'%( Dm)
Do=Dm+d## mm
print ' \n Outside coil diameter = %.2f mm < 25 mm. Hence design is ok.'%( Do)
Kw=(4*C-1)/(4*C-4)+0.615/C## Wahl's correction factor
print ' \n Wahl''s correction factor = %.3f '%(Kw)
tau=8*Kw*C*Fmax/(pi*d**2)## N/mm.sq.
print ' \n Maximum shear stress = %.2f N/mm.sq.'%(tau)
from __future__ import division
from math import sqrt,pi
# Given Data
Fmin=600## N
Fmax=1000## N
C=6## spring index
n=1.5## factor of safety
Sys=700## N/mm.sq.
Ses_dash=350## N/mm.sq.
Kw=(4*C-1)/(4*C-4)+0.615/C## Wahl's correction factor
Ks=1+0.5/C## Shear Stress factor
Fm=(Fmax+Fmin)/2## N
Fa=(Fmax-Fmin)/2## N
tau_m_into_d_sq=Ks*(8*Fm*C)/(pi)## where tau_m_into_d_sq = tau_m*d**2
tau_a_into_d_sq=Kw*(8*Fa*C)/(pi)## where tau_a_into_d_sq = tau_a*d**2
#(tau_m-tau_a)/Sys+2*tua_a/Ses_dash=1/n
d=sqrt(n)*sqrt((tau_m_into_d_sq-tau_a_into_d_sq)/Sys+2*tau_a_into_d_sq/Ses_dash)## mm
print ' wire diameter of spring = %.2f mm'%(d)
from __future__ import division
from math import sqrt,pi,ceil
# Given Data
dv=100##mm
C=5.5## spring index
pi=1## N/mm.sq.
p=1.075## N/mm.sq.
Del=6## mm
tau_max=400## N/mm.sq.
G=80## kN/mm.sq.
Fi=(pi/4)*dv**2*pi## N (initial tension in spring)
print ' \n initial tension in spring = %.f N'%( Fi)
F=(pi/4)*dv**2*p## N (maximum tension in spring)
print ' \n maximum tension in spring = %.f N'%( F)
k=(F-Fi)/Del## N/mm (stiffness of spring)
print ' \n stiffness of spring = %.2f N/mm'%(k)
#Tmax=F*Dm/2 where Dm=5.5*d
Tmax_BY_d=F*5.5/2## calculation
#Tmax=(pi/16)*d**3*tau_max
d=sqrt(Tmax_BY_d/((pi/16)*tau_max))## mm
print ' \n diameter of spring = %.2f mm. Use 18 mm.'%(d)
d=ceil(d)## mm (rounding)
Dm=5.5*d##mm
print ' \n mean coil diameter = %.f mm'%(Dm)
Do=Dm+d##mm
print ' \n outside coil diameter = %.f mm'%(Do)
Di=Dm-d## mm
print ' \n initial coil diameter = %.f mm'%(Di)
n=G*10**3*d*Del/8/(F-Fi)/C**3## no. of turns
print ' \n no. of turns = %.f'%(n)
nt=n+1## total no. of turns
print ' \n total no. of turns(for extension spring) = %.f'%(nt)
gi=1## mm (initial gap)
lf=nt*d+(nt-1)*gi## mm
print ' \n free length of spring = %.f mm'%(lf)
p=lf/(nt-1)##mm
print ' \n pitch of coils = %.2f mm'%(p)
from __future__ import division
from math import sqrt,pi,ceil
# Given Data
d=6##mm
Do=75## mm
tau=350## N/mm.sq.
G=84## kN/mm.sq.
print ' \n (i) neglecting the effect of curvature'
dm=Do-d## mm
C=dm/d## spring index
Ks=1+0.5/C## shear stress factor
#tau=Ks*(8*Fmax*C)/(pi*d**2)
Fmax=tau/(Ks*(8*C)/(pi*d**2))## N
print ' \n Axial load = %.1f N'%(Fmax)
delBYi=8*Fmax*C**3/(G*10**3*d)## mm/turn
print ' \n deflection per active turn = %.3f mm/turn'%(delBYi)
print ' \n\n (ii) considering the effect of curvature'
Kw=(4*C-1)/(4*C-4)+0.615/C## Wahl's correction factor
#tau=Kw*(8*Fmax*C)/(G*d)
Fmax=tau/(Kw*8*C/(pi*d**2))#
print ' \n Axial load = %.1f N'%(Fmax)
delBYn=8*Fmax*C**3/(G*10**3*d)## mm/turn
print ' \n deflection per active turn = %.3f mm/turn'%(delBYn)
# Note - answer in the textbook is wrong for last part.