Hello,
Im trying to develop a study case where I add a new generator at a bus with
loads. Happens that when I add that new generator, and change its bus type from
1 to 2, the program not always run the power flow as if that generator was type
2, that means it does not calculate the optimal PG and QG. I noticed that the
program only assums the new bus as type 2 if it is added right after every type
2 bus is listed.
The code I have right now is:
define_constants;
mpc = loadcase('case6ww');
size(mpc.gen, 1); %gives the last row of generator data
ng = size(mpc.gen, 1) + 1; %Specifies the start point
bus_number= 5; Pg= 0; Qg = 0; Qmax=10; Qmin=-10; Vg=1.01; mBase=100; status=1;
Pmax=20; Pmin=0;
mpc.gen(ng, GEN_BUS:PMIN) = [bus_number Pg Qg Qmax Qmin Vg mBase status Pmax
Pmin];
barramento_gerador=mpc.gen(ng, GEN_BUS);
fprintf('\nbus %d', barramento_gerador);
mpc.gen (ng,PG) = 10; %add 10MW to bus _number
mpc.bus (ng,BUS_TYPE) = 2; %changes the type of bus bus_number to PV
mpc.gencost(ng,MODEL)=2;
runpf(mpc);
As it is, I can add a new generator at bus 5 by modifying matrix mpc.gen and by
changing its bus type from 1 to 2. By applying these changes the matrix mpc.bus
would be like this:
mpc.bus = [
1 3 0 0 0 0 1 1.05 0 230 1 1.05 1.05;
2 2 0 0 0 0 1 1.05 0 230 1 1.05 1.05;
3 2 0 0 0 0 1 1.07 0 230 1 1.07 1.07;
4 1 70 70 0 0 1 1 0 230 1 1.05 0.95;
5 2 70 70 0 0 1 1 0 230 1 1.05 0.95;
<<<<--------------------
6 1 70 70 0 0 1 1 0 230 1 1.05 0.95;
];
As it is right now, if i run a power flow, it does not change the values of PG
and QG, instead, it keeps the values I have initially defined.
But, if I add a generator at bus 4 instead on bus 5, by changing the variable
by me created bus_number = 4 (see code below), the program runs a perfect power
flow and automatically defines the values of PG and QG as expected for a bus
type 2. In this case the matrix would be:
mpc.bus = [
1 3 0 0 0 0 1 1.05 0 230 1 1.05 1.05;
2 2 0 0 0 0 1 1.05 0 230 1 1.05 1.05;
3 2 0 0 0 0 1 1.07 0 230 1 1.07 1.07;
4 2 70 70 0 0 1 1 0 230 1 1.05 0.95;
<<<<--------------------
5 1 70 70 0 0 1 1 0 230 1 1.05 0.95;
6 1 70 70 0 0 1 1 0 230 1 1.05 0.95;
];
What i could notice is that the program only performs a correct power flow if
the buses are listed by order on the mpc.bus matrix. First I define all bus
type 3, then all bus type 2 and last all bus type 1. If they are ordered
randomly, the program does not work. Now I wounder if there is a solution for
this problem. How can I make it run a correct power flow by using the code
below? I've tryied to manipulate the file ext2int.m but it seems that it does
not work.
Is there any funtion to reorganize the matrix? What can i do?
Kind regards,
Rapa