Hi Bryan,thank you again for your competent answer. Good to know that using an Enable Subsystem is the correct way.
> While the code within the block does not execute when the system is not enabled, there still is some computational overhead for introducing the Enabled Subsystem. If the C-Script was more complex one would expect a more significant difference between placing the C-Script in an Enabled Subsystem vs. the conventional implementation.
I can understand that there is an overhead, but something like 10% seemed quite high. But as you mentioned later, running over 100% maybe isn’t the best idea. Therefore, I deleted some stuff from my model in order to get lower usage. I got now following processor loads:- Enabled Subsystem: 37%- Disabled Subsystem: 34%- Without Subsystem: 31%
So the overhead seems to be approx… 3% and much less than 10%. This is acceptable, but it can still hurt as my model was running before stable at 98-99% CPU load.
> You should take a holistic approach to improving your model execution - e.g. simplifying the model if possible, removing unnecessary scopes/displays, and harmonizing sample times. There also is the RT Box model optimization tutorial on our website which might be helpful to review the basics.
Totally agree with you. But if you are working on a prototype and you don’t know exactly what is happening within the model, scopes and displays help a lot. And also receiving a lot of measurements sometimes helps. At the end, the final model will probably less demanding.
> Regarding sample times, one very minor opportunity in this case is to change the Delay block’s Sample Time parameter from 1 second to Ts. With that change an internal counter is not need to ensure the event happens every 1s, but every loop. You can always do a diff between the C code generated from two models to see the impact.
This was a typo in my test model. In my real model I am using Ts as you mentioned.
> Note that when the overrun occurs the RT Box outputs are not updated at the end of the time-step. Additional latency and potentially integration errors are introduced in the loop, so running at over 100% is probably not recommended.
What exactly happens if the model without External Mode active is below 100% and if activated rises over 100%? Are the HW values updated correctly and the plotted values might be slightly off or is this undefined?
Thank you for your help and best regards,
Reto