# Chapter 24: Positive Displacement Machines¶

## Example 24.1, Page 860¶

In :
from __future__ import division
import math

#Initializing  the  variables
H_at  =  10.3;
Hs  =  1.5;
Hd  =  4.5;
Ls  =  2;
Ld  =  15;
g  =  9.81;
Ds  =  0.4;                                                              #  Diameter  of  stroke
Db  =  0.15;                                                            #  Diameter  of  bore
Dd  =  0.05;                                                            #  Diameter  of  discharge  and  suction  pipe
nu  =  0.2;
f  =  0.01;
abs_pump_pressure  =  2.4;

#Calculations
A  =  math.pi*(Db)**2/4;
a  =  math.pi*(Dd)**2/4;
r  =  Ds/2;
W  =  2*math.pi*nu;
Hsf  =  0;
def  H_suck(n):
y  =  H_at  -  Hs  +(-1)**n*(L/g)*(A/a)*W**2*r;
return y

def  H(n,DischargeOrSuction):
if(DischargeOrSuction  ==  1):
y  =  H_at  -  Hs  +(-1)**n*(Ls/g)*(A/a)*W**2*r;
elif(DischargeOrSuction  ==  2):
y  =  H_at  +  Hd  +(-1)**n*(Ld/g)*(A/a)*W**2*r;
else:
print "There  is  something  wrong  :"
return y

def  H_mid(DischargeOrSuction,uA):
if(DischargeOrSuction  ==  1):
Hsf  =  4*f*Ls/(2*Dd*g)*(uA/a)**2;
y  =  H_at  -  Hs  -  Hsf;
elif(DischargeOrSuction  ==  2):
Hsf  =  4*f*Ld/(2*Dd*g)*(uA/a)**2;
y  =  H_at  +  Hd  +  Hsf;
else:
print "There  is  something  wrong  :"
return y

Hs_start  =  H(1,1);                #  Inertia  head  negative  hence  n  =  1
Hs_end    =  H(2,1);                #  Inertia  head  positive  hence  n  =  2
Hd_start  =  H(1,2);
Hd_end    =  H(2,2);
u  =  W*r;
Hs_mid  =  H_mid(1,u*A);
slip  =  0.04;
Hd_mid  =  H_mid(2,u*A);
suction   = [Hs_start,  Hs_end,  Hs_mid];
discharge = [Hd_start,  Hd_end,  Hd_mid];
suction1=[0,0,0]
discharge1=[0,0,0]
for c in range(3):
suction1[c]   =round(suction[c],2)
discharge1[c] =round(discharge[c],2)
W_max  =  (abs((abs_pump_pressure  -  H_at  +  Hs)*(g/Ls)*(a/A)*(1/r)))**0.5;
W_max_rev  =  W_max/(2*math.pi)*60;                      #  maximum  rotation  speed  in  rev/min

print suction1
print discharge1
print "\n!----Part(c)----1 \nDrive speed for s eperation (rev/min) :",round(W_max_rev)

!----Part(a)----!  Head at
Start   End   Mid
[8.22, 9.38, 8.38]

Start   End   Mid
[10.45, 19.15, 17.93]

!----Part(c)----1
Drive speed for s eperation (rev/min) : 40.0


## Example 24.2, Page 863¶

In :
from __future__ import division
import math

#Example  24.2

#Initializing  the  variables
H_friction  =  2.4;
H_at  =  10.3;
Hs  =  1.5;
L  =2;
f  =  0.01;
d  =  0.05;
g  =  9.81;                                 #  Diameter  of  stroke
Db  =  0.15;                                #  Diameter  of  bore
r  =  0.2;

#Calculations
A  =  math.pi*(Db)**2/4;
a  =  math.pi*(d)**2/4;
W=  (((H_at  -  Hs  -    H_friction  )*(2*d*g/(4*f*L)))**0.5)*(a/A)*(math.pi/r); # in rad/s
W_rev  =  W/(2*math.pi)*60;                 #  maximum  rotation  speed  in  rev/min
# IMPORTANT : In book conversion from rad/s to rev/min is wrong, so answer will be diffrent from book


speed in          (rad/s)  : 15.46