Azzera filtri
Azzera filtri

Link between Genetic Algorithm ga and Simulink

5 visualizzazioni (ultimi 30 giorni)
RA
RA il 18 Nov 2021
Risposto: oussama kharroubi il 14 Apr 2023
I tried my ga optimization on a quasi-static problem, it works. Now I am working on a dynamic model so I should use a simulink model.
x represents a vector for one variable; x=size(1,16); it represents the number of PV panels connected to the system; horizon time=16. sampling time=1;
Pbatt=x*Psource-Pload represents the input of my simulink model. (Psource and Pload are given)
I have 2 functions and one script in matlab: one function for the objective function, one function for the constraints, and one script 'optbatt.m' for the minimization where I wrote my ga and called my both functions.
Referring to my simulink model of the battery I can calculate the current and the state of charge SOC of the battery then use this SOC to calculate my objective function and the constraints.
PS: In ga algorithm I don't need to give initial points for x.
So my question is:
1-Where should I put my sim command in objective and constraints functions or in my minimization script 'optbatt.m' ?
2- How can I link between my 'optbatt.m' and simulink and have the value of current and SOC from simulink to use in my functions?
3- How Simulink will work if x is not defined it will be calculated via ga? because at each run an error message appears: x variable undefined!

Risposte (2)

Alan Weiss
Alan Weiss il 18 Nov 2021
I am no expert in Simulink®, but perhaps some documented examples might show how to link (Global) Optimization Toolbox solvers to Simulink:
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

oussama kharroubi
oussama kharroubi il 14 Apr 2023
Hi @RA,
I am currently working on the same project, would you please provide me with your source code and simulink design? I'd be grateful and thank you.
here's my email: oussamakh212@gmail.com

Categorie

Scopri di più su Manual Performance Optimization in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by