37
CHEE3007 Process Modelling and Dynamics HEAT EXCHANGER Model Solution, Calibration, Validation and End-Use Team D7 Arnold Ng, Damien Naidu & Kim Loi

Final Report v.1-1

Embed Size (px)

DESCRIPTION

Written assignment on process modelling

Citation preview

Page 1: Final Report v.1-1

CHEE3007 Process Modelling and Dynamics

HEAT EXCHANGER

Model Solution, Calibration, Validation and End-Use

Team D7Arnold Ng, Damien Naidu & Kim Loi

Page 2: Final Report v.1-1

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.......................................................................................... 9

7. SENSITIVITY ANALYSIS ON OUTPUTS...................................................................................10

8. DISTRIBUTED PARAMETER MODEL......................................................................................11

9. REFERENCE.................................................................................................................................... 12

10. APPENDIX....................................................................................................................................... 13

10.1. Appendix 1..................................................................................................................................... 13

ii

Page 3: Final Report v.1-1

1. INTRODUCTIONThe 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 modelSelection of initial conditions and debugging proceduresVerification of model prediction against some plant dataCalibration and validation through Parameter EstimationA sensitivity analysis of changes in inputsA sensitivity analysis of changes in parametersA 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 CONSTRUCTIONFollowing the model proposed in the previous report, the equations used and their precedence are listed below.

Conservation Equation:(g1)

dTdt

=FW

V ρL(T ¿−T )+ Q

V ρL c p , L

Constitutive Equation:Heat Transfer:

(g2)Q=UA ∆T LM

(g3)

ΔT LM=∆ T 1−∆ T 2

ln ( ∆ T1

∆ T2 )(g4)

∆ T 1=T steam ,∈¿−T¿ ¿

(g5)∆ T 2=T steam ,out−T

1

Page 4: Final Report v.1-1

(g6)T

steam ,∈¿= BA−log (p¿¿steam)−C ¿

¿

(g7) T steam ,out=T steam ,∈¿¿

Variables:t time [s]T outlet temperature [K]FW inlet water flow [kg/s]V tube volume [m3]ρL inlet water density [kg/m3]Tin inlet water temperature [K]cP,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]ΔTLM the log-mean differenceΔT1 inlet temperature difference [K]ΔT2 outlet temperature difference [K]Tsteam,in inlet temperature of steam [K]Psteam 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 variables2. 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

2

Page 5: Final Report v.1-1

Specific Heat Capacity (CpL) and Density (ρL) 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 (CpL = 4200 kJ/ kg K andρL = 1000 kg/m3) 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 U = 2280-3400 W m-2 K-1 (hence U = 2840 W m-2 K-1) for steam to water heat transfer. UA can be used using the system dimensions:

UA=U πDi L=128 W K−1

Antoine Equation Variables (A, B & C)The saturation temperature (Tsteam 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 15–20oC 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 2.04 × 10−4 m3.

0 20 40 60 80 1004140

4160

4180

4200

4220

Temperature (C)

Spe

cific

Hea

t Cap

acity

(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 100950

960

970

980

990

1000

Temperature (C)

Den

sity

(kg/

m3 )

Figure 2 Density of water as function of temperature adapted from Green & Perry 2007

3

Page 6: Final Report v.1-1

3.3. System Inputs (Fw, Psteam & Tin)The water flow rate (Fw), inlet steam pressure (Psteam) and inlet water temperature (Tin) 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 560

80

100

120

140

160

Saturation Pressure (bar)

Tem

pera

ture

(C)

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

4

Page 7: Final Report v.1-1

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

0 20 40 60 80 1000

20

40

60

80

Time (s)

Tem

pera

ture

(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).

5

Page 8: Final Report v.1-1

dynamic change in water temperature was not clearly displayed. The time span was reduced down to 100s instead.

4. MODEL VERIFICATIONTo 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.

Figure 6. Initial comparisons of model’s 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 model’s outlet water temperature and experimental data for steam pressure at 2.8 bar (gauge) and water flow rate of 0.047 kg/s.

6

Page 9: Final Report v.1-1

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 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.

7

Page 10: Final Report v.1-1

0 1000 2000 3000 4000 50000

20

40

60

80

100

120

140

Time (s)

UA

(W K

- 1)

5. MODEL CALIBRATION & VALIDATIONModel 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 (Q) using equation 1. This was then substituted into the rearranged heat transfer equation (equation 2).

Q=C pL Fw (T−T ¿)(1)

UA=∆T LM

Q(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.

8

Page 11: Final Report v.1-1

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.

0 100 200 300 400 500320

325

330

335

340

345

350

355

Time (s)

Out

lete

Wat

er T

empe

ratu

re (K

)

Model

Experimental

Psat = 280kPa (gauge)Tin = 292 KFw = 0.092 to 0.047 kg/s

0 100 200 300 400 500320

325

330

335

340

345

Time (s)

Out

lete

Wat

er T

empe

ratu

re (K

)

Model

Experimental

Psat = 280kPa (gauge)Tin = 292 KFw = 0.092 to 0.047 kg/s

9

Page 12: Final Report v.1-1

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 Psat = 280kPa, Tin = 292K and Fw = 0.092 to 0.047 kg/s Statistical Variable Original Calibrated

UA (W K-1) 128 104CI (95%) - 1.3

R2 - 0.82SSE 346 85

NormRMSE 2.6 0.08Residual RMSE 0.025 0.0048

Residuals 7.42 0.02

Table XX Statistical Variable Mean (excluding boiling point step changes)

UA (W K-1) 105CI (95%) 1.6

R2 0.80SSE 113

NormRMSE 0.41Residual RMSE 0.0200

Residuals 0.01

0 100 200 300 400 500-15

-10

-5

0

5

10

15

20

time, s

=y i-y

mi

0 100 200 300 400 500-5

0

5

10

15

20

time, s

=y i-y

mi

10

Page 13: Final Report v.1-1

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 (Fw and Psat) Fw (kg/s) 0.092 0.029 0.055 0.0714 0.092 0.047 0.069Tin (oC) 61.7 100.7 91.5 54.0 51.6 49.5 101.5Psat (gkPa) 240 240-220 220 220 280 280 280UA (W K-1) 107 119 112 98 104 104 120CI (95%) 3.3 0.6 2.6 0.2 0.8 1.3 6.8R2 0.46 0.80 0.76 0.87 0.57 0.82 0.56SSE 220 24125 247 2 13 85 1336NormRMSE 0.17 3.01 0.09 1.58 0.13 0.08 0.14Residual RMSE 0.0076 0.0728 0.0077 0.0780 0.0019 0.0048 0.0171Residuals 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 105CI (95%) 2.2 1.6

R2 0.69 0.80SSE 3718 113

NormRMSE 0.74 0.41

0 200 400 600 800 1000 1200320

325

330

335

340

345

350

355

360

Time (s)

Out

let W

ater

Tem

pera

ture

(K)

ModelExperimental

Psat = 200kPa (gauge)Tin = 292K

0.075 kg/s

0.058 kg/s

0.039 kg/s

11

Page 14: Final Report v.1-1

Residual RMSE 0.0271 0.0200Residuals 3.76 0.01

12

Page 15: Final Report v.1-1

6. SENSITIVITY ANALYSIS ON INPUTSInitial conditions were set as follows:Flow of water (Fw) = 0.05 kg/sPressure of steam (Psteam) = 3.4 baraInlet 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

13

Page 16: Final Report v.1-1

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 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 ~± 5℃, 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.

14

Page 17: Final Report v.1-1

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.

15

Page 18: Final Report v.1-1

8. DISTRIBUTED PARAMETER MODELA 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.

16

Page 19: Final Report v.1-1

Therefore, the accuracy of the output increases. Since the temperature was previously underestimated, this increase in accuracy results in a rise in the temperature.The MATLAB code for this analysis is presented in Appendix X.

17

Page 20: Final Report v.1-1

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

18

Page 21: Final Report v.1-1

10. APPENDIX

10.1. Appendix 1Function 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, m3rhoL = 1000; %Density of Water, kg/m3CpL = 4200; %Specific Heat Capacity of Water, J/(kg K)Fw = 0.054; %Water Flow-Rate, kg/sUA = 128; %Overall Heat Transfer Coefficient, W/KTin = 273.15+18.6; %Inlet Water Temperature, KPsteam = 2.4+1; %Inlet Steam Pressure, barA = 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---------------------------------

19

Page 22: Final Report v.1-1

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

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 variablesclc 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 timeA = 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

20

Page 23: Final Report v.1-1

10.2. Appendix XDriver 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 allclc tspan = [0,100]; global FwFw = 0.05; %kg/sglobal PsteamPsteam = 3.4; %barglobal UAUA = 105; %W/K %Overall Heat Transfer Coefficientglobal TinTin = 18.63+273.15; %K y0 = 338.71; %K %Solve model[t,y] = ode15s(@LumpedHE,tspan,y0); %plot solutionsubplot(3,1,1)plot(t,y-273.15,'k')hold on

%change FwFw=0.05+0.15*0.05; %solve model[t,y] = ode15s(@LumpedHE,tspan,y0); %plot solutionplot(t,y-273.15,'r')hold on

%calculate percentage changedisp('For Fw +15%, steady state temperature changes by ')A1=(y(end)-y0)/(y0-273.15)*100;disp(A1) %change FwFw=0.05-0.15*0.05; %solve model[t,y] = ode15s(@LumpedHE,tspan,y0); %plot solutionplot(t,y-273.15,'b')hold offtitle ('Varying water flow rate')xlabel('Time (s)')ylabel('Temperature (C)')legend('Fw = 0.05kg/s','Fw +15%','Fw -15%','Location','East')

21

Page 24: Final Report v.1-1

%calculate percentage changedisp('For Fw -15%, steady state temperature changes by ')A2=(y(end)-y0)/(y0-273.15)*100;disp(A2) %reset and solve for changes in PsteamFw=0.05; %solve model[t,y] = ode15s(@LumpedHE,tspan,y0); %plot solutionsubplot(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 solutionplot(t,y-273.15,'r')hold on

%calculate percentage changedisp('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 solutionplot(t,y-273.15,'b')hold offtitle ('Varying steam pressure')xlabel('Time (s)')ylabel('Temperature (C)')legend('Psteam = 3.4 bara','Psteam +15%','Psteam -15%','Location','East')

%calculate percentage changedisp('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 solutionsubplot(3,1,3)plot(t,y-273.15,'k')hold on

22

Page 25: Final Report v.1-1

%change Tin Tin=18.63+0.15*18.61+273.15; %solve model [t,y] = ode15s(@LumpedHE,tspan,y0); %plot solutionplot(t,y-273.15,'r')hold on

%calculate percentage changedisp('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 solutionplot(t,y-273.15,'b')hold offtitle ('Varying inlet temperature')xlabel('Time (s)')ylabel('Temperature (C)')legend('Tin = 18.63 C','Tin +15%','Tin -15%','Location','EAst')

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

23

Page 26: Final Report v.1-1

10.3. Appendix XDriver 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 allclc tspan = [0,100]; global FwFw = 0.05; %kg/sglobal PsteamPsteam = 3.4; %barglobal UAUA = 105; %W/K %Overall Heat Transfer Coefficientglobal TinTin = 18.63+273.15; %K y0 = 338.71; %K %solve model [t,y] = ode15s(@LumpedHE,tspan,y0); %plot solutionsubplot(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 solutionplot(t,y-273.15,'r')hold on

%calculate percentage changedisp('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 solutionplot(t,y-273.15,'b')hold offtitle ('Varying UA')xlabel('Time (s)')ylabel('Temperature (C)')legend('UA = 105 W/K','UA +30%','UA -30%','Location','Best')

24

Page 27: Final Report v.1-1

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

25

Page 28: Final Report v.1-1

10.4. Appendix XFunction file for Variable Stage Distributed Parameter Modelfunction 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, m3V = pi*R^2*L; %m3rhoL = 1000; %kg/m3cpL = 4180; %J/kg.KA = 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 STAGEf(1) = Fw * (Tin - T(1)) / (V/N*rhoL) + Q(1)/(V*rhoL*cpL/N);%INTERMEDIATE STAGEfor j = 2:(N-1) f(j) = Fw * (T(j-1) - T(j)) / (V/N*rhoL) + Q(j)/(V*rhoL*cpL/N);end %OUTLET STAGEf(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 Modelclear allclc global N Fw UA Psteam L Tin %establish a baseline temperature profileN=10;Fw = 0.054;UA = 105;Psteam = 3.4;L = 0.8;Tin=18.63+273.15;

26

Page 29: Final Report v.1-1

%T0 = 61.68+273.15; %generate initial profileY0 = ones(1,N)*Tin; %solve ODE[t,y] = ode15s(@DistributedHE,[0 100],Y0); %plot temperature vs timesubplot(1,2,1)plot(t,y(:,N)-273.15,'r')hold ontitle('Temperature vs time');xlabel('Time (s)');ylabel('Temperature (C)'); %plot temperature vs lengthsubplot(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 ontitle('Temperature vs length')xlabel ('Length (m)')ylabel ('Temperature (C)') %change FwFw = 0.054-0.15*0.054; %solve ODE[t,y] = ode15s(@DistributedHE,[0 100],Y0); %plot temperature vs timesubplot(1,2,1)plot(t,y(:,N)-273.15','r--')hold on %plot temperature vs lengthsubplot(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 stagesFw = 0.054;N=25; %generate initial profileY0 = ones(1,N)*Tin; %solve ODE[t,y] = ode15s(@DistributedHE,[0 100],Y0); %plot temperature vs timesubplot(1,2,1)

27

Page 30: Final Report v.1-1

plot(t,y(:,N)-273.15,'b')hold on %plot temperature vs lengthsubplot(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 FwFw = 0.054-0.15*0.054; %solve ODE[t,y] = ode15s(@DistributedHE,[0 100],Y0); %plot temperature vs timesubplot(1,2,1)plot(t,y(:,N)-273.15','b--')hold on %plot temperature vs lengthsubplot(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 stagesFw = 0.054;N=5; %generate initial profileY0 = ones(1,N)*Tin; %solve ODE[t,y] = ode15s(@DistributedHE,[0 100],Y0); %plot temperature vs timesubplot(1,2,1)plot(t,y(:,N)-273.15,'g')hold on %plot temperature vs lengthsubplot(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 FwFw = 0.054-0.15*0.054; %solve ODE[t,y] = ode15s(@DistributedHE,[0 100],Y0);

28

Page 31: Final Report v.1-1

%plot temperature vs timesubplot(1,2,1)plot(t,y(:,N)-273.15','g--')hold onlegend('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 lengthsubplot(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 onlegend('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')

29