Hi Dr. Ray Ok, I use totcost() and it works.
Thank you very much for your support, I really appreciated. Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 From: Ray Daniel Zimmerman<mailto:r...@cornell.edu> Sent: Wednesday, 28 April, 2021 2:18 AM To: MATPOWER-L<mailto:matpowe...@list.cornell.edu> Subject: Re: Optimal load flow cost Hi Khaldon, Dispatchable loads are modeled as negative generators with negative cost. The negative “cost” is actually the negative of the benefit the load receives from the consumption. The OPF objective is to minimize the total “cost” which is the negative of the net benefits (benefits to demand - cost of supply). It is expected that these net benefits would be positive, hence the OPF objective function value is negative. So, there is nothing to fix. If you want to see only the cost of generation, use the totcost() function for only the rows of gen/gencost that correspond to actual generators, not the dispatchable loads. Hope this helps, Ray On Apr 23, 2021, at 2:18 AM, KHALDON AHMED QAID AL-AREQI <p011810...@student.utem.edu.my<mailto:p011810...@student.utem.edu.my>> wrote: Dear MATPOWER Team, Thanks for this creative tool. I am new using MATPOWER, am not sure if I do it correctly here. I am trying to do load shedding scenarios using load2dis() in OPF for case9. But in the normal scenario the cost increased and become negative. What I should to fix this? Using this code mpc=loadcase(case9); mpc = load2disp(mpc); r=runopf(mpc); cost=r.f Ans cost = -1569703.31218761 Thank you in advance , any help is appreciated Khaldon Qaid Sent from Mail<https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3FLinkId%3D550986&data=04%7C01%7Cp011810007%40student.utem.edu.my%7C62cdb9928b5d44cbdfc808d909a8eab2%7C677eeb56f2df46759e0cccd600a91580%7C0%7C0%7C637551443387857921%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TfeCREndcUaG7jEdEwSOt%2B0%2FLQtlRHDD5TSlazHsVPc%3D&reserved=0> for Windows 10