optimal trajectory for qp

26 views
Skip to first unread message

tina

unread,
Jan 7, 2015, 6:26:43 PM1/7/15
to yal...@googlegroups.com

Hallo Johan,

for k = 1:N

        objective
= objective + ((c_p1*z{k} + c_p2 + c_n1*(u{k}(1)-z{k})*0.3108 - u{k}(2)*vp_inv{k})*d1 + d0{k})^2 + beta*(c_p1*z{k} + c_p2 + c_n1*(u{k}(1)-z{k})*0.3108)^2 + rho*(u{k}(1)-U_L{k})^2;

       

        constraints
= [constraints, x{k+1}(1) == a*x{k}(1) + b_T*u{k}(1) + disturbance{k}];

        constraints
= [constraints, x{k+1}(2) == x{k}(2) - c{k}*u{k}(2)];

        constraints
= [constraints, U1_min{k} <= u{k}(1) <= U1_max{k}];

        constraints
= [constraints, X1_min{k} <= x{k}(1) <= X1_max{k}];

        constraints
= [constraints, U2_min <= u{k}(2) <= U2_max];

        constraints
= [constraints, X2_min <= x{k}(2) <= X2_max];

        constraints
= [constraints, z{k} >= max(u{k}(1),0)];

        constraints
= [constraints, c_p1*z{k} + c_p2 + c_n1*(u{k}(1)-z{k})*0.3108 - u{k}(2)*vp_inv{k}>= 0];  

end

    X
= [x{:}];

    constraints
= [constraints, sum(X(1,:)) >= v2sum];


As above the codes are the cost function and constraints.
Enclosed you can find the two optimal trajectories under two situations. As respect to them I have two questions.
1 For the first optimal trajectory there is a protruding and then the value of the trajectory falls back, which locates when the lower constraints of  x2 is reached. Is it because of the shape of the
parabola of the cost function? But why does the trajectory fall down back?
2 This trajectory has oscillation. But when the value of the trajectory is higher (giving larger value for v2sum in the last constraint), the oscillation will disappear. Is it something to do with the system dynamics and the big sampling time making the error, which in the near of the bottom of the parabola makes the optimal solution with oscillation? But when I largely change the sampling time there is still oscillation.
I'm sorry that I can't give the eproducible code.
Thank you very much!

Liting

v1.fig
v2.fig

Johan Löfberg

unread,
Jan 8, 2015, 2:42:35 AM1/8/15
to yal...@googlegroups.com
Impossible for me to answer. Sounds like a problem/tuning specific issue
Reply all
Reply to author
Forward
0 new messages