Solver in Matlab (like Solver in Excel) Question Updated
8 ビュー (過去 30 日間)
古いコメントを表示
Greetings Friends,
I am working a solar+wind power systems as a project. I have come to a point where I have to optimize the Area of Solar farm and Area of wind farm.
Variable list:
- Wind_farm_area
- Solar_farm_area
- Combined_area=Wind_farm_area+Solar_farm_area;
- Total_Energy_Production
- Continuous_Loads %continuous for 8760 hours(1 year)
- Day_load_Defecit
- Night_Load_Defecit
I have close to 800 lines of code
In Excel,When all the cells are given their values and formulas for calculations, By using Solver I can select the cell having value (Day_load_Defecit= Load(at day)-Energy Produced(at day);) as my Objective cell, set value to be ZERO by changing variables of Solar_farm_area and Wind_farm_area .By using this method Solver automatically changes the values of areas to optimal level to satisfy the contion.
![Annotation 2019-08-07 182551.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/233125/Annotation%202019-08-07%20182551.png)
Actrually,My program is really long, thats the reason I couldn't post it. Initially I Declare the values of Wind_farm_area=1.6174E05; Solar_farm_area=16000; Combined_area=Wind_farm_area+Solar_farm_area; It does so many calcualtions to calculate Total_Energy_Production. Load details are read from several excel files. Program actually takes more than a min to do all the calculations.
Its like running the program for several iterations for various values of Solar_farm_area and Wind_farm_area and program would find the right values of areas, so that combined energy produced is with some Percent greater than the total_Integrated_load.
(There are actually more than 50 variables that interconnect the Wind_farm_area and Solar_farm_area with Total_Energy_Produced.Continuous_loads (Continuous for 8760 hours(1 year)).
Day_load_Defecit= Load(at day)-Energy Produced(at day);
%These are values calculated every hour of day with energy produced from initial values of wind and solar farm areas given.
and Night_Load_Defecit= Load(at Night)-Energy produced(at night);
%These are values calculated every hour of night with energy produced from initial values of wind and solar farm areas given.
PROBLEM:
I have to optimize
- Least wind area to have zero Night_load_defecit
- Least Combined area to have at least 5-10 % more than total_integrated_continuous load.
Usually in Excel,We use solver, by constricting the difference in night procuction to night load = 0 and solve it.Is there anything like that in Matlab. Forgive me if I have causes any confusion in my way of questioning.
It would be very helpful if anyone could help me with my problem.
2 件のコメント
Shubham Gupta
2019 年 8 月 8 日
Do you have Optimization toolbox ? If so, there are few functions that can optimize the problem for you. I presonally like lsqnonlin, because the way it work is pretty straight forward.
You have a function that you want to optimize, then only by choosing initial condition for the function, you should be able to optimize it. For e.g.
function y = func(p)
Night_load = 6*p^2-5*p-1;
Night_prod = -2*p^2-2*p+1;
y = Night_load-Night_prod;
end
to optimize func with parameters p and input x, you simply write
p_opt = lsqnonlin(@(p) func(p), p0)
Here, it will minimize 'func(p)' to 0 by changing parameter 'p'.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Systems of Nonlinear Equations についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!