Energy optimization model with solar, wind, and thermal sources in MATLAB:-Simulink
3 views (last 30 days)
Show older comments
I’m working on an energy optimization model that integrates multiple generation sources: solar, wind, and thermal. I’m using MATLAB and would like guidance on how to properly structure the model to:
- Minimize total generation cost,
- Meet an hourly electricity demand (given as a vector),
- Respect generation capacity limits per source,
- Allow for scenario simulations (e.g., high demand, low solar availability).
Someone could help me? I should pay
0 Comments
Answers (1)
Shishir Reddy
on 27 Jun 2025
Hi @Cesar
As per my understanding, you would like to minimize generation costs while meeting capacitty constraints for solar, wind and thermal sources. Kindly refer to the following steps to solve this using 'linprog'.
1. Define the input data
nSources = 3;
nHours = 24;
cost = [30; 50; 80]; % solar; wind; thermal
demand = [ .. ]; % 24x1 vector
capacity = [ .. ]; % (3x24 matrix)
availability = [ ... ]; % same 3x24 size, (1 or 0)
2. Flatten the decision variables into one vector 'x', which represents how much each source generates each hour.
f = repmat(cost, nHours, 1); %Objective function
lb = zeros(nSources * nHours, 1);
ub = reshape(capacity .* availability, [], 1);
3. Define the equality constraints 'Aeq' and 'Beq' for the optimization problem such that each row of 'Aeq' represents one hour, summing the generation of all sources at that time, and 'Beq' holds the corresponding demand values.
4. Call the linear programming solver:
options = optimoptions('linprog','Display','none');
[x_opt, fval, exitflag] = linprog(f, [], [], Aeq, beq, lb, ub, options);
This basic model can be used to tweak scenarios by modifying 'demand', 'capacity', or 'availability'. For example, set low solar availability by making solar rows in 'availability' closer to zero.
For more information regarding 'optimoptions' and 'linprog', kindly refer the following documentations -
I hope this helps.
0 Comments
See Also
Categories
Find more on Solar Power in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!