Page 541 - Design and Operation of Heat Exchangers and their Networks
P. 541
524 Appendix
% n_opt = 0: rating
% 1: fmincon
% 2: partical swarming optimization
% 3: genetic algorithm with integer variables, round to mm
n_opt = 0;
x = [4.761000 0.357000 0.055000 0.340000];
% L (m), d_s (m), l_c (m), l_bc (m)
lb = [4 0.3 0.05 0.2];
ub = [6 0.6 0.20 0.8];
C_RF = 1.2; % area reserve factor for design
nvars = 4;
% subject to the linear inequalities A∗x <= b. If no inequalities exist,
% set A = [] and b = [].
A = [];
b = [];
% subject to the linear equalities Aeq∗x = beq. If no equalities exist,
% set Aeq = [] and beq = [].
Aeq = [];
beq = [];
nonlcon = [];
IntCon = [1, 2, 3, 4];
% rng default; % For reproducibility
switch n_opt
case 1
scale = [1 1 1 1];
rlb = lb ./ scale;
rub = ub ./ scale;
x=x./ scale;
x = fmincon(@(x)opt_shell_and_tube_heat_exchanger ...
(x, C_RF, scale), x, A, b, Aeq, beq, rlb, rub);
x=x.∗ scale;
case 2
scale = [1 1 1 1];
nlb = lb ./ scale;
nub = ub ./ scale;
options = optimoptions('particleswarm', 'SwarmSize', 500, ...
'HybridFcn', @fmincon);

