MorningThanks for your reply. I was actually trying to improve voltage profile 
by minimizing the difference of each node voltage from the reference voltage 
(sum(1-V(i)). I did not work at all. No change was observed relative to the 
node voltage.nice day to every one
    Le mercredi 18 novembre 2020 à 18:16:56 UTC+1, Ray Daniel Zimmerman 
<r...@cornell.edu> a écrit :  
 
 The easiest way to add the cost you want is by using direct specification of 
legacy costs as described in Sections 6.3.3 and 7.1.3 in the User’s Manual.
Something like …
define_constants;mpc = loadcase('case33bw');%         -----Va------  ----Vm---  
---Pg---Qg---mpc.N = [ sparse(33,33)  speye(33)  sparse(33, 2) ];mpc.Cw = 
ones(33, 1);%                           d  rhat k   mmpc.fparm = ones(33, 1) * 
[ 1   1   0   1];mpc.gencost(:, COST:COST+2) = 0;    % zero out generator costr 
= runopf(mpc, mpopt);
I should also mention two other things:   
   - On a system with a single generator like this one, there are really no 
available degrees of freedom for doing any dispatch optimization, so changing 
the cost function may change the objective function value, but it will not 
affect the dispatch.
   - I suspect you actually want to minimize the square of the voltage 
deviations from 1 (setd to 2), or at least minimize the negative of the cost 
you indicate (setm to –10. Minimizing sum(v(i)-1) actually maximizes the 
deviations of voltage from 1.

— Ray


On Nov 16, 2020, at 11:47 AM, Adjifack Nelson <adjifackfra...@yahoo.fr> wrote:
Good morning every bodyI am trying to add a cost function to opf flow model 
minimizing voltage difference. The added cost function is of the form 
sum(v(i)-1). I have tried to impletent it using add_quad_cost but i have 
errors. I have included an image of my matlab work space showing the error. 
With Q=[], c=-ones(33,1) and k=ones(33,1).Best regards<Cap1.PNG>

  

Reply via email to