You are on page 1of 29

# Sustainable

Transporta2on and
Electrical Power
Systems

de Oviedo

## Lesson 2 Network Descrip2on

Using Graph Theory
Lesson 8 Simulator 1 (base magnitudes and
Semester 3 Power Systems for Electrical Transporta2on
Lecturer: Pablo Arboleya Arboleya

Base Magnitudes

11AC

39

12AC

16AC

13AC

15AC

AC/DC

14AC

AC/DC

AC/DC

6DC 7DC

4DC

1DC
2DC
3DC

5DC

## Figura 3.1: Sistema AC/DC dimensiones constantes.

Base Currents :
Sb
Ib1 =
Base Current in AC subsystem
3V1b
Sb
Ib 2 =
3V2b
S
Ib1 = b
Base Current in DC subsystem
Vdb

Bases :
Base Impedances :
Sb
Power
V1b2
es 3,Base
luego los
nodos de la topologa de DC comenzarn en 4
anterior el nt ahora
Z b1 =
Base Impedance in AC subsystem
y as se seguir con el criterio de numeracin ya explicado.

## V1b Base Voltage in AC subsystem

Sb
V2b Base Voltage in link subsystem
V2b2
Zb 2 =
Vdb Base Voltage in DC subsystem
Sb
f n Base frequency
Vdb2
Z db =
Base Impedance in DC subsystem
Sb

t
he
12AC
substa2ons
Sn
V1
V2
Pcu
Vcc

15AC

## Rated Power of Power transformer (VA)

Rated Voltage of Power transformer62primary side (V)4. Formulacin del modelo y resolucin del flujo de cargas
Rated Voltage of Power transformer secondary side (V)
AC
AC
vN
nodo AC j
Cooper Losses of Power transformer side (W)
dj , vN qj
iLEdk , iLEqk
Short circuit voltage of power transformer (%)

Scc

AC/DC
iLEk

## Grid Parameters Estimation

nodo DC i

V12Vcc
Z cc _ t =
100Sn
S
I1 = n
3V1
P
Rcc _ t = cu2
3I1

V22
4DC
Z eq = X eq =
Scc Figura 4.9: Detalle de ecuaciones del rectificador.
Conmutation Reactance Estimation
As pues la funcin que rige el frenado de un tren i es:
Z eq _ total = Z eq + Z cc + Rdiode
_ on

I2 =

Sn
3V2

X cc _ t = Z cc2 _ t Rcc2 _ t

edge k

iDC
ti

Pi

DC
vNi
DC
= m(vN
i Vmax )

Donde m = I0 /(Vmax V0 ).

DC
vN
i

DC
vN
i Vc

DC
Vc vN
i Vmax
DC
vN i Vmax

(4.28)

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

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)

lines_ac_IS.txt
%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

Depending of
the kind of
rec2er

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

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

Load all the data contained in the txt les (use the
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.
three columns, the next columns will be Rccpu Xccpu
Zeqpu_total
nodes_ac same as nodes_ac_IS but in p.u.

Calculate the number of nodes and edges:
ntrain=3; = number of trains (Now it will be a constant)
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 rec2er
nedges_ac = all AC edges including the power transformers
nedges = all AC and DC edges

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
nodes_ac

## Create the next variables:

rec2ers_acdc : each row represents a rec2er:
(edge number; from; to; Zpu)

## trafos_ac: each row represents a power transformer:

(edge_number; from; to; Rpu; Xpu)

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_DC_AC = DC nodes connected with the AC subsystem

## Task 5 buid matrix M (1 hour)

accumarray
ones
zeros
eye
transpose or
horzcat
vertcat
blkdiag
diag

Number of equa2ons

## Build matrix M, and ll all posi2ons of RBDC with a

parameter dened as innite.
Useful commands:

n BDC R DC
B

R AC
B
X AC
B

n BAC
n BAC

( )

DC
n NDC

n NAC
n NAC

X AC
B
R AC
B

-I

AC T

( )
n BAC

n BAC

AC
S

AC T

( )

n BDC

DC

-I
n NDC n NAC n NAC n NDC

n NAC

Number of unknowns

iDC

E
AC
iEd
iAC

Eq
DC
it
iLE
AC iL
Ed = 0

iAC
Nd

iL
Eq
iAC

Nq

v DC
N
AC

nN
v AC

Nd
AC
v Nq

train_pos deni2on:
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:
rst -> 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
sh -> train power in p.u. (+ = trac2on, -=braking)

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

## 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:
nd
Unique

## See the example in the next slide

train_pos= [1 0 0 0 443e3/Sb
2 10 11 0.9999 0
3 10 11 0.5 -80e3/Sb
Trains 1 and 6 must
4 11 12 0.5 -80e3/Sb
be located near node
5 12 13 0 0
10.
6 0 0 0 -80e3/Sb
Trains 7 is in the
7 10 11 0.9999 -80e3/Sb
same posi2on as2
8 12 13 0.5 0
a n d w h e n i t s
9 12 13 0.3 -80e3/Sb];

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

10

12

1
6

5
4

11
3

2 7

13

9 8

## Suggested steps for task 6

Dene 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 rst real DC line
next to the rst DC substa2on at a distance of param, it doesnt maner if there are
more than one non-ac2ve trains in the same point at this moment. (The command
nd 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 nd some one add param to all
of them
Check if there is some train with a distance greater than one, if you nd 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.

## 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

1
6

5
4

11
3

7 2

13

9 8

## 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.
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)

## 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
rst 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]
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];

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 dierent 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 rst edge and the second
one should be Ady_dc_n_ts(train_pos(6,1), train_pos(6,3) ) .

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

10
13
12
5
1
6 Edge 41
4
9 8
Edge 40
11
3

7 2

## Task 7 (Ac2va2on of the DC edges)

Depending on the size of aux, we can have three dierent
situa2ons:

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

We will ac2vate rst the connec2on of the rst substa2on with the rst 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

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

10
9
5

13

12
5

4
6
26
27 17 21 11
3

9 8

## Task 7 (Ac2va2on of the DC edges)

We have to obtain a variable with two rows called dc_ac2v, the rst 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
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

10
9
5

41

12
49

6
40
26
27 17 21 11

13
5
68
46
64
4
8
9
75

2
3 7
Finally we use these indices and values to correct M

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

fmincon

min f (x) = X A2 + X B2 + X C2
g1 (x) = 2X A + 5X B 5
g2 (x) = X A + X C 2
g3 (x) = X A2 + 2X B + X C 10
h1 (x) = 2X A 2X B + X C = 2
h2 (x) = 10X A + 8X B 14 X C = 26
h3 (x) = 4 X A + 5X B 6X C2 = 6
0 X A 10
1 XB 5
5 X C 8
X A 0 = X B 0 = X C 0 = 1

[SOL,fval,exi{lag]=fmincon(@myfun,X0,A,b,Ae
q,beq,lb,ub,@mycon,op2ons);
2 1 0
5
A =
b =

1
0
1

2
2 2 1
-2
Aeq =
b
=
eq
10 8 14
26
lb = (0,1,5)
ub = (10,5,8)

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: Dening the

parameters outside the solvers
%% Specied 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);
%% Rec2er
R_eq=rec2ers_acdc(:,4);

## 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_Nd_AC=zeros(1,nnodes_ac);
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)

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)
AC (d)
I_N_d_AC=X(????); %Injected currents in AC nodes (d)
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)

mycon
%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)