How to solve the error "Conversion to logical from optim.prob​​lemdef.Op​t​imizatio​nC​onstrai​nt is not possible!"

2 ビュー (過去 30 日間)
n = numel(daily_Ppv);
% VARIABLES
Ppvg = optimvar('Ppvg',1,n,'LowerBound',0,'UpperBound',daily_Ppv);
Ppvb = optimvar('Ppvb',1,n,'LowerBound',0,'UpperBound',daily_Ppv);
Pbe = optimvar('Pbe',1,n,'LowerBound',0,'Upperbound',Pemax);
Ppve = optimvar('Ppve',1,n,'LowerBound',0,'UpperBound',daily_Ppv);
Pelet = optimvar('pelet',1,n,'LowerBound',0,'UpperBound',Pemax);
SOC = optimvar('SOC',1,n,'LowerBound',SOCmin,'UpperBound',SOCmax);
% CONSTRAINS
PowerFlow.Constraints.PPV = daily_Ppv==Ppvb+ Ppvg + Ppve;
PowerFlow.Constraints.PB = Ppvb*eta_pvb <= Pbmax;
PowerFlow.Constraints.ELET1 = Pelet == Ppve*eta_pve + Pbe*eta_be;
PowerFlow.Constraints.ELET2 = Pelet <= Pemax;
PowerFlow.Constraints.BAT = optimconstr(n);
for i = 1:n
if Ppve(i) >= Pelet(i) %% this line reports the error
PowerFlow.Constraints.BAT(i) = Pbe(i)==0;
else
PowerFlow.Constraints.BAT(i) = Pbe(i)>0;
end
Hi, I have meet the pfollowing problem in MATLAB. The battery cannot charge/discharge at the same time so, in the last constraints I tried to write this. When I ran the code the error says: "Conversion to logical from optim.problemdef.OptimizationInequality is not possible."
Appreciate for your help!

採用された回答

Alan Weiss
Alan Weiss 2021 年 11 月 8 日
You probably need to formulate your constraints according to the procedures in Integer and Logical Modeling.
Alan Weiss
MATLAB mathematical toolbox documentation

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by