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

1 visualización (últimos 30 días)
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!

Respuesta aceptada

Alan Weiss
Alan Weiss el 8 de Nov. de 2021
You probably need to formulate your constraints according to the procedures in Integer and Logical Modeling.
Alan Weiss
MATLAB mathematical toolbox documentation

Más respuestas (0)

Categorías

Más información sobre Problem-Based Optimization Setup en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by