Switching model parameters for optimization problem

Hi everyone,
I am currently working on a classic quadratic optimization problem, which I solved with
sol = quadprog(H,f,A,b,Aeq,beq,lb,ub,x0,options)
The solution is a state of energy trajectory subject to the differential equation given below:
The state of energy dynamics are formulated as equality constraints (, ), so I can use them for the quadprog solver.
My issue here is that the battery efficiency η switches between two values (, ) according to the sign of the input/output . My current solution is only based on , no matter which sign has, because I wasn't sure how to put such an "if-statement" in the solver.
How can I consider this in my optimization formulation? Can I still use quadprog or do I have to use some other methods?
Best Regards
Sean

2 Comments

Matt J
Matt J on 26 Apr 2021
Edited: Matt J on 26 Apr 2021
It is not at all clear how the inputs to quadprog were derived from the parameters of your differential equation, or what the quadprog output represents. Why can't you invoke quadprog on two separatetwo sub-problems, one for each possible value of the switch?
Hi Matt,
First I formulated the equation as a state space system
% System dynamics (continous) of battery
Ac = -1/tau;
Bc = [eta_ch/C_E];
n = length(Ac(1,:)); % state dimension
m = length(Bc(1,:)); % input dimension
sysc = ss(Ac,Bc,eye(n),zeros(n,m));
where the state of energy is my state and my input.
I then formulated the state space equation as an equality constraint where x is my state of energy trajectory and u my corresponding power input/ouput trajectory .
So I wanted quadprog() to find the optimal state of energy and power input/output trajectory subject to my cost function. Formulating the cost matrices is easy but the value B which is multiplied to the power input/output changes according to the sign of u. This is where I'm stuck, because I don't know how to consider this switching value of B in quadprog.
Best Regards
Sean

Sign in to comment.

Answers (1)

Matt J
Matt J on 26 Apr 2021
Edited: Matt J on 26 Apr 2021
I'm assuming x is unknown and u is known. Wouldn't it then just be,
Ppos=(u>=0);
Bu=nan(size(u)); %the vector B*u
Bu(Ppos)=u(Ppos)*eta;
Bu(~Ppos)=u(~Ppos)/eta;

Categories

Products

Release

R2020b

Asked:

on 26 Apr 2021

Edited:

on 26 Apr 2021

Community Treasure Hunt

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

Start Hunting!