We've got a big problem: how fast did the simulations run? Were they in sync with our real clock? The answer is no; simulation time and actual clock time are not the same. The amount of time it takes to run a simulation depends on many factors (among them are the model's complexity, the solver's step sizes, and the processor's speed). Having a very simple model (the cruise controller), powerful hardware, and a time step of 0.1 seconds, the simulation time is way ahead of the real time.
And guess what, the application we want to interface with is using the system clock.
How do we solve this problem?
We'll use the famous Simulink Real Time Execution S-function by Guy Rouleau, published in the MATLAB ...