Sunteți pe pagina 1din 31

CHEE3007 Process Modelling and Dynamics

HEAT EXCHANGER

Model Solution, Calibration, Validation and End-Use









Team D7
Arnold Ng, Damien Naidu & Kim Loi








ii
Table of Contents
1. INTRODUCTION ................................................................................................................................ 1
2. MODEL CONSTRUCTION ................................................................................................................ 1
3. NUMERICAL SOLUTION .................................................................................................................. 2
3.1. General Solution Method............................................................................................................... 2
3.2. Selection of Parameters ................................................................................................................. 2
3.3. System Inputs (Fw, Psteam & Tin) ............................................................................................. 4
3.4. Initial Conditions ............................................................................................................................. 4
3.5. Typical Model Solution .................................................................................................................. 4
3.6. Troubleshooting ............................................................................................................................... 5
4. MODEL VERIFICATION ................................................................................................................... 6
5. MODEL CALIBRATION & VALIDATION ...................................................................................... 8
6. SENSITIVITY ANALYSIS ON INPUTS ........................................................................................ 13
7. SENSITIVITY ANALYSIS ON OUTPUTS .................................................................................... 15
8. DISTRIBUTED PARAMETER MODEL ....................................................................................... 16
9. REFERENCE ..................................................................................................................................... 18
10. APPENDIX ........................................................................................................................................ 19
10.1. Appendix 1 ...................................................................................................................................... 19



1
1. INTRODUCTION
The project aims to model a heat exchanger system to predict the dynamic changes of outlet water
temperature in response to disturbances in steam flow-rate and inlet water flow rate. This report is a
continuation from the previous report where a model was proposed for the heat exchanger system.

This report focuses on obtaining a numerical solution for the model and testing the sensitivity of
inputs and parameters to disturbances. The steps taken in this model includes:
Preparation of a numerical solution to the proposed model
Selection of initial conditions and debugging procedures
Verification of model prediction against some plant data
Calibration and validation through Parameter Estimation
A sensitivity analysis of changes in inputs
A sensitivity analysis of changes in parameters
A distributive parameter model for sensitivity analysis

The report uses MATLAB to obtain a numerical solution for the model. All MATLAB codes used
in the report are listed in the Appendix.

2. MODEL CONSTRUCTION
Following the model proposed in the previous report, the equations used and their precedence are
listed below.

Conservation Equation:
(g1)



Constitutive Equation:
Heat Transfer:
(g2)



(g3)

)

(g4)


(g5)


2

(g6)

)

(g7)



Variables:
t time [s]
T outlet temperature [K]
F
W
inlet water flow [kg/s]
V tube volume [m
3
]

L
inlet water density [kg/m
3
]
T
in
inlet water temperature [K]
c
P,L
heat capacity of pure water [J/kg.K]
Q heat transfer from steam to the liquid water [J]
UA convective heat transfer coefficient multiplied by the heat transfer area [W/K]
T
LM
the log-mean difference
T
1
inlet temperature difference [K]
T
2
outlet temperature difference [K]
T
steam,in
inlet temperature of steam [K]
P
steam
inlet steam pressure [mmHg]
The order of solving the equations is: g6, g7, g5, g4, g3, g2. The core MATLAB codes based on
these equations are detailed in Appendix 1. The constitutive equations are arranged in precedence
order to obtain solution.

3. NUMERICAL SOLUTION
3.1. General Solution Method
The model was solved using an ODE function in MATLAB. The method requires the user to:
1. set up a function file and assign variables
2. specify algebraics, parameters and constants to satisfy the degrees of freedom,
3. list the constitutive equations in order (from the digraph in Assignment 1) to minimize
computation time,
4. set the conservative equations to be solved and
5. then in a separate driver file with ODE solver, initial conditions and time span of the
process, calling the previous function file
3.2. Selection of Parameters


3

Specific Heat Capacity (C
pL
) and Density (

) of Water





The specific heat capacity (at constant pressure) and density are functions of temperature. However
in the model neither are considered as variables instead they are specified (C
pL
= 4200 kJ/ kg K
and

= 1000 kg/m
3
) as constants. Figure 1 and 2 show that the specified thermal properties will
be overestimates with increasing water temperature. However the heat capacity and density only
vary by 2% and 5% respectively over the temperature range so the simplification is justified.
Overall Heat Transfer Coefficient (UA)
The overall heat transfer coefficient is specific to a heat exchanger and usually a function of the
system flow rates. Convection within the water stream was deemed the dominant mechanism of
heat transfer so UA is greatly dependent on water flow rate. An approximate value for the
coefficient value can be found in Welty et al. 2007 which quotes = 2280-3400 W m
-2
K
-1
(hence

= 2840 W m
-2
K
-1
) for steam to water heat transfer. can be used using the system dimensions:



Antoine Equation Variables (A, B & C)
The saturation temperature (T
steam in
) was calculated using the Antoine Equation (results displayed
in Figure 4). The steam pressure could be set between 1 and 3 bar (gauge) which is a significance
difference of 1520
o
C when examining Figure 4, therefore a constant saturation temperature was
not specified instead the Antoine Equation was included as a constitutive equation to determine
steam temperature from a given steam pressure.


Water-side Tube Volume (V)




The volume of water tube was calculated using dimensions of the heat exchanger (D = 1.8e-4 m, L
= 0.8m), which are assumed constant and with cylindrical geometry. The calculated volume is

.
0 20 40 60 80 100
4140
4160
4180
4200
4220
Temperature (C)
S
p
e
c
i
f
i
c

H
e
a
t

C
a
p
a
c
i
t
y

(
J
/
k
g

C
)
Figure 1 Specific heat capacity of water as function
of temperature adapted from Green & Perry 2007
0 20 40 60 80 100
950
960
970
980
990
1000
Temperature (C)
D
e
n
s
i
t
y

(
k
g
/
m
3
)
Figure 2 Density of water as function of temperature
adapted from Green & Perry 2007

4


3.3. System Inputs (Fw, Psteam & Tin)

The water flow rate (F
w
), inlet steam pressure (P
steam
) and inlet water temperature (T
in
) are specified
using laboratory data. These inputs are unique to each scenario, hence cannot be specified as
parameters.
3.4. Initial Conditions






There is one conservative equation for the lumped model so one initial condition needs to be
specified. The initial outlet water temperature needs to be specified. This can be selected from a
typical operating point in the experimental data at the users discretion.

3.5. Typical Model Solution
Model Solution
The above model in MATLAB was used to produce a numerical solution for a specified operating
point. Figure 4 displays a typical solution for initial steady state in the laboratory experiment. All
the inlets and parameters ran smoothly. The figure shows both the dynamic part and steady part of
the solution. The model shows that steady is reached really fast, indicating by a very steep slope in
the dynamic section.




0 1 2 3 4 5
60
80
100
120
140
160
Saturation Pressure (bar)
T
e
m
p
e
r
a
t
u
r
e

(
C
)
Figure 3 Water temperatures at different saturation pressures
using the Antoine Equation with variables from NIST 2013
5


3.6. Troubleshooting




There were a few issues that were encountered when the model was solved:

For low water flow rates (0.015 kg/s) the water stream boiled. The model overestimated
the exit temperature for this situation because model assumes no phase change in the water
stream. Cut-off flow rate of 0.015 kg/s is used to ensure that boiling point is not reached.
The ODE solver was changed from ODE45 to ODE15s which is better at handling stiff
models. This modification
reduced the oscillations in the
model solution. Oscillations in
the model solution can be
amplified when step changes are
implemented so a solver change
is justified (Figure 5 highlights
oscillations).
Initial temperature needed to be
changed to Kelvin degrees as the
model is based on K.
Time span for ODE solver was
chosen too wide (1000 s), the
dynamic change in water
temperature was not clearly
displayed. The time span was
reduced down to 100s instead.
0 20 40 60 80 100
0
20
40
60
80
Time (s)
T
e
m
p
e
r
a
t
u
r
e

(
C
)
Fw = 0.054kg/s
Tin = 18.6C
Psteam = 2.4bar (gauge)
T(0) = 68.6 (initial condition)
Figure 5 Model solved with ODE45 has oscillations in the
steady state solution
Figure 4 Typical heat exchanger operating point (steady-state
behavior).
6

4. MODEL VERIFICATION
To assess the importance of the value of UA on the model, a preliminary comparison between the
model prediction of outlet liquid temperature and the experimental data was done. The theoretical
UA of 128 W/K was selected. Using MATLAB, the results are shown in Figure 6 & Figure 7.






From Figure 6 & Figure 7, the model prediction of outlet temperature deviates from the
experimental data, over and under-predicting the temperatures in both scenarios in the range of 10
Figure 6. Initial comparisons of models outlet water temperature and experimental
data for steam pressure at 2.4 bar (gauge) and water flow rate of 0.091 kg/s.
Figure 7. Initial comparisons of models outlet water temperature and experimental data for
steam pressure at 2.8 bar (gauge) and water flow rate of 0.047 kg/s.
7
degrees Kelvin. The sum of least squares for both scenarios, 184.95 and 891.48, suggest a
substantial difference between the model and the data. However, the model returns a solution that
has a similar shape to the data solution. This suggests the accuracy of the model prediction can be
improved by adjusting UA through calibration to fit the experimental data.

In addition, the Measured data vs Model data plots show clusters of steady-state data against a few
dynamic data points. The lack of dynamic data will pose difficulty in assessing the accuracy of the
model through statistical analysis. On the other hand, it was noted that the residual plots show a
high chance of correlation in the residuals. This suggests the model may need to be modified as the
difference between the prediction and actual data seems to increase with time. However, residual
plots with calibrated UA would be able to clarify this situation.


8
0 1000 2000 3000 4000 5000
0
20
40
60
80
100
120
140
Time (s)
U
A

(
W

K
-
1
)
5. MODEL CALIBRATION & VALIDATION
Model Calibration

The predictive capability of the model can be improved through iteratively changing a parameter to
reduce the sum square of errors. It was observed during the initial model comparison that the UA
was overestimated given the higher outlet temperature predicted by the model than observed
experimentally. UA for this heat exchanger was determined to be mainly a function of the water
flowrate so it varies with disturbances in the water flowrate. However, the variation of UA may be
within the specified accuracy to use a constant UA.

Matlab was used for calibration utilising the Levenberg-Marquardt nonlinear regression method
(LMA). The method is quite popular; however the LMA can only find local minimums, not global
minimums when calibrating UA (Madsen et al. 2004). Therefore it is important to use a wide range
of operating points to ensure that the calibrated UA is not biased by a narrow set of operating
conditions. This is accomplished by essentially running the model over the entire data set (seven
step changes) and then averaging the calibrated values to get the best estimate.

As a check on the Matlab results the UA can be determined empirically using the experimental data.
This was done by calculating the heat absorbed by the water () using equation 1. This was then
substituted into the rearranged heat transfer equation (equation 2).


) ()

()

Figure 3 shows the result of the substitution. There are two instances when the heat transfer
coefficient decreases substantially (at 1000 seconds and 4600 seconds), which are likely caused
by the same event, that is the water flow rate was lowered to a level which allowed sufficient
residence time for the water to boil. This contradicts the assumption of no phase change in the water
stream so is considered outside the scope of the model. A qualitative examination of Figure 3,
disregarding the boiling point data a UA of 100 to 120 W K
-1
would be reasonable to expect during
the calibration.












9
0 100 200 300 400 500
320
325
330
335
340
345
350
355
Time (s)
O
u
t
l
e
t
e

W
a
t
e
r

T
e
m
p
e
r
a
t
u
r
e

(
K
)


Model
Experimental
Psat = 280kPa (gauge)
Tin = 292 K
Fw = 0.092 to 0.047 kg/s
0 100 200 300 400 500
320
325
330
335
340
345
Time (s)
O
u
t
l
e
t
e

W
a
t
e
r

T
e
m
p
e
r
a
t
u
r
e

(
K
)


Model
Experimental
Psat = 280kPa (gauge)
Tin = 292 K
Fw = 0.092 to 0.047 kg/s

Figure 3 Empirically calculated overall heat transfer coefficient (UA) with time
Figure 4 shows one of the seven step changes used in the calibration (see Appendix for others
which show similar trends). It shows that while the shape of the model and experimental data is the
same (suggesting that the underlying mechanism in the model is correct) there is a clear
overestimate with the model output, which would suggest that model is calculating a larger amount
of heat transferred to the water stream than occurs in reality, that is the UA value is too large.
Therefore the calibration would likely decrease the original UA, which is observed.













Figure 4 Typical operating point in the original model running at a step increase from a lowering
of the water flowrate (UA = 128 W K
-1
)
The calibration was run by executing the mainpar.m function file at each of the step changes for
relevant initial water temperatures, flowrates and steam saturation pressure to obtain a calibrated
UA for each case and key statistical variables describing how good the calibrated model fits the
experimental data. Figure 5 shows the increased fit the calibrated model has for the experimental
data.










10
0 100 200 300 400 500
-15
-10
-5
0
5
10
15
20
time, s

=
y
i
-
y
m
i


0 100 200 300 400 500
-5
0
5
10
15
20
time, s

=
y
i
-
y
m
i


Figure 5 Typical operating point in the calibrated model running at a step increase from a
lowering of the water flowrate with UA = 104 1.3 W K
-1

The data is weighted towards the steady-state data for calibration as there are more data points in
this region. If the steady-state data is reduced the UA estimate will change with a greater fit for the
dynamic behaviour, however due to the fast response of the system to changes and the fact that
measurements were taken every 10seconds this results (not many individual dynamic points) in
larger sum of square residuals and therefore not optimal for finding a reasonable UA.

The calibrated UA can better quantified in terms of its improvement by examining Table X and
Figure 6 (other step changes display the same trends). It is apparent from the residual plot and other
similar descriptors (smaller confidence interval) that the model error has likely been reduced. These
outputs were simulated with calibrate.m. Table XX displays the final calibrated value of UA (105
1.6 W K
-1
). The changes that involved boiling were removed to maintain model scope and
accuracy. The final calibrated value was lower than the original value as expected from the
empirical analysis that estimated a UA between 100 to 120 W K
-1
.

Table X Comparison of the original (128 W K
-1
) and calibrated UA for P
sat
= 280kPa, T
in
= 292K
and F
w
= 0.092 to 0.047 kg/s
Statistical Variable Original Calibrated
UA (W K
-1
) 128 104
CI (95%) - 1.3
R
2
- 0.82
SSE 346 85
NormRMSE 2.6 0.08
Residual RMSE 0.025 0.0048
Residuals 7.42 0.02

Table XX
Statistical Variable Mean (excluding boiling point step changes)
UA (W K
-1
) 105
CI (95%) 1.6
R
2
0.80
SSE 113
NormRMSE 0.41
Residual RMSE 0.0200
Residuals 0.01


11
0 200 400 600 800 1000 1200
320
325
330
335
340
345
350
355
360
Time (s)
O
u
t
l
e
t

W
a
t
e
r

T
e
m
p
e
r
a
t
u
r
e

(
K
)


Model
Experimental
Psat = 200kPa (gauge)
Tin = 292K
0.075 kg/s
0.058 kg/s
0.039 kg/s
Figure 6 Residual Plot before and after calibration

Validation
Model validation requires that calibrated UA be checked against the experimental data. However,
independent data must be used since the calibrated UA was determined using the original data
which would bias validation (Figure X). It is apparent qualitatively from Figure X that the
calibrated UA is able to predict outlet water temperature within the 20% accuracy the model goal
specified.



















Figure X Validation of UA = 105 2 (W K
-1
) using group D1 data for different water flowrates,
constant saturation pressure and inlet water flowrate (see Appendix X for Matlab code)

Appendix
Calibrated overall heat transfer coefficient (UA) at different step changes (F
w
and P
sat
)
F
w
(kg/s) 0.092 0.029 0.055 0.0714 0.092 0.047 0.069
T
in
(
o
C) 61.7 100.7 91.5 54.0 51.6 49.5 101.5
P
sat
(gkPa) 240 240-220 220 220 280 280 280
UA (W K
-1
) 107 119 112 98 104 104 120
CI (95%) 3.3 0.6 2.6 0.2 0.8 1.3 6.8
R
2
0.46 0.80 0.76 0.87 0.57 0.82 0.56
SSE 220 24125 247 2 13 85 1336
NormRMSE 0.17 3.01 0.09 1.58 0.13 0.08 0.14
Residual RMSE 0.0076 0.0728 0.0077 0.0780 0.0019 0.0048 0.0171
Residuals 0.02 26.23 0.03 0.00 0.00 0.02 0.04

Mean result of Calibrated UA values from the different step stages
Statistical Variable Mean Mean (excluding B.P data)
UA (W K
-1
) 109 105
CI (95%) 2.2 1.6
R
2
0.69 0.80
SSE 3718 113
NormRMSE 0.74 0.41
12
Residual RMSE 0.0271 0.0200
Residuals 3.76 0.01




13
6. SENSITIVITY ANALYSIS ON INPUTS
Initial conditions were set as follows:
Flow of water (Fw) = 0.05 kg/s
Pressure of steam (Psteam) = 3.4 bara
Inlet temperature (Tin) = 18.63

The final steady state temperature for these inputs was 338.72.

Next, the input variables were varied separately to determine the effect each variable has on the
modeled state variable, the outlet temperature. The results are presented in Figure 6.1.

Figure 6.1 Effect of varying input variables by 30% on the outlet temperature
For a 15% increase in the water flow rate, steady state outlet temperature drops by 7.4% while a
15% decrease in the water flow rate increases the steady state outlet temperature by 9.3%. This is
expected because a decrease in the water flow rate means that there is less water to absorb the heat,
resulting in a rise in the temperature. It should be noted that the decrease in flow rate causes a
temperature rise of a greater magnitude than the drop caused by the increase in the flow rate. This is
because a slower flow rate also increases the retention time, allowing more time for heat transfer
and hence resulting in more heat being absorbed. Conversely, the increase in flow rate results in
14
less heat being absorbed. This phenomenon exacerbates the temperature increase for a reduction in
flow rate and mitigates the temperature drop for a similar increase in flow rate.

For a 15% increase in the steam pressure, steady state outlet temperature increases by 2.6%, while
for a 15% decrease, the steady state outlet temperature decreases by 2.9%. This is not unexpected as
increasing the steam pressure increases the steam temperature, thereby increasing the driving force
for the heat transfer and the amount of heat transferred. This causes an increase in the steady state
outlet temperature. However, the overall effect on the outlet temperature is smaller than the effect
of water flow rate. This seems to suggest that the heat transfer driving force is not a major factor in
the heat transfer. This is because even while the temperature varies by ~, which is about 5-
10% of the temperature difference through heat exchanger, the final effect on the outlet temperature
is only ~3% which is far less than the effect of the flow rate, which was ~7-10%.

Now, examining the effect of the inlet temperature, it was found that a 15% increase resulted in a
2.6% increase in the steady state temperature. Conversely, a 15% decrease resulted in a 2.6% drop
in the steady state outlet temperature. This is not surprising as an increase in the inlet temperature
increases the amount of heat flowing into the exchanger, as part of the water flow, and hence would
cause an increase in the amount of heat flowing out of the heat exchanger. However, this effect is
not very strong because the inlet temperature of the water is only ~20-50% of the outlet temperature
for the ranges examined during the experiment. Therefore, the absolute magnitude of a 15% change
in the inlet temperature is insufficient to greatly affect the outlet temperature.

From the analysis of the sensitivities, it is found that the outlet temperature is most sensitive to the
water flow rate. Therefore, the water flow rate would be an ideal controlling variable if it were
desired that the outlet temperature be maintained.

The MATLAB code for this analysis is presented in Appendix X.
15
7. SENSITIVITY ANALYSIS ON PARAMETERS

Sensitivity analysis was also carried out on the key parameter in this model, the scaled overall heat transfer
coefficient, UA. UA was varied by 30% and the results graphed for comparison (Figure 7.1).

Figure 7.1 Effect of varying UA on the outlet temperature
A 15.4% increase in outlet temperature was observed when UA was increased by 30% while a
drop of 17.8% was observed when UA was decreased by 30%. This is unsurprising as UA is a
key controlling factor in the heat transfer between the steam and the water. Increasing the UA
will result in an increase in the heat transferred, Q, from the steam to the water and hence
cause the outlet temperature to rise.

The MATLAB code for this analysis is presented in Appendix X.


16
8. DISTRIBUTED PARAMETER MODEL
A variable stage model was used in order to model the system in the distributed domain. The
system was broken up into N stages, with key parameters and state variables changing from stage to
stage. The model was used to predict the response to a 15% decrease in the flow rate and the
number of stages was varied (between 5 25 stages) in order to analyse the effect of the number of
stages on the steady state outlet temperature and temperature profile (Figure 8.1).

Figure 1 Outlet temperature response and temperature profile for variable stage distributed parameter model
From the graph, it can be seen that as the water flow rate is decreased, the outlet temperature rises
and the temperature profile is steeper. This is expected for the reasons described in Task 6. It is
interesting to note, however, that the calculated steady state outlet temperature and temperature
profile changes as the number of stages increases.

As the number of stages increases, the steady state outlet temperature increases. However, the
magnitude of the response to each subsequent increase in the number of stages is decreasing as the
number of stages gets higher and higher. Compare the case where the number of stages is increased
from 5 (green) to 10 (red) and subsequently to 25 (blue). Even though the number of stages
increased by 150% in the latter test, compared with 100% in the former, the response of the outlet
temperature in the latter test is markedly less than that in the former. Analysis of the gradient
change of the temperature profile in response to the increase in the number of stages shows a
similar trend.

The reason for this is because when the number of stages is small, stage variables tend to be more
inaccurate as they are averaged throughout the stage. In this case, where the temperature of the
outlet is taken as the temperature of the final stage, the outlet temperature would be underestimated
because it is averaged with a lower temperature. However, as the number of stages increases, the
size of each stage decreases, which means that parameter variation in the stage is reduced.
Therefore, the accuracy of the output increases. Since the temperature was previously
underestimated, this increase in accuracy results in a rise in the temperature.
17
The MATLAB code for this analysis is presented in Appendix X.

18
9. REFERENCE

www2.imm.dtu.dk/pubdb/views/edoc_download.php/3215/pdf/imm3215.pdf
Also use all the references from Project 1 as well

19
10. APPENDIX
10.1. Appendix 1
Function File:
%CHEE3007 Assignment 2 Lumped DoublePipe HX Model
%Heat is Exchanged between Saturated Steam and Liquid Water
%Created by team D7, CHEE3007, Sem 2, 2013

%FUNCTION FILE CALLED HeatExchanger

function f = HeatExchanger(t,y)

%-------------------Assign Variable to ODE---------------------------------
T = y;
%Assigning T to the vector y

%-------------------Parameters, Constants----------------------------------

V = 2.04E-4; %Volume of HX, m3
rhoL = 1000; %Density of Water, kg/m3
CpL = 4200; %Specific Heat Capacity of Water, J/(kg K)
Fw = 0.054; %Water Flow-Rate, kg/s
UA = 128; %Overall Heat Transfer Coefficient, W/K
Tin = 273.15+18.6; %Inlet Water Temperature, K
Psteam = 2.4+1; %Inlet Steam Pressure, bar
A = 3.55959; %Antoine Equation Constant
B = 643.748; %Antoine Equation Constant
C = -198.043; %Antoine Equation Constant


%-------------------Constitutive Equations---------------------------------

Tsteamin = (B/(A-log10(Psteam))) - C; %K
%Antoine Equation to calculate the temperature
%given the saturation pressure

Tsteamout = Tsteamin; %K
%This relationship holds when the steam is
%assumed to always be at saturation

deltaT1 = (Tsteamin - Tin); %K
%A term in log-mean Temperature Difference Equation

deltaT2 = (Tsteamout - T); %K
%A term in the MeanLog Temperature Difference Equation

deltaTlm = (deltaT1 - deltaT2)/log(deltaT1/deltaT2); %K
%Log-Mean Temperature Difference

Q = UA*deltaTlm; %W
%Amount of heat transfer between the Water and Steam


%-------------------Conservation Equations---------------------------------

f = (Fw/(V*rhoL))*(Tin-T) + Q/(V*rhoL*CpL); %K/s
%ODE describes the Dynamic Exit Temperature of the Water Side
f=f'; %Transpose the result matrix
20

Driver file:
%CHEE3007 Assignment 2 Lumped DoublePipe HX Model
%Heat is Exchanged between Saturated Steam and Liquid Water
%Created by team D7, CHEE3007, Sem 2, 2013

%DRIVER FILE CALLED HeatExchangerd

clear all %clear all previously stored variables
clc

y0 = 273.15+61.68; %K
%Set Initial Temperature Condition



tspan = [0 100]; %s
%Set time interval the model will be solved over


[t y] = ode15s(@HeatExchanger,tspan,y0);
%uses ODE45 and solves over tspan
%for y0 as an initial condition, calls on
%function file HeatExchanger


A = load('D7 Prac data.txt');
%load the experimental data result to A

Tdata = A(:,2); %K
%load experimental temperature to Tdata


time_data = A(:,1) %s
%load the time span from experimental data

%Plot solution over time
A = plot(t,Tmodel) %plot model temperature versus time

hold on

B = plot(time_data,Tdata)
%plot data temperature versus time

xlabel('Time (s)');

ylabel('Temperature (C)');

title('Model versus data');

legend(A,'Model',B,'Data');

hold off

21
10.2. Appendix X
Driver for Sensitivity Analysis of Lumped Paremeter Model
%CHEE3007 Assignment 2 Lumped DoublePipe HX Model
%Heat is Exchanged between Saturated Steam and Liquid Water
%Driver

clear all
clc

tspan = [0,100];

global Fw
Fw = 0.05; %kg/s
global Psteam
Psteam = 3.4; %bar
global UA
UA = 105; %W/K %Overall Heat Transfer Coefficient
global Tin
Tin = 18.63+273.15; %K

y0 = 338.71; %K

%Solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
subplot(3,1,1)
plot(t,y-273.15,'k')
hold on

%change Fw
Fw=0.05+0.15*0.05;

%solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
plot(t,y-273.15,'r')
hold on

%calculate percentage change
disp('For Fw +15%, steady state temperature changes by ')
A1=(y(end)-y0)/(y0-273.15)*100;
disp(A1)

%change Fw
Fw=0.05-0.15*0.05;

%solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
plot(t,y-273.15,'b')
hold off
title ('Varying water flow rate')
xlabel('Time (s)')
ylabel('Temperature (C)')
legend('Fw = 0.05kg/s','Fw +15%','Fw -15%','Location','East')


%calculate percentage change
22
disp('For Fw -15%, steady state temperature changes by ')
A2=(y(end)-y0)/(y0-273.15)*100;
disp(A2)

%reset and solve for changes in Psteam
Fw=0.05;

%solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
subplot(3,1,2)
plot(t,y-273.15,'k')
hold on

%change Psteam
Psteam=3.4+0.15*3.4;

%solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
plot(t,y-273.15,'r')
hold on

%calculate percentage change
disp('For Psteam +15%, steady state temperature changes by ')
A3=(y(end)-y0)/(y0-273.15)*100;
disp(A3)

%change Psteam
Psteam=3.4-0.15*3.4;

%solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
plot(t,y-273.15,'b')
hold off
title ('Varying steam pressure')
xlabel('Time (s)')
ylabel('Temperature (C)')
legend('Psteam = 3.4 bara','Psteam +15%','Psteam -15%','Location','East')

%calculate percentage change
disp('For Psteam -15%, steady state temperature changes by ')
A4=(y(end)-y0)/(y0-273.15)*100;
disp(A4)

%reset and solve for changes in Tin
Psteam=3.4;

%solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
subplot(3,1,3)
plot(t,y-273.15,'k')
hold on

%change Tin
Tin=18.63+0.15*18.61+273.15;
23

%solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
plot(t,y-273.15,'r')
hold on

%calculate percentage change
disp('For Tin +15%, steady state temperature changes by ')
A5=(y(end)-y0)/(y0-273.15)*100;
disp(A5)

%change Tin
Tin=18.63-0.15*18.61+273.15;

%solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
plot(t,y-273.15,'b')
hold off
title ('Varying inlet temperature')
xlabel('Time (s)')
ylabel('Temperature (C)')
legend('Tin = 18.63 C','Tin +15%','Tin -15%','Location','EAst')

%calculate percentage change
disp('For Tin -15%, steady state temperature changes by ')
A6=(y(end)-y0)/(y0-273.15)*100;
disp(A6)


24
10.3. Appendix X
Driver for Sensitivity Analysis of Lumped Paremeter Model
%CHEE3007 Assignment 2 Lumped DoublePipe HX Model
%Heat is Exchanged between Saturated Steam and Liquid Water
%Driver

clear all
clc

tspan = [0,100];

global Fw
Fw = 0.05; %kg/s
global Psteam
Psteam = 3.4; %bar
global UA
UA = 105; %W/K %Overall Heat Transfer Coefficient
global Tin
Tin = 18.63+273.15; %K

y0 = 338.71; %K

%solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
subplot(3,1,1:3)
plot(t,y-273.15,'k')
hold on

%change UA
UA=105+0.3*105;

%solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
plot(t,y-273.15,'r')
hold on

%calculate percentage change
disp('For Tin +30%, steady state temperature changes by ')
A1=(y(end)-y0)/(y0-273.15)*100;
disp(A1)

%change UA
UA=105-0.3*105;

%solve model
[t,y] = ode15s(@LumpedHE,tspan,y0);

%plot solution
plot(t,y-273.15,'b')
hold off
title ('Varying UA')
xlabel('Time (s)')
ylabel('Temperature (C)')
legend('UA = 105 W/K','UA +30%','UA -30%','Location','Best')

%calculate percentage change
disp('For Tin -30%, steady state temperature changes by ')
25
A2=(y(end)-y0)/(y0-273.15)*100;
disp(A2)





26
10.4. Appendix X
Function file for Variable Stage Distributed Parameter Model
function f = DistributedHE(t,y)

global Fw Psteam UA N L Tin

%---------------------LOCAL VARIABLES --------------------------------
T = ones(1,N);
for i=1:N
T(i) = y(i);
end

%---------------------PARAMETERS--------------------------------------
R=9e-3; %inner radius of the pipe, m3
V = pi*R^2*L; %m3
rhoL = 1000; %kg/m3
cpL = 4180; %J/kg.K
A = 3.55959; %Antoine Equation Constant
B = 643.748; %Antoine Equation Constant
C = -198.043; %Antoine Equation Constant

%----------------CONSTITUTIVE EQUATION--------------------------------
Tsteamin = B/(A-log10(Psteam))-C;
Tsteamout = Tsteamin; %K %This relationship holds when the steam
%is assumed to always be at saturation

for k = 1:N
Q(k) = (UA/N) * (Tsteamin - T(k));
end

%----------------CONSTERVATIVE EQUATIONS--------------------------------

%INLET STAGE
f(1) = Fw * (Tin - T(1)) / (V/N*rhoL) + Q(1)/(V*rhoL*cpL/N);
%INTERMEDIATE STAGE
for j = 2:(N-1)
f(j) = Fw * (T(j-1) - T(j)) / (V/N*rhoL) + Q(j)/(V*rhoL*cpL/N);
end

%OUTLET STAGE
f(N) = Fw * (T(N-1) - T(N)) / (V/N*rhoL) + Q(N)/(V*rhoL*cpL/N);

f=f';

Driver file for Variable Stage Distributed Parameter Model
clear all
clc

global N Fw UA Psteam L Tin

%establish a baseline temperature profile
N=10;
Fw = 0.054;
UA = 105;
Psteam = 3.4;
L = 0.8;
Tin=18.63+273.15;
%T0 = 61.68+273.15;

%generate initial profile
27
Y0 = ones(1,N)*Tin;

%solve ODE
[t,y] = ode15s(@DistributedHE,[0 100],Y0);

%plot temperature vs time
subplot(1,2,1)
plot(t,y(:,N)-273.15,'r')
hold on
title('Temperature vs time');
xlabel('Time (s)');
ylabel('Temperature (C)');

%plot temperature vs length
subplot(1,2,2)
z = 0:(L/N):L;
Tz = zeros(1,N+1);
Tz(1) = 18.63;
Tz(2:N+1) = y(end,:)-273.15;
plot(z,Tz,'r')
hold on
title('Temperature vs length')
xlabel ('Length (m)')
ylabel ('Temperature (C)')


%change Fw
Fw = 0.054-0.15*0.054;

%solve ODE
[t,y] = ode15s(@DistributedHE,[0 100],Y0);

%plot temperature vs time
subplot(1,2,1)
plot(t,y(:,N)-273.15','r--')
hold on

%plot temperature vs length
subplot(1,2,2)
z = 0:(L/N):L;
Tz = zeros(1,N+1);
Tz(1) = 18.63;
Tz(2:N+1) = y(end,:)-273.15;
plot(z,Tz,'r--')
hold on

%reset and change number of stages
Fw = 0.054;
N=25;

%generate initial profile
Y0 = ones(1,N)*Tin;

%solve ODE
[t,y] = ode15s(@DistributedHE,[0 100],Y0);

%plot temperature vs time
subplot(1,2,1)
plot(t,y(:,N)-273.15,'b')
hold on

28
%plot temperature vs length
subplot(1,2,2)
z = 0:(L/N):L;
Tz = zeros(1,N+1);
Tz(1) = 18.63;
Tz(2:N+1) = y(end,:)-273.15;
plot(z,Tz,'b')
hold on

%change Fw
Fw = 0.054-0.15*0.054;

%solve ODE
[t,y] = ode15s(@DistributedHE,[0 100],Y0);

%plot temperature vs time
subplot(1,2,1)
plot(t,y(:,N)-273.15','b--')
hold on

%plot temperature vs length
subplot(1,2,2)
z = 0:(L/N):L;
Tz = zeros(1,N+1);
Tz(1) = 18.63;
Tz(2:N+1) = y(end,:)-273.15;
plot(z,Tz,'b--')
hold on

%reset and change number of stages
Fw = 0.054;
N=5;

%generate initial profile
Y0 = ones(1,N)*Tin;

%solve ODE
[t,y] = ode15s(@DistributedHE,[0 100],Y0);

%plot temperature vs time
subplot(1,2,1)
plot(t,y(:,N)-273.15,'g')
hold on

%plot temperature vs length
subplot(1,2,2)
z = 0:(L/N):L;
Tz = zeros(1,N+1);
Tz(1) = 18.63;
Tz(2:N+1) = y(end,:)-273.15;
plot(z,Tz,'g')
hold on

%change Fw
Fw = 0.054-0.15*0.054;

%solve ODE
[t,y] = ode15s(@DistributedHE,[0 100],Y0);

%plot temperature vs time
subplot(1,2,1)
29
plot(t,y(:,N)-273.15','g--')
hold on
legend('Fw = 0.054 kg/s, N=10','Fw -15%, N=10','Fw = 0.054 kg/s, N=25','Fw -15%,
N=25','Fw = 0.054 kg/s, N=5','Fw -15%, N=5','Location','SouthEast')

%plot temperature vs length
subplot(1,2,2)
z = 0:(L/N):L;
Tz = zeros(1,N+1);
Tz(1) = 18.63;
Tz(2:N+1) = y(end,:)-273.15;
plot(z,Tz,'g--')
hold on
legend('Fw = 0.054 kg/s, N=10','Fw -15%, N=10','Fw = 0.054 kg/s, N=25','Fw -15%,
N=25','Fw = 0.054 kg/s, N=5','Fw -15%, N=5','Location','SouthEast')