You can see how the OPF model is constructed in …

opf_setup()

The generator costs (piecewise linear and linear or quadratic) are handled via 
add_quad_cost(). Then there are two other functions that are used to handle any 
higher-order polynomial generator costs or legacy user-defined costs ...

opf_gen_cost_fcn()
opf_legacy_user_cost_fcn()

The nodal mismatch equality constraints are implemented by …

opf_power_balance_fcn()
opf_power_balance_hess()

The branch flow inequality constraints are implemented by …

opf_branch_flow_fcn()
opf_branch_flow_hess()

Btw, this is all in MATPOWER 7.0b1.

Hope this helps,

    Ray


> On Apr 11, 2019, at 12:45 PM, Morteza Dabbaghjamanesh <[email protected]> wrote:
> 
> Hi,
> Is there any way to change the default constraints and objective cost 
> function of OPF (even if it requires to change the source code of manpower)? 
> I am very much inquisitive to know where should I start if I really need to 
> change the default constraints and objective cost function?
> 
> Sincerely,
> 
> From: [email protected] 
> <mailto:[email protected]> 
> <[email protected] 
> <mailto:[email protected]>> on behalf of Ray 
> Zimmerman <[email protected] <mailto:[email protected]>>
> Sent: Tuesday, April 9, 2019 4:32:34 PM
> To: MATPOWER discussion forum
> Subject: Re: Using conventional parameters as variables in opf
>  
> Yes.
> 
>> On Apr 9, 2019, at 4:30 PM, Morteza Dabbaghjamanesh <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Thank you very much for your reply, so if I set pf.enforce_q_lims equal to 
>> 1, it will do the PV-PQ switching?
>> 
>> Sincerely,
>> 
>> 
>> From: [email protected] 
>> <mailto:[email protected]> 
>> <[email protected] 
>> <mailto:[email protected]>> on behalf of Ray 
>> Zimmerman <[email protected] <mailto:[email protected]>>
>> Sent: Tuesday, April 9, 2019 3:23:49 PM
>> To: MATPOWER discussion forum
>> Subject: Re: Using conventional parameters as variables in opf
>>  
>> I could be wrong, but I would be very, very surprised if the near singular 
>> matrix issue is related to modeling the shunt susceptances as generators. 
>> The only other idea I have is to call the OPF iteratively as a subroutine 
>> with fixed shunt susceptances that you update according to your own 
>> optimization at each iteration.
>> 
>> Regarding PV, PQ switching during the power flow, have a look at the 
>> pf.enforce_q_lims option (help mpoption or Table 4-2 or Table C-2 in the 
>> manual 
>> <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.pserc.cornell.edu%2Fmatpower%2Fdocs%2FMATPOWER-manual-7.0b1.pdf&data=02%7C01%7Cmdabba1%40lsu.edu%7C9a697a24a5d9440d5ec308d6bd32ec8e%7C2d4dad3f50ae47d983a09ae2b1f466f8%7C0%7C0%7C636904423748376878&sdata=ZFj4Zepgx6rPQLHQTuq6uFZ8NeGoD8cZIqpHI4QPhEc%3D&reserved=0>).
>> 
>>    Ray
>> 
>> 
>>> On Apr 9, 2019, at 11:50 AM, Morteza Dabbaghjamanesh <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>> Thanks for your reply.  I have been able to fix the problem but can you 
>>> suggest any alternative way of converting the OPF parameters as variables 
>>> because I guess adding the shunt susceptances as generators is taking the 
>>> matrix close to singularity as I am getting some warning.
>>> 
>>> One more question, does matpower do PV , PQ switching while solving the 
>>> Power Flow?
>>> 
>>> Sincerely,
>>> 
>>> From: [email protected] 
>>> <mailto:[email protected]> 
>>> <[email protected] 
>>> <mailto:[email protected]>> on behalf of Ray 
>>> Zimmerman <[email protected] <mailto:[email protected]>>
>>> Sent: Tuesday, April 9, 2019 9:00:08 AM
>>> To: MATPOWER discussion forum
>>> Subject: Re: Using conventional parameters as variables in opf
>>>  
>>> If it is not converging, it is likely (though not absolutely certain) that 
>>> the problem is infeasible. I suggest that you try turning on soft limits to 
>>> see if the OPF will converge with a few constraint violations. That can 
>>> show you which are the conflicting constraints. MATPOWER 7.0b1 has a much 
>>> improved soft-limit capability, so definitely get 7.0b1 if you don’t 
>>> already have it. See Section 7.6.4 in the MATPOWER User’s Manual 
>>> <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.pserc.cornell.edu%2Fmatpower%2Fdocs%2FMATPOWER-manual-7.0b1.pdf&data=02%7C01%7Cmdabba1%40lsu.edu%7C9a697a24a5d9440d5ec308d6bd32ec8e%7C2d4dad3f50ae47d983a09ae2b1f466f8%7C0%7C0%7C636904423748386887&sdata=mYWOeN5C2B%2F2cbU%2FJDENnvirep8GWW1lRakeM8pAUGI%3D&reserved=0>
>>>  for more details on OPF soft limits.
>>> 
>>> Then do …
>>> 
>>> mpc = loadcase('<your case>');
>>> mpc = toggle_softlims(mpc, 'on');
>>> r = runopf(mpc);
>>> 
>>> Oh, and by the way, PQ vs PV makes no difference for the OPF, only for the 
>>> power flow.
>>> 
>>> Hope this helps,
>>> 
>>>    Ray
>>> 
>>> 
>>>> On Apr 1, 2019, at 11:51 PM, Morteza Dabbaghjamanesh <[email protected] 
>>>> <mailto:[email protected]>> wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> I have already set the Vmax and Vmin in mpc.bus section to Vg but the 
>>>> condition gets worse, the OPF is not converging now. Previously, though I 
>>>> have seen convergence but I have voltage violation almost in every buses 
>>>> of my system and this is also happening now. Do you have any idea why this 
>>>> is happening or how to get rid of this issue? Does switching from PQ to PV 
>>>> bus seems reasonable to you?
>>>> 
>>>> If you can suggest some alternative way even it is difficult, it will be 
>>>> of great help to me.
>>>> 
>>>> Regards,
>>>> 
>>>> 
>>>> Get Outlook for iOS 
>>>> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Faka.ms%2Fo0ukef&data=02%7C01%7Cmdabba1%40lsu.edu%7C9a697a24a5d9440d5ec308d6bd32ec8e%7C2d4dad3f50ae47d983a09ae2b1f466f8%7C0%7C0%7C636904423748386887&sdata=IKuJK6SA7QJTPD2Pi8tAuyjW85NQ4i%2FWpEX%2FMwV9Yk8%3D&reserved=0>
>>>>  
>>>> From: [email protected] 
>>>> <mailto:[email protected]> on behalf of Ray 
>>>> Zimmerman <[email protected] <mailto:[email protected]>>
>>>> Sent: Monday, April 1, 2019 5:25 PM
>>>> To: MATPOWER discussion forum
>>>> Subject: Re: Using conventional parameters as variables in opf
>>>>  
>>>> There is not an easy way to convert a parameter (like shunt susceptance) 
>>>> to an OPF variable. The approach you are already taking is what I would 
>>>> suggest. It sounds like you may  not have set VMIN and VMAX to the desired 
>>>> voltage (VG).
>>>> 
>>>> On your second question, yes, the gencost matrix is always assumed to be 
>>>> ordered exactly the same as the gen matrix. That is, row i in one 
>>>> corresponds to row i in the other.
>>>> 
>>>>     Ray
>>>> 
>>>> 
>>>>> On Apr 1, 2019, at 11:03 AM, Morteza Dabbaghjamanesh <[email protected] 
>>>>> <mailto:[email protected]>> wrote:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> I was wondering whether there is any way of converting a parameter into a 
>>>>> variable in OPF. Say for example, if I want to convert the shunt 
>>>>> susceptance which is usually passed as a parameter to the OPF , to a 
>>>>> variable, what is the easiest way of doing it. 
>>>>>  
>>>>> 
>>>>> Currently, I am considering shunts as reactive generators which can only 
>>>>> produce reactive power and no real power, to implement that, I have 
>>>>> appended new rows equal to the number of shunt buses in the generator 
>>>>> section of mpc data. Then I set the 'Pg','Pmax' and 'Pmin' to zero. I 
>>>>> collected the voltage from the bus data section and passed it to the 'Vg' 
>>>>> of the new added rows. I have also added some rows in the generator cost 
>>>>> section (appended at the last of the existing cost of the generators). I 
>>>>> have set the 'Qmax' and 'Qmin' from my maximum and minimum shunt 
>>>>> susceptance. I have also changed the bus types to 'PV' from 'PQ' mode (in 
>>>>> applicable cases). Though I am having an OPF solution but looking at the 
>>>>> results there are voltage limit violation in almost every buses. Can you 
>>>>> please suggest what could be the solution of this problem?
>>>>> 
>>>>> 
>>>>> Another issue is, if I add any new generator to the power flow data, then 
>>>>> should I add the generator cost information at the end of the existing 
>>>>> generator cost or should I insert them as per the index of the 
>>>>> generators. 
>>>>> 
>>>>> Best regards, 
>>>>> Morteza Dabbaghjamanesh

Reply via email to