Hi,
Let’s say I want to use acados for the following scenario:
- Simulink Configuration: fixed-step of 1 second.
- OCP Configuration: 2 steps for prediction horizon with a fixed step size of 0.1 seconds (
ocp.solver_options.N_horizon = 2
andocp.solver_options.tf = 0.2
).
This should result in time steps for acados like [0, 0.1, 0.2] at simulation time 0 and [1, 1.1, 1.2] at simulation time 1 (internally, the solver’s shooting nodes remain at [0, 0.1, 0.2], but with inputs coming from the corresponding Simulink time step).
Based on the snippet from simulink_example_advanced.m:
simulink_opts.samplingtime = '-1';
% 't0' (default) - use time step between shooting node 0 and 1
% '-1' - inherit sampling time from other parts of the Simulink model
it appears that setting simulink_opts.samplingtime = '-1';
should make the S-function inherit the sampling time from the rest of the Simulink model.
Yet, when running the model with these settings in Simulink, I encountered the following errors:
- “Invalid setting for fixed-step size (1.0) in model ‘simulink_model’. All sample times in your model must be an integer multiple of the fixed-step size.”
- “The sample time period (0.1) of ‘simulink_model/acados_sfunc’ is not an integer multiple of the fixed step size (1.0) specified for model.”
Am I misunderstanding the purpose of the ‘-1’ setting, or is there an additional configuration required for the described scenario?