Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

P9: SEWAGE FOR CIVILS (MATLAB functions, plotting) DUE: November 29, 2016 by 11:

ID: 3573227 • Letter: P

Question

P9: SEWAGE FOR CIVILS

(MATLAB functions, plotting)

DUE: November 29, 2016 by 11:59 p.m. CT (Extra Credit)

December 1, 2016 by 11:59 p.m. CT (Final Deadline) POINTS: 75

INTRODUCTION:

You have been asked to design a pump for pumping treated effluent at a sewage treatment facility. The pump must remove the effluent at the fastest rate possible without causing a pipe to burst or overflowing the effluent handling tank. The motor that y9ou are using runs at 60 rpm. The piston head is 6 inches in diameter. Given this, select r so the average output of the pump is no larger than 420 in3/s due to the speed at which the effluent can be handled. Exceeding this value will overflow the tank. Also select l so that the instantaneous velocity of the flow is not more than 1400 in3/s or the pipe will burst due to excess pressure.

The piston used has a diameter of 6 in. The average flow rate of the pump is the area of the piston multiplied by the distance it travels, 2*r, given by the equation

ave_flow = piston_area*2*r.

To determine the value of r, plug in the maximum allowed average flow and the piston area. Then solve for r. The solution should be rounded down to a half inch increment. For example, 4.9 would be rounded to 4.5. The rounding can be hand coded if needed.

The equations you will need to solve the problem are listed below. Note that is the angular velocity of the shaft, t is the current time, and x is the displacement of the piston.

q=rsin=lsin

=t

sin=r/l sint

s=rcost

u=lcos

x=s+u=rcost+lcos

cos=(1-sin^2 )=(1-(r/l sint)^2 )

To determine the value of l, test four values. The first value should be at least 0.5 inches larger than r and should be increased by increments of 2.0 inches. For each value of l, plot the flow rate as a function of time for one rotation of the pump. Each of the plots should appear in the same figure on the same axis. The plot must contain axis labels with units, title, and a legend. Use visual inspection of the plot to select the value of l that will not exceed the maximum instantaneous flow rate.

Diagram of the pump.

ASSIGNMENT:

There should be three files for this problem. Two should contain functions. The other should have a script that accomplishes all the tasks given below.

Given the information above, determine r.

Create a plot to determine the smallest l that can be used without exceeding the maximum instantaneous flow rate. The plot must contain the flow rate for four different values of l. It also must contain axis labels with units, title, and a legend.

Use the selected values to generate plots of the position and velocity of the piston every 0.01 seconds over one rotation of the shaft. The plot must contain axis labels with units and a title. These plots should appear in different figures.

Explanation / Answer

Keep all the three below .m files in one directory. And then run the script.m

piston_position.m
-----------------

%function
function [x] = piston_position( r, l, w, t)
tmp1 = r*cos(w*t);
tmp2 = sqrt((1 - ((r/l)*sin(w*t))^2));
x = tmp1+(l* tmp2);
end


piston_velocity.m

----------------------

function [x_dot] = piston_velocity( r, l, w, t)
tmp1 = sin(w*t);
tmp2 = (r/(2*l))*sin(2*w*t)*(1/sqrt((1 - ((r/l)*sin(w*t))^2)));
x_dot = -(r*w)*(tmp1+tmp2);
end


script.m

------------


clear all;
clc
max_flow=420;
%units are in inches^3 per second
piston_diameter=8;%diameter is 8 so radii is 4
piston_area= pi*((4)^2);%asssuimg the orfice to be circular in shape
r= max_flow/(piston_area * 2);%manipulating the equation 1 and substituting the known values
r=floor(r);
r=r+0.5;
disp('the value of r is');
disp(r);
%determing the value of l
l=zeros(1,4);
l(1)=r+2.5;
for i=1:3
l(i+1)=l(i)+3;
end
disp('the values of l which i will be cheking are');
disp(l);
rpm_given=60;
w=(2*pi*rpm_given)/60 ;
max_inst_flow=1500;
%I have taken max_inst_flow to be 1500 instead of 1400;
%units are in inches^3 per second
%1 rotation means wt varies from 0 to 2*pi rads
time_inc=0.01;
%time increment is by 0.01 second.
w_inc=time_inc*w;
t=0;
%initialising time =0
no_iterations = (2*pi)/w_inc;
% I will be storing my flow values in inst_flow.
% I have initialised inst_flow to all 0's.I know there will be 100 values cz
%I am incrementi
for i=1:4
for k=1:no_iterations
t=t+time_inc;   
temp= abs(piston_velocity(r,l(i),w,t));
inst_flow(i,k)= temp*piston_area;
end
end
%format long g
%disp(inst_flow);
%plotting the flow rate for different l
t=0:.01:.99;
plot(t,inst_flow(1,:),'b');hold on
plot(t,inst_flow(2,:),'c');hold on
plot(t,inst_flow(3,:),'g');hold on
plot(t,inst_flow(4,:),'r');
title('Instantaneous velocity of the flow for different l');
xlabel('time in seconds');
ylabel('Instantaneous velocity of the flow in inc^3/sec');
grid on;
legend('flow with l1','flow with l2','flow with l3','flow with l4');
%checking the value of l for which it does not exceed max_inst_flow
flag=[0,0,0,0];
for i=1:4
for k=1:no_iterations
if (inst_flow(i,k)> max_inst_flow);
flag(i)=1;
end
end
if (flag(i)==0);
required_l= i;
end
end
disp('the value of l in inches for which Instantaneous velocity of the flow does not exceed the maximum limit is');
disp(l(required_l));
%plotting the third part for the required l i.e the position and velocity of the piston every 0.01 seconds over 1 rotation of the shaft
l=l(required_l);
for j=1:no_iterations
velocity(j)= piston_velocity(r,l,w,t(j));
position(j)= piston_position(r,l,w,t(j));
end
figure;
plot(t,position);
title(' position of the piston every 0.01 seconds over 1 rotation of the shaft');
xlabel('time in seconds');
ylabel('position in inches (inch)');
grid on;
figure;
plot(t,position);
title('velocity of the piston every 0.01 seconds over 1 rotation of the shaft');
xlabel('time in seconds');
ylabel(' velocity in inch/sec');
grid on;