sizing microgrid using for and if statement
Ältere Kommentare anzeigen
Hello,
I am currently doing a project where my task is to size the components in micro-grid and calculate the LCC. I extracted the data för one day. Data I have are: Battery voltage, Battery current, Inverter power( reprecent the consumption), Solar power (represent the production).I am a beginner in matlab and hope that some one can help me here. I want to write a code that loop through all the hours in the day and calculate the following:
for all hours
if (production > consumption) and (battery power <= 80%*Battery max capacity)
charge the battery= Production-consumption
elseif (production > consumption) and (battery power >= 80%*Battery max capacity)
wasted power= Production-consumption
elseif (consumption > production) and (battery power >= 20%*Battery max capacity)
use the battery=consumption-production
else (consumption > production) and (battery power <= 20%*Battery max capacity)
increase battery capacity = consumption-production
end
I am already stuck by looping through all the hours and dont know how to do it
so thankful for help
1 Kommentar
Guillaume
am 24 Apr. 2019
In all likelyhood you don't need a loop. Your test can probably be carried out at once on all the data.
For us to be able to give you an answer that works for you, it would be very useful to see an example of the data (is it a table, cell array, one or more matrix? How is the time stored? As a datetime? datenum? datestr?, etc.). So please attach a demo mat file to your question.
Akzeptierte Antwort
Weitere Antworten (1)
Abm
am 30 Apr. 2019
0 Stimmen
Thank you so much for responding !! I kept thinking in this problem from yesterday.
I will continue as you suggest for the rest of the solution.
Best regards
Kategorien
Mehr zu Data Type Conversion finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!