Hello,
I have some questions regarding the execution time in the 'Simulink Support Package for Arduino Hardware'.
Q1. If I want to run a Simulink model at 100Hz on Arduino Hardware, should I set the Fixed-step size to 10ms in the Solver details? (My model is based on sensor values)
Q2. Or my model is based on sensor values, and I want it to run at 100Hz. In this case, should I set the sample time of the I2C controller read block to 10ms?
Q3. What happens if the execution time of my model exceeds 10ms (an overrun occurs)?
For example, let's assume that the model operates based on sensor values received (start model) every 10ms. If the algorithm takes 15ms to run, I see two possible options:
- The algorithm runs with the sensor values from time t, and the sensor values from t+10ms are discarded (since the algorithm is still running), and the algorithm runs again with the sensor values from t+20ms.
- The algorithm runs with the sensor values from time t, and as soon as the algorithm finishes, it starts again with the sensor values from t+10ms at t+15ms.
Which one happens? I believe it is option 1.
If someone knows, please provide an answer.
Thank you.