Gaofei
September 22, 2020, 8:04am
1
Hi
My goals are:
1.Run a Simulink model using the S-function
2.Online Change reference y_ref and y_ref_e;
(https://github.com/acados/acados/blob/master/examples/acados_matlab_octave/getting_started/minimal_example_ocp.m )
https://github.com/acados/acados/blob/master/examples/acados_matlab_octave/getting_started/simulink_model_closed_loop.slx
It’s compiled. But,some questions:
1.the Input of the S-function,I cannot match the inputs in minimal_example_ocp.m.
mabe this:
ocp.set(‘init_x’, x_traj_init);
ocp.set(‘init_u’, u_traj_init);
ocp.set(‘init_pi’, zeros(nx, N))
% change values for specific shooting node using:
% ocp.set('field', value, optional: stage_index)
ocp.set('constr_lbx', x0, 0)
this can update x0.
but y_ref and y_ref_e?, I cannot find how to set.
N = 20,nx = 4 ,nu = 1;but y_ref = zeros(100,1) y_ref_e = zeros(4,1),I cannot understand. I think y_ref = zeros(5,1)?
Thanks a lot,
gaofei
FreyJo
September 23, 2020, 9:59am
2
Hi,
Online Change reference y_ref and y_ref_e;
Can be done like here https://github.com/acados/acados/blob/61251bc867d33f233670ac66b5e1dd2765997642/examples/acados_matlab_octave/race_cars/main.m#L260
Gaofei:
N = 20,nx = 4 ,nu = 1;but y_ref = zeros(100,1) y_ref_e = zeros(4,1),I cannot understand. I think y_ref = zeros(5,1)?
Please try phrasing your question more clearly.
Cheers,
Jonathan
Gaofei
September 24, 2020, 1:35am
3
Thank you for your reply.
The second.
N = 20,nx = 4 ,nu = 2;y_ref = zeros(120,1) ,y_ref_e = zeros(4,1).
But,y_ref = zeros(120,1)? I don’t know how to explain it.
Thanks a lot,
gaofei
FreyJo
September 24, 2020, 1:34pm
4
The Simulink block input for y_ref
contains the y_ref
values for all stages (but the terminal one) concatenated, see:
Probably you have ny = 6, N = 20
in the problem you made the screenshot from.
Does this make sense?
Cheers!
Gaofei
September 25, 2020, 2:03am
5
@FreyJo . That’s right. N*ny, that’s how I understand it.
But why set this form?
I think we are not concerned about all stages.
Maybe,I just want to set the first stage.
Thanks
gaofei
FreyJo
September 28, 2020, 8:20am
6
Gaofei:
But why set this form?
This gives you the option to change y_ref
at all stages, if you don’t want to change them for some stages, just set them to your default y_ref
value…
Gaofei
September 28, 2020, 8:41am
7
thanks for the positive feedback!
I got it.
in addition,I had get the answers from the old topic.
Hi,
Thank you for implementing S-function as it b…
All my problems have been solved.
Thanks for the amazing work you done!
Best regards,
Gaofei