i’am using the matlab interface of acados for modelling a hybrid powertrain. The power demand is preset by a parameter trajectory. This works fine, as the resulting states and controls look reasonable. Unfortunately matlab returns an error when requesting the trajectory of constraint variables.
This is made, using
for i = 0:N-1 constraint.P_inv2eng(ocp.get('x',i), ocp.get('u',i))); end
There I get the error:
Error using casadi.Function/call (line 942) .../casadi/core/sx_function.cpp:71: Cannot evaluate "P_inv2eng:(i0,i1)->(o0) SXFunction" since variables [P_inert] are free.
P_inert is set before solving the problem as:
for i = 0:N-2 ocp.set('p', P_inert(i+1), i); end
I don’t understand the error since the paramer is defined before solving.
Thanks for your help.