Why should I use operation blocks instead of a quicker function block in simulink?
1 view (last 30 days)
Show older comments
Raúl Rivera on 9 Nov 2022
- 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:
Jim Riggs on 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).
Find more on Test Model Components in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!