• Non ci sono risultati.

Example: electric network

N/A
N/A
Protected

Academic year: 2021

Condividi "Example: electric network"

Copied!
8
0
0

Testo completo

(1)

Example: electric network

Let us consider the following electric network:

V u V R

1

V 1

V 2 R 1

R 2 C 1

C 2 L

I L I r 2

I u

The POG scheme of the considered electric network is:

V

u

I

L

- -

6 1 s

6Q1

1 C

1

6V1

 

- 

? 1 s

1 L

?

I

L

 -

 -

R

1

6

6

V

R

1

- 

- 

1 R

2

?

?

I

R

2

 -

 -

6 1 s

6Q2

1 C

2

6

V

2

- 

V

2

I

u

Removing the algebraic loop one obtains the following equivalent POG scheme:

V

u

I

L

- -

6 1 s

6Q1

1 C

1

6V1

 

- 

? 1 s

1 L

?

I

L

 -

V

R

 1 

R1R2 R1+R2

6

6

V

RL

- - - R1

R1+R2 -

I

2L

V

RV 

 R1

R1+R2  

1 R1+R2

?

?

I

2V

- -

I

R

2

 -

6 1 s

6Q2

1 C

2

6

V

2

- 

V

2

I

u

= 0

This POG block scheme of the electric network has been implemented in the

Simulink environment using the following parameters R1 = 10 ohm; R2 = 10

ohm; C1 = 0.1 F; C2 = 0.3 F; L = 0.2 H.

(2)

From the POG scheme one obtains the following state space dynamic model:

 

 

 

 

 

 

 

 

C 1 0 0 0 L 0 0 0 C 2

 V ˙ 1

˙I L

˙ V 2

=

0 1 0

− 1 (R −R

1

R

2

1

+R

2

)

−R

1

(R

1

+R

2

)

0 (R R

1

1

+R

2

)

− 1 (R

1

+R

2

)

 V 1 I L V 2

 +

 0 1 0

 V u

V R

1

= h

0 R R

1

R

2

1

+R

2

R

1

R

1

+R

2

i x The reachability matrix of the system is:

R + =

0 C 1

1

L

−R

1

R

2

C

1

L

2

(R

1

+R

2

) 1

L

−R

1

R

2

L

2

(R

1

+R

2

)

− ( C

2

L (R

1

+R

2

)

2

) +C

1

R

12

( −L +C

2

R

22

)

C

1

C

2

L

3

(R

1

+R

2

)

2

0 C R

1

2

L (R

1

+R

2

) − R

1

(L+C

2

R

1

R

2

)

C

22

L

2

(R

1

+R

2

)

2

 The determinant of matrix R + is always non zero and positive:

det R + = R 1 C 1 C 2

2 L 3 (R 1 + R 2 ) 2

The system is reachable. The system is not reachable only if R 1 = 0.

• Matlab commands:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

syms R1 R2 C1 C2 L

Am=[ 0 1/C1 0 ;

-1/L -R1*R2/(L*(R1+R2)) -R1/(L*(R1+R2));

0 R1/(C2*(R1+R2)) -1/(C2*(R1+R2)) ; ];

Bm=[ 0;

1/L;

0];

Cm=[ 0 R1*R2/(R1+R2) R1/(R1+R2) ];

R_piu=simplify([Bm Am*Bm Am*Am*Bm]) det(R_piu)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Rete_Elettrica_2016.m %

% Point to point control of an electric circuit %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all; close all; clc; echo on

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% The International System (SI) units are used %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

A=1; ohm=1; V=1; H=1; F=1; rad=1; sec=1;

%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% System parameters %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

R1 = 10*ohm; % Resistance R1

R2 = 10*ohm; % Resistance R2

C1 = 0.1*F; % Capacitance C1

C2 = 0.3*F; % Capacitance C2

L = 0.2*H; % Inductance L

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Initial conditions %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

V10=10*V; % Initial voltage of capacitor C1

IL0= 0*A; % Initial current of inductor L

V20=10*V; % Initial voltage of capacitor C2

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Final conditions %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

V1f= 0*V; % Final voltage of capacitor C1

ILf=10*A; % Final current of inductor L

V2f= 0*V; % Final voltage of capacitor C2

% echo on

pause; % Press any key to continue

clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% The state space matrices of the system are defined %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Am=[ 0 1/C1 0 ;

-1/L -R1*R2/(L*(R1+R2)) -R1/(L*(R1+R2));

0 R1/(C2*(R1+R2)) -1/(C2*(R1+R2)) ; ];

Bm=[ 0;

1/L;

0];

Cm=[ 0 R1*R2/(R1+R2) R1/(R1+R2) ];

%

SYS=ss(Am,Bm,Cm,0)

%

pause; % Press any key to continue

clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Transfer function %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

GS=tf(SYS)

Transfer function:

25 s^2 + 3.855e-015 s --- s^3 + 25.17 s^2 + 58.33 s + 8.333

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(4)

% System poles %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

pole(SYS) ans =

-2.4117 -22.6021 -0.1529

%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% System zeros %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

zero(SYS)

%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Position of poles and zeros %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(1) pzmap(SYS)

%

pause; % Press any key to continue

clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Controllability canonical form %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYSC=canon(SYS) % Canonical form

%

pause; % Press any key to continue

clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Controllability matrix %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ctrb(SYS) ans =

1.0e+003 *

0 0.0500 -1.2500 0.0050 -0.1250 2.8542 0 0.0083 -0.2097

%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Determinant of the controllability matrix %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%

det(ctrb(SYS)) ans =

347.2222

%

pause; % Press any key to continue

clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Free evolution of the system %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[Y,T,X] = initial(SYS,[V10 IL0 V20]);

figure(2) subplot(311)

plot(T,X(:,1)); grid on

(5)

title(’Voltage V1’) ylabel(’V1 [V]’)

%

subplot(312)

plot(T,X(:,2)); grid on title(’Current IL’) ylabel(’IL [A]’)

%

subplot(313)

plot(T,X(:,3)); grid on title(’Voltage V2’) ylabel(’V2 [V]’) xlabel(’Time [s]’)

%

pause; % Press any key to continue

clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Discrete sampled system %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Tsamp=0.5; % Sampling period

SYSD = c2d(SYS,Tsamp,’zoh’); % System discretization [AD,BD,CD,DD] = ssdata(SYSD) % Discrete system

%

pause; % Press any key to continue

clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Point to point control of the discrete system %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

X0=[V10; IL0; V20]; % Initial state

Xf=[V1f; ILf; V2f]; % Final state

u=Controllo_P2P(AD,BD,X0,Xf,3); % Minimal norm control input [YS,TS,XS] = LSIM(SYSD,u,[],X0) % Simulation

%

pause; % Press any key to continue

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Data plot %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(3) clf

subplot(311)

plot(TS,XS(:,1),’*’); hold on stairs(TS,XS(:,1)); grid on title(’Voltage V1’)

ylabel(’V1 [V]’)

%

subplot(312)

plot(TS,XS(:,2),’*’); hold on stairs(TS,XS(:,2)); grid on title(’Current IL’)

ylabel(’IL [A]’)

%

subplot(313)

plot(TS,XS(:,3),’*’); hold on stairs(TS,XS(:,3)); grid on title(’Voltage V2’)

ylabel(’V2 [V]’) xlabel(’Time [s]’)

pause; % Press any key to continue

clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% System trajectories in the state space %

(6)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(4); clf figure(5); clf for k=(3:8)

u=Control_P2P(AD,BD,X0,Xf,k); % Minimal norm control input [YS,TS,XS] = lsim(SYSD,u,[],X0); % Simulation

t=(0:k)*Tsamp;

[tt,uu] = stairs(t,u);

Ind=find(diff(tt)==0);

tt(Ind+1)=tt(Ind+1)+0.0000001;

tin=(0:0.0001:1)*t(end);

uin= interp1(tt,uu,tin);

[YSt,TSt,XSt] = lsim(SYS,uin,tin,X0,’zoh’);

%

figure(4)

plot3(XS(:,1),XS(:,2),XS(:,3)); hold on plot3(XS(:,1),XS(:,2),XS(:,3),’*’);

plot3(XSt(:,1),XSt(:,2),XSt(:,3),’r’);

figure(5)

[XX,YY]=stairs(TS,u);

plot3(ones(size(XX))*k,XX,YY); hold on echo off

end echo on figure(4)

plot3(X0(1),X0(2),X0(3),’*r’);

plot3(Xf(1),Xf(2),Xf(3),’*r’);

title(’Trajectories in the state space’) xlabel(’Voltage V1 [V]’)

ylabel(’Current IL [A]’) zlabel(’Voltage V2 [V]’) grid on

figure(5) grid on

title(’Control variable’) ylabel(’u(t) [V]’)

xlabel(’Time [s]’)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Function Control P2P(AD,BD,X0,Xf,np):

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Provides the minimum norm control action which stirs the system

% from the initial state X0 to the final state Xf, in "np" steps.

% The system AD and BD is supposed to be discrete and reachable

%

function u=Control_P2P(AD,BD,X0,Xf,np)

%

Rpiu=MatRagK(AD,BD,np); % Reachability matrix

u=Rpiu’*inv(Rpiu*Rpiu’)*(Xf-(AD^np)*X0); % Minimum norm control action u=[fliplr(u’) 0];

return

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(7)

Function MatRagK(AD,BD,np):

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Rp=MatRagK(A,B,k)

%

% Compute the reachability matrix of system (A,B) in k steps:

%

% Rp = [B A*B A*A*B ... A^(k-1)*B]

%

function Rp=MatRagK(A,B,k)

[nra,nca]=size(A); % Nr. of rows and columns [nrb,ncb]=size(B); % of matrices A and B if (nra==nca)&(nca==nrb)

Rp=B;

for n=[1:k-1]

Rp=[Rp (A^n)*B];

end else

help MatRagK

disp(’Error: matrix A is not squared or it is not compatible with B’) end

return

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

• Free evolution:

0 2 4 6 8 10 12 14 16 18 20

−5 0 5 10

Voltage V1

V1 [V]

0 2 4 6 8 10 12 14 16 18 20

−3

−2

−1 0 1

Current IL

IL [A]

0 2 4 6 8 10 12 14 16 18 20

0 5 10

Voltage V2

V2 [V]

Time [s]

(8)

• State space trajectories:

0

200

400

600

−100 −150 0 −50

100 50 150

0 20 40 60 80 100

Voltage V1 [V]

Trajectories in the state space

Current IL [A]

Voltage V2 [V]

• Control signals u(k):

3 4 5 6 7 8

0 1 2 3 4

−500 0 500 1000

Time [s]

Control variable

u(t) [V]

Riferimenti

Documenti correlati

The ‘functional’ network is cre- ated considering a set of main pathways of interest (first level pathways - 1 L), chosen by the user since known to be involved in the phenomenon

Intermediate Accounting: IFRS Edition (Second ed.).. Deve sussistere una probabilità elevata che l’entità riceva una somma dalla controparte come compenso per la propria

dictyExpress widget can be used to retrieve data from a database, just like GEO Data Sets and similar to the File widget.. We have

Genes is a useful widget that presents information on the genes from the NCBI Gene database and outputs annotated data table. You can also select a subset and feed it to other

Indeed, when M increases, the uniform and Lipschitz constants of V M 0 deteriorate and we had to assume a bounded Lipschitz continuous kernel in the Mean Field theory, with

peripheral VIs to access your devices digital I/O, analog I/O, SPI, I2C, UART, PWM and more... NI myRIO Kits

‘‘Linearizing voltage control of MVDC power systems feeding constant power loads: Stability analysis under saturation,’’ in Proc.. IEEE Power

Noticing that the data, after 100 steps, remarkably change in amplitude, indicate how to cope with this variation in the algorithm, in order to let it rapidly converge... Run