My team has the goal to set up the control unit of a Fuel-Cell-Electric-Truck. The hardware we use is a MicroAutoBox 2 from dSpace which is quite compatible with Simulink. Therefore, the controller is programmed using Simulink and ported to the AutoBox thereafter.
I’m responsible for the development and implementation of the vehicle’s energy management. Part of this task is the full horizon prediction of the energy consumption. Modeling and solving this OCP is no problem using Matlab. But I have problems implementing the OCP solver in Simulink. My plan is to call this function when riding the truck every five minutes which allows enough computational time (thinking of it as a function).
I tried calling the Matlab scripts as Matlab-Functions which was impossible when importing the casadi package. Transfering the solver to c-code and implementing it as a S-Function only returns x_0, not the entire horizon.
Therefore, I have these questions:
Is it possible to solve an OCP using Simulink?
If this is possible, are there any examples? (I didn’t find anything)
Thanks for your help. I hope you can understand my problem. If there are any questions, feel free to ask them.