You are on page 1of 3

clc

%Example of power extracted by turbine


disp('Do you wish to continue :');
disp('1-To continue');
k=input('0-To exit :');
while k==1
disp('Inputs of te problem: ');

disp('*****************************************************************************
******************************');
f = input('frictional factor : ' );
L = input('lenth of the pipe in m : ');
d = input('dia of the pipe in m : ');
H = input('height in m : ');
g = input('acceleration due to gravity in m/s^2 : ');
p = input('give the value of power in mph : ');
w = 1000;
A=(3.14*d^2)/4;

disp('*****************************************************************************
******************************');
syms Q
t=(w*Q*(H-f*L*(Q/A)^2/(2*g*d))/75);
solQ=solve(p==t,Q);
fprintf('required discharge is = %0.4f',solQ,'m^3/s');
fprintf('*****************************************');
fprintf('\n');
%k=input('interest to continue ( 1 for continue & 0 for exit)');
end

%water hammer 11.18


k=1;
while k==1
w=9810; %N/m^3
k=input('bulk modulus in N/m^2 : '); %N/m^2;
g=input('acceleration due to gravity in m/s^2 : ');
V=input('velocity in m/s : ');
D=input('diameter in m : '); %m
T=12*10^(-3); %m
E=input('modulus of elasticity in N/m^2 : '); %N/m^2
m=input('poissons ratio : ');

%Neglecting the elasticity of pipe material


p1=V*(w*k/g)^0.5;

%Considering hte elasticity of pipe material but neglecting poisson's ratio


p2=V/(g/w*(1/k+D/(T*E)))^0.5;
%Considering hte elasticity of pipe material including poisson's ratio
p3=V/(g/w*(1/k+(D/(T*E))*(1-1/(2*m))))^0.5;

disp(['pressure when Neglecting the elasticity of pipe material =


',num2str(p1),'N/m^2']);
disp(['pressure when Considering hte elasticity of pipe material but neglecting
poissons ratio = ',num2str(p2),'N/m^2']);
disp(['pressure when Considering hte elasticity of pipe material including
poissons ratio = ',num2str(p3),'N/m^2']);
fprintf('*****************************************');
fprintf('\n');
k=input('interest to continue ( 1 for continue & 0 for exit)');
end

%rise of pressure 11.17


k=1;
while k==1
t=input('time in sec : ');
L=input('length in meter : ');
c=1430; %m/sec
ts=2*L/c;
g=input('acceleration due to gravityin m/sec^2 :');
d=input('diameter in meter : ');
Q=input(' discharge in m^3/sec :');
A=(pi*d^2)/4;
v=Q/A;
w1=1000; %kg/m^3;
w2=9.81; %Kn/m^3;
if ts<t
p1=w1*L*v/(g*t) ; %kg/m^2;
p2=w2*L*v/(g*t) ; %KN/m^2;
end

%For instantaneous closure of valve


p3=w1*v*c/g ; %kg/m^2;
p4=w2*v*c/g ; %KN/m^2;
disp(['required pressure when ts<t = ',num2str(p2),'KN/m^2']);
disp(['required pressure when closed instantanously = ',num2str(p4),'KN/m^2']);
fprintf('*****************************************');
fprintf('\n');
k=input('interest to continue ( 1 for continue & 0 for exit)');
end
clc
%11.6
k=1;
while k==1
pressure_head= input('pressure head in m:');
%eff=(H-hf)/H;
eff=input('efficency:');
g=input('acceleration due to gravity in m/s^2:');
D=input('dia of the pipe in m : '); %m
f=input('frictional factor : ');
L=input('lenth of the pipe in m : '); %kms
P= input('give the value of power in kw : '); %KW
w=9810;

H=pressure_head/eff;
hf=H-pressure_head;
V=((2*g*D*hf)/(f*L))^0.5;
Q=(pi*D^2)/4*V;
n=P*1000/(w*Q*(H-hf));
N=round(n,0); %Number of pipes required
disp(['Number of pipes is = ',num2str(N)]);

%max power transmission


hfmax=H/3;
Vmax=((2*g*D*hfmax)/(f*L))^0.5;
Qmax=(pi*D^2)/4*Vmax*N;
Pmax=w*Qmax*(H-hfmax)/1000;
disp(['Maximum head loss = ',num2str(hfmax),'m']);
disp(['Maximum velocity = ',num2str(Vmax),'m/s']);
disp(['Maximum discharge = ',num2str(Qmax),'m^3/s']);
disp(['Maximum power = ',num2str(Pmax),'W']);
fprintf('*****************************************');
fprintf('\n');
k=input('interest to continue ( 1 for continue & 0 for exit)');

end

You might also like