View
3
Download
0
Category
Preview:
Citation preview
Lab 5 Tank Draining Experiment
Analysis and Design of Engineering Systems
ES205-05
4/28/16
Noah Severyn, Chad Estill, Dan Skiroock
2
Abstract
In this laboratory experiment, a system of two tanks is set up. The initial condition response of each
single tank as it drained was recorded. For each of the tank orifices, a discharge coefficient of .7 was
initially assumed. A model for each tank was then constructed using this coefficient to determine the
height of the liquid in the tank over time. Using the initial model and the data, a new optimized
discharge coefficient was formulated. An optimized model for each tank is created using the new
coefficients of .8272 and1.598, for tank 1 and 2, respectively. A model for a system of two tanks
draining into each other is derived using the optimized coefficients. When plotted against the data
collected for the double tank system, the two match closely. This further reinforces the validity of our
two discharge coefficient values. This same procedure can be used to estimate the unknown discharge
coefficients of any shape or size nozzle or orifice.
3
Table of Contents
4 ……………………………………………………… Introduction
5 ……………………………………………………… Experimental Test Procedure
7 ……………………………………………………… Method of Analysis
8 ……………………………………………………… Results and Discussion
11 ……………………………………………………… Conclusion and Recommendations
13 ……………………………………………………… Appendix
4
Introduction
In this lab our team measured the initial condition response of a single tank draining, with the purpose
of using these to validate our model for a two tank system.
For each single tank, a model is developed based on an initial discharge coefficient (Cd) value. Using the
Standard Error Estimate (SEE), the initial Cd is optimized and a second, optimized model is created using
this value which more closely models the data. A second system is set up with two tanks, with one
draining into the other. The measured response for this system is used to validate the accuracy of both
discharge coefficients calculated previously, as well as our two tank model which was derived from
conservation of mass and Bernoulli’s principles.
The first section, Experimental Procedure, outlines the experimental test procedure taken when
collecting the data. The setup of the tanks is explained, along with the data collection methods. The
next section, Method of Analysis, summarizes the process used to analyze the data. Important
equations are listed and explained, and a diagram of the model used is provided. All subsequent data
analyzation is also explained, including calibration and optimization techniques. In Results and
Discussion, the final data is presented and is shown to prove that the calculated discharge coefficients
are accurate. An overview of objectives met and recommendations for improvement are provided in
the Conclusions and Recommendations section. All other relevant items, including calibration data,
MATLAB code, and Simulink models are referenced in the Appendix.
5
Experimental Test Procedure 1. Setup of the Pressure Measurement Device:
The pressure transducer is placed at bottom of each tank and records pressure at the bottom
of each tank in terms of voltage
Calibrate the pressure sensor: the tank is filled and the valve is opened. After the tank has
drained about one inch, a pressure and height reading is taken. This is repeated until there is
one inch left in the tank
Note: Computerized data collection was used during this lab
2. Single Tank Experiments:
The upper tank is filled to a height of 9 inches.
The valve is opened and the tank is left to drain until the water is about a quarter of an inch
high.
Repeat this for the lower tank
Note: Computerized data collection was used to record instantaneous voltage readings.
3. Double Tank Experiment:
Refill the upper tank to a fluid height of 8 inches of water
Fill the lower tank to a fluid height of approximately 4 inches of water
Open both outflow valves at the same time, then start the data recording for both tanks
6
Method of Analysis
In order to model each tank in the system, we derived an equation to model how the height of each
tank varies over time. The equations are used to model each individual tank as it drains, without any
input. Using conservation of mass, and operating under the assumption that the fluid density is
constant, we arrived at the top tank solution of
𝑑ℎ1
𝑑𝑡=
−2𝐴 ∙ 𝐴01 ∙ 𝐶𝑑1√2𝑔(ℎ10 + ℎ0 ∙ 𝑡 + (𝐴01 ∙ 𝑑𝑡)2 ∙ 𝑔 + (2𝐴)2
(2𝐴)2 (1)
and the bottom tank solution of
𝑑ℎ2
𝑑𝑡=
−2𝐴 ∙ 𝐴02 ∙ 𝐶𝑑2√2𝑔(ℎ20 + ℎ0 ∙ 𝑡 + (𝐴02 ∙ 𝑑𝑡)2 ∙ 𝑔 + (2𝐴)2
(2𝐴)2
(2)
where h1 and h2 are the heights of the top and bottom tanks measured from the bottom, respectively.
A represents the cross-sectional area of both tanks, while A01 and A02 indicate of the areas of the top
and bottom orifices, respectively. Cd1 and Cd2 represent the discharge coefficients for each orifice. As
indicated in Figure 1, h10 and h20 serve as the distance from the bottom of the tank to orifice exit.
Figure 1: A diagram of the two
tank system used along with
geometric labels.
7 The data is collected in Table A1 related the measured height of water in each tank and the
corresponding voltage from the pressure sensor. Data from this table was plotted and a line of best fit
is formed. From the data taken for the upper tank, the calibration equation
𝑣𝑢(ℎ) = .1023 ∙ ℎ𝑢𝑝𝑝𝑒𝑟 + 1.2905
(3)
is obtained, where vu(h) is the voltage from the pressure sensor and hupper is the height of the fluid in
the upper tank. Similarly, the calibration equation for the lower tank
𝑣𝐿(ℎ) = .1048 ∙ ℎ𝑙𝑜𝑤𝑒𝑟 + 1.4519
(4)
is calculated, where vL(h) is the voltage from the pressure sensor and hlower is the height of the fluid in
the lower tank. For the single and double tank runs, the calibration equations 3 and 4 are used to
formulate an exact value for height for every corresponding voltage output.
For the initial model, we assumed that each Cd in Equation 1 and Equation 2 was 0.7. Using Matlab’s
fminsearch technique, an optimized Cd is calculated for each tank. The Standard Error Estimate (abbr.
SEE),
𝑆𝐸𝐸 = √∑ (ℎ𝑚𝑜𝑑𝑒𝑙,𝑖 − ℎ𝑑𝑎𝑡𝑎,𝑖)2𝑛
𝑖=1
𝑛 − 2
(5)
is utilized as a comparison tool to determine the best discharge coefficient. The best coefficient is the
one that minimizes SEE. A new, optimized model is constructed using the optimized Cd value and
Equation 1 or Equation 2, respectively.
The model for the double tank system is created from using Equations 1 and 2, where the liquid from
the top tank drains directly into the lower one. A numerical solver, Simulink, is utilized to create a
theoretical model for this system, presented in Figure A3. According to the model presented in Figure
1, multiple switch statements are used to control values entering the tank: Switch returns a height of
h1B after the tank has ceased to drain, Switch1 returns a height of h2B after the second tank has
finished draining. Switch two “turns off” the input to the second tank when the first tank is empty.
8
Results and Discussion
The main claim of this lab was to validate our model of the double tank system using experimental data
from single tank experiments. To do this, we first determined the Cd’s for each tank as described
above. These values and their appropriate SEE values are shown in Table 1.
Table 1. Discharge coefficients and SEE results for the initial and optimized models for both the upper
and lower tank.
Upper tank Lower tank
Case Discharge coefficient, SEE (in) Discharge coefficient, SEE (in)
Initial model 0.7 .6777 0.7 2.5815
Optimized model .8272 .2329 1.598 .1920
An initial simulation was created using these Cd values and compared to the actual system data to
validate their accuracy. Using Equation 5, the best Cd value was calculated and used to create an
optimized model. The plots for the data, initial models, and optimized models are shown in Figure 2
and Figure 3.
Figure 2. The data, initial and optimized model responses of the upper tank.
9
Figure 3. The data, initial and optimized model responses of the lower tank.
Looking at Figures 2 and 3 above, we can conclude that the optimized Cd’s are very close to the actual
values of the data. For example on Figure 2, from a time of 15 to 20 seconds, the data and model
match up exactly. The same follows suit for Figure 3, but for times of 30 to 40 seconds. Another way to
show that the data and models are similar is by looking at the SEE values for both simulations. For the
upper tank, it has a value of .2329 which is a very close relationship. The bottom tank is even closer at a
SEE value of .1920. Both figures also have the same ending values.
There are some discrepancies in the plots, which would cause both of them not to match up. First off,
there is a spike towards the beginning in Figure 2. This could be caused by a multitude of different
causes. First off, the tanks themselves were not attached very well to apparatus, they were only
attached at two points which could have caused the tanks to swing a little bit when the tank is bumped,
or more importantly, when the valve is opened. This swinging could cause the sensor to get an
inaccurate reading as the water sloshed around. This would help to explain the spike at about 1 second
on the first figure. There are also spikes and jumps intermittently throughout all of the data. This could
be caused by the swinging, as well as the water splashing. This splashing will cause a slight change in
the sensor readings which will cause the spikes. Our goal does not include modeling this liquid
movement, so it can be safely neglected.
Other than the spikes, there are areas on the graph where the data goes both below and above the
model. This is caused by the fact that when there is less water in the system, it will drain out slower and
10 will cause the rate of draining to diminish. The model is optimized and keeps a continuous line, where
the data points will speed up and slow down due to the water level. This is shown on both of the
figures. On Figure 2, the data is above the model from the beginning to about 15 seconds. The data
then dips below from a time of 20 seconds until the end. In Figure 3, it is above from time 0 to 40
seconds, and below from time 40 to 60.
The Cd values for our simulation result in the data matching our model somewhat closely with the
exception of a few values, notably the discharge coefficient for tank two. Discharge coefficient values
have to be under the value of 1, but ours is 1.598. This could be caused by a few different things. First
off, the volume of the tanks, which helped us find our Cd’s, may not be totally accurate; the calculated
areas may not exactly match up with actual. The tanks have curved corners, rather than straight, which
will cause the area in our calculation to be smaller. This larger area would lead to a larger Cd calculation
due to the way that we calculated out Cd’s. The discrepancies in the Cd’s could also be due to a
combination of the other discrepancies in the data collection mentioned above.
Even though there were a few discrepancies within our data, we were still able to construct an accurate
model for the double tank experiment. Figure 4 compares the double tank model created using the
discharge coefficients against the collected data.
Figure 4. The data for the double tank and the simulated double tank model.
11 The model matches up closely with the data, but there are once again a few discrepancies between the
two. There are not really any noticeable spikes or jumps in either sets of data. The data does go under
and over the model again, which is once again probably caused by the water slowing down as it
empties. The peak times and values of both models and the corresponding data match up. This is
important because it shows that the drain and fill at the same rate. They models and data also have
similar steady state values and times. This shows that they become empty at the same time and all stay
constant at their final values. Otherwise, they both follow the same trend and actually meet up at a few
places, which helps solidify that this is an accurate model with the Cd’s that we used.
12
Conclusion and Recommendations
We can conclude that our initial data recorded was what we expected. It is easy to validate the
accuracy of our data because the model and the data graphs are very similar to each other for both the
upper and lower tanks. We can conclude from the slopes of the graphs on Figures 1 and 2 that the
second tank drains slower than the first, due to the size of the orifice. These two figures also show that
the optimized discharge coefficients values are accurate, and match our recorded data very well. The
result in Figure 3 comparing our model to data for the double tank is also relatively accurate, providing
another way to reinforce the validity of our discharge coefficients.
The first thing that needs to be mentioned as for things that should be changed if the lab were to be
done again is the spike in our graph. A few things could be changed to conclude better results. The
tanks need to be sturdier so that there is less variance in the way that the tanks could shake or wobble
so as to shift how the water was being drained. Another way that the tanks could be shifted is when
the valve is opened, it has a tendency to shift the tank. A way to decrease this fluctuation is by opening
the valve before beginning to record data, giving the water a little more time to settle. Furthermore, a
more accurate method than a hand ruler could be used to measure the dimensions of the tank and
orifice diameters, which potentially could vastly affect the resulting model and cause many
discrepancies and errors. Another way to conclude more accurate data is if the tanks would be shaped
in a way that is easier to measure using just a ruler. For example, the tanks we used had a smaller area
at the bottom than it did at the top, it also had curved edges, which gives some room for error in the
data simply from measurements of the tank.
13
Appendix A – Calibration of tank pressure transducer
Using a calibration program that was installed on the computer at the lab station, we obtained voltage values for
each tank at different heights. Using the data from table A1, we constructed a line of best fit. Using the slope and
intercept values from that line, we were able to derive a relationship between height and voltage. This allowed us
to compare the data found in our tests to out model.
Table A1: The output from the pressure transducer as measured along with the height of water from
the bottom of each tank.
Upper tank Lower Tank
Water height from bottom
(in)
Pressure transducer
output (V)
Water height from
bottom (in)
Pressure transducer
output (V)
9.02 2.21 8.91 2.37
8.05 2.11 7.94 2.28
6.95 2.00 7.00 2.20
5.95 1.90 5.98 2.09
4.98 1.81 4.99 1.98
3.94 1.70 4.00 1.87
2.93 1.59 2.99 1.76
1.97 1.49 1.97 1.66
0.94 1.38 1.00 1.55
14
Figure A1. A plot of the pressure transducer output and its calculated calibration equation (fit) for the
upper tank.
Figure A2. A plot of the pressure transducer output and its calculated calibration equation (fit) for the
lower tank.
15 clear all
close all
clc
%% Linear Fit Data
upperHcal = [9.02;8.05;6.95;5.95;4.98;3.94;2.93;1.97;0.94];
upperVcal = [2.21;2.11;2.00;1.90;1.81;1.70;1.59;1.49;1.38];
lowerHcal = [8.91;7.94;7.00;5.98;4.99;4.00;2.99;1.97;1.00];
lowerVcal = [2.37;2.28;2.20;2.09;1.98;1.87;1.76;1.66;1.55];
upperFitcal = polyfit(upperHcal,upperVcal,1);
um = upperFitcal(1);
ub = upperFitcal(2);
uv = um*upperHcal+ub;
lowerFitcal = polyfit(lowerHcal,lowerVcal,1);
lm = lowerFitcal(1);
lb = lowerFitcal(2);
lv = lm*lowerHcal+lb;
plot(upperHcal,upperVcal,upperHcal,uv)
xlabel('Height of water from bottom of tank (in)')
ylabel('Pressure on sensor (Volts)')
set(gcf,'color','w')
legend('Upper Tank','Upper Tank fit','Location','southeast')
figure()
plot(lowerHcal,lowerVcal,lowerHcal,lv)
xlabel('Height of water from bottom of tank (in)')
ylabel('Pressure on sensor (Volts)')
set(gcf,'color','w')
legend('Lower Tank','Lower Tank fit','Location','southeast')
%% Import & Formulate Data
lowerTank = xlsread('Lab_5_Bottom_Tank.xls');
upperTank = xlsread('Lab_5_Top_Tank.xls');
doubleTank = xlsread('Lab_5_Double_Tank.xls');
tdataLower = lowerTank(:,1);
vdataLower = lowerTank(:,3);
tdataUpper = upperTank(:,1);
vdataUpper = upperTank(:,2);
tdataDouble = doubleTank(:,1);
vdataDoubleUpper = doubleTank(:,2);
vdataDoubleLower = doubleTank(:,3);
hdataUpper = (vdataUpper-ub)./um;
hdataLower = (vdataLower-lb)./lm;
hdataDoubleUpper = (vdataDoubleUpper-ub)./um;
hdataDoubleLower = (vdataDoubleLower-lb)./lm;
%% Save as .mat
save UpperTankData tdataUpper hdataUpper
save LowerTankData tdataLower hdataLower
save DoubleTankData tdataDouble hdataDoubleUpper hdataDoubleLower
%% Fminsearch
16 Cd0=.7;
%Upper
options = optimset(@fminsearch);
options = optimset(options,'Display','iter');
coeffs = fminsearch(@lab5_perf_index_upper,Cd0,options);
Cd_upper = coeffs(1);
%Lower
Cd0=.7;
options = optimset(@fminsearch);
options = optimset(options,'Display','iter');
coeffs = fminsearch(@lab5_perf_index_lower,Cd0,options);
Cd_lower = coeffs(1);
SEE_upper = lab5_perf_index_upper(Cd0);
SEE_upper_op = lab5_perf_index_upper(Cd_upper);
SEE_lower = lab5_perf_index_lower(Cd0);
SEE_lower_op = lab5_perf_index_lower(Cd_lower);
%% Plot Initial vs Optimized Model
%Upper
d=.375; %in
Aout=pi*d^2/4; %in^2
Area=25.31; %in^2
a=3.5625; %in
g=32.2*12; %in/s^2
h0 = hdataUpper(1);
hmodel_ui=(-2*Area*Aout*Cd0*sqrt(2*g*(h0+a)).*tdataUpper +
(Aout*Cd0.*tdataUpper).^2.*g + 2*Area^2*h0)/(2*Area^2);
hmodel_uo=(-2*Area*Aout*Cd_upper*sqrt(2*g*(h0+a)).*tdataUpper +
(Aout*Cd_upper.*tdataUpper).^2.*g + 2*Area^2*h0)/((2*Area)^2);
figure()
plot(tdataUpper,hmodel_ui,tdataUpper,hmodel_uo,'--',tdataUpper,hdataUpper,'-
.')
xlabel('Time (s)')
ylabel('Height of water in tank (in)')
set(gcf,'color','w')
legend('Initial Model','Optmized Model','Data')
%Lower
d=.1875; %in
Aout=pi*d^2/4; %in^2
Area=25.31; %in^2
a=3.375; %in
g=32.2*12; %in/s^2
h0 = hdataLower(1);
hmodel_li=(-2*Area*Aout*Cd0*sqrt(2*g*(h0+a)).*tdataLower +
(Aout*Cd0.*tdataLower).^2.*g + 2*Area^2*h0)/(2*Area^2);
hmodel_lo=(-2*Area*Aout*Cd_lower*sqrt(2*g*(h0+a)).*tdataLower +
(Aout*Cd_lower.*tdataLower).^2.*g + 2*Area^2*h0)/((2*Area)^2);
figure()
plot(tdataLower,hmodel_li,tdataLower,hmodel_lo,'--',tdataLower,hdataLower,'-
.')
xlabel('Time (s)')
ylabel('Height of water in tank (in)')
17 set(gcf,'color','w')
legend('Initial Model','Optmized Model','Data')
%% Double Tank Data
maxstep= 0.1;
tol= 1e-4;
g=32.2;
Q1 = 0;
A1 = 25.31/144;
A2 = 25.31/144;
Do1 = .375/12;
Do2 = .1875/12;
Ao1 = pi*(Do1^2)/4;
Ao2 = pi*(Do2^2)/4;
h10 = 3.5625/12;
h20 = 3.375/12;
h1B = 0.625/12;
h2B = 0.5625/12;
Cd1 = Cd_upper;
Cd2 = Cd_lower;
h1_0 = 8/12;
h2_0 = 4/12;
tf = 250;
alpha = Cd1*Ao1*sqrt(2*g);
beta = Cd2*Ao2*sqrt(2*g);
n = h1B;
m = h2B;
sim('Skiroock_Prelab_5_model')
h1_in=h1*12;
h2_in=h2*12;
figure()
plot(tdataDouble,hdataDoubleUpper,tdataDouble,hdataDoubleLower,t,h1_in,t,h2_i
n);
legend('Upper Tank Data','Lower Tank Data','Simulated Upper Tank','Simulated
Lower Tank')
ylabel('Height of Fluid in Tank (From Bottom), (in)')
xlabel('Time, (s)')
function SEE_upper = lab5_perf_index_upper(Cd)
%Simulates upper tank parameters
d=.375; %in
Aout=pi*d^2/4; %in^2
Area=25.31; %in^2
a=3.5625; %in
g=32.2*12; %in/s^2
load UpperTankData
h0 = hdataUpper(1);
%hmodel=(-2*Area*Aout*Cd*sqrt(2*g*(h0+a)).*tdataUpper +
(Aout*Cd.*tdataUpper).^2.*g + 2*Area^2*h0)/((2*Area)^2);
hmodel=(-2*Area*Aout*Cd*sqrt(2*g*(h0+a)).*tdataUpper +
(Aout*Cd.*tdataUpper).^2.*g + 2*Area^2*h0)/((2*Area)^2);
18 SEE_upper = sqrt(sum((hmodel-hdataUpper).^2)./(length(hmodel)-2));
End
function SEE_lower = lab5_perf_index_lower(Cd)
%Simulates upper tank parameters
d=.1875; %in
Aout=pi/4*(d^2); %in^2
Area=25.31; %in^2
a=3.375; %in
g=32.2*12; %in/s^2
load LowerTankData
h0 = hdataLower(1);
hmodel=(-2*Area*Aout*Cd*sqrt(2*g*(h0+a)).*tdataLower +
(Aout*Cd.*tdataLower).^2.*g + 2*Area^2*h0)/((2*Area)^2);
SEE_lower = sqrt(sum((hmodel-hdataLower).^2)./(length(hmodel)-2));
end
Figure A3. The Simulink diagram used to model the two tank system.
Recommended