Flownetwork Problem
Flownetwork Problem
OBJECTIVE:
• To get comfortable in ‘playing’ with process data in Matlab. Remem-
ber the first step in successful process data analysis is to enjoy playing
with data.
• To verify that the data does indeed make sense. Appropriate balance
equations (mass, energy) can be used to identify sensors which may not
be functioning correctly. This exercise is also known in the literature
as ‘data reconciliation’ or ‘data validation’.
Basic Theory: Consider a reactor temperature at steady state (i.e.
constant with time). Ideally, the temperature reading (as measured by a
temperature sensor, say a thermocouple) should be constant. However, in
practice this will not be the case, and the sensor measurement will typically
be corrupted with noise (sensor noise, process noise, etc.). The measurement
equation can then be written as:
Tm = T + ε (1)
where T is the true (unknown) temperature value (the value which the
temperature would have if there were no noise), and ε is noise, assumed to
be Normally distributed with mean 0.
An example of repeated measurement as given by equation (??) is shown
in Figure 1 below (the true value is 100 0 C).
Noise in the sensor (as characterized by equation 1) is unavoidable. How-
ever, sometimes the sensors suffer from what are called as “gross errors” or
“bias errors” apart from normally distributed noise. For example, a sensor
which is wrongly calibrated (always shows a value which is 50 C more than
the true value) can have a bias. Another common reason for gross error can
be incorrect installation of the sensor. In presence of gross error, the sensor
equation can be written as:
Tm = T + δ + ε (2)
1
103
102
101
100
Temperature
99
98
97
96
0 50 100 150 200 250
time
104.5
104
103.5
103
102.5
Temperature
102
101.5
101
100.5
100
99.5
0 50 100 150 200 250
time
2
If sufficient measurements are present in the process, then by using
process balance equations (mass balance, energy balance), gross errors in
some sensors can be detected. For instance in the above example, if there is
another thermocouple close to the temperature sensor and there is no addi-
tion or loss of heat between the two points then there will exist a relation:
Tm -Tnew =0. This relation can be used to detect gross error in any of these
two temperature sensors.
Problem:
A “process monitoring and data reconciliation” experiment has been
designed for evaluating the performance of various sensors and detecting
sensor malfunctions.
The equipment consists of a cold and hot water stream mixing at a
’T’ junction, as shown in the schematic below. The temperatures and flow
rates are measured by thermocouples and orifice meters respectively. The
equipment is interfaced to a personal computer and all variables are logged
every 2 sec. Several thousand data points have been collected and have been
stored in the file “data.txt”. The data file is provided in the course website.
Load the data into your Matlab workspace using ”load data.txt” com-
mand (change the directory or the path if necessary). You should have a
variable called “data” with size 2990X8 in the workspace. Data columns are
as follows:
• Column 1: Time(sec)
• Column 2:T1(degrees C)
• Column 3:T2(degrees C)
• Column 6:Flow-cold(Volts)
• Column 7:Flow-hot(Volts)
• Column 8:Flow-total(Volts)
3
Fcw Ft
T1 T4 T5
cold
water
Fhw
hot
water T2
Figure 3: Schematic of a mixing process. “F” stands for flowrate, and “T”
stands for temperature
√
ṁhw (kg/h) = 1.444 + 181.574 volts
√
ṁt (kg/h) = −2.319 + 355.822 volts
b) Plot the flow rate data (each of the three flow rates) by plotting it in units
of kg/h versus time. Calculate the mean and the variance of each of the three
flow rates. Note that under steady state assumptions, the sensor readings
should ideally be constant. However, due to presence of noise (experimental
errors, sensor noise, etc.) the sensor values are not constant, but fluctuate
around a mean value. Does the data seem to make sense?
c) Clean outliers from the flow rate data set (i.e. replace all data points
which are outside the mean ± 3*standard deviation band by the correspond-
ing variable mean and save this data for use in part d) and onwards. Show
the plots of the clean flow rate data.
[The idea here is that if noise is normally distributed with mean 0,
then the probability of getting a measurement which is outside the mean
± 3*standard deviation limit is practically zero (0.001). Hence, it is as-
sumed that values outside this limit are a result of some malfunction, such
as a sudden voltage spike, or a wrong recording (if a human is involved)
and these values need to be replaced by a reasonable estimate (which is the
mean) in our analysis].
For the remaining parts, work with the clean flow rates (free of outliers)
4
0 = ṁt − ṁhw − ṁcw
However, due to noise in the measurements, the LHS of above equation will
not exactly be zero, and the above eqn. can be rewritten as:
0 = Cp4 T4 − Cp5 T 5
Compute the closure error for the above equation (make simplifying assump-
tions about the heat capacities, for example you can assume that they are
insensitive to temperature variations and hence just cancel them from the
above equation).
Construct the histogram of this closure error and calculate its mean and
variance. Do you think there is a gross error with either one of T4 or T5
sensors?
2) If your answer to the previous question is “yes there is a gross error
in either T4 or T5 sensor”, then we need to detect which one of the two has
a gross error. For that, let’s write down overall energy balance equations.
We can write two separate equations: one with T4 and one with T5 as:
5
0 = ṁcw Cp1 T1 + ṁhw Cp2 T2 − ṁt Cp3 T4 and
(You can make appropriate assumptions for the CP values of the different
streams as before). Similar to mass balance closure errors, the LHS will not
be exactly zero.
(a) Plot the histograms of the two closure errors, and compute their
means and variances. (b) Which of the above energy balances gives the
most reasonable closure errors? Based on this which of T4 or T5 sensor is
likely to contain gross error?
[Note: In the energy balance equations, we have made simplifying as-
sumptions, such as no loss of energy to the surroundings, and ignored po-
tential energy, kinetic energy, and work done].
Answering the above problems:
For each of the above question, provide relevant plots with appropriate
labels (plots without labels will not get any credit), discuss the plots and
comment on the results. Also, try to be precise and technical when answering
these questions.