hi i have a function with 5 constraints , i need someone to help me write the 5th one

2 次查看(过去 30 天)
hi, am having an issue with a new constraint that was added to the code;
|Sk-Sk-1|>Delta SOCmin
Sk-Sk-1=dx
Sk-1-Sk=ds
DeltaSOCmin=0.2
For the first cosntraint of line 345 the code was performing normally,the problem is when adding this new constraint (line 349) the results are violation of constraint and the function F is returning Inf .The question is if it should be written another way or what are the changes that should be done to avoid violation , thanks

回答(1 个)

Divyajyoti Nayak
Divyajyoti Nayak 2023-7-6
Hi Anwar,
If your constraint is |S[k] - S[k-1]| > dSOCmin then the condition in the if statement should be
if any(abs(dx)<=dSOCmin | abs(ds)<=dSOCmin)
But this won't avoid the violation, as atleast one of the absolute values is less than dSOCmin.
I don't think the code is the problem but rather the values calculated in dx and ds.
  2 个评论
Anwar
Anwar 2023-7-9
Hi Divyajyoti,
this is an optimisation algorithm of EV states of charges;the values of dx and ds varries between 30 to 70, and they should respect the boundries by not being above 40 (SOCmax) and not under 20 (SOCmin),and geuss what the algorithm works perfectely without any violation of both conditions without mentionning the second constraint (if any(abs(dx)<dSOCmin | abs(ds)<dSOCmin) and the moment mentionning it in the code the algorithm start giving values of 10 AND 15 for the abs (ds) and the result is a violation (INF F)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by