I think you need to take some time to understand the examples I already gave. 
If you understand them, the answer to your question should be obvious. Simply 
eliminate the row of A corresponding to the generator whose power factor you 
want to free up.

-- 
Ray Zimmerman
Senior Research Associate
211 Warren Hall, Cornell University, Ithaca, NY 14853
phone: (607) 255-9645



On Mar 14, 2011, at 12:04 PM, Roberto Carvalini wrote:

> Ok. Except generator 1, I want to have specified PF for other generators. 
> Could you please give me an example? I will be appreciate
> 
> Also I did the last email command but it has error.
> 
> Best Wishes
> 
> Roberto 
> 
> 
> On Mon, Mar 14, 2011 at 17:01, Ray Zimmerman <[email protected]> wrote:
> You have to leave at least one with a free power factor and large enough 
> reactive power range to balance the reactive power in the system.
> 
> -- 
> Ray Zimmerman
> Senior Research Associate
> 211 Warren Hall, Cornell University, Ithaca, NY 14853
> phone: (607) 255-9645
> 
> 
> 
> On Mar 14, 2011, at 11:53 AM, Roberto Carvalini wrote:
> 
>> How can I solve this problem?
>> 
>> Best Wishes
>> 
>> Roberto 
>> 
>> 
>> On Mon, Mar 14, 2011 at 16:44, Ray Zimmerman <[email protected]> wrote:
>> But you are over-specifying the problem and it will not have a solution. You 
>> can't specify all of the power factors exactly and expect the power flow 
>> equations to be satisfied.
>> 
>> -- 
>> Ray Zimmerman
>> Senior Research Associate
>> 211 Warren Hall, Cornell University, Ithaca, NY 14853
>> phone: (607) 255-9645
>> 
>> 
>> 
>> On Mar 14, 2011, at 11:39 AM, Roberto Carvalini wrote:
>> 
>>> Because I want to have PF=0.9 or 0.95 for all generators. As you know, it 
>>> is very important
>>> 
>>> On Mon, Mar 14, 2011 at 16:36, Ray Zimmerman <[email protected]> wrote:
>>> You need a row of A for each generator, each one with QPratio in the column 
>>> corresponding to Pg(i) and -1 in the column corresponding to Qg(i) ...
>>> 
>>> mpc.A = sparse([1:ng; 1:ng], [2*nb+(1:ng); 2*nb+ng+(1:ng)], 
>>> [QPratio*ones(ng,1); -ones(ng,1)], 1:ng, 2*nb+2*ng);
>>> 
>>> As I said, this is likely to make the OPF infeasible, so I'm not sure why 
>>> you'd want to do it.
>>> 
>>> -- 
>>> Ray Zimmerman
>>> Senior Research Associate
>>> 211 Warren Hall, Cornell University, Ithaca, NY 14853
>>> phone: (607) 255-9645
>>> 
>>> 
>>> 
>>> 
>>> On Mar 14, 2011, at 11:17 AM, Roberto Carvalini wrote:
>>> 
>>>> Thank you very much.
>>>> 
>>>> Is it possible for you to give an example, for example case9, for all 
>>>> generators? I will be appreciate if you do it.
>>>> 
>>>> Best Regards
>>>> 
>>>> R. Carvalini 
>>>> 
>>>> On Mon, Mar 14, 2011 at 16:08, Ray Zimmerman <[email protected]> wrote:
>>>> The A matrix is from equation (5.25) in the User's Manual. As I mentioned, 
>>>> the coefficients need to go in the columns corresponding to Pg(1) and 
>>>> Qg(1). So, Pg(1) is in the first column following the voltage angles (1st 
>>>> nb columns) and magnitudes (next nb columns), so it's in column 2*nb+1. 
>>>> For Qg(1) it's the first column after the Pg columns, so 2*nb (for the 
>>>> voltage angles and magnitudes) plus ng columns for Pg.
>>>> 
>>>> Yes, if you wanted to do this for all generators, you need to include a 
>>>> row in A for each. Be careful though, this will likely over-constrain the 
>>>> problem and make it infeasible. If all generators have a fixed power 
>>>> factor, then balancing the real power output to match the load will mean a 
>>>> specific reactive power output as well, which will not necessarily match 
>>>> the reactive power load.
>>>> 
>>>> -- 
>>>> Ray Zimmerman
>>>> Senior Research Associate
>>>> 211 Warren Hall, Cornell University, Ithaca, NY 14853
>>>> phone: (607) 255-9645
>>>> 
>>>> 
>>>> 
>>>> On Mar 11, 2011, at 11:40 AM, Roberto Carvalini wrote:
>>>> 
>>>>> Thank you very much.
>>>>> 
>>>>> I have read the manual but I didn't understand by which formula you 
>>>>> computed this matrix (highlighted)
>>>>> 
>>>>> mpc.A = sparse([1; 1], [2*nb+1; 2*nb+ng+1], [QPratio; -1], 1, 2*nb+2*ng);
>>>>> 
>>>>> and if want to define the same PF for all generators, must I repeat this 
>>>>> for all or it depends on the type buses (PV or Slack)?
>>>>> 
>>>>> Regards
>>>>> 
>>>>> R. Carvalini
>>>>> 
>>>>> On Fri, Mar 11, 2011 at 16:27, Ray Zimmerman <[email protected]> wrote:
>>>>> Dirk's suggestion is fine for a simple power flow. But if you want to run 
>>>>> an OPF, where the generator dispatch is to be determined by the 
>>>>> optimization, but subject to a constant power factor constraint, then you 
>>>>> will need to supply an additional user-defined linear constraint. For 
>>>>> example, if you want to run case9 with a constant power factor constraint 
>>>>> of 0.95 on the first generator, you could do it like this ...
>>>>> 
>>>>> define_constants;
>>>>> mpc = loadcase('case9');
>>>>> nb = size(mpc.bus, 1);
>>>>> ng = size(mpc.gen, 1);
>>>>> pf = 0.95;
>>>>> QPratio = sqrt(1/pf^2 -1);
>>>>> %% add constraint that QPratio * Pg(1) - Qg(1) = 0
>>>>> mpc.A = sparse([1; 1], [2*nb+1; 2*nb+ng+1], [QPratio; -1], 1, 2*nb+2*ng);
>>>>> mpc.l = 0;
>>>>> mpc.u = 0;
>>>>> r = runopf(mpc);
>>>>> resulting_pf = r.gen(1, PG) / sqrt(r.gen(1, PG)^2 + r.gen(1, QG)^2)
>>>>> 
>>>>> The important part here is defining the A matrix properly, where the 
>>>>> columns correspond to voltage angles, voltage magnitudes, generator real 
>>>>> injections, and generator reactive injections (2*nb + 2*ng columns in 
>>>>> all). So the coefficients for our constraint co in the columns 
>>>>> corresponding to Pg(1) and Qg(1).
>>>>> 
>>>>> -- 
>>>>> Ray Zimmerman
>>>>> Senior Research Associate
>>>>> 211 Warren Hall, Cornell University, Ithaca, NY 14853
>>>>> phone: (607) 255-9645
>>>>> 
>>>>> 
>>>>> 
>>>>> On Mar 11, 2011, at 9:50 AM, Dirk Van Hertem wrote:
>>>>> 
>>>>>> You model your generator as a load, so it is not represented in your gen 
>>>>>> matrix. Of course, if you want model your generator in a unit 
>>>>>> commitment, this may not be trivial...
>>>>>> 
>>>>>> Dirk
>>>>>> 
>>>>>> On 03/11/2011 12:32 PM, Roberto Carvalini wrote:
>>>>>>> 
>>>>>>> Thank you
>>>>>>> 
>>>>>>> How can I add? my problem is this
>>>>>>> 
>>>>>>> Best Wishes
>>>>>>> 
>>>>>>> Roberto 
>>>>>>> 
>>>>>>> 
>>>>>>> On Fri, Mar 11, 2011 at 12:22, Dirk Van Hertem 
>>>>>>> <[email protected]> wrote:
>>>>>>> You can just define them as a PQ bus with negative power... (negative 
>>>>>>> load)
>>>>>>> 
>>>>>>> Dirk
>>>>>>> 
>>>>>>> 
>>>>>>> On 03/11/2011 12:11 PM, Roberto Carvalini wrote:
>>>>>>> Hi
>>>>>>> 
>>>>>>> How can I define constant power factor in MAPOWER for example, for 
>>>>>>> generators PF=0.9?
>>>>>>> 
>>>>>>> Please help me
>>>>>>> 
>>>>>>> Regards
>>>>>>> 
>>>>>>> Roberto
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> -- 
>>>>>>> Dirk Van Hertem                       [email protected]
>>>>>>> Electrical Engineering Department  http://www.esat.kuleuven.be/electa
>>>>>>> K.U. Leuven, ESAT-ELECTA                     GSM: +32-(O)498-61.74.98
>>>>>>> 10, Kasteelpark Arenberg, B-3001 Heverlee        fax: +32-16-32.19.85
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> Dirk Van Hertem                       [email protected]
>>>>>> Electrical Engineering Department  http://www.esat.kuleuven.be/electa
>>>>>> K.U. Leuven, ESAT-ELECTA                     GSM: +32-(O)498-61.74.98
>>>>>> 10, Kasteelpark Arenberg, B-3001 Heverlee        fax: +32-16-32.19.85 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> 
>>> Best Wishes
>>> 
>>> Roberto 
>> 
>> 
> 
> 

Reply via email to