Dear Ray
Thank you for your help!
I was able to modify the code to work for my kundur file but I still have some
questions to make sure i fully understand how the program works.
are my comments in the code correct:
define_constants;
mpopt = mpoption('opf.ac.solver', 'MIPS', 'verbose', 2);%choose which solver to
use+which info to
print
mpc = loadcase('case30');%load file
nb = size(mpc.bus, 1);%calculate number of busses in system
ng = size(mpc.gen, 1);
mpc.gencost = ones(ng, 1) * [2 0 0 2 1 0];%modify the gencost matrix in the
case30file
r1 = runopf(mpc, mpopt);%runopf(wil give same result as pf because all cost are
equal)
mpc.gencost(:, 5) = 0;%modify gen cost so all cost of generation is 0
mpc.N = [sparse(nb, nb) speye(nb, nb) sparse(nb, 2*ng)];
Because there are no new elements in the matrix x I would suspect N to be an
eye matrix. I don't really understand what this formulation of N does and how
the 3 matrix defined relate to each other.(does this isolate the Voltage from
the x vector?)
mpc.fparm = ones(nb, 1) * [2 1 0 1];%define objective for each bus
mpc.Cw = 1000 * ones(nb, 1);% we multipy by 1000 to make the objective strong?
r2 = runopf(mpc, mpopt);%runopf
the cost funciton is (V-1)^2 so
The formula in matpower for the cost objective is:
fu(x; z) =1/2 w^THw + C^Tw
by default H is zero so the first part is gone. ?
C=Cw
Fparm=
?d=2 power
r=1 shift
k=0 no deadzone
m=1 scale factor
w=(V-1)^2 because of fparm.
this is how we get the costfunction
I hope you find the time to look at my questions.
Kind regards
Robin
________________________________
Van: [email protected]
<[email protected]> namens Ray Zimmerman
<[email protected]>
Verzonden: maandag 28 november 2016 17:19
Aan: MATPOWER discussion forum
Onderwerp: Re: change objective OPF
Here is an example of how to do it for case30. The first run is a
loss-minimization solution, the second minimizes the voltage deviations from 1
p.u. using the objective you specified.
define_constants;
mpopt = mpoption('opf.ac.solver', 'MIPS', 'verbose', 2);
mpc = loadcase('case30');
nb = size(mpc.bus, 1);
ng = size(mpc.gen, 1);
mpc.gencost = ones(ng, 1) * [2 0 0 2 1 0];
r1 = runopf(mpc, mpopt);
mpc.gencost(:, 5) = 0;
mpc.N = [sparse(nb, nb) speye(nb, nb) sparse(nb, 2*ng)];
mpc.fparm = ones(nb, 1) * [2 1 0 1];
mpc.Cw = 1000 * ones(nb, 1);
r2 = runopf(mpc, mpopt);
norm(r1.bus(:, VM) - 1)
norm(r2.bus(:, VM) - 1)
Notice the reduction in voltage deviations from the first run.
Ray
On Nov 24, 2016, at 10:46 AM, Robin Weckx
<[email protected]<mailto:[email protected]>> wrote:
Dear,
I have implemented the two area kundur topology in the matpower software. I can
successfully run a PF and OPF. My next goal is the change the objective of the
OPF so that the voltages on the busses are as close to unity as possible
independently from the cost of the generators. For this i modified my gencost
matrix so that all the generators have the same cost. the next step is to add
my objective while the constrains stay the same. Because i don't need to add
any values because Vm is already in the x matrix this process should be quite
straightforward but i keep failing.
My objective function is fmin=(Vm-1)^2 for all the voltages of the busses. How
do i implement this?
i looked at the "add_costs" function but don't really know where i should use
this function.
i tried the direct implementation method of cheaper 7. should i just but the
values of the H,N,Cw,... in de Kundur file that I use to perform
runopf('Kundur')?
or could i just modify the gencost matrix to make a "buscost" matrix where all
the polynomial cost functions are as defined above?
Could you please give me some more directions on how to solve this problem?
thanks in advance
kind regards
Weckx Robin