how to add a limitation in the following codes?

1 次查看(过去 30 天)
hi everyone,
i am newbie here and i want to develop Matlab codes for a Pv/Battery which i mean charging/discharging of li-ion battery and optimization to get the results for one year.
I wrote the other codes but i cant add limitation for codes i dont know how to discribe the situation, i hope you can understand me!
General view:
1-The first is that PV produced the maximum possible energy to supply the load and also to charge the battery while the state of charge is less than soc.
2-The second is that the battery soc reaches the maximum value and the PV at this point must stop charging the battery.
3-In the third the PV could not cover all the demanded energy by load and its not able to charge the battery and so at this point the battery must cover the load alone.
in here;
Pmax=3600
Pmin=0
the answer must not bigger than Pmax and must not smaller than Pmin
  3 个评论
Mamad Mamadi
Mamad Mamadi 2019-12-15
编辑:per isakson 2019-12-15
no its not sumulink becuase i dnt know how to use simulink.its all about codes
i mean;
Pmax= 3600wh
Pmin=0wh
Pch wont be 3750 , must not be bigger than 3600
Pdis wont be -150, must not be smaller than 0
Pch=[2600 2750 2800 2950 3010 3100 3300 3580 3750];
Pdis=[3450 3330 2900 1500 1200 850 300 22 -150];
it these codes right? if not how can i write it?
a=1;
b=0;
result_data=[];
while a<=length(Pch);
b= Pch(a)+b;
result_data(a+1)=b;
a=a+1;
if result_data <= Pmax ;
finalresult = result_data;
elseif result_data > Pmax ;
break;
end
finalresult;
end
Rik
Rik 2019-12-15
(the previous comment was reposted as a question here)

请先登录,再进行评论。

回答(1 个)

eng ashraf
eng ashraf 2020-12-5
编辑:Rik 2020-12-5
Please, if you know the solution please send me the code
[]@yahoo.com

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by