Optimization considering integral constraints (battery power system)
Show older comments
Hello. I need to optimize one function in order to simulate a power system with a battery. The simplified version of the problem is:
- t=[1:24] for the hours in a day,
- L=SystemLoad(1:24) for the load in the system and
- x=x1...x24 in which x is the battery power for each hour (in Watts)
I need to find in order to optimize my function cost, and they represent the power provided by the battery every hour in order to fulfill the load.
- Objective function is f=(x*A) where A is the cost/watt at different hours (dot product).
- Equality constraints are x*B=L where B are parameters which change depending on the hour (example: efficiencies).
The question for I which I am requesting your help is to know how to implement a constraint for the energy use every hour (watt-hour). Basically I would like a “cumulative integral” from x1 to x2, from x2 to x3, from x3 to x4 and so on, so I know how depleted is my battery (each cycle shall decrease my battery energy, until certain limit). Also I need to limit the derivative of the battery (watt/hour) so I can control the battery power ramp of the system under the specified levels.
What I want to especify as constraints is something as
- InitialEnergy-Integral(x1-x2)>0,
- InitialEnergy-Integral(x1-x3)>0,
- InitialEnergy-Integral(x1-x4)>0 and so on
for the derivative it would look like:
- d(x1-x2)/dt<1000,
- d(x2-x3)/dt<1000,
- d(x3-x4)/dt<1000 and so on.
I have thought about implementing these constraints with the type NONLCON option of the FMINCON but I do not know how to implement an "integral" and "derivative" constraints.
I have more equality and inequality constraints, but I have leaved them out to ease the explanation of my problem. Thanks!.
Accepted Answer
More Answers (1)
Alan Weiss
on 26 Feb 2013
I believe that this is a linear programming problem. Use linprog, not fmincon, for its solution.
The formulation of the problem is fairly straightforward. Your vector x = x(1),...,x(24) is the set of control variables you are trying to optimize. You have
x(i) >= 0 % a lower bound constraint, lb = zeros(size(f))
A*x <= b
The matrices A and b in A*x <= b can incorporate all your other constraints. For example, if IE is the initial energy, then perhaps this represents your battery power ramp constraints are
A = [ 1 -1 0 0 ... 0;
1 -1 -1 0 ... 0;
1 -1 -1 -1 ... 0;
...
1 -1 -1 -1 ... -1];
I believe that this matrix A, along with a vector b whose value is IE for each component, takes the restriction into account.
You can write a similar extension of A and b to take the derivative into account. And the equality constraint x*B = L can be turned into an equality constraint matrix-vector combo, called Aeq and beq in the documentation.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
2 Comments
li
on 11 Mar 2014
Hi, Hugo, have you found a solution for this question? I am now studying the power system with batteries. And still impeded with charging/discharging behavior of batteries, can you share your outcome with me? Many thanks.
Communities
More Answers in the Power Electronics Control
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!