how to add a limitation in the following codes?

2 visualizzazioni (ultimi 30 giorni)
Mamad Mamadi
Mamad Mamadi il 8 Dic 2019
Commentato: Rik il 5 Dic 2020
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 Commenti
Mamad Mamadi
Mamad Mamadi il 15 Dic 2019
Modificato: per isakson il 15 Dic 2019
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 il 15 Dic 2019
(the previous comment was reposted as a question here)

Accedi per commentare.

Risposte (1)

eng ashraf
eng ashraf il 5 Dic 2020
Modificato: Rik il 5 Dic 2020
Please, if you know the solution please send me the code
[]@yahoo.com

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by