air bleed control lqr control

27
Preliminary Heat Exchanger Control Design Study Steve Rogers 9 April 2011 Table of Contents Preliminary Heat Exchanger Control Design Study......................1 Introduction........................................................1 Operating Conditions................................................2 Model Linearization.................................................2 Simulink Dynamic Model..............................................3 Pole Placement Method...............................................4 LQR Method.........................................................11 Optimization Using LQR.............................................15 Conclusions........................................................16 Appendix...........................................................17 Appendix – operating condition 1...................................17 Appendix – operating condition 2...................................19 Appendix – operating condition 3...................................20 Appendix – operating condition 4...................................21 Appendix – Genetic Algorithm Optimizer.............................22 Introduction Air bleed control systems for jet engines involve pressure, flow, and temperature regulation. Heat exchangers, control valves, and sensor suites are components of the system to be regulated. Ordinarily a cascade control system is used, with flow/pressure on the inner loop and temperature on the outer loop. The classical approach is to close one loop at a time starting with the inner loop. This study shows how a modern approach will close both loops simultaneously. We will show 4 1

Upload: steve-rogers

Post on 15-Mar-2016

223 views

Category:

Documents


1 download

DESCRIPTION

Air bleed HX showing matlab linearization, LQR control, & GA optimization

TRANSCRIPT

Page 1: Air Bleed Control LQR control

Preliminary Heat Exchanger Control Design StudySteve Rogers

9 April 2011

Table of ContentsPreliminary Heat Exchanger Control Design Study......................................................................................1

Introduction.............................................................................................................................................1

Operating Conditions...............................................................................................................................2

Model Linearization.................................................................................................................................2

Simulink Dynamic Model.........................................................................................................................3

Pole Placement Method..........................................................................................................................4

LQR Method..........................................................................................................................................11

Optimization Using LQR.........................................................................................................................15

Conclusions............................................................................................................................................16

Appendix...............................................................................................................................................17

Appendix – operating condition 1.........................................................................................................17

Appendix – operating condition 2.........................................................................................................19

Appendix – operating condition 3.........................................................................................................20

Appendix – operating condition 4.........................................................................................................21

Appendix – Genetic Algorithm Optimizer..............................................................................................22

IntroductionAir bleed control systems for jet engines involve pressure, flow, and temperature regulation. Heat exchangers, control valves, and sensor suites are components of the system to be regulated. Ordinarily a cascade control system is used, with flow/pressure on the inner loop and temperature on the outer loop. The classical approach is to close one loop at a time starting with the inner loop. This study shows how a modern approach will close both loops simultaneously. We will show 4 different operating conditions. Solutions will be by pole placement and LQR (modern methods).

In order to speed up development, optimization may be used to determine the weighting for the control laws. In this case we chose the LQR for optimization. We limited the parameter optimization to 11 variables, which include 6 state weights for the state estimator and the control gain, 4 input weights for the state estimator, and 1 input weight for the control gain.

1

Page 2: Air Bleed Control LQR control

Operating ConditionsThe following simulink model is intended to represent an air flow loop through a heat exchanger. The simulink model below is used to extract linear models at varying operating conditions which are used for control design. The various operating conditions are listed below. The operating conditions are contrived and are shown merely for the purpose of illustrating the control development concept.

Fkw = [1.5 2 3 5]+0.5;ts_Q = [0.5 1 1.5 2];ts_Fkw = [20 30 40 60];Cp = [0.2 0.22 0.24 0.28];Cv = Cp;rho = [0.1 0.09 0.08 0.06];Tin = [20 60 80 110];

The above are inserted into the linearization model for each design. Example matlab code for inserting the operating variables follows.

set_param('HX_lin_Mdl/In_Fkw','Value',num2str(Fkw(i)))set_param('HX_lin_Mdl/Cp','Value',num2str(Cp(i)))

Model LinearizationModern, as well as classical approaches require linear models. The linearization is performed by the following matlab code. The 2nd line establishes the input nominal value, along with the command limits.

op=operspec('HX_lin_Mdl');op.Inputs(1).u = 1;op.Inputs(1).Min = 0.5;op.Inputs(1).Max = 20;op.Outputs.Min(1) = op.Inputs(1).Min;op=findop('HX_lin_Mdl',op);lin_sys{i} = linearize('HX_lin_Mdl',op,io);A = lin_sys{i}.a;B = lin_sys{i}.b;C = lin_sys{i}.c;D = lin_sys{i}.d;sys = ss(A,B,C,D);

There is a single input and 4 outputs for the linearized model. The 4 outputs are: 1) Q measurement, 2) T measurement, 3) T error, and 4) T integral error. The input is Q commanded. Adding outputs for T error and T integral error provide additional setpoint error states that are input into the linearized model. Thus, any control law (pole placement, LQR, Hinf, etc.) that utilizes the following model construction will have a PI (proportional integral) control law as a component. In order to emulate failed sensors, the linearization model will be updated to eliminate them as outputs. The physical model is not altered, just the output vector. The output model is in the Appendix. A comparison of the eigenvalues of the original system and the controlled system is:

[eig(A),eig(syscon3)]

0 -2.0000

-0.2000 -1.0000

0 -0.3000

2

Page 3: Air Bleed Control LQR control

-1.0000 -0.0900 + 0.1500i

-0.3333 -0.0900 - 0.1500i

-2.0000 -0.2000

The 1st column is the uncontrolled system, while the 2nd column is the controlled system. The 2 integrators have been replaced with a complex stable pole. Note that the specified poles will be the same for all operating conditions.

1

Out_y

0.1

rho

1

3s+1Valve 10

V

30

Tsp

20

Tin

1

5s+1Temp_sensor

1s

T_err_int

1s

T

1

s+1Qsensor

1

0.5s+1Qlag

2

In_Fkw

1

20s+1HX_dist

0.20

Cv

0.2

Cp

1

In_Q

4

Simulink Dynamic ModelThe simulink model below is nearly the same as the linearization model, with the additions of control algorithm and observer. The simulink diagram is for the 1st operating condition: Fkw = 1.5 ts_Q = 0.5 ts_Fkw = 20 Cp = 0.2 Cv = 0.2; rho = 0.1 Tin = 20 Note that Fkw is the heat load, ts_Q is the time constant for the flow loop, ts_Fkw is the time constant for the heat load, and Tin is the inlet temperature.

3

Page 4: Air Bleed Control LQR control

0.1

rho

1

3s+1Valve 10

V

30

Tsp

20

Tin

1

5s+1Temp_sensor

20

Taw

1s

T_err_int

1s

T

Scope

1

s+1Qsensor

1

0.5s+1Qlag

Q Saturation

1

10s+1HX_dist

2

Fkw

0.20

Cv

0.2

Cp

syscon3

Controller

Tmeas

Tmeas

Terr

Terr

4

44

v ar

Qsat

2Q

AW

3

3

AW&err

Pole Placement MethodThe 1st controller shown is a pole placement state space method. Pole placement attempts to place the controlled system poles at specified locations by calculating control matrix gains. The development code is shown below.

[a,b,c,d] = ssdata(sys); a1 = -0.05;b1 = 0.4i; pc = [a1+b1,a1-b1,-0.2,-0.08,-0.3,-1.2]; po = pc - 3; Lobs = place(a',c',po).';[nr,ncd]=size(Lobs); Lcon = place(a,b,pc);[nr,nc]=size(Lcon); syscon3 = ss(a-Lobs*c,Lobs,Lcon,zeros(nr,ncd));

The pole-zero maps display the poles/zeros for each of the 4 outputs SISO systems. All are stable with reasonable time constants and damping coefficients. The observer poles are in red & the controlled system poles are in blue. Note that there are right-half-plane zeros in 3 of the observers.

4

Page 5: Air Bleed Control LQR control

-5 0 5-0.5

0

0.5Pole-Zero Map

Real Axis

Imag

inar

y Ax

is

-6 -4 -2 0 2-0.5

0

0.5Pole-Zero Map

Real Axis

Imag

inar

y Ax

is

-6 -4 -2 0 2-0.5

0

0.5Pole-Zero Map

Real Axis

Imag

inar

y Ax

is

-6 -4 -2 0-0.4

-0.2

0

0.2

0.4Pole-Zero Map

Real Axis

Imag

inar

y Ax

is

The 4 impulse responses are below. They are indicators of disturbance rejection capabilities of the control system. The top 3 are of most interest since the bottom is the integral of the 3 rd. The Q measurement (top) is the most important since it has the fastest dynamics and determines the overall system response. Within 50 seconds the disturbance has damped out. Also, the magnitude of response is relatively small, which keeps the other responses bounded as well.

5

Page 6: Air Bleed Control LQR control

-1

0

1From: Q cmd

To: Q

mea

s

-50

0

50

To: T

mea

s

-50

0

50

To: T

err

0 20 40 60 80 100 120-200

0

200

To: T

err

int

Impulse Response

Time (sec)

Ampl

itude

The step response is the integral of the impulse response and also is an indicator of the disturbance sensitivity of the control system.

6

Page 7: Air Bleed Control LQR control

-2

0

2From: Q cmd

To: Q

mea

s

-200

0

200

To: T

mea

s

-200

0

200

To: T

err

0 20 40 60 80 100 120-4000

-2000

0

To: T

err

int

Step Response

Time (sec)

Ampl

itude

The preceding plots were the output of linear model control analyses. The following shows the simulation plots of the simulink diagram with both plant and controller operating. The key plot is the bottom right, which is the deviation from setpoint (temperature error). The bottom left is the temperature measurement.

7

Page 8: Air Bleed Control LQR control

0 200 400 600-1500

-1000

-500

0

500poleplace MV - HX System output variables

0 200 400 6000

0.5

1

1.5

0 200 400 6000

20

40

60

0 200 400 600-20

0

20

40

time (sec)

The next plot is from the 2nd operating condition & shows the same type of response as the 1st. This is due to the consistency of the pole-placement approach. The key plot is the bottom right, which is the deviation from setpoint (temperature error). The bottom left is the temperature measurement.

8

Page 9: Air Bleed Control LQR control

0 200 400 600-3000

-2000

-1000

0

1000poleplace MV - HX System output variables

0 200 400 6000

0.5

1

1.5

0 200 400 6000

50

100

0 200 400 600-50

0

50

100

time (sec)

The next plot is from the 3rd operating condition. The same kind of response is evident for all operating conditions. The key plot is the bottom right, which is the deviation from setpoint (temperature error). The bottom left is the temperature measurement.

9

Page 10: Air Bleed Control LQR control

0 200 400 600-3000

-2000

-1000

0

1000poleplace MV - HX System output variables

0 200 400 6000

0.5

1

1.5

0 200 400 6000

50

100

150

0 200 400 600-50

0

50

100

time (sec)

The next plot is from the 4th operating condition. The same kind of response is evident for all operating conditions. The key plot is the bottom right, which is the deviation from setpoint (temperature error). The bottom left is the temperature measurement.

10

Page 11: Air Bleed Control LQR control

0 200 400 600-3000

-2000

-1000

0

1000poleplace MV - HX System output variables

0 200 400 6000

0.5

1

1.5

0 200 400 6000

50

100

150

0 200 400 600-50

0

50

100

150

time (sec)

LQR MethodThe 2nd controller shown is a linear quadratic regulator (LQR) state space method. Pole placement attempts to place the controlled system poles at specified locations by calculating control matrix gains. LQR weights the states & inputs to generate control matrix gains. The development code is shown below.

[a,b,c,d] = ssdata(sys); Q = eye(size(a))*1;%R = b(:,1:2)'*b(:,1:2)*1; R = c*c';R = eye(size(R))*1e2; Lobs = lqr(a',c',Q,R).';[nr,ncd]=size(Lobs); Q = eye(size(a))*1;R = b'*b*1e6; Lcon = lqr(a,b,Q,R);[nr,nc]=size(Lcon); syscon3 = ss(a-Lobs*c,Lobs,Lcon,zeros(nr,ncd));

The LQR weighting is accomplished via the Q & R matrices. One set of weights generates the observer gain matrix (Lobs) and another generates the control gain matrix (Lcon). The pole-zero maps display the poles/zeros for each of the 4 outputs SISO systems. All are stable with reasonable time constants and damping coefficients. The observer poles are in red & the controlled system poles are in blue. Note that there are right-half-plane zeros in only the last of the observers. In the case of the pole placement there were right-half-plane zeros in 3 of the 4 conditions.

11

Page 12: Air Bleed Control LQR control

Pole-Zero Map

Real Axis

Imag

inar

y Ax

is

-3 -2 -1 0-1

-0.5

0

0.5

1Pole-Zero Map

Real Axis

Imag

inar

y Ax

is

-3 -2 -1 0-1

-0.5

0

0.5

1Pole-Zero Map

Real Axis

Imag

inar

y Ax

is

-3 -2 -1 0 1-1

-0.5

0

0.5

1Pole-Zero Map

Real Axis

Imag

inar

y Ax

is

-3 -2 -1 0-1

-0.5

0

0.5

1

The 4 impulse responses are below. They are indicators of disturbance rejection capabilities of the control system. The top 3 are of most interest since the bottom is the integral of the 3 rd. The Q measurement (top) is the most important since it has the fastest dynamics and determines the overall system response. Within 40 seconds the disturbance has damped out. Also, the magnitude of response is relatively small, which keeps the other responses bounded as well. The magnitude of the response is similar to that of the pole placement, but it is much less oscillatory. This corresponds with the pole-zero maps above.

12

Page 13: Air Bleed Control LQR control

-0.2

0

0.2From: Q cmd

To: Q

mea

s

-10

0

10

To: T

mea

s

-10

0

10

To: T

err

0 10 20 30 40 50 60 70 80 90-100

0

100

To: T

err

int

Impulse Response

Time (sec)

Ampl

itude

The step response is the integral of the impulse response and also is an indicator of the disturbance sensitivity of the control system. Again, the response appears less oscillatory than that of the pole placement.

13

Page 14: Air Bleed Control LQR control

-0.5

0

0.5From: Q cmd

To: Q

mea

s

-100

0

100

To: T

mea

s

-100

0

100

To: T

err

0 10 20 30 40 50 60 70 80 90-2000

-1000

0

To: T

err

int

Step Response

Time (sec)

Ampl

itude

The preceding plots were the output of linear model control analyses. The following shows the simulation plots of the simulink diagram with both plant and controller operating. The 1 st operating condition plot is shown next. The key plot is the bottom right, which is the deviation from setpoint (temperature error). The bottom left is the temperature measurement. Only one operating condition is shown as the procedure is the same as in the preceding section. The next section will deal with optimization, which is more important.

14

Page 15: Air Bleed Control LQR control

0 200 400 600-600

-400

-200

0

200lqr MV - HX System output variables

0 200 400 6000

0.5

1

1.5

0 200 400 6000

10

20

30

40

0 200 400 600-10

0

10

20

30

time (sec)

Optimization Using LQR

If there is multiple operating conditions that have significantly varying characteristics they usually require different control law gains for useful performance. An optimization program was set up to converge on 11 lqr control parameters as shown in the matlab code snippet below.

[a,b,c,d] = ssdata(sys{i}); Q = diag(in(1:6)); R = diag(in(7:10)); Lobs = lqr(a',c',Q,R).';[nr,ncd]=size(Lobs); R = diag(in(11)); Lcon = lqr(a,b,Q,R);[nr,nc]=size(Lcon); syscon3 = ss(a-Lobs*c,Lobs,Lcon,zeros(nr,ncd));

The differing operating conditions shown previously serve as motivation for an optimization problem. The linearized plant models for each operating condition are shown in the Appendix. The optimizer should have a reasonably well thought out performance index to direct it. In this case it is a combination of deviation from setpoint and smoothness of transition, that is, there should be minimal change in measurements from one sampling instant to the next.

The following plot was generated by optimizing over a series of operating conditions with changing setpoints and kw inputs, which provided disturbances to the system. There is still some oscillation or

15

Page 16: Air Bleed Control LQR control

‘buzz’ at the initial portion of the simulation for the 1st operating condition, but the others have become smooth.

0 500 1000 1500-500

0

500

1000lqr MV - HX System output variables

0 500 1000 15000

1

2

3

4

5

0 500 1000 15000

50

100

150

0 500 1000 1500

-5

0

5

time (sec)

The optimizer is a genetic algorithm as written by the author and the matlab code is shown in the Appendix.

Conclusions

A continuous simulink model of a flow controlled heat exchanger was modeled. Four operating conditions were examined. Linear models of each were generated & are given in the Appendix. Two modern control methods were investigated as a means of tying together the inner and outer control loops simultaneously. The control solutions include an observer design and a control design. The observer generates an estimated, smooth state vector, while the control design uses the state estimates to track to a temperature setpoint.

An optimization approach was also developed to speed up the control design over multiple operating conditions. Ordinarily, the development of a control law for a single operating condition will proceed manually to determine a feasible optimization process. Then, other operating conditions are included as the optimization process is evaluated. As experience and confidence in the optimization process is gained the entire suite of operating conditions are included. Failed sensor scenarios may also be included, or handled separately, as needed.

16

Page 17: Air Bleed Control LQR control

Any ‘modern’ control law (pole placement, LQR, Hinf, etc.) that utilizes the above model construction will have a PI (proportional integral) control law as a component. Since it has more states involved in the feedback controller than the classical PI controller it can be made more robust to disturbances. In order to emulate failed sensors, the linearization model can be updated to eliminate the failed sensors as outputs.

The observer gain matrix Lobs produced by the LQR method for all operating conditions seem more uniformly spread over the input measurements. This is desirable from a robustness point of view. The pole placement Lobs set most of the column corresponding to the temperature error integral to zero. The LQR temperature response appeared to give less overshoot than the pole placement method. The impulse response of the LQR design was less oscillatory; therefore, it is likely to be more robust to disturbances.

If gain scheduling for various operating conditions is required, please note that more parameters are required for each operating condition than the typical PI controller.

Future activities include: 1) generate a better, more representative dynamic model, including realistic operating conditions, 2) controller discretization at proper sampling rates, 3) investigation of various sensor failures which may point to use of LQR output feedback, 4) gain scheduling for the various operating conditions, & 5) test plan (considering failures, changes in operating conditions, & interactions to the control loops) for control system verification/validation.

Appendix

Appendix – operating condition 1Linearized model – operating condition 1

a =

x1 x2 x3 x4 x5 x6

x1 -2 0 0 0 0 0

x2 0 -1 0 0 0 0.3333

x3 0 20 0 0 0 0

x4 0 0 0 0 -0.2 0

x5 0 0 1 0 -0.2 0

x6 2 0 0 0 0 -0.3333

b =

17

Page 18: Air Bleed Control LQR control

u1

x1 1

x2 0

x3 0

x4 0

x5 0

x6 0

c =

x1 x2 x3 x4 x5 x6

y1 0 1 0 0 0 0

y2 0 0 0 0 0.2 0

y3 0 0 0 0 -0.2 0

y4 0 0 0 1 0 0

d =

u1

y1 0

y2 0

y3 0

y4 0

The observer gain matrix Pole placement Lobs =

2.2622 0.3577 -0.3577 0

5.9687 0.1545 -0.1545 0

18

Page 19: Air Bleed Control LQR control

19.6757 25.3964 -25.3964 0

0 -0.5000 0.5000 4.2000

-0.1010 15.4449 -15.4449 0

36.1821 1.9436 -1.9436 0

The observer gain matrix LQR Lobs =

0.0002 0.0001 -0.0001 -0.0000

0.0068 0.0163 -0.0163 -0.0045

0.1355 1.5313 -1.5313 -0.8492

-0.0045 -0.3411 0.3411 0.6779

0.0817 2.0404 -2.0404 -1.7056

0.0063 0.0225 -0.0225 -0.0071

The controller gain matrix Pole placement Lcon =

-1.6533 0.3196 0.0061 -0.0004 0.0004 0.0025

The controller gain matrix Pole placement Lcon =

0.1947 0.2615 0.0141 -0.0010 0.0010 0.2041

Appendix – operating condition 2Linearized model – operating condition 2

a =

-1.0000 0 0 0 0 0

0 -1.0000 0 0 0 0.3333

0 61.2245 0 0 0 0

0 0 0 0 -0.2000 0

0 0 1.0000 0 -0.2000 0

1.0000 0 0 0 0 -0.3333

Matrices b, c, & d are the same for all operating conditions.

Pole placement Lobs =

19

Page 20: Air Bleed Control LQR control

28.8890 -0.5032 0.5032 0

6.9738 0.0022 -0.0022 0

61.1681 25.3529 -25.3529 0

0 -0.5000 0.5000 4.2000

-0.0167 15.4322 -15.4322 0

54.1833 -0.2378 0.2378 0

LQR Lobs =

0.0006 0.0016 -0.0016 -0.0002

0.0062 0.0237 -0.0237 -0.0033

0.2797 4.0393 -4.0393 -1.2465

-0.0033 -0.4160 0.4160 0.7042

0.1183 3.7757 -3.7757 -2.0799

0.0052 0.0290 -0.0290 -0.0048

Pole placement Lcon =

-0.6533 0.6392 0.0040 -0.0002 0.0002 0.0049

LQR Lcon =

0.3280 0.5504 0.0100 -0.0010 0.0010 0.3819

Appendix – operating condition 3Linearized model – operating condition 3

a =

-0.6667 0 0 0 0 0

0 -1.0000 0 0 0 0.3333

0 83.3333 0 0 0 0

0 0 0 0 -0.2000 0

0 0 1.0000 0 -0.2000 0

0.6667 0 0 0 0 -0.3333

20

Page 21: Air Bleed Control LQR control

Matrices b, c, & d are the same for all operating conditions.

Pole Placement Lobs =

66.6056 -2.6625 2.6625 0

7.3012 -0.1076 0.1076 0

83.1563 25.4074 -25.4074 0

0 -0.5000 0.5000 4.2000

-0.0553 15.4471 -15.4471 0

61.3978 -1.5995 1.5995 0

LQR Lobs =

0.0008 0.0036 -0.0036 -0.0004

0.0059 0.0255 -0.0255 -0.0029

0.3339 5.1829 -5.1829 -1.3491

-0.0029 -0.4309 0.4309 0.7074

0.1274 4.3827 -4.3827 -2.1543

0.0047 0.0296 -0.0296 -0.0041

Pole Placement Lcon =

-0.3200 0.9587 0.0044 -0.0003 0.0003 0.0074

LQR Lcon =

0.3742 0.7070 0.0095 -0.0010 0.0010 0.4792

Appendix – operating condition 4Linearized model – operating condition 4

a =

-0.5000 0 0 0 0 0

0 -1.0000 0 0 0 0.3333

0 117.0213 0 0 0 0

0 0 0 0 -0.2000 0

21

Page 22: Air Bleed Control LQR control

0 0 1.0000 0 -0.2000 0

0.5000 0 0 0 0 -0.3333

Matrices b, c, & d are the same for all operating conditions.

Pole Placement Lobs =

108.0312 -5.6919 5.6919 0

7.4691 -0.1486 0.1486 0

116.8411 25.3984 -25.3984 0

0 -0.5000 0.5000 4.2000

-0.0563 15.4438 -15.4438 0

65.3202 -2.3030 2.3030 0

LQR Lobs =

0.0010 0.0057 -0.0057 -0.0005

0.0056 0.0276 -0.0276 -0.0024

0.4057 6.8067 -6.8067 -1.4573

-0.0024 -0.4449 0.4449 0.7099

0.1380 5.1396 -5.1396 -2.2243

0.0043 0.0298 -0.0298 -0.0034

Pole Placement Lcon =

-0.1533 1.2783 0.0041 -0.0002 0.0002 0.0099

LQR Lcon =

0.4296 0.9308 0.0090 -0.0010 0.0010 0.6141

Appendix – Genetic Algorithm Optimizer

% GA_scr_v1.m% Solution of improving edge detection of tracker by% genetic algorithm optimization.

22

Page 23: Air Bleed Control LQR control

% preliminariesclear allclose allclcwarning offdbstop if error if exist('GA_lqr_param.mat','file')==2,load GA_lqr_param, endnum_elements = 15; % number of elements evaluated each generationMAXGEN = 50; % maximum number of generations (iterations)num_xovers = 3; % number of cross oversnvar = 11; % number of variables (see next line)filtr_pole = 0.9;% field_max_vec = [5*ones(1,6),1000*ones(1,4),2000,1000*ones(1,4),1200];field_max_vec = [5*ones(1,6),1500*ones(1,4),3000];GA_field_max(:,1) = field_max_vec(1)*ones(num_elements,1); %state wt1GA_field_max(:,2) = field_max_vec(2)*ones(num_elements,1); %state wt2GA_field_max(:,3) = field_max_vec(3)*ones(num_elements,1); %state wt3GA_field_max(:,4) = field_max_vec(4)*ones(num_elements,1); %state wt4GA_field_max(:,5) = field_max_vec(5)*ones(num_elements,1); %state wt5GA_field_max(:,6) = field_max_vec(6)*ones(num_elements,1); %state wt6GA_field_max(:,7) = field_max_vec(7)*ones(num_elements,1); %control wt1GA_field_max(:,8) = field_max_vec(8)*ones(num_elements,1); %control wt2GA_field_max(:,9) = field_max_vec(9)*ones(num_elements,1); %control wt3GA_field_max(:,10) = field_max_vec(10)*ones(num_elements,1); %control wt4GA_field_max(:,11) = field_max_vec(11)*ones(num_elements,1); %control wt5% GA_field_max(:,12) = field_max_vec(12)*ones(num_elements,1); %control wt1% GA_field_max(:,13) = field_max_vec(13)*ones(num_elements,1); %control wt2% GA_field_max(:,14) = field_max_vec(14)*ones(num_elements,1); %control wt3% GA_field_max(:,15) = field_max_vec(15)*ones(num_elements,1); %control wt4% GA_field_max(:,16) = field_max_vec(16)*ones(num_elements,1); %control wt5 % field_min_vec = [zeros(1,6),2*ones(1,4),200,2*ones(1,4),200];field_min_vec = [zeros(1,6),2*ones(1,4),200];GA_field_min(:,1) = field_min_vec(1)*ones(num_elements,1); %state wt1GA_field_min(:,2) = field_min_vec(2)*ones(num_elements,1); %state wt2GA_field_min(:,3) = field_min_vec(3)*ones(num_elements,1); %state wt3GA_field_min(:,4) = field_min_vec(4)*ones(num_elements,1); %state wt4GA_field_min(:,5) = field_min_vec(5)*ones(num_elements,1); %state wt5GA_field_min(:,6) = field_min_vec(6)*ones(num_elements,1); %state wt6GA_field_min(:,7) = field_min_vec(7)*ones(num_elements,1); %control wt1GA_field_min(:,8) = field_min_vec(8)*ones(num_elements,1); %control wt2GA_field_min(:,9) = field_min_vec(9)*ones(num_elements,1); %control wt3GA_field_min(:,10) = field_min_vec(10)*ones(num_elements,1); %control wt4GA_field_min(:,11) = field_min_vec(11)*ones(num_elements,1); %control wt5% GA_field_min(:,12) = field_min_vec(12)*ones(num_elements,1); %control wt1% GA_field_min(:,13) = field_min_vec(13)*ones(num_elements,1); %control wt2% GA_field_min(:,14) = field_min_vec(14)*ones(num_elements,1); %control wt3% GA_field_min(:,15) = field_min_vec(15)*ones(num_elements,1); %control wt4% GA_field_min(:,16) = field_min_vec(16)*ones(num_elements,1); %control wt5 GA_field = GA_field_min + (GA_field_max - GA_field_min).*rand(size(GA_field_min));if exist('global_best','var'), GA_field = [GA_field(1:end-1,:);global_best(1,:)];endif exist('global_2nd_best','var'),

23

Page 24: Air Bleed Control LQR control

GA_field = [GA_field(2:end,:);global_2nd_best(1,:)];endGA_best = GA_field;GA_best_cum = GA_field;perf_index_vec = contr_opt(GA_field);% [perf_index_vec,edge_PI_vec] = get_GA_optim(GA_field);[PImin,ind_PImin] = min(perf_index_vec);glob_best = ones(num_elements,1)*GA_field(ind_PImin,:);xcum = GA_field;perf_index_cum = perf_index_vec;[val ncp] = min(perf_index_cum,[],2);[val1 ncg] = min(val);[temp,nc2b] = sort(val);global_2nd_best = GA_best(nc2b(2),:);glob_best_filt = glob_best(1,:);for gen = 1:MAXGEN temp1 = [glob_best(1,:);glob_best_filt]; temp1 = [temp1;(randn(1,nvar)/15+1).*global_2nd_best(1,:)]; glob_best_mute = ceil(num_elements/2); for k = 1:glob_best_mute-num_xovers-1 % mutation computations temp = (randn(1,nvar)/15+1).*glob_best(1,:); temp1 = [temp1;temp]; end for k = 1:num_xovers-1 % crossover computation temp = randi(nvar,[1,5]);% select from 5 variables to get better spread minx = min(temp); maxx = max(temp); temp = GA_field(randi([2 num_elements],1),:); temp(minx:maxx) = glob_best(1,minx:maxx); temp1 = [temp1;temp]; end [nr,nc] = size(temp1); chromo_mute = randi(num_elements,[num_elements-nr,1]); temp2 = []; for k = 1:num_elements-nr % mutation computations temp = (randn(1,nvar)/15+1).*GA_field(chromo_mute(k),:); temp2 = [temp2;temp]; end GA_field = [temp1;temp2]; GA_field = min(GA_field,GA_field_max); % upper constraint GA_field = max(GA_field,GA_field_min); % lower constraint xcum = [xcum,GA_field]; perf_index_vec = contr_opt(GA_field); %[perf_index_vec,edge_PI_vec] = get_GA_optim(GA_field); perf_index_cum = [perf_index_cum perf_index_vec]; [val ncp] = min(perf_index_cum,[],2); for j = 1:length(ncp) GA_best(j,:) = xcum(j,... [nvar*(ncp(j)-1)+1:nvar*(ncp(j)-1)+nvar]); end GA_best_cum = [GA_best_cum,GA_best]; [temp,nc2b] = sort(val); glob_best = ones(num_elements,1)*GA_best(nc2b(1),:); global_2nd_best = GA_best(nc2b(2),:); glob_best_filt = filtr_pole*glob_best_filt + (1-filtr_pole)*global_2nd_best;

24

Page 25: Air Bleed Control LQR control

%[val nedge_best] = min(sum(edge_PI_vec,2)); %edge_glob_best = edge_PI_vec(nedge_best,:); %save GA_lqr_param perf_index_cum glob_best GA_best_cum xcum global_2nd_best edge_glob_best save GA_lqr_param perf_index_cum glob_best GA_best_cum xcum global_2nd_best glob_best(1,:),perf_index_vec',%edge_glob_bestend

25