Why should I use operation blocks instead of a quicker function block in simulink?

17 vues (au cours des 30 derniers jours)
  • I am newbie with this, I´m just testing with the simulink features and when trying to make some operations , find it more difficult to use simple operation blocks instead of a simulink function block which could encompass all this with code and gives me straight away the output, any drawback in doing so? Btw ,i am doing just a differential equation which could be done with matlab too, and the same question regarding to matlab, why using operation blocks instead some code? . My final aim is to simulate a 3 in series reactors and then a distillation column and thats a bunch of differential equations with simple operations ,so whats is more convenient for that?. Thanks in advance.
  • Drop some pics of what i am adressing to:
  • Could use function blocks, but what is the negative side of doing this?
  • Instead of that i find cumbersome:

Réponses (1)

Jim Riggs
Jim Riggs le 10 Nov 2022
You might want to check out this documentation on Comparison of Custom Block Functionality.
It references some limitations on Matlab function blocks being able to represent model states. In particular, the Matlab function is only able to model discrete states (using persistent variables) - i.e. no continuous states. This is because callback methods are not allowed (see the link, above)
I tried both of your model architectures, and my experience is that the one using the Matlab function block runs much slower - it takes almost double the time that the first one does. ( ~0.5 seconds compared to 0.28 seconds).

Catégories

En savoir plus sur General Applications dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by