creating a function for cost optimization problem

Hello everyone, I am a student and I am just starting to learn MATLAB. I have got a project where I have to optimize two Things using matlab. The Problem is that i have to find the right kind of fuel cell (power rating of fuel cell which can be used to meet our energy demand as a user) and a fuel cell-CHP system for a given multi-family house. I already have gathered the input data of the type of building, no. of rooms, no. of members and the energy consumption (electricity & heat) , with the help of which I have already made the load profile and with the help of load profile was able to figure out how much money a user roughly has to pay for the energy.
Now instead of using the conventional sources of energy and buying energy from the grid, we want to install a fuel cell CHP system. A CHP system is basically a system which can produce heat and power in the same time. With the above data on load profile, I can somehow figure out as to which power rating of fuel cell I can use for my purpose. So far, it’s easy to figure that out.
But now comes the question of optimization. According to my task I have to optimize mainly two things: (1) installation and operation cost of fuel cell-CHP system (2) installed capacity of my fuel cell CHP system. I can only imagine that for optimizing the installed capacity of my fuel cell-CHP system, there are some factors that must be considered. For example: data of the fuel cell and the other components that are used in the overall fuel cell-CHP system. Data like rated power of the fuel cell, efficiency, thermal to electric power ratio of the fuel cell, thermal and electric demand, operational hours, size of different components used in the fuel cell-CHP system (I am thinking of including an electrical & thermal energy storage devices, so that extra demand can be met or energy can be fed back to the grid and hence can be profitable) In the same way I can again imagine that for optimizing the installation and operational cost of fuel cell-CHP system there are certain factors that must be taken into account. For example : cost of the fuel for the fuel cell, cost of fuel cell itself, cost of other components used in the overall fuel cell-CHP system, maintenance cost, government subsidies for using fuel cell-CHP systems, profit or loss for selling extra energy or purchasing it from/to the grid.
Now before actually starting with writing a Code in MATLAB , i have to somehow represent These above mentioned factors in a function(or a Code) or maybe make an algorithm or a model but i have no clue how to do that. if there is anyone who can Maybe help or give some advice, i would be very very grateful. (Thanks in Advance)

回答 (1 件)

Stephan
Stephan 2018 年 9 月 1 日

0 投票

Hi,
i recommend you to start with paper and pen and first create a mathematical model. To optimize, you need an objective function. Maybe a multi-objective optimization approach is the best for your problem. Which boundary conditions have to be fulfilled? Are there integer conditions for decision variables? What are the decision variables and what restrictions apply to them? Is the objective function linear? All these and other questions will have to be resolved before it makes sense to write the code. If you have developed a model and have questions about its implementation in Matlab, come back with a new question. You will get help here.
Information and examples about optimization in Matlab can be find here:
Best regards
Stephan

10 件のコメント

claudia sommer
claudia sommer 2018 年 9 月 1 日
Thanks a lot Stephan. I will then try to figure out a way to represent my question in term of a mathematical model. Actually that was something I wanted help with . As to how to represent the factors I mentioned in a mathematical model. I mean as I have written that I can only imagine the things that affect my cost or the installed capacity can be the above factors above,it doesn't have to be all those above factors (can be less), I just wanted to somehow make a rough model out of it to show to my professor but I will try to work on it and come back if get any lucky.thanks,I appreciate your help .
Stephan
Stephan 2018 年 9 月 1 日
編集済み: Stephan 2018 年 9 月 1 日
Perhaps it is easier to start with a very simple model and extend it step by step.
claudia sommer
claudia sommer 2018 年 9 月 1 日
Yeah I will start only with that . Hope I can figure that out .thanks
Stephan
Stephan 2018 年 9 月 1 日
Very simple examples you find in the documentation sites of the different solvers like linprog , intlinprog , fmincon ...
Bigger Examples to work through you can find here:
and here:
There are several optimizers in Matlab that are used depending on the task and problem structure - but all have a very similar syntax. If you have understood for a simple example how to formulate an optimization problem in Matlab, it is quite easy to apply this to larger problems. There are many examples and exemplary documentation in Matlab. Most new users in Matlab make the mistake of not reading in the documentation. There is almost nothing that is not well documented. You will find examples in the documentation for almost all Matlab functions.
claudia sommer
claudia sommer 2018 年 9 月 1 日
But as you said the best first step to take would be to create a rough mathematical model with the given factors I think might affect the cost and the installed capacity of the fuel cell CHP system and once that's done , I will try to put it in a code and optimize . Do you think that's what I should follow ?
Stephan
Stephan 2018 年 9 月 1 日
That could be one way - you should also discuss this with your professor to be sure he agrees with your approcach. Is this a graduation work?
If you keep it simple in the beginning, you can try this simple problem quickly in Matlab and become safer with the usage of Matlab. This approach also has the advantage that you can oversee what you are doing and can check the results by hand.
The links I've sent are meant for getting you started in Matlab Optimization and maybe as a suggestion what you could build into your model as you expand it.
claudia sommer
claudia sommer 2018 年 9 月 1 日
I sure will discuss this with my professor but what you are saying seems logical to me. that's why i most probably will follow it . yes this is one part of my bachelor's thesis. my professor only said that i should just take care of optimizing only these two parameters , cost and the installed capacity of the fuel cell chp system. somehow need to try to decrease the overall cost and increase the overall capacity of my system. then compare it with the conventional energy ways and make a conclusion. since it is a new technology to use a CHP system with fuel cell in residential areas, there might not always be a positive result but i have to show that in my report.
claudia sommer
claudia sommer 2018 年 9 月 1 日
And just to quote what my professor wrote is this: "Target: Developing a flexible program that gives for the input data (number of flats, area, number of people, energy consumption, insulation of house, energy profile and other) the best economic performance of the fuel cell related to the installed power".
Thing is i already have all the above data my professor is talking about and with the help of that i already got the load profile of the building and how much it cost throughout the year and hence i can just manually pick a fuel cell with a power rating that will meet my energy demand but i think he wants an optimized model of this. so i am guessing there is only the question of optimizing the cost is left. and as i said cost is somehow depends on the factors i mentioned in my original post.
Stephan
Stephan 2018 年 9 月 1 日
編集済み: Stephan 2018 年 9 月 1 日
That sounds like an interesting task - I will continue to subscribe to the thread.
Since this is a thesis, it should be ensured that the creative / scientific part is done by yourself. For questions regarding the use of Matlab, please visit the forum here.
So if there are questions like:
  • Why do I receive this error message from Matlab?
  • My code does not do what it should - What should I do?
  • Here's my model - Which solver do you recommend to me?
etc., then that should not be a problem.
But when it comes to the mental performance that should be the core of your work - then it's your turn.
I wish you a lot of success and will be happy to help you (just like the other contributers here)
claudia sommer
claudia sommer 2018 年 9 月 1 日
Thanks a lot. you already put me in a right direction , now i can definitely think of something.

サインインしてコメントする。

カテゴリ

質問済み:

2018 年 8 月 31 日

コメント済み:

2018 年 9 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by