Page 553 - Design and Operation of Heat Exchangers and their Networks
P. 553

536   Appendix


          switch n_opt
               case 1
                   scale = [1 111111 1111];
                   rlb = lb ./ scale;
                   rub = ub ./ scale;
                   x=x./ scale;
                   x = fmincon(@(x)opt_plate_fin_heat_exchanger ...
                        (x, C_RF, scale, nvars, file), x, A, b, Aeq, beq, rlb, rub);
                   x=x.∗ scale;
               case 2
                   scale = [1 111111 1111];
                   nlb = lb ./ scale;
                   nub = ub ./ scale;
                   options = optimoptions('particleswarm', 'SwarmSize', 500, ...
                       'HybridFcn', @fmincon);
                   [x, fval, exitflag, output] = ...
                        particleswarm(@(x)opt_plate_fin_heat_exchanger ...
                        (x, C_RF, scale, nvars, file), nvars, nlb, nub, options);
                   x=x.∗ scale;
               case 3
                   %    N_fl L_h  L_c  h_f_h  h_f_c  delta_f_h delta_f_c l_s_h
                   %  l_s_c  FPM_h FPM_c
                   scale = [1 0.001 0.001 0.0001 0.0001 0.00001  0.00001  0.0001
          0.0001 0.1  0.1];
                   nlb = round(lb ./ scale, 0);
                   nub = round(ub ./ scale, 0);
                   options = optimoptions('ga','PopulationSize',250, ...
                       'MaxGenerations', 5000, 'MaxStallGenerations', 500);
                   x = ga(@(x)opt_plate_fin_heat_exchanger(x, C_RF, scale,
                        nvars, file), ...
                     nvars, A, b, Aeq, beq, nlb, nub, nonlcon, IntCon, options);
                   x=x.∗ scale;
               otherwise
                   scale = [1 111111 1111];
                   n_output = 2; % output calculation results and more information
                   plate_fin_heat_exchanger(x ./ scale, C_RF, scale, nvars, file,
                   n_output);
                   plate_fin_heat_exchanger(x ./ scale, 1, scale, nvars, file,
                   n_output);
          end
   548   549   550   551   552   553   554   555   556   557   558