Dear Ray,
while trying to find a way to add a user defined constraint I came across this 
example posted by you a couple years ago:
What I want to do is to create an equality constraint that will allow only 
above a limit of operation of certain units. In fact, I have 14 gens of which 
11 are conventional. I want the output of those eleven gens to be always above 
50% of the total load. So the inequality should be sth like: 
Pg1+Pg2+...Pg11> 0.5* Load
I have 41 buses so I believe that the following can produce my extra constraint:
A_V = sparse(1, 80);A_Pg = sparse(  [ 1 1 1 1 1 1 1 1 1 1 1 0 0 0] );
A_Qg = sparse(1, 14);
mpc.A = [A_V A_Pg A_Qg];
mpc.l = [0.5*Load];
Questions:
In the example following, you only put pu values at the limits of the struct. 
Can I use absolute values?
Does what I present here makes sense?
In the following example is there a chance there is a typo and it is mpc.u = 
[0;  0.09] instead of mpc.u = [0;  0.01] or I am getting sth wrong?
Best Regards,
Vagelis 








Ok, here's a simple example ...

Suppose you wanted to add the following two constraints to case9.m:
1) generator 1 and generator 2 real power output must be equal
        0 <= Pg1 - Pg2 <= 0
2) the difference in voltage magnitudes between buses 1 and 9 must be less than 
0.01 p.u.
        -0.01 <= Vm1 - Vm9 <= 0.09Since we have 9 buses and 3 generators, the A 
matrix will be 2 x 24 (9 angles, 
9 magnitudes, 3 real injections, 3 reactive injections).

mpc = loadcase('case9');
A_Va = sparse(2, 9);
A_Vm = sparse(  [ 0 0 0 0 0 0 0 0  0;
                  1 0 0 0 0 0 0 0 -1 ] );
A_Pg = sparse(  [ 1 -1  0;
                  0  0  0 ] );
A_Qg = sparse(2, 3);
mpc.A = [A_Va A_Vm A_Pg A_Qg];
mpc.l = [0; -0.01];
mpc.u = [0;  0.01];

opt = mpoption('OUT_BRANCH', 0, 'OUT_ALL_LIM', 0, 'OUT_SYS_SUM', 0);
r = runopf(mpc, opt);


                                          

Reply via email to