Optimisation regarding "Edit" block (Dashboard category in Simulink library)

2 vues (au cours des 30 derniers jours)
Bertrand NOGAREDE
Bertrand NOGAREDE le 3 Nov 2023
Réponse apportée : Ayush le 15 Nov 2023
Hello,
I'm currently working on a model of enormous size. Therefore, the CPU load on my real time target can be overloaded.
I'm looking to optimise my model. I've selected numerous optimisation option in the hardware settings menu .
Hence, I'm looking for more fine optimisation means.
My model has a great quantity of constants. Many of these constants are modified through specific "Edit" blocks (Dashboard category in Simulink library). These edit blocks are contained in a dashboard on the top level of my model.
As a last information, the constants have a sample time equal to the model's (Te = 1e-4s)
My questions are,
> what is the influence on a model of the "Edit" blocks? For example, does it double the calculation load of a referenced constant?
> what is the influence of sample time of constants in simulink? may they have a considerable impact of a microcontroller's performance?
The solutions I consider are
> removing the majority of the "Edit" blocks (greatly impacting the ergonomy of the interface).
> putting the constants at is 1s sample rate.
Thank you for your time
Best regards,

Réponses (1)

Ayush
Ayush le 15 Nov 2023
Hi Bertrand,
I understand that you want to optimise your model and want some clarification on the use and impact of “Edit” block and sample times on the optimisation of the model.
  1. With regards to you first question, using “Edit” blocks is very useful in tuning parameters and constants but it does not necessarily double the calculation load of a referenced constant. Although there is some additional overhead, since model needs to check the value at every time step, it does not become significant till you don’t have large number of “Edit” blocks. Please refer to the below documentation to know more about “Edit” blocks in the “Dashboard” category in Simulink: https://www.mathworks.com/help/simulink/dashboard.html
  2. With regards to your second question, the sample time of a constant in Simulink dictates the frequency of it being updated in a simulation cycle. Since you have kept the sample time to be (1e-4)s and your model has a large quantity of constants, the computational overhead would be significant. This could further impact the performance of a microcontroller. Please refer to the below documentation to know more about “Sample Time”: https://www.mathworks.com/help/simulink/sample-time.html
Therefore, the solutions that you are considering are reasonable in the following ways:
  1. Removing the majority “Edit” block: This would reduce the overhead with checking the values at every time step for each block and optimise the computations of your model. One potential drawback could be you model not being as flexible as before and thus making it harder to use.
  2. Changing the sample time of constants to 1s: This would also reduce the computational load significantly as the frequency of updating the constant would reduce drastically. This might not be acceptable for some constants that need frequent updates, so you may have to regulate that accordingly.
Hope it helps,
Regards,
Ayush Misra

Produits


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by