Battery storage -optimisation problem_charge and discharge-conditional constraint/nested function_JNF
조회 수: 2 (최근 30일)
이전 댓글 표시
Dear Sir,
Please find the attached file, which is a modified version of matlab example , https://www.mathworks.com/matlabcentral/fileexchange/73139-microgrid-energy-management-system-ems-using-optimization?s_tid=srchtitle
.I want to use two different cost in objective function depending on whether Pbattups is positive or negative.I have tried to use nested function as below:
%function Cost = Price( LBMPCost,Profit,PbattupsV)
%if PbattupsV >=0
% Price=LBMP;
%elseif PbattupsV <=0
% Price=Cost;
%else
%Cost= 0;
%end
Also i tried to use this condition as a constraint ,
%prob.Constraints.C1 = PbattupsV>=0,Price=LBMP;
%prob.Constraints.C2 = PbattupsV<=0,Price=Cost;
Both case i am getting error.
Also if i change the lower bounds or upperbounds of Pbattups to 0,it doesnt change in output.
Please look into the attached file and advice if anything can be done on this file.so that i can seperately input cost to the objective function.
댓글 수: 0
답변 (1개)
Walter Roberson
2021년 8월 21일
As discussed at https://www.mathworks.com/matlabcentral/answers/820880-how-to-do-conditional-statements-using-optimisation-variables#comment_1695484
What you are trying to do is not possible for the current optimizers, and in particular trying to do it by way of if statements will never be possible with the Problem Based Solver approach.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!