Are you attempting to use the provided extension for fixed reserves, or are you attempting to write your own extension?
If it’s the former, the full implementation is included in toggle_reserves() <http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/toggle_reserves.html>. Simply load your case file, use toggle_reserves() to enable the callbacks, then run the OPF (or just call runopf_w_res() <http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/runopf_w_res.html>, which does these 3 steps automatically for you). If you are attempting to write your own extension, I suggest making a copy of toggle_reserves.m and rename it and all of the functions in it and use it as a template for your own extension. Ray > On Mar 28, 2019, at 12:40 PM, Jubeyer Rahman <[email protected]> wrote: > > Hi, > > Recently I was digging through the extending OPF chapter of Matpower manual, > but I don't quite catch the process. Regarding the example given there on > 'Fixed zonal reserves' what I understand from my reading is, it is required > to write down a call back function for formulation along with some call of > callback functions. I have followed every steps mentioned there but could not > make the code run (I am using version 6.0). I am adding my code snippet here > for better conveying. > > %%% > mpc=loadcase('case30.m'); > mpopt = mpoption('out.all', 0, 'verbose', 0); > mpc=add_usefcn(mpc,'formulation',@userfcn_reserves_formulation); > mpc=ext2int(mpc,mpopt); > results=runopf(mpc); > results=int2ext; > > %%%% > Error message: > Access to an object's fields is only permitted within its methods. > > I have added the mpc.reserve data(cost, req, zones) posted in > 't_case30_userfcns.m' file. > I have written the userfcn_reserves_formulation in a different script , but > it is not working. > I didn't write the add_var and add_constraint explicitly since the > add_userfcn callback function already contains those. > > Can you tell me what I am missing? > > Regards, > Jubeyer >
