There is support for user-defined costs of the form described in section 6.3.1 
of the User’s Manual 
<http://www.pserc.cornell.edu/matpower/docs/MATPOWER-manual-6.0.pdf>, but this 
does not include arbitrary non-linear cost functions. The intention is to 
include that in an upcoming version.

   Ray



> On Jul 15, 2017, at 11:55 AM, Abhyankar, Shrirang G. <[email protected]> wrote:
> 
> MATPOWER supports two types of generator cost curves: quadratic and 
> piece-wise linear. I don’t think there is support for user-defined cost 
> curves, Ray would be able to provide a more definitive answer. So, I think 
> there is an no easy way to implement the objective you need. You’ll need to 
> modify the MATPOWER code in order to implement what you want and there may be 
> substantial coding you may need to do.
>  
> Shri
>  
> From: <[email protected] 
> <mailto:[email protected]>> on behalf of Akash Tyagi 
> <[email protected] <mailto:[email protected]>>
> Reply-To: MATPOWER discussion forum <[email protected] 
> <mailto:[email protected]>>
> Date: Saturday, July 15, 2017 at 8:10 AM
> To: MATPOWER discussion forum <[email protected] 
> <mailto:[email protected]>>
> Subject: Re: Objective Functions
>  
> Yeah, 
> Thanks so much sir.
> Do you have any idea of how of to add valve point effect in the mpc.gencost 
> data?
> Presently, our Objective function is mainly a*P^2+b*P+c.
> But if we want to include the valve point effect i.e. 
> a*P(i)^2+b*P(i)+c+abs(e(i)*sin(f(i)(Pmin(i)-P(i))).
> Can this be added in the MATPOWER??
>  
> On Sat, Jul 15, 2017 at 6:25 PM, Sarmad Hanif <[email protected] 
> <mailto:[email protected]>> wrote:
> I would not say real power minimization, I think it is better to say active 
> power cost minimization.
> From: [email protected] 
> <mailto:[email protected]> 
> [mailto:[email protected] 
> <mailto:[email protected]>] On Behalf Of Akash Tyagi
> Sent: Saturday, 15 July, 2017 8:51 PM
> 
> To: MATPOWER discussion forum
> Subject: Re: Objective Functions
>  
> Thanks a lot.
> It is working now.
> The last thing I want to ask is if we don't add reactive cost data to case, 
> then it is considering only the real power minimization??
>  
> On Sat, Jul 15, 2017 at 6:01 PM, Sarmad Hanif <[email protected] 
> <mailto:[email protected]>> wrote:
> From Generator Cost Data table of the MATPOWER manual:
> “If gen has ng rows, then the first ng rows of gencost contain the costs for 
> active power produced by the
> corresponding generators. If gencost has 2ng rows, then rows ng + 1 through 
> 2ng contain the reactive
> power costs in the same format.”
>  
> Since there are only active power cost terms in the case file and you have 
> put all active power cost terms to zero, your cost function will evaluate to 
> zero.
> First add reactive power cost term rows and then specify their marginal 
> values to be able for MATPOWER to consider them.
> Hope it helps.
> Sarmad
>  
> From: [email protected] 
> <mailto:[email protected]> 
> [mailto:[email protected] 
> <mailto:[email protected]>] On Behalf Of Akash Tyagi
> Sent: Saturday, 15 July, 2017 7:46 PM
> 
> To: MATPOWER discussion forum
> Subject: Re: Objective Functions
>  
> After putting the cost term of the real power to zero in the mpc.gencost 
> field, as attached the case below-
> Then after running the optimal power flow by using the following code-
> clc
> clear
> close all;
> define_constants;
> mpc=loadcase(newcase5);
> results=runopf(mpc);
> The objective function is coming zero.??
> I am not getting this??
>  
> On Sat, Jul 15, 2017 at 10:19 AM, Sarmad Hanif 
> <[email protected] <mailto:[email protected]>> 
> wrote:
> Hi,
> Mr. Kardos already gave the references for you to explore the cost functions 
> in detail.
> A quick fix:
> If you just want to minimize reactive power, then just put cost terms of the 
> real power to zero in its approriate mpc.gencost field J
>  
> Btw, minimizing objective function can mean anything, as it depends on your 
> “function”. It cannot always mean considering only the reactive power, as you 
> mentioned in your previous email.
>  
> Thanks,
> Sarmad
>  
> From: [email protected] 
> <mailto:[email protected]> 
> [mailto:[email protected] 
> <mailto:[email protected]>] On Behalf Of Akash Tyagi
> Sent: Wednesday, 12 July, 2017 4:59 PM
> To: MATPOWER discussion forum
> Subject: Re: Objective Functions
>  
> Hello,
> The obj_func mainly minimizes the cost including the real and reactive power.
> But I have to only minimize objective function i.e. cost considering only the 
> reactive power.
> I tried the way explained by you above but I am not able to do this.?
> Can you help?
> basically, my goal is to change the objective function.
> Thanks
>  
> On Wed, Jul 12, 2017 at 1:49 PM, Akash Tyagi <[email protected] 
> <mailto:[email protected]>> wrote:
> ok, thanks
>  
> On Wed, Jul 12, 2017 at 1:40 PM, Kardoš Juraj <[email protected] 
> <mailto:[email protected]>> wrote:
> Try to have a look in the code in opf_costfcn.m and compare it with the 
> objective function definition in the manual 
> (http://www.pserc.cornell.edu/matpower/manual.pdf 
> <http://www.pserc.cornell.edu/matpower/manual.pdf>) section 6.1 equation 
> (6.6). You will find the function implemented in the code, as well as its 
> gradient and Hessian w.r.t. vector x (equation 6.5). If you have problems 
> with derivatives, have a look at section 6 in this document 
> http://www.pserc.cornell.edu/matpower/TN2-OPF-Derivatives.pdf 
> <http://www.pserc.cornell.edu/matpower/TN2-OPF-Derivatives.pdf>. It describes 
> how the first and second derivatives can be computed. Good luck!
> ==========================
> Juraj Kardos
> Advanced Computing Laboratory
> Institute of Computational Science
> Universita della Svizzera italiana
> Via Giuseppe Buffi 13
> Lugano 6904
> Switzerland
> http://www.ics.inf.usi.ch <http://www.ics.inf.usi.ch/>
> ===========================
>  
> On 12 Jul 2017, at 09:46, Akash Tyagi <[email protected] 
> <mailto:[email protected]>> wrote:
>  
> Can you explain me through simple example.?
>  
> On Wed, Jul 12, 2017 at 1:09 PM, Kardoš Juraj <[email protected] 
> <mailto:[email protected]>> wrote:
> Hello, 
>  
> as far as I know, you can define arbitrary objective function by modifying 
> the following source file: opf_costfcn.m. Don’t forget that you need to 
> provide gradient and Hessian w.r.t. OPF control variables as well. These 
> derivations are used in optimizers to find the optimal solution.
>  
> Best regards,
>  
> ==========================
> Juraj Kardos
> Advanced Computing Laboratory
> Institute of Computational Science
> Universita della Svizzera italiana
> Via Giuseppe Buffi 13
> Lugano 6904
> Switzerland
> http://www.ics.inf.usi.ch <http://www.ics.inf.usi.ch/>
> ===========================
>  
> On 12 Jul 2017, at 08:02, Akash Tyagi <[email protected] 
> <mailto:[email protected]>> wrote:
>  
> Hello everyone, 
> I am working on congestion management and running optimal power flow.
> The Objective function after running the OPF is the cost, but I want to 
> include my own objective function.
> Can you please let me know how to remove the existing objective function and 
> include my own objective function.
> Thanks in advance
>  
>  
>  
>  
>  
>  
>  
>  

Reply via email to