# Chapter 25: Machine–Network Interactions¶

## Example 25.4, Page 893¶

In :
from __future__ import division
import math

#Initializing  the  variables
Pa_P1  =  -200;                                                      #  From  previous  Question
Q  =  1.4311  ;                                                        #  From  previous  questions.

#Calculations
DpSys  =  Pa_P1  +  98.9*Q**2;
print "System Operating point (m^3/s):",round(DpSys,2)

System Operating point (m^3/s): 2.55


## Example 25.7, Page 906¶

In :
from __future__ import division
import math
import sympy
from sympy import solve,symbols

#Initializing  the  variables
Vo  =  25.3;                                                            #Outlet  velocity
D  =  10  ;                                                                #  Mean  hydraulic  diameter
f  =  0.008;                                                            #  friction  factor
X  =  1000;                                                              #  Length  of  road
P  =  12600;                                                            #  Absorbing  power
Va  =  300;                                                              #  Tunnel  air  flow
K1  =  0.96;
K2  =  0.9;
T  =  590;                                                                #Thrust
rho  =  1.2;                                                            #  Air  density

#Calculations
alpha  =  (1/D)**2;
A  =  math.pi*D**2/4;                                                    #  Area  of  tunnel
Vt  =  Va/A;
W  =  Vo/Vt;                                                            #Omega
E  =  (1-alpha*W);
C  =  (1-alpha*W)*(1-E)**2  +  E**2  -  1;
#  Manipulating  equation  25.20;
LHS  =  f*X*(E+1)**2/D  +  C  +  1  ;

n1  =  symbols('n1')
result=solve(K1*(2*((alpha*W**2 + (1-alpha)*E**2-1)+(n1-1)*(alpha*W*(W-1)-C/2)))-LHS)

n=result

#  Alternative  approach  using  equation  25.22
n2  =  (rho*((4*f*X*Vt**2)/(2*D)    +  1.5*Vt**2/2))*A/(K1*K2*T);
Pt  =  round(n2)*P;

print "Number of fans required    :",round(n2)
print "Total  power consumed (KW) :",Pt/1000

Number of fans required    : 6.0
Total  power consumed (KW) : 75.6


## Example 25.8, Page 907¶

In :
from __future__ import division
import math
import sympy
from sympy import solve,symbols
#Initializing  the  variables
f  =  0.008;
T  =  290;
L  =  750;
Dt  =  9;                                                                  #  Diameter  Tunnel
Df  =  0.63;                                                            #  Diameter  fan
K1  =  0.98;
K2  =  0.92;
Vo  =  27.9;
n  =  10;
A=math.pi*Dt**2/4
rho=1.2
X=750
#Calculations
alpha  =  (Df/Dt)**2;
#  equation  25.20  becomes  when  E  =  1  nad  C  =  0
W=symbols('W')
omega  =  solve(2*K1*  (alpha*W**2  +(n-1)*alpha*W*(W-1))  -  4*f*L/Dt  -1)

for i in range(1,len(omega)):  #  since  omega  is  always  positive  and  real
if omega[i]>0:
w  =  round(omega[i],1);
Vt  =  Vo/w;

# by equation 25.22
VT=(n*(K1*K2*T)/(A*(rho*((4*f*X)/(2*Dt)    +  1.5/2))))**0.5
print "Tunnel Velocity  (m/s) :",round(VT,2)

Tunnel Velocity  (m/s) : 4.05


## Example 25.9, Page 914¶

In :
from __future__ import division
import math

#Initializing  the  variables
Ws  =  0.45;
Ks  =  3.2;
H  =  152;
h  =  0;
Hatm  =  10.3;
Pv  =  350;                             #vapour  pressure
g  =  9.81;
rho  =  1000;

#Calculations
Ht1  =  152*(Ws/Ks)**(4/3);     # the value of Ht1 is 11.12 and in book it is taken as 11.2 so there will be a difference in final answer
Hvap  = round(Pv/(rho*g),3);
Z  =  Hatm  -h  -Hvap  -Ht1;
print "Elevation of pump (m):",round(Z,3)


Elevation of pump (m): -0.851


## Example 25.11, Page 927¶

In :
from __future__ import division
import math
import sympy
from sympy import symbols,solve
import numpy as np

#Initializing  the  variables
Co  =  0;
Qc  =  0.0024;
V  =  5400;
c  =  10;
#Calculations
#####--------------------PART(A)-----------------#######
n1=symbols('n1')
def partA(n1):
Ci = 10;
# t = infinity so e^(-nt) = 0
Q=10000*Qc/(c-Co)
n1 = Q*3600/V;
return n1
ans=partA(n1)

print "Part(A) : number of air changes per hour if the garage is in continuous use and the maximum permissible concentration of carbon monoxide is 0.1 per cent. :",ans,"\n"

#####--------------------PART(B)-----------------#######
n=symbols('n')
def   partB(n):
Ci  =  0;
n=[1.5,1.2,0.9,1.0]
t=1      #  time  in  hours
error=[]
mini=100
ans=0
for i in range(4):
Q  =  V/3600;
A  =   10000*Qc/Q;                                                            # as Co=0
error.append(abs((A*(1-math.e**(-n[i]*t))/c)-n[i]));
if(error[i]<mini):
mini=error[i]
ans=n[i]
return ans
ans=partB(n)
print "Part(B) : number of air changes per hour if this maximum level is reached after 1 hour and the garage is out of use :",ans,'\n'

#####--------------------PART(C)-----------------#######
c=symbols('c')
def   partC(c):
Ci  =  0;
n  =  1;
t = 0.333333                         #  20  minutes  in  hours
Q  =  V*n/3600;
y  =    (Co  +  10000*Qc/Q)*(1-math.e**(-n*t)) + Ci*math.e**(-n*t) ;
return y
ans=partC(c)
print "Part(C) :the concentration after 20 minutes (Parts per 10000) :",round(ans,3),'\n'
#####--------------------PART(D)-----------------#######
t=symbols('t')
def   partD(t):
Ci  =  10;
n  =  1;
c  =  0.1;
t=np.log(100)
return round(t,2)
ans=partD(t)
print "Part(D) : time necessary to run the ventilation system at the rate calculated in (b) to reduce the concentration to 0.001 per cent (in hours) :",ans,"hours"

Part(A) : number of air changes per hour if the garage is in continuous use and the maximum permissible concentration of carbon monoxide is 0.1 per cent. : 1.6

Part(B) : number of air changes per hour if this maximum level is reached after 1 hour and the garage is out of use : 1.0

Part(C) :the concentration after 20 minutes (Parts per 10000) : 4.535

Part(D) : time necessary to run the ventilation system at the rate calculated in (b) to reduce the concentration to 0.001 per cent (in hours) : 4.61 hours