I am implementing a model predictive control strategy on a Simulink model. The controller is represented by a subsytem which has for inputs the relevant state variables (x) and the control trajectory (u') calculated in the previous time step, and for outputs the new control trajectory (u) calculated for the current time step. Simplified version in the picture:
This results in a computacionally taxing subsystem which I only want to run once per time step. Simulink chooses ode3 for my model, which is what I've been using before adding the control system. Using this solver, however, means I will have the controller subsystem unnecessarily run 3 times per time step (once per evaluation).
I would wish to know how to make it so that the controller subsystem only runs once per step regardless of the solver. Ideally it should only run on the first evaluation and directly use the output obtained one for the remaining evaluations (or ignore it, since the output control is only applied in the next time step).