Page 542 - Design and Operation of Heat Exchangers and their Networks
P. 542
Appendix 525
[x, fval, exitflag, output] = ...
particleswarm(@(x)opt_shell_and_tube_heat_exchanger ...
(x, C_RF, scale), nvars, nlb, nub, options);
x=x.∗ scale;
case 3
scale = [0.001 0.001 0.001 0.001];
nlb = round(lb ./ scale, 0);
nub = round(ub ./ scale, 0);
options = optimoptions('ga','PopulationSize',250, ...
'MaxGenerations', 5000, 'MaxStallGenerations', 500);
x = ga(@(x)opt_shell_and_tube_heat_exchanger(x, C_RF, scale), ...
nvars, A, b, Aeq, beq, nlb, nub, nonlcon, IntCon, options);
x=x.∗ scale;
otherwise
scale = [1 1 1 1];
C_RF = 1.2; % area reserve factor for rating
n_output = 1; % output calculation results
shell_and_tube_heat_exchanger(x ./ scale, C_RF, scale, n_output);
C_RF = 1; % area reserve factor for rating
n_output = 1; % output calculation results
shell_and_tube_heat_exchanger(x ./ scale, C_RF, scale, n_output);
end
function f = opt_shell_and_tube_heat_exchanger(x, C_RF, scale)
persistent n0 f0
if isempty(n0)
n0 = 1;
f0 = 1E100;
end
f_C_RF = shell_and_tube_heat_exchanger(x, C_RF, scale, 0);
f = shell_and_tube_heat_exchanger(x, 1, scale, 0);
if (f < f0 && f_C_RF < f0)
if (f_C_RF > f )
f0 = f_C_RF;
shell_and_tube_heat_exchanger(x, C_RF, scale, 1);
else
f0 = f;
shell_and_tube_heat_exchanger(x, 1, scale, 1);
end
end
end

