Hi Panagis, Other than the labeling on the x-axis of your plot (should be centered around 5, not 0), I don't see anything unusual. What value did you expect for z? The cost is minimized by setting z to any value within the deadband, i.e. f(z) = 0. Whereas, f(z) > 0 for any value of z between 0 and 1 or between 9 and 10.
-- Ray Zimmerman Senior Research Associate 419A Warren Hall, Cornell University, Ithaca, NY 14853 phone: (607) 255-9645 On Jun 26, 2012, at 12:04 PM, Panagis Vovos wrote: > Dear all, > > I am trying to add my own cost function for a new variable 'z' in OPF, > according to 5.3 of the user's manual. > 'z' is between 0 and 10, but there are no other linear or non-linear > constraints. The only thing that leads the variable to a specific > value is the cost function attached to it. It is a quadratic cost > function (d=2) with a "dead band" from 1 to 9 (r=5,k=4). Below you can > find the code I have written to implement it. You can add it to any > Matpower case and test it by running the OPF, since 'z' is an > independent variable. The problem is that the result is z=1.8127, i.e. > in the deadband! Does anyone knows why is that? I have also attached > the Matlab figure of the cost function (w,r) I believe I have created. > > %% CODE ADDED IN MATPOWER CASE FILE > > % ADDITION OF 'z' VARIABLE > NumberOfXvars=(size(mpc.bus,1)+size(mpc.gen,1))*2; > OldVarsA=zeros(size(mpc.buslink,1),NumberOfXvars); > NewVars=size(mpc.buslink,1); > NewVarsA=eye(NewVars); > mpc.A=sparse([OldVarsA NewVarsA]); > mpc.l=zeros(NewVars,1); % lower limit equals 0 > mpc.u=10*ones(NewVars,1); % upper limit equals 10 > > % ADDITION OF COST ON 'z' VARIABLES > mpc.N=mpc.A; > % fparm=[d r^ k m]; > mpc.fparm=[2 5 4 1]; > mpc.Cw=sparse([1]); > > What am I doing wrong? > Any help would be highly appreciated. > > Best regards, > > Panagis Vovos > <NewCost.jpg>
