Analysis of Control System and Synthesis of Real Compensator

Курсовой проект - Компьютеры, программирование

Другие курсовые по предмету Компьютеры, программирование

gt;0&d0 (3)>0&d0 (4)>0&(d0 (2)*d0 (3) - d0 (1)*d0 (4))>0(System is stable by Hyrwitz criterion)(because all coeficients in Hurwitz matrix are positive)(and particular case for 3rd order s-m is true)disp (system is unstable)% task 1.5

 

Results of the program:

n0 =

0 6.3000 63.0000=

.1000 1.6000 6.0000 63.0000is stable by Hyrwitz criterion because all coeficients in Hurwitz matrix are positive and particular case for 3rd order s-m is true

6) check whether the system is stable or not using Nyquist criterion;

Theoretical information:

There are two formulations of Nyquist criterion of stability depending on whether the open-loop system is stable or not stable.the open-loop system is stable, the closed loop system would be stable if the Nyquist plot of the open-loop system does not encircle the point with coordinates (-1, 0) at the complex plane.

If the open-loop system is unstable, the closed loop system would be stable if the Nyquist plot of the open-loop system encircles the point with coordinates (-1, 0) at the complex plane times, where is the number of roots in RHP, in the counter-clockwise direction when frequency changes from zero to infinity.

Operator nyquist(sys) plots the Nyquist response of an arbitrary LTI model sys.

Program code:

figure(3), nyquist(Wolun), grid on% task 1.6

Results of the program:

 

. 5

System is stable because Nyquist plot for the open-loop system doesn`t encircle point (-1; 0).

7) if system is stable, determine the stability margins using Bode diagram;

Theoretical information:

Stability margins

There is a special operator margin for calculating the stability margins in MatLab. Its syntax is

 

[Gm, Pm, Wcg, Wcp]=margin(sys),

 

where is gain margin, is phase margin, is frequency under which , is frequency under which . and are crossover frequencies.invoked without left-hand arguments, margin(sys) plots the open-loop Bode response with the gain and phase margins marked by vertical lines.

Program code:

figure(4), margin(Wolun), grid on, legend (Uncompensated system)% task 1.7

Results of the program:

 

. 6

 

So, gain margin is equal to infinity and phase margin - 41.1 deg.

8) do the conversion from the transfer functions to state space;

Theoretical information:

State space description

Complete state space description of a continuous system with constant coefficients is the following:

 

 

where is the input vector; is the output vector; is the state vector characterizing the system dynamics.

To create the continuous-time LTI (Linear Time Invariant) models in MatLab it is necessary to use operator ss.example,

sys=ss (A, B, C, D)

 

creates the state space of a continuous-time system.

Relationship between state space and transfer function description

The diagram explaining the relationship between the state space description and description with the transfer functions is represented in fig. 7.

 

. 7

 

For the continuous case we have

 

.

 

In MatLab operator ss2tf carries out conversion from state space description to transfer functions. If output is a vector than numerator Num of the transfer function is a matrix, each row of which contains numerator polynomial coefficients of the corresponding transfer function (from input to the first, second and so on outputs). If it is necessary to define any concrete transfer function then it is necessary to take the corresponding row from the matrix Num, for example tf2=tf (Num(2,:), Den). Denominator would be common for all transfer functions.

Program code:

[A0, B0, C0, D0] = tf2ss (n0, d0)

Results of the program:

A0 =

-60 -630

0 0

1 0=

 

 

=

63.0000 630.0000=

 

9) calculate the eigenvalues of the uncompensated system;

Theoretical information:

Eigenvalues

The eigenvalues of the square matrix are the roots of the equation: , where is a unit matrix. The result of using the operator is a vector containing the eigenvalues of the square matrix .

Program code:

eigenvalues = eig(Wclun)% task 1.9

Results of the program:

eigenvalues =

.8199

.5901 + 6.4933i

.5901 - 6.4933i

10) calculate -norm of the uncompensated system.

Theoretical information:

Calculation of -norm

The -norm of a stable continuous system with a transfer function is a square root from average value of a square of impulse response of a system, and at conversion to Laplace transformation according to Parseval theorem, this norm is determined by the following way:

,

 

where is trace of matrix; is matrix conjugated to ; is the integral of the error squared under input signal which is equal to -function.index can be calculated with the help of the controllability or observability gramians. The function gram allows to calculate Gram function for an estimation of system controllability, which is called controllability gramian. Controllability gramian is applied to research controllability properties of the system models set in state space, and also for construction of their minimal realizations. It is more convenient for calculations, than controllability matrix.gramian of this system is determined with the integral:

 

.

 

In MatLab: Gc=gram (A, B)gramian is positive defined if and only if the pair of matrices is controlled. Controllability gramian is calculated with the solution of the continuous Lyapunov equation:

 

.

 

In MatLab: Gcc=lyap (A, B*B).

Observability gramian of the system is determined with the integral:

.

 

In MatLab: Go=gram (A, C).gramian is positive defined if and only if the pair of matrixes is observed. Observability gramian is calculated with the solution of the continuous Lyapunov equation:

 

.

 

In MatLab: Goo=lyap (A, C*C).is that the matrix should be stable, i.e. for continuous models all eigenvalues should have negative real parts.is illustrated in MATLAB using the following commands: gram (controllability gramian), lyap (the solution of Lyapunov equation), trace (a trace of matrix).

 

Gc=gram (A, B);%or Gc=lyap (A, B*B);

J=sqrt (trace(C*Gc*C));

 

%or J=sqrt (trace(B*Go*B)), where Go is observability gramian.

-norm can also be determined in MatLab as follow:

h2_n=normh2 (A, B, C, D)

-norm accepts the value which is equal to infinity in the following cases:

-the model is unstable or neutral;

- the continuous model has a nonzero matrix D.

Program code:

H2op_loop = normh2 (A0, B0, C0, D0)% task 1.10

Results of the program:

H2op_loop =

.6137

II. Synthesize the real PD-compensator () which would guarantee desired phase margin at gain crossover frequency :

Theoretical information:

Synthesis of PD-controllers

Transfer function of ideal PD-controller is the following:

 

,

 

where is the gain of proportional part; is the gain of differential one.gain increased unrestrictedly results in the infinite gain on high frequencies. So, in order to restrict the gain on high frequencies an additional pole is appended in the differential component of PD-controller. In this case the transfer function of real PD-controller can be written as:

 

,

 

where is a very small value (). If is known so it is necessary to determine two parameters in the synthesis procedure.synthesis of PD-controller, first of all, it is necessary to calculate the phase shift of controller at frequency as

 

 

and to determine

.

 

Then is determined as

 

.

 

In MatLab:

 

theta=-pi+Pm/57.296-phase/57.296=cos(theta)/mag=sin(theta)/(om*mag)

% Creation of the transfer function of real PD-controller=tf([Kp*tau+Kd Kp], [tau 1])

code:

disp (Task 2. Synthesis of real PD-compensator)

t1=0.0001;=2.5;=60;

1)calculate the phase shift of compensator at given frequency ;

Program code:

 

disp (Phase shift of compensator at given frequency w )

[mag, phase] = bode (Wolun, w)% task 2.1=-pi+Pm/57.296-phase/57.296;

Results of the program:

mag =

.8769=

.6199

2) determine the gain of proportional part of compensator ;

Program code: