You really do need to understand what that code is doing before you can make 
modifications to make it do something else. So, to repeat my main question … is 
there a particular part of that code that you are having trouble understanding?

It is setting up a constraint l <= A * x <= u, where x = [Va; Vm; Pg; Qg], so 
you need to define the A, l and u to restrict the Qg/Pg ratio in a way the 
enforces the power factor range you desire. You have an example of how to 
enforce the Qg/Pg ratio to a specific value that corresponds to a given power 
factor. Once you understand that, it should be trivial to get rid of the 
appropriate bound (l or u) to change it to an upper or lower bound on the power 
factor. Then you add a similar and opposite bound for another power factor 
value for the other end of your range.

But, as I said … the first step is to fully understand the example you have.

    Ray



> On Sep 21, 2015, at 2:37 AM, Carlos Marta Gonzalez Almeida 
> <[email protected]> wrote:
> 
> DEar Dr. Zimmerman,
> 
> I don't know how I should change the equality constraint to inequality 
> constraint. I'll be very grateful if you can help me.
> 
> Best regards,
> 
> Carlos
> 
> On Fri, Sep 18, 2015 at 4:12 PM, Ray Zimmerman <[email protected] 
> <mailto:[email protected]>> wrote:
> Please address MATPOWER support questions (including followup’s to this 
> e-mail) to the MATPOWER mailing list 
> <http://www.pserc.cornell.edu/matpower/#mailinglist>.
> 
> You simply have to change the equality constraint to an inequality 
> constraint. Is there a particular part of that code snippet that you are 
> having trouble understanding?
> 
>    Ray
> 
> 
>> On Sep 1, 2015, at 11:58 AM, Carlos Marta Gonzalez Almeida 
>> <[email protected] <mailto:[email protected]>> wrote:
>> 
>> Dear Dr. Zimmerman,
>> 
>> According to your previous posts on the following equation which makes the 
>> power factor constant. Now I want to have power factor varying between -0.95 
>> and 0.95. What changes to the following equation to be made?
>> 
>> Thank you very much.
>> 
>> Carlos
>> 
>> 
>> 
>> ng = size(mpc.gen, 1);
>> pf = 0.95;
>> QPratio = sqrt(1/pf^2 -1);
>> mpc.A = sparse([1:ng 1:ng]', [2*nb+(1:ng) 2*nb+ng+(1:ng)]', 
>> [QPratio*ones(ng,1); -ones(ng,1)], ng, 2*nb+2*ng);
>> mpc.A = mpc.A(2:10, :);
>> mpc.l = zeros(ng-15, 1);
>> mpc.u = mpc.l;
> 
> 

Reply via email to