Sam Hamels
New Member
- Joined
- Mar 20, 2018
- Messages
- 49
This is a bit of an unusual post, aimed at people familiar with optimization problems solved by the Excel solver (or Add-ins like OpenSolver)
In the attached Excel file, I simulate the following simple scenario:
The problem I have is that I need to add the following detail to the simulation, but I don't know how:
The charging and discharing of the battery causes some 'losses' of electricity. For example, if the battery consumes 10 units of electricity, only 9 actually end up in the battery. Likewise, when the battery delivers 10 units of electricity to the home, 11 units actually go out of the battery. In this example, both the charge efficiency and the discharge efficiency are 90%.
I have tried playing around with binary variables to disconnect charging from discharging, and apply the losses to the battery charging and discharging, but I can't manage to make anything work. It always makes my problem unsolvable.
Intuitively, I basically want this to be to formula of the column with the 'energy stored inside the battery':
The problem is that I can't use an IF function because the solver doesn't allow for that. Hence my experimentation with binary variables (without success).
Any advice would be extremely welcome.
Excel file: http://s000.tinyupload.com/index.php?file_id=03390715579981265136
In the attached Excel file, I simulate the following simple scenario:
- A house consumes electricity from the grid for 24 hours.
- The amount of electricity taken from the grid is shown for every hour (it fluctuates throughout the day)
- The price of electricity is also shown for every hour (it also fluctuates throughout the day)
- The amount paid for electricity is (for each hour) the amount consumed multiplied by the price in that hour
- The house has a battery that is used to change the amount of electricity that is taken from the grid during each hour
- The point of this is to decrease the amount of electricity taken from the grid during hours with a high electricity price, and to increase the amount taken from the grid during hours with a low electricity price
- This way, the total amount paid for electricity can be reduced
- This is an optimization, solved by the basic Excel solver (although I could also use the free Add-in called 'OpenSolver')
- The optimization minimizes the total amount paid, *after* the battery has done its thing.
- Some constraints must me obeyed within the optimization, to be realistic:
- The battery cannot be charged beyond its maximum energy storage capacity
- The amount of energy stored in the battery cannot be lower than zero
- The battery cannot be (dis)charged faster than its maximum (dis)charge rate
- After the optimization is completed (in other words, "when the battery has done its thing"), the total amount of electricity taken from the grid throughout the day cannot be changed
- The 'new' amount of electricity taken from the grid during each hour cannot be negative
The problem I have is that I need to add the following detail to the simulation, but I don't know how:
The charging and discharing of the battery causes some 'losses' of electricity. For example, if the battery consumes 10 units of electricity, only 9 actually end up in the battery. Likewise, when the battery delivers 10 units of electricity to the home, 11 units actually go out of the battery. In this example, both the charge efficiency and the discharge efficiency are 90%.
I have tried playing around with binary variables to disconnect charging from discharging, and apply the losses to the battery charging and discharging, but I can't manage to make anything work. It always makes my problem unsolvable.
Intuitively, I basically want this to be to formula of the column with the 'energy stored inside the battery':
- IF the change in electricity taken from the grid is positive, then multiply that change by the battery charging efficiency to arrive at the amount actually stored in the battery
- IF the change in electricity taken from the grid is negative, then multiply that change by the battery discharging efficiency to arrive at the amount actually going out of the battery
The problem is that I can't use an IF function because the solver doesn't allow for that. Hence my experimentation with binary variables (without success).
Any advice would be extremely welcome.
Excel file: http://s000.tinyupload.com/index.php?file_id=03390715579981265136
Last edited: