Mistake with "connect" command while making a global state-space system

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Mistake with "connect" command while making a global state-space system

Beginner1
Hi!
I don´t know why the command "Connect" does not a god job at connecting
sys_ol and sys_il. Here is my code:


*/%Packages call
  pkg control load
  pkg io load
 
%Parámetros del sistema

  %Outer Loop
  kv=3;%Constante proporcional del PI de la componente d
  Tv=0.05;%Constante de tiempo del PI de la componente d
  kq=0.4;%Constante proporcional del PI de la componente q
  Tq=0.05;%Constante de tiempo del PI de la componente q
  kdroop_AC=0;%-3.0023;%Pendiente droop Q/U_AC
  droop_FSM=0.05;%Pendiente droop P/f
  FSM_slope=droop_FSM/0.002;%Pendiente droop P/f en p.u.
 
  %Inner Loop
  ki=5000;%1% Constante integral de los controladores proporcional
resonantes
  kp=1.5;% Constante proporcional de los controladores proporcional
resonantes
  w=2*pi*50;
  wg0=2*pi*50;
  w_r=2*pi*50;
  wr=2*pi*50;
  a23 = 2*(wg0^2+wr^2);
  da23 = 4*wg0;
  a03 = (wr^2-wg0^2)^2;
  da03 = -4*wg0*(wr^2-wg0^2);
  b33 = ki;
  db33 = 0;
  b13 = ki*(wg0^2+wr^2);
  db13 = ki*2*wg0;
  c23 = -ki*wg0;
  dc23 = -ki;
  c03 = ki*wg0*(wr^2-wg0^2);
  dc03 = ki*(wr^2-3*wg0^2);
 
  %2-level VSC&Normalization block
  Vdref_perm=1.002;%1.003;
  Vqref_perm=0.084;%0.077;
  Vdc_diff_perm=0.5;%0.492;
  kdiff=(0.7)*Vdc_diff_perm;%Según DIgilent debería ser multiplicada por 1.4
en vez de 0.7
  K_0=sqrt(3)/(2*sqrt(2));%Factor de modulación sinusoidal del VSC
  Ub_DC=640/2;%Tensión base en DC del VSC-Según DIgilent debería ser 640 en
vez de 640/2
  Ub_AC=275;%Tensión base en AC del VSC
  k0=(K_0)*Ub_DC/Ub_AC;
  Vdc_perm=1;%1.017;
  Pmd_perm=0.689;%0.702;%0.69;
  Pmq_perm=0.051;%0.057;%0.053;
  Kvsc=k0*Vdc_perm;
 
  x1d_0= (1/(2*ki*wg0^3))*(-y_Vqref(3000)+Vq(1)+kp*(y_iqref(1)-Iq(1)));
  x1q_0= (1/(2*ki*wg0^3))*(y_Vdref(7000)-Vd(1)-kp*(y_idref(1)-Id(1)));
  x2d_0=0;
  x2q_0=0;
  x3d_0=0;
  x3q_0=0;
  x4d_0=0;
  x4q_0=0;
 
%Definición del tiempo de simulación
  Tfinal = 3;
  t = (0:0.0001:Tfinal)';
 
%Función enable: para marcar la activación de la rama FSM
  enable=1;
 
%Definición de matrices A,B,C y D
 
  %Outer loop:Vdc-Q
 
  A_ol=[0 0;0 0];
  B_ol=[-kv/Tv kv/Tv 0 0 0 0 -kv*FSM_slope*enable/Tv kv*enable/Tv
-kv*enable/Tv kv*enable/Tv;0 0 kq/Tq -kq/Tq -(kq/Tq)*kdroop_AC
(kq/Tq)*kdroop_AC 0 0 0 0];
  C_ol=[1 0;0 1];
  D_ol=[-kv kv 0 0 0 0 -kv*FSM_slope*enable kv*enable -kv*enable kv*enable;0
0 kq -kq -kq*kdroop_AC kq*kdroop_AC 0 0 0 0];
 

  %Inner loop:PR current controller
 
  A_il=[0 1 0 0 0 0 0 0; 0 0 1 0 0 0 0 0;0 0 0 1 0 0 0 0; 0 0 -4*w^2 0 0 0 0
0;0 0 0 0 0 1 0 0;0 0 0 0 0 0 1 0;0 0 0 0 0 0 0 1;0 0 0 0 0 0 -4*w^2 0];
  B_il=[0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 -1 0 1 0 -4*w*x3d_0;0
0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 -1 0 1 -4*w*x3q_0];
  C_il=[0 2*ki*w^2 0 ki 0 0 ki*w 0; 0 0 -ki*w 0 0 2*ki*w^2 0 ki];
  D_il=[1 0 -kp 0 kp 0 ki*(2*w*x2d_0+x3q_0+2*w^2*x1q_0); 0 1 0 -kp 0 kp
ki*(2*w*x2q_0-2*w^2*x1d_0-x3d_0)];

  %Normalization block
  D_nb=[kdiff 0 (0.7)*Vdref_perm;0 kdiff (0.7)*Vqref_perm];%Según DIgilent
debería ser multiplicada por 1.4 en vez de 0.7

  %2-level VSC:controlled voltage source-average model
  D_vsc=[k0*Vdc_perm 0 k0*Pmd_perm;0 k0*Vdc_perm k0*Pmq_perm];
 
%Definición de las ecuaciones de estado x.=Ax+Bu; y=Cx+Du
  %Outer loop
  stname_ol = {'xv','xq'};
 
inname_ol={'vdcref','vdc','qacref','qac','vacref','vac','fmeas','pdcref','paux','FSMcoordpos'};
  outname_ol={'idref','iqref'};
  sys_ol = ss
(A_ol,B_ol,C_ol,D_ol,'stname',stname_ol,'inname',inname_ol,'outname',outname_ol);
 
  %Inner loop
  stname_il = {'xd1','xd2','xd3','xd4','xq1','xq2','xq3','xq4'};
  inname_il={'Vd','Vq','Id','Iq','idref','iqref','omegagiro'};
  outname_il={'Vdref','Vqref'};
  sys_il = ss
(A_il,B_il,C_il,D_il,'stname',stname_il,'inname',inname_il,'outname',outname_il);
 
 %Assembled system1
 
inname_group={'vdcref','vdc','qacref','qac','vacref','vac','fmeas','pdcref','paux','FSMcoordpos','Vd','Vq','Id','Iq','omegagiro'};
  stname_group={'xv','xq','xd1','xd2','xd3','xd4','xq1','xq2','xq3','xq4'};
  outname_group={'idref','iqref','Vdref','Vqref'};
  sys=connect(sys_ol,sys_il,stname_group,inname_group,outname_group);/
  *

The results in the console while typing "sys" begin with:
<http://octave.1599824.n4.nabble.com/file/t372684/Captura.jpg>

And this is not correct since matrix A should also have the columns
corresponding to xd1 and xq1.




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Mistake with "connect" command while making a global state-space system

marco atzeri-2
On 5/28/2018 4:59 PM, Beginner1 wrote:
> Hi!
> I don´t know why the command "Connect" does not a god job at connecting
> sys_ol and sys_il. Here is my code:
>
>
> */%Packages call
>    pkg control load
>    pkg io load

are you sure ?

https://octave.org/doc/interpreter/Using-Packages.html#Using-Packages

     pkg load control
     pkg load io


Reply | Threaded
Open this post in threaded view
|

Re: Mistake with "connect" command while making a global state-space system

Beginner1
This post was updated on .
Thank you Marco. I changed the load packages statement.
However the "connect" command still performs the same error since it does
not connect properly sys_ol and sys_il. In the assembled system, A matrix
should have rows and columns for the following state-space variables:
'xv','xq','xd1', 'xd2','xd3', 'xd4','xq1', 'xq2','xq3', 'xq4' but it
actually constrructs it for 'xv','xq', 'xd2','xd3', 'xd4','xq2','xq3', 'xq4'
by missing 'xd1' and 'xq1'. I don´t understand why and would like to obtain
the right A,B,C,D matrixes.





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Mistake with "connect" command while making a global state-space system

Beginner1
 And another strange issue is that when I type help connect, the console
says:                                                                                                          
>> help connect
error: help: the 'connect' function belongs to the control package from
Octave Forge
but has not yet been implemented.

And the problem is that I have already called control package by typing:
 pkg load control




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Mistake with "connect" command while making a global state-space system

marco atzeri-2


On 5/29/2018 11:13 AM, Beginner1 wrote:

>   And another strange issue is that when I type help connect, the console
> says:
>>> help connect
> error: help: the 'connect' function belongs to the control package from
> Octave Forge
> but has not yet been implemented.
>
> And the problem is that I have already called control package by typing:
>   pkg load control
>

the error says "not yet been implemented" so no one have yet written it.
There is only a placeholder for the future in the help


Reply | Threaded
Open this post in threaded view
|

Re: Mistake with "connect" command while making a global state-space system

Beginner1
I previously used the "connect" command in a previous example and it worked
properly:
/*%Packages call
  pkg load control
  pkg load io
 
%Parámetros del sistema

  %Outer Loop
  kv=15;%Constante proporcional del PI de la componente d
  Tv=0.05;%Constante de tiempo del PI de la componente d
  kq=0.4;%Constante proporcional del PI de la componente q
  Tq=0.05;%Constante de tiempo del PI de la componente q
  kdroop_AC=0%-3.0023;%Pendiente droop Q/U_AC
  droop_FSM=0.050000000000000000000001%0.0500366528;%Pendiente droop P/f
  FSM_slope=droop_FSM/0.002;%Pendiente droop P/f en p.u.
 
  %Inner Loop
  w=314.159;% Frecuencia de corte(rad/s) del controlador proporcional
resonante
  ki=5000;%1% Constante integral de los controladores proporcional
resonantes
  kp=1.5% Constante proporcional de los controladores proporcional
resonantes
 
  %2-level VSC&Normalization block
  Vdref_perm=1.003;%1.003;
  Vqref_perm=0.074;%0.077;
  Vdc_diff_perm=0.491;%0.492;
  kdiff=(0.7)*Vdc_diff_perm;%Según DIgilent debería ser multiplicada por 1.4
en vez de 0.7
  K_0=sqrt(3)/(2*sqrt(2));%Factor de modulación sinusoidal del VSC
  Ub_DC=640/2;%Tensión base en DC del VSC-Según DIgilent debería ser 640 en
vez de 640/2
  Ub_AC=275;%Tensión base en AC del VSC
  k0=(K_0)*Ub_DC/Ub_AC;
  Vdc_perm=1.019;%1.017;
  Pmd_perm=0.689;%0.702;%0.69;
  Pmq_perm=0.051;%0.057;%0.053;
  Kvsc=k0*Vdc_perm;
%Definición del tiempo de simulación
  Tfinal = 3;
  t = (0:0.0001:Tfinal)';
 
%Función enable: para marcar la activación de la rama FSM
  enable=0;
 
%Definición de matrices A,B,C y D
 
  %Outer loop:Vdc-Q
  %A_ol=[0 0;0 0];
  %B_ol=[-kv/Tv kv/Tv 0 0 0 0 -kv*FSM_slope*enable/Tv kv*enable/Tv
-kv*enable/Tv kv*enable/Tv;0 0 kq/Tq -kq/Tq -(kq/Tq)*kdroop_AC
(kq/Tq)*kdroop_AC 0 0 0 0];
  %C_ol=[1 0;0 1];
  %D_ol=[-kv kv 0 0 0 0 -kv*FSM_slope*enable kv*enable -kv*enable
kv*enable;0 0 kq -kq -kq*kdroop_AC kq*kdroop_AC 0 0 0 0];
   
  A_ol=[0 0;0 0];
  B_ol=[-kv/Tv kv/Tv 0 0 0 0 -kv*FSM_slope*enable/Tv kv*enable/Tv
-kv*enable/Tv kv*enable/Tv;0 0 kq/Tq -kq/Tq -(kq/Tq)*kdroop_AC
(kq/Tq)*kdroop_AC 0 0 0 0];
  C_ol=[1 0;0 1];
  D_ol=[-kv kv 0 0 0 0 -kv*FSM_slope*enable kv*enable -kv*enable kv*enable;0
0 kq -kq -kq*kdroop_AC kq*kdroop_AC 0 0 0 0];
 

  %Inner loop:PR current controller
 
 
  A_il=[0 1 0 0 0 0; 0 0 1 0 0 0; 0 -4*(w)^2 0 0 0 0;0 0 0 0 1 0;0 0 0 0 0
1;0 0 0 0 -4*(w)^2 0];
  B_il=[0 0 0 0 0 0; 0 0 0 0 0 0;0 0 -1 0 1 0;0 0 0 0 0 0;0 0 0 0 0 0;0 0 0
-1 0 1];
  C_il=[2*((w)^2)*ki  0  ki  0  ki*w  0;0 -ki*w 0 2*(w^2)*ki 0 ki];
  D_il=[1 0 -kp 0 kp 0;0 1 0 -kp 0 kp];
 
  %A_il=[0 1 0 0 0 0; 0 0 1 0 0 0; 0 -4*w^2 0 0 0 0;0 0 0 0 1 0;0 0 0 0 0
1;0 0 0 0 -4*w^2 0];
  %B_il=[0 0 0 0 0 0; 0 0 0 0 0 0;0 0 -1 0 1 0;0 0 0 0 0 0;0 0 0 0 0 0;0 0 0
-1 0 1];
  %C_il=[2*(w^2)*ki  0  ki  0  ki*w  0;0 -ki*w 0 2*(w^2)*ki 0 ki];
  %D_il=[1 0 -kp 0 kp 0;0 1 0 -kp 0 kp];
 
  %Normalization block
  D_nb=[kdiff 0 (0.7)*Vdref_perm;0 kdiff (0.7)*Vqref_perm];%Según DIgilent
debería ser multiplicada por 1.4 en vez de 0.7
  %D_nb=[0.7 0;0 0.7];
  %2-level VSC:controlled voltage source-average model
  D_vsc=[k0*Vdc_perm 0 k0*Pmd_perm;0 k0*Vdc_perm k0*Pmq_perm];
 
%Definición de las ecuaciones de estado x.=Ax+Bu; y=Cx+Du
  %Outer loop
  stname_ol = {'xv','xq'};
 
inname_ol={'vdcref','vdc','qacref','qac','vacref','vac','fmeas','pdcref','paux','FSMcoordpos'};
  outname_ol={'idref','iqref'};
  sys_ol = ss
(A_ol,B_ol,C_ol,D_ol,'stname',stname_ol,'inname',inname_ol,'outname',outname_ol);
 
  %Inner loop
  stname_il = {'xd1','xd2','xd3','xq1','xq2','xq3'};
  inname_il={'Vd','Vq','Id','Iq','idref','iqref'};
  outname_il={'Vdref','Vqref'};
  sys_il = ss
(A_il,B_il,C_il,D_il,'stname',stname_il,'inname',inname_il,'outname',outname_il);
 
  %Normalization block
  inname_nb={'Vdref','Vqref','Vdcdiff'};
  %inname_nb={'Vdref','Vqref'};
  outname_nb={'Pmd','Pmq'};
  sys_nb = ss (D_nb,'inname',inname_nb,'outname',outname_nb);
 
  %2-level VSC
  inname_vsc={'Pmd','Pmq','vdc'};
  outname_vsc={'Vd_AC','Vq_AC'};
  sys_vsc = ss (D_vsc,'inname',inname_vsc,'outname',outname_vsc);
 
  %Assembled system1
 
inname_group={'vdcref','vdc','qacref','qac','vacref','vac','fmeas','pdcref','paux','FSMcoordpos','Vd','Vq','Id','Iq','Vdcdiff'};
 
%inname_group={'vdcref','vdc','qacref','qac','vacref','vac','fmeas','pdcref','paux','FSMcoordpos','Vd','Vq','Id','Iq'};
  outname_group={'idref','iqref','Vd_AC','Vq_AC'};
  sys=connect(sys_ol,sys_il,sys_nb,sys_vsc,inname_group,outname_group);*/

It worked properly with this system as it included all the state space
variables from all subsystems, as matrix A proved:
<http://octave.1599824.n4.nabble.com/file/t372684/Captura2.jpg>

So I don't understand why it does not work with an assembled system of 10
state-space variables but it does work for an assembled system of 8.



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Mistake with "connect" command while making a global state-space system

Beginner1
Any suggestion? the command gives a wrong construction of A,B,C and D
matrixes whenever 10 state variables are included instead of 8.  The command
has been used by other users for sure since in previous examples gave me
correct construction of the global A,B,C,D matrixes including all
state-space variables from all subsystems...



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Mistake with "connect" command while making a global state-space system

Doug Stewart-4


On Tue, May 29, 2018 at 9:40 AM, Beginner1 <[hidden email]> wrote:
Any suggestion? the command gives a wrong construction of A,B,C and D
matrixes whenever 10 state variables are included instead of 8.  The command
has been used by other users for sure since in previous examples gave me
correct construction of the global A,B,C,D matrixes including all
state-space variables from all subsystems...

to see the help for connect do:

help @lti/connect


--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: Mistake with "connect" command while making a global state-space system

Beginner1
Yes, I knew this info since I visited this help website

https://octave.sourceforge.io/control/function/@lti/connect.html



I have followed the right syntax for the connect command by connecting
different subsystems through the expression SYS = connect (SYS1, SYS2, ...,
SYSN, INPUTS,OUTPUTS)....and this does not construct well the A,B,C and D
matrixes for the assembled system in the 1st case I presented in the thread.



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Mistake with "connect" command while making a global state-space system

Beginner1
Therefore, Connect command presents a limitation, isn´t it? It only connects
well subsystems of up to 8 state-space variables in total. This is because
when I do it for a group of subsystems accounting for more than 8
state-space variables in total,  the command gives wrong A,B,C,D matrixes.

There must be something else...



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html