advanced controls-lab report 2

19
 1 Contents OBJECTIVES ............................................................................................................................................... 2 RESULTS AND DISCUSSION........................................................................................................................ 2 1. PART (A) ............................................................................................................................................ 2 2. PART (B).......... ................................................................................................................................... 4 3. PART C ............................................................................................................................................... 7 3.1 PROCEDURE ........................................................................................................................................ 7 3.2 RESULTS............................................................................................................................................... 9 3.3 DISCUSSIONS ..................................................................................................................................... 18

Upload: omar-abdullah

Post on 21-Jul-2015

18 views

Category:

Documents


0 download

TRANSCRIPT

ContentsOBJECTIVES ............................................................................................................................................... 2 RESULTS AND DISCUSSION........................................................................................................................ 2 1. 2. 3. PART (A) ............................................................................................................................................ 2 PART (B)............................................................................................................................................. 4 PART C ............................................................................................................................................... 7

3.1 PROCEDURE ........................................................................................................................................ 7 3.2 RESULTS............................................................................................................................................... 9 3.3 DISCUSSIONS ..................................................................................................................................... 18

1

ECE 4032 ADVANCED CONTROLExperiment 2: Optimal ControlA dc motor is modeled by the following differential equations:

Where,V is the input voltage, i is the current, E is the back emf, T is the generated torque, w is the angular velocity and y is the angular position.

OBJECTIVESObtaining a suitable state-space representation for the modeled system Designing an optimal state-feedback controller to regulate the states to zero and performing simulations Forcing angular position to track perfectly a constant signal by designing an optimal state-feedback controller Achieve perfect tracking before the position reference changes value Analyzing the affects of parameters such as Q and R in the simulations

RESULTS AND DISCUSSION 1. PART (A)A suitable state space representation is required to be derived with some given values for different parameters.According to theory, ; ; ( )

;

Given,

2

For state space representation,

[ ],

[ ];

So, state space representation is: [ ] [ ][ ] ][ ] [ ]

[ Given, J=1, k= 5 , R = 10 [ ]

[

]

The steady state representation using Simulink in MATLAB for the state space equation is:

V

+ -

y

Figure 1: Steady state representation for state space equation for part (a)

3

2. PART (B)In part (b) an optimal state-feedback controller to regulate the states to zero is designed. A simulation is performed and the DC motor has an initial angular position of 2, and is at rest. Optimal control is the process of finding a control u that forces to converge to zero as fast as possible. In other words, the goal is forcinga system to follow an optimal trajectory x* as fast as possible with the least amount of control effort u to minimize the performance criteria or a cost function.

Quadratic performance index (J) is defined as:

where Q and Rare state and control positive definite symmetric weighting matrices.

Therefore, given a state space system

Y=Cx To design the optimal controller, the following steps should be followed. Choose positive definite symmetric weighting matrices Q and R Solve Ricatti equation to get P as follows: Set u as defined below:

4

To understand the affects of Q and R matrices on how they affect the optimal control of the system, initially, Q matrix is varied and R is constant. In the second section Q matrix is constant and R is changing and according to the graphs the affect of each matrix is analyzed. The size of the weighting matrices Q and R defines how much you want to penalize x and u. The results and graphs of the simulation are shown below: Simulation time= 50sQ=[1 0; 0 1]Q=[2 0; 0 3]

Q = [4 0;0 5]

Q = [70 0;0 80]

5

According to the theory, it is known as the weighting matrix Q increases the system will converge faster. In order to confirm this with the simulation, four different values for matrix Q is considered and simulated. The plots represent that as Q increases the system will converge to zero faster. With first Q the system converges to zero later compared to the last Q which is bigger. Therefore, we can conclude that as Q increases the system converges to zero faster. (R is kept constant) In the next step, Q is kept constant and the effects of changing R are analyzed. R=3 R = 0.1

According to the theory, as the magnitude of the R matrix increases the system will need less input. Therefore, it should take the system a longer time to converge. To confirm the simulation with theory, two simulations are performed with different magnitudes of R. For R = 3 the system will need less inputs compared to R=0.1 and according to the plots shown above, the systems with R=0.1 converges faster when R=3. Therefore, it is confirmed with the theory that for big values of R the system needs less input butfor smaller R's system will have more inputs and therefore the system converges faster with smaller R values.

Figure 2: Steady state representation for state space equation for part (b)

6

3. PART C

3.1 PROCEDUREA steady-state error (ess) exists in the system. Hence a feed forward controller (Kf) is used to compensate the steady-state error. Following are the steps taken to design Kf: 1. The closed loop transfer function of the system in terms of Kf is obtained. The transfer function is obtained by running the following MATLAB code:syms sK1K2 A = [-2.5 0; 1 0]; B = [0.5; 0]; C = [0 1]; K = [K1 K2]; t_func = C*inv(s*eye(2)-(A-B*K))*B

( ) ( ) The transfer function in terms of Kf is: ( ) ( ) 2. Then the steady-state response is re-evaluated. ( ) ( )

7

(

)

Where ( )

Therefore, the steady state response is: ( ) ( )

3. The value of Kf is obtained when the steady-state error is equal to zero.

Using the Kf value obtained, simulations are done with the values of Q and R varied accordingly in order to achieve accurate results. MATLAB code:A = B = C = D = sys [-2.5 0; 1 0]; [0.5; 0]; [0 1]; 0; = ss(A,B,C,D);

Q = [500 0; 0 10000]; R = 1; [K,P,E] = lqr(sys,Q,R); Kf = K(:,2);

8

3.2 RESULTSQ = [25 0; 0 50]

9

Q = [50 0; 0 25]

10

Q = [50 0; 0 50]

11

Q = [100 0; 0 1000]

12

Q = [100 0; 0 5000]

13

Q = [100 0; 0 10000]

14

Q = [500 0; 0 10000]

15

Q = [700 0; 0 10000]

16

Q = [1000 0; 0 10000]

17

3.3 DISCUSSIONSR remain constant (R = 1) because varying R doesnt affect the output signal much. [ ].

From the plots above a general relationship can be derived between q 22 and q11. When q22 is greater than q11 the output signal is closer to the square wave input as seen on the first two plots where [ ] [ ]

-

After that q11 was fixed at 100 and q22 was varied. It was made sure that the input voltage does not exceed 100 to prevent errors in simulation. As q 22 was increased keeping q11 constant (q22 = 1000, 5000, 10000 and so on) it was seen that the angular position and its reference became more confined within each other. However the input voltage level kept on rising and almost reaches a peak of 100 which is undesirable. Therefore increasing q22 makes the angular position converge faster but at a higher cost of input voltage.Thats why q22 = 5000 is chosen as the optimal value and the preferred Q thus is Q [ ] since the input voltage is low enough.The angular position

track perfectly a constant signal and perfect tracking is achieved before the position reference changes value as seen in the plot. Since the input voltage reaches 100V when q22 = 10000, we wont try for values greater than 10000 because it will be expensive to supply higher voltages and for optimal tracking there may be steady state errors in order to save input (in this case input voltage) cost. Keeping q22 = 10000 q11 is varied to see how it affects the output signal. The input voltage plots remain almost identical since q22 was one of the main factors affecting the input voltage plot. The angular position and the reference plot remains almost similar but somewhat becomes more confined. This proves that q22 has a greater effect on the plots than q11. q22 being larger than q11 is the more noticeable change to the plots than varying q11 and keeping q22 constant.

-

18

ConclusionIncreasing Q causes the system to converge to zero faster. Therefore, for bigger values of Q the system converges faster to zero compared to the Qs that have lower values. Furthermore, for R which is the other weighting matrix, for high values of R the system needs less input and if R value is low the system will need more inputs. Therefore, for lower values of R the system will converge faster to zero and for higher values of R it converges to zero slower.

19