This can get a bit confusing because x is in p.u., but the functions totcost and polycost assume everything is in MW. So xx is converted to MW to compute f. The first derivative of the cost returned by polycost in line 135 is in $/MW and must also be converted to $/(p.u. generation).
I hope that helps, -- Ray Zimmerman Senior Research Associate B30 Warren Hall, Cornell University, Ithaca, NY 14853 phone: (607) 255-9645 On Dec 13, 2013, at 4:29 PM, Arash Alimardani <[email protected]> wrote: > Dear Dr. Zimmerman, > > I may be wrong, but apprently, in opf_costfnc.m, line 135, there is an issue > which it not clear to me. In calculating the gradiant of cost function, > baseMVA is multiplied as in: > df_dPgQg(ipol) = baseMVA * polycost(gencost(ipol, :), xx(ipol), 1); > > However, in calculating xx(ipol), in line 87, it has already been considered > that baseMVA should be multiplied to get actual values which are not in per > unit as: > xx = [ Pg; Qg ] * baseMVA; > > Therefore, there seem to be no reason for multiplying the gradient in line > 135 by baseMVA again, and it should be: > df_dPgQg(ipol) = polycost(gencost(ipol, :), xx(ipol), 1); > > Please, let me know of your opinion on this. > > Regards, > Arash Alimardani >
