I would not say real power minimization, I think it is better to say active power cost minimization. From: [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 ☺ 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) 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. 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 =========================== 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
