PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

29
Lesson 2 – Network Descrip2on Using Graph Theory Semester 3 – Power Systems for Electrical Transporta2on Lecturer: Pablo Arboleya Arboleya Sustainable Transporta2on and Electrical Power Systems Universidad de Oviedo Lesson 8 – Simulator 1 (base magnitudes and other parameters –tasks)

description

simulator

Transcript of PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Page 1: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Lesson  2  –  Network  Descrip2on                              Using  Graph  Theory  

Semester  3  –  Power  Systems  for  Electrical  Transporta2on  

Lecturer:  Pablo  Arboleya  Arboleya  

Sustainable  Transporta2on  and  Electrical  Power  

Systems  

Universidad  de  Oviedo  

Lesson  8  –  Simulator  1  (base  magnitudes  and  other  parameters  –tasks)  

Page 2: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Bases :Sb → Base Power V1b → Base Voltage in AC subsystemV2b → Base Voltage in link subsystemVdb → Base Voltage in DC subsystemfn → Base frequency

Base Currents :

Ib1 =Sb3V1b

→ Base Current in AC subsystem

Ib2 =Sb3V2b

→ Base Current in link subsystem

Ib1 =SbVdb

→ Base Current in DC subsystem

Base Impedances :

Zb1 =V1b

2

Sb → Base Impedance in AC subsystem

Zb2 =V2b

2

Sb → Base Impedance in link subsystem

Zdb =Vdb

2

Sb → Base Impedance in DC subsystem

3.2. Solución a la variación de dimensión del sistema 39

AC/DC AC/DCAC/DCAC/DC

G

G

1DC

2DC

3DC

4DC

5DC

6DC7DC

8link9link 10link

11AC

12AC

13AC 14AC15AC

16AC

Figura 3.1: Sistema AC/DC dimensiones constantes.

anterior el nt ahora es 3, luego los nodos de la topología de DC comenzarán en 4y así se seguirá con el criterio de numeración ya explicado.

Base  Magnitudes  

Page 3: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Other  useful  data  to  characterize  the  substa2ons  

3.2. Solución a la variación de dimensión del sistema 39

AC/DC AC/DCAC/DCAC/DC

G

G

1DC

2DC

3DC

4DC

5DC

6DC7DC

8link9link 10link

11AC

12AC

13AC 14AC15AC

16AC

Figura 3.1: Sistema AC/DC dimensiones constantes.

anterior el nt ahora es 3, luego los nodos de la topología de DC comenzarán en 4y así se seguirá con el criterio de numeración ya explicado.

62 4. Formulación del modelo y resolución del flujo de cargas

vACNdj , vAC

Nqj

vDCNi

iLEdk, iLEqk

iLEk

edge k

nodo AC j

nodo DC i

Figura 4.9: Detalle de ecuaciones del rectificador.

Así pues la función que rige el frenado de un tren i es:

iDCti =

!"#

"$

Pi

vDCNi

vDCNi ! Vc

m(vDCNi " Vmax) Vc ! vDC

Ni ! Vmax

0 vDCNi # Vmax

(4.28)

Dondem = I0/(Vmax " V0).

4.2.4.2. Modelo matemático de la subestación de tracción

A lo largo de los apartados anteriores se plantearon cada una de las ecuacionesque rigen el funcionamiento por una lado del sistema AC que forma la red dealimentación y por otro del sistema DC formado por la red de tracción ferroviaria.

Como se comentó en capítulos anteriores, en esta tesis se tratará de resolver elsistema conjunto AC/DC de forma unificada, sin la necesidad de procesos iterati-vos entre los dos sistemas tratados de forma independiente. Queda por tanto clarala importancia de las ecuaciones que sirven como nexo de unión entre los dossistemas. Estas ecuaciones son las que afectan a las variables propias de la sub-estación de tracción y que tendrán por tanto una importancia vital en el correctofuncionamiento del sistema.

En este trabajo se modelan subestaciones de tracción formadas por rectifica-dos de 6 pulsos no controlados. Las ecuaciones (4.29) y (4.30) representan elbalance de potencias en un convertidor ideal sin perdidas, como el de la figura 4.9conectado entre el nodo de AC j y el nodo de DC i, representando el edge k.

Sn → Rated Power of Power transformer (VA)V1 → Rated Voltage of Power transformer primary side (V)V2 → Rated Voltage of Power transformer secondary side (V)Pcu → Cooper Losses of Power transformer side (W)Vcc → Short circuit voltage of power transformer (%)Rdiode _ on → Conmutation reactance of the rectifier (Ω)Scc → Short circuit power at the AC point of coupling (VA)

Transformer Parameters Estimation

Zcc _ t =V1

2Vcc

100SnI1 =

Sn3V1

I2 =Sn3V2

Rcc _ t =Pcu3I1

2 Xcc _ t = Zcc _ t2 − Rcc _ t

2

Grid Parameters Estimation

Zeq = Xeq =V2

2

SccConmutation Reactance EstimationZeq _ total = Zeq + Zcc + Rdiode _ on

Page 4: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Input  data  

•  All  input  data  will  be  in  a  folder  called  input  •  Input  folder  will  contain  the  next  txt  files:  – bases.txt  – lines_ac_IS.txt  – lines_dc_IS.txt  – links_acdc_IS.txt  – nodes_ac_IS.txt  

Page 5: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

bases.txt  2e6                %Sb                                                                            (Base  Power)  24e3            %V1b                                                                      (Base  voltage,  primary  side)  1221            %V2b                                                                      (Base  voltage,  secondary  side)  1648.93  %Vdb=3*sqrt(2)*V2b/pi    (Base  Voltage,  DC  side)  500e6        %Scc                                                                        (Short  circuit  power  in  the  substa2ons)  50                      %a                                                                            (Rated  frequency)  

Depending  of  the  kind  of  rec2fier  

%number    from          to        R  (ohm)    X  (ohm)  1                                                1            2          7.21249        37.24256            2                                                1            4          7.69066        39.71168  3                                                1            6          6.47530        33.43600    4                                                2            5          1.99240        10.28800    5                                                3            4          4.00472        20.67888  6                                                3            5          1.89278          9.77360  

lines_ac_IS.txt  

Page 6: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

lines_dc_IS.txt  %number  from        to        R(ohm)  1                                          1            2          0.59  2                                          2            3          1.18  3                                          2            4        0.354  4                                          3            4          0.59    

%n        dc_node    ac_node    Sn                                  V1            V2                    Pcu          Vcc        Rdiode_on  %          (from)              (to)                      (VA)                            (V)          (V)                    (W)          (%)        (ohm)    1                        1                    2                            1315e3      24000      1221      13300          5.5        1e-­‐3    2                        3                    3                            1315e3      24000      1221      13300          5.5        1e-­‐3    3                        4                    4                            1315e3      24000      1221      13300          5.5        1e-­‐3    

links_acdc_IS.txt  

Page 7: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

nodes_ac_IS.txt  %Type  1=PQ  (P  y  Q  (-­‐)  generated  (+)  consumed),  2=PV,3=slack.    %Sub                |Type        |  Vd            |  Vq                          |  P                      |  Q                |  |V|  %num            |                          |  V                |  V                              |  W                    |  VAr        |    V  1                              3                            25000                    0                                0                              0                0  2                              1                                              0                    0                                0                              0                0  3                              1                                              0                    0                                0                              0                0  4                              1                                              0                    0                                0                              0                0  5                              1                                              0                    0          400000                              0                0  6                              1                                              0                    0      1000000        800000              0    

Page 8: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Task  1  (45  min)  

•  Load  all  the  data  contained  in  the  txt  files  (use  the  command  “cd”  to  access  to  the  input  folder  and  “load”  to  read  the  data.  

•  Obtain  all  base  magnitudes  (currents,  impedances)  •  Obtain  the  next  variables  –  lines_dc                same  as  lines_dc_IS  but  in  p.u.  –  lines_ac                same  as  lines_ac_IS  but  in  p.u.      –  links_acdc        same  as  links_acdc_IS  but  in  p.u.  in  the  first                three  columns,  the  next  columns  will  be  Rccpu  Xccpu  Zeqpu_total      

– nodes_ac          same  as  nodes_ac_IS  but  in  p.u.  

Page 9: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Task  2  (30  min)  

•  Calculate  the  number  of  nodes  and  edges:    –  ntrain=3;                      =  number  of  trains  (Now  it  will  be  a  constant)  –  nlinks                                  =  number  of  substa2ons  (links)  –  nnodes_dc                =  number  of  dc  nodes  without  trains  –  nnodes_dc_t        =  number  of  dc  nodes  with  trains  –  nnodes_ac                =  number  of  ac  nodes  without  link  nodes  –  nnodes_ac_t        =  number  of  ac  nodes  with  link  nodes  –  nnodes                            =  total  number  of  nodes  –  nedges_dc_n      =  edges  connec2ng  the  trains    –  nedges_dc_ts    =  edges  connec2ng  the  trains  with  the  rest  of  DC  nodes  –  nedges_dc_ss    =  edges  connec2ng  the  DC  nodes  (the  real  ones)  –  nedges_dc                =  all  DC  edges  –  nedges_link            =  edges  containing  a  rec2fier  –  nedges_ac                =  all  AC  edges  including  the  power  transformers  –  nedges                            =  all  AC  and  DC  edges  

Page 10: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Task  3  (45  min)  

•  Adapt  the  index  of  the  nodes  and  the  edges  in  the  next  variables  to  the  described  node  and  edge  enumera2on  criteria:  –  lines_ac  –  lines_dc  –  links_acdc  – nodes_ac    

•  Create  the  next  variables:  – rec2fiers_acdc  :  each  row  represents  a  rec2fier:  

•   (edge  number;  from;  to;  Zpu)  

–  trafos_ac:  each  row  represents  a  power  transformer:  •   (edge_number;  from;  to;  Rpu;  Xpu)  

Page 11: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Task  4  (20  min)  

•  Create  vectors  containing  the  indices  of  every  kind  of  node:  

•  N_slack  =      slack  nodes  •  N_PV          =      PV  nodes    •  N_PQ          =      PQ  nodes  •  N_AC          =      AC  nodes  (no  trafo  secondaries)  •  N_Train  =        train  nodes  •  N_DC          =        DC  nodes    (no  trains)  •  N_DCT      =        All  DC  nodes  •  N_link        =        Link  nodes  •  N_DC_AC  =  DC  nodes  connected  with  the  AC  subsystem  

Page 12: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Task  5  buid  matrix  M  (1  hour)  

•  Build  matrix  M,  and  fill  all  posi2ons  of  RBDC  with  a  parameter  defined  as  infinite.  

•  Useful  commands:  –  accumarray  –  ones  –  zeros  –  eye  –  transpose  or  ‘  –  horzcat  –  vertcat  –  blkdiag    –  diag  

−RBDC ΓDC

−RBAC XB

AC ΓAC

−XBAC −RB

AC ΓAC

ΓDC( )T S

ΓAC( )T -I

ΓAC( )T -I

⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟

iEDC

iEdAC

iEqAC

itDC

iEL

iEdL

iNdAC

iEqL

iNqAC

vNDC

vNdAC

vNqAC

⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟

= 0€

nBDC

nBAC

nBAC

nNDC

nNAC

nNAC

nBDC

nBAC

nBAC

nNDC

nNAC

nNAC

nNDC

nNAC

nNAC

Num

ber  of  equ

a2on

s  

Number  of  unknowns  

Page 13: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

train_pos  defini2on:  

       train_pos=            [1                        4          5              0.5          443e3/Sb                                                                                2                        4          5              0.8          380e3/Sb                                                                          3                        4          6              0.7          -­‐80e3/Sb];  

•  Each  row  represent  a  train,  it  must  contain  all  the  trains  in  the  system,  the  columns  will  represent:  –  first                -­‐>  the  train  index  –  Second    -­‐>from  bus  (always  a  real  dc  node)  –  third            -­‐>  to  bus  (always  a  real  dc  node)  –  fourth      -­‐>  distance  in  (%)  from  the  train  to  the  from  node  –  fish                -­‐>  train  power  in  p.u.  (+  =  trac2on,  -­‐=braking)  

•  If  al  columns  except  the  first  one  are  zero,  this  means  that  the  train  is  not  ac2ve  

Page 14: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Task  6  reallocate  the  trains  in  the  system  (2  hours)  

•  The  trains  must  be  reallocated  if  they  are  non  ac2ve  or  if  there  are  two  or  more  in  the  same  point.  

•  If   they  are  non-­‐ac2ve   trains   they  will   be   reallocated   connected   to  the   lower   index  DC   substa2on  at   a  distance  equal   to   a  parameter  called  param=0.001.   If   there  are  more   than  one  non-­‐ac2ve   trains,  the  second  one  will  be  at  2*param  and  so  on.  

•  If  more  than  on  train  are  in  the  same  electrical  point  they  must  be  reallocated,  the  minimum  distance  between  2  trains  must  be  equal  to  param.  

•  In   the   realloca2ng   process,   be   careful   of   not   obtaining   distances  greater  or  equal  that  1  p.u.  between  the  train  and  the  from  node.  

•  Useful  commands:  –  find  –  Unique  

•  See  the  example  in  the  next  slide    

Page 15: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Task  6  (trains  realloca2on)  train_pos=            [1                        0                0              0                                    443e3/Sb                                                                          2                        10        11            0.9999                0                                                                3                        10        11            0.5                            -­‐80e3/Sb                                                        4                        11        12            0.5                            -­‐80e3/Sb                                                        5                        12        13            0                                    0                                                        6                        0                0              0                                  -­‐80e3/Sb                                                        7                        10        11            0.9999                -­‐80e3/Sb                                                        8                        12        13            0.5                              0                                                        9                        12        13            0.3                              -­‐80e3/Sb];  

10   12   13  

11  

1  6  

3   2   7  

4  

5  

9   8  

•  Trains   1   and   6   must  be  located  near  node  10.  

•  Trains   7   is   in   the  same   posi2on   as2  a n d   w h e n   i t s  r e a l l o c a t e d   t h e  distance  will  be  equal  or  greater  than  one  

•  T r a i n   5   i s   i n  substa2on   12   so   it  should  be  reallocated  near  it    

Page 16: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Suggested  steps  for  task  6  •  Define  param=0.0001;   it   is  the  distance  that  separate  the  trains  when  they  are  in  

the  same  point  •  Check  if  any  train  is  out  of  the  system  and  locate  this  trains  in  the  first  real  DC  line  

next  to  the  first  DC  substa2on  at  a  distance  of  param,  it  doesn’t  maner  if  there  are  more  than  one  non-­‐ac2ve  trains  in  the  same  point  at  this  moment.  (The  command  “find”  will  be  very  useful)  

•  check   if   there   is   more   than   one   train   at   the   same   posi2on,   the   command  [a,b,c]=unique(train_pos(:,[2   3]),'rows');   use   the   parameters   “a”   and   “c”   to  determine    

•  For  each  real  dc  line  determine  the  index  of  the  trains  that  are  in  that  line.    •  Go  through  this  indices,  compare  the  posi2on  of  the  train  of  each  indices  with  the  

rest  of  the  trains  and  while  exist  another  train  in  the  same  posi2on  reallocate  the  actual  one  by  adding  param  to  the  distance.  (Two  trains  have  the  same  posi2ons  if  the  columns  2,3  and  4  of  train_pos  are  the  same)  

•  Then,  check  If  there  is  some  train  at  zero,  adnif  you  find  some  one  add  param  to  all  of  them  

•  Check  if  there  is  some  train  with  a  distance  greater  than  one,  if  you  find  someone  divide  all  the  distance  by  the  maximum  distance  in  per  unit  plus  2*param.  

•  Then  use  the  command  sortrows  nested  to  obtain  all  the  trains  ordered  in  all  lines.  

Page 17: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Task  6  (train_pos  with  reallocated  trains)  train_pos  =  

       1.0000      10.0000      11.0000        0.0002        0.2215          6.0000      10.0000      11.0000        0.0004      -­‐0.0400          3.0000      10.0000      11.0000        0.5000      -­‐0.0400          7.0000      10.0000      11.0000        0.9997      -­‐0.0400          2.0000      10.0000      11.0000        0.9998                  0          4.0000      11.0000      12.0000        0.5000      -­‐0.0400          5.0000      12.0000      13.0000        0.0001                  0          9.0000      12.0000      13.0000        0.3000      -­‐0.0400          8.0000      12.0000      13.0000        0.5000                  0  

10   12   13  

11  

1  6  

3   7   2  

4  

5  

9   8  

Page 18: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Task  7  (Ac2va2on  of  the  DC  edges)  •  In  this  task  we  will  ac2vate  the  correct  DC  edges.  •  First  we  will  construct  this  auxiliary  matrix,  very  helpful  to  determine  the  correct  

index  of  an  edge.  •  Ady_dc_n_ts  =            0          1          2                3          4            5              6            7                8              9          10        11        12            0          0        13        14        15        16        17        18          19          20          21        22        23            0          0          0          24        25        26        27        28          29          30          31        32        33            0          0          0              0        34        35        36        37          38          39          40        41        42            0          0          0              0            0        43        44        45          46          47          48        49        50            0          0          0              0            0            0          51      52          53          54          55        56        57            0          0          0              0            0            0            0        58          59          60          61        62        63            0          0          0              0            0            0            0            0          64          65          66        67        68            0          0          0              0            0            0            0            0              0          69          70        71        72  •  This  matrix  has  the  same  structure  that  the  adjacency  matrix  between  trains  and  

trains  and  substa2on,  the  number  of  rows  is  the  number  of  trains  (9  in  this  par2cular  case  of  study)  and  the  number  of  columns  is  the  number  of  trains  plus  the  number  of  substa2ons.  

•  If  we  want  to  know  the  index  of  the  edge  connec2ng  the  train  “i”  with  the  train  or  substa2on  “j”  we  just  have  to  extract  the  element  Ady_dc_n_ts(i,j)  

Page 19: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Task  7  (Ac2va2on  of  the  DC  edges)  •  For  each  real  DC  line,  I  extract  the  indices  of  the  trains  that  are  in  that  line  

comparing  that  line  with  the  train  posi2on  in  train  pos,  for  instance,  the  first  DC  line  is  (10,11)  

•  For  each  real  DC  line  I  create  an  auxiliary  variable  called  aux  with  the  indices  of  the  trains  in  train  pos  located  in  that  line,  in  this  par2cular  case  aux=[1  2  3  4  5]  

train_pos  =  

       1      10      11        0.0002        0.2215          6      10      11        0.0004      -­‐0.0400          3      10      11        0.5000      -­‐0.0400          7      10      11        0.9997      -­‐0.0400          2      10      11        0.9998                  0          4      11      12        0.5000      -­‐0.0400          5      12      13        0.0001                  0          9      12      13        0.3000      -­‐0.0400          8      12      13        0.5000                  0  

lines_dc  =  

     73      10      11      0.4340        74      11      12      0.8680        75      11      13      0.2604        76      12      13      0.4340  

For  the  1st    DC  line  (10,11):    aux=  [1  2  3  4  5]  For  the  2nd  DC  line  (11,12):    aux=  [6]  For  the  3rd  DC  line  (11,13):    aux=  empty  matrix  For  the  4th  DC  line  (12,13):    aux=  [7  8  9];  

Page 20: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

train_pos  =  

       1      10      11        0.0002        0.2215          6      10      11        0.0004      -­‐0.0400          3      10      11        0.5000      -­‐0.0400          7      10      11        0.9997      -­‐0.0400          2      10      11        0.9998                  0          4      11      12        0.5000      -­‐0.0400          5      12      13        0.0001                  0          9      12      13        0.3000      -­‐0.0400          8      12      13        0.5000                  0  

Task  7  (Ac2va2on  of  the  DC  edges)  •  Depending  on  the  size  of  aux,  we  can  have  three  different  situa2ons:  

–  length(aux)=0;  In  this  case  we  have  to  ac2vate  the  real  DC  line,  this  is  the  case  of  the  third  DC  lline  (11,13),  so  the  edge  75  should  be  ac2vated.  

–  length(aux)=1;  Just  one  train  in  the  line,  for  instance  the  second  line  (11,12).  Is  the  row  number  6  in  the  train  pos  matrix,  using  the  matrix  Ady_dc_n_ts  and  the  indices  in  the  row  number  six  I  obtain  the  edges:  Ady_dc_n_ts(train_pos(6,1),  train_pos(6,2)  )  is  the  first  edge  and  the  second  one  should  be  Ady_dc_n_ts(train_pos(6,1),  train_pos(6,3)  )    .  

Ady_dc_n_ts(train_pos(6,1),  train_pos(6,2)  )=  Ady_dc_n_ts(4,11)=40  Ady_dc_n_ts(train_pos(6,1),  train_pos(6,3)  )=  Ady_dc_n_ts(4,11)=41    

10   12   13  

11  

1  6  

3   7   2  

4  

5  

9   8  

Edge  41  

Edge  40  

Page 21: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

train_pos  =  

       1      10      11        0.0002        0.2215          6      10      11        0.0004      -­‐0.0400          3      10      11        0.5000      -­‐0.0400          7      10      11        0.9997      -­‐0.0400          2      10      11        0.9998                  0          4      11      12        0.5000      -­‐0.0400          5      12      13        0.0001                  0          9      12      13        0.3000      -­‐0.0400          8      12      13        0.5000                  0  

Task  7  (Ac2va2on  of  the  DC  edges)  •  Depending  on  the  size  of  aux,  we  can  have  three  different  

situa2ons:  –  length(aux)>=2;  that  is  the  case  of  the  line  (10,11)  for  instance.  

•  We  will  ac2vate  first  the  connec2on  of  the  first  substa2on  with  the  first  train  (1,10)  and  the  last  substa2on  with  the  last  train  (2,11).  

•  Then  we  will  ac2vate  the  connec2ons  between  trains(1,6),  (6,3),  (3,7)  and  (7,2).  Be  careful  because  in  Ady_dc_n_ts  you  must  extract  the  index  (3,6)  because  the  index  (6,3)  is  zero    

10   12   13  

11  

1  

6  

3   7   2  

4  

5  

9   8  

9  

5  

26  27   17   21  

Page 22: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

train_pos  =          1      10      11        0.0002        0.2215          6      10      11        0.0004      -­‐0.0400          3      10      11        0.5000      -­‐0.0400          7      10      11        0.9997      -­‐0.0400          2      10      11        0.9998                  0          4      11      12        0.5000      -­‐0.0400          5      12      13        0.0001                  0          9      12      13        0.3000      -­‐0.0400          8      12      13        0.5000                  0  

Task  7  (Ac2va2on  of  the  DC  edges)  •  We  have  to  obtain  a  variable  with  two  rows  called  dc_ac2v,  the  first  row  will  indicate  the  ac2ve  edges,  

and  the  second  row  the  resistance  of  the  edges.  For  calcula2ng  the  resistance  we  have  to  calculate  the  distances  between  the  trains  and  the  trains  and  substa2ons  in  p.u.  and  then  mul2ply  this  value  by  the  resistance  of  the  DC  lines  in  the  matrix  line_dc.  

•  For  instance,  the  resistance  of  line  26  between  trains  3  and  6  will  be  (0.5-­‐0.0004)*0.4340  •  For  instance,  the  resistance  of  line  9  between  train  one  and  substa2on  10  will  be  (0.0002-­‐0)*0.4340  

lines_dc  =        73      10      11      0.4340        74      11      12      0.8680        75      11      13      0.2604        76      12      13      0.4340  

10   12   13  

11  

1  

6  

3   7   2  

4  

5  

9   8  

9  

5  

26  27   17   21  

40  

41  49  

46   64  68  

75  

dc_ac2v  =          9                        21                    5                      26                  27                      17                40                    41                  75                    49                  68                  46                    64          0.0001    0.0001    0.0001  0.2168    0.2169    0.0001  0.4339    0.4340    0.2604    0.0001  0.2170  0.1302  0.0868  

Finally  we  use  these  indices  and  values  to  correct  M  

Page 23: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

TASK  8  SOLVER  

min f (x) = XA2 + XB

2 + XC2

g1(x) = 2XA + 5XB ≤ 5g2(x) = XA + XC ≤ 2g3(x) = XA

2 + 2XB + XC ≤10h1(x) = 2XA − 2XB + XC = −2h2(x) =10XA + 8XB −14XC = 26h3(x) = −4XA + 5XB − 6XC

2 = 60 ≤ XA ≤101≤ XB ≤ 5−5 ≤ XC ≤ 8

XA 0 = XB 0 = XC 0 = −1

fmincon  

A =2 1 01 0 1⎛

⎝ ⎜

⎠ ⎟ b =

52⎛

⎝ ⎜ ⎞

⎠ ⎟

Aeq =2 −2 1

10 8 −14⎛

⎝ ⎜

⎠ ⎟ beq =

-226⎛

⎝ ⎜

⎠ ⎟

lb = (0,1,−5)ub = (10,5,8)

[SOL,fval,exi{lag]=fmincon(@myfun,X0,A,b,Aeq,beq,lb,ub,@mycon,op2ons);  

Page 24: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

func2on  example_fmincom    param1=10;  param2=6;  XA=-­‐1;  XB=-­‐1;  XC=-­‐1;  X0=[XA  XB  XC];  A=[2  1  0;  1  0  1];  b=[5  2];  Aeq=[2  -­‐2  1;  10  8  -­‐14];  beq=[-­‐2  26];  lb=[0  1  -­‐5];  ub=[10  5  8];  

op2ons=op2mset('Algorithm','interior-­‐point','TolFun',1e-­‐6,'TolCon',1e-­‐6,'TolX',1e-­‐10,'MaxFunEvals',5e6,'MaxIter',5e6);  [SOL,fval,exi{lag,output,lambda]=fmincon(@myfun,X0,A,b,Aeq,beq,lb,ub,@mycon,op2ons);  

func2on  F  =  myfun(X)  XA=X(1);  XB=X(2);  XC=X(3);  F=[XA^2+XB^2+XC^2];  end  func2on  [c,ceq]=mycon(X)  XA=X(1);  XB=X(2);  XC=X(3);          c=[];          c=[c                  XA^2+2*XB+XC-­‐param1];          ceq=[];          ceq=[ceq                    -­‐4*XA+5*XB-­‐6*XC^2-­‐param2];  end  end  

TASK  8  SOLVER  

Page 25: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

TASK  8  SOLVER:  Defining  the  parameters  outside  the  solvers  

%%  Specified  Values  Needed  to  State  the  equa2ons  %%  AC  nodes  [a,b,c]=intersect(nodes_ac(:,1),N_slack');  V_spec_slack_d=nodes_ac(b,3);  V_spec_slack_q=nodes_ac(b,4);  [a,b,c]=intersect(nodes_ac(:,1),N_PQ');  P_spec_PQ=nodes_ac(b,5);  Q_spec_PQ=nodes_ac(b,6);  [a,b,c]=intersect(nodes_ac(:,1),N_PV');  P_spec_PV=nodes_ac(b,5);  V_spec_PV=nodes_ac(b,7);    %%  Train  aux=sortrows(train_pos,1);  P_train=aux(:,5);  %%  Rec2fier  R_eq=rec2fiers_acdc(:,4);  

Page 26: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

TASK  8  Ini2aliza2on  of  the  unknowns    %%%%  Inizializa2on  of  the  unknowns  %%%%%%%  X_I_E_DC=zeros(1,nedges_dc);  X_I_Ed_AC=zeros(1,nedges_ac);  X_I_Eq_AC=zeros(1,nedges_ac);  X_I_t_DC=zeros(1,ntrain);  X_I_E_L=zeros(1,nnodes_dc);  X_I_Ed_L=zeros(1,nedges_link);  X_I_Nd_AC=zeros(1,nnodes_ac);  X_I_Eq_L=zeros(1,nedges_link);  X_I_Nq_AC=zeros(1,nnodes_ac);  X_V_N_DC=ones(1,nnodes_dc_t);  X_V_Nd_AC=ones(1,nnodes_ac_t);  X_V_Nq_AC=ones(1,nnodes_ac_t);  

X0=[X_I_E_DC  X_I_Ed_AC  X_I_Eq_AC  X_I_t_DC  X_I_E_L  X_I_Ed_L  X_I_Nd_AC  X_I_Eq_L  X_I_Nq_AC  X_V_N_DC  X_V_Nd_AC  X_V_Nq_AC];  

%%%  Solving  procedure  %%%%%%%  A=[];    b=[];  Aeq=M;  beq=zeros(size(M,1),1);  ub=[];  lb=[];  op2ons=op2mset('Algorithm','interior-­‐point','TolFun',1e-­‐6,'TolCon',1e-­‐6,'TolX',1e-­‐10,'MaxFunEvals',5e6,'MaxIter',5e6)  [SOL,fval,exi{lag,output,lambda]=fmincon(@myfun,X0,A,b,Aeq,beq,lb,ub,@mycon,op2ons)  

Page 27: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

TASK  8  Advice  to  use  the  variables  inside  myfun  and  mycon  

%%  Unknowns  %%  

%Currents  I_E_DC=X(1:nedges_dc);  %All  edge  currents  in  the  DC  subsystem  I_E_d_AC=X(nedges_dc+1:nedges_dc+nedges_ac);  %All  the  edge  currents  in  the  AC  subsystem  (d)  I_E_q_AC=X(nedges_dc+nedges_ac+1:nedges_dc+2*nedges_ac);  %All  the  edge  currents  in  the  AC  subsystem  (q)  I_T_DC=X(nedges_dc+2*nedges_ac+1:nedges_dc+2*nedges_ac+ntrain);  %Train  Currents  I_E_LR=X(nedges_dc+2*nedges_ac+N_DC_AC);  %Links  DC  currents  (Here  I  consider  only  the  real  currents,  not  the  ghost  currents)  I_E_LG=X(nedges_dc+2*nedges_ac+N_GHOST);  %Links  ghost  currents  I_E_d_L=X(nedges_dc+2*nedges_ac+nnodes_dc_t+1:nedges_dc+2*nedges_ac+nnodes_dc_t+nlinks);  %Links  currents  AC  (d)  I_N_d_AC=X(????);                                                              %Injected  currents  in  AC  nodes  (d)  I_E_d_L=X(????);                                                                      %Links  currents  AC  (q)  I_N_q_AC=X(???????);                                                  %Injected  currents  in  AC  nodes  (q)  I_N_d_slack=X(??)                                                                  %Injected  current  in  slack  node  (AC)  (d)  I_N_d_PQ=X(??)                                                                          %Injected  current  in  PQ  node  (AC)  (d)  I_N_d_PV=X(??)                                                                          %Injected  current  in  PV  node  (AC)  (d)  I_N_q_slack=X(??)                                                                  %Injected  current  in  slack  node  (AC)  (q)  I_N_q_PQ=X(??)                                                                        %Injected  current  in  PQ  node  (AC)  (q)  I_N_q_PV=X(??)                                                                        %Injected  current  in  PV  node  (AC)  (q)  

Page 28: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

%Voltages  V_N_dc_t=X(nedges_dc+2*nedges_ac+nnodes_dc_t+2*nnodes_ac_t+N_Train        %Voltage  in  train  nodes  (DC)  V_N_dc_s=X(nedges_dc+2*nedges_ac+nnodes_dc_t+2*nnodes_ac_t+N_DC);          %Voltage  in  substa2on  nodes  (DC)  V_N_d_slack=X(nedges_dc+2*nedges_ac+nnodes_dc_t+2*nnodes_ac_t+N_slack);        %Voltage  in  slack  bus  (AC)  (d)  V_N_d_PQ=X(???);                        %Voltage  in  PQ  nodes  (AC)  (d)  V_N_d_PV=X(???);                        %Voltage  in  PV  nodes  (AC)  (d)  V_N_d_link=X(???);                    %Voltage  in  link  nodes  (AC)  (d)  V_N_q_slack=X(???);              %Voltage  in  slack  bus  (AC)  (q)  V_N_q_PQ=X(???);                      %Voltage  in  PQ  nodes  (AC)  (q)  V_N_q_PV=X(???);                      %Voltage  in  PV  nodes  (AC)  (q)  V_N_q_link=X(???);                  %Voltage  in  link  nodes  (AC)  (q)  

TASK  8  Advice  to  use  the  variables  inside  myfun  and  mycon  

Page 29: PSET_lesson08_Simulator_1_base Magnitudes and Ameters – Tasks

Task  9:  Postprocesor  

•  Use  a  procedure  similar  to  the  one  described  in  task  8  to  be  able  to  obtain  directly  from  the  solu2on  all  the  varaibles  described  in  the  previous  slides.