Mex Function - specifying an input to output port dependency

4 views (last 30 days)
I'd like to be able to specify an input port to output port dependency on my mex function Simulink blocks to that Simulink doesn't falsely think there are algebraic loops. Is this possible? Could it be made possible?
For example, for some of my blocks there's a simple input to output port relationship (output port N is dependent only on input port N), If any output port loops back without a delay (e.g. output port M loops back through combinational logic to input port P, ( P != M)), Simulink will think this is an algebraic loop, as it will assume all input ports to the block drive all outputs (for this example that there is a connection from P to M in the block). I want to tell Simulink there is no such connection and therefore no loop by specifying some internal connectivity relationship for my block.

Answers (1)

Kaustubha Govind
Kaustubha Govind on 18 Oct 2012
I've not tried this myself, but if the input port P is not used directly in the mdlOutputs method (can be used in mdlUpdate instead), I think you can set ssSetInputPortDirectFeedThrough to zero for that port to avoid algebraic loops.
Kaustubha Govind
Kaustubha Govind on 22 Oct 2012
Mark: I'm trying to think if such an API function would make sense considering that there is only one mdlOutputs function to compute all the outputs - not sure if what you're asking for might violate some of the Simulink Engine's rules. Perhaps if it is possible, you could split your functionality into two S-function blocks and combine them into one (virtual) subsystem? So to a user, it will still be one block, but you are separating out the implementation.
Please feel free to contact MathWorks Tech Support to verify if there is a better solution, and to submit an enhancement request with your requirements.

Sign in to comment.


Find more on Schedule 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!

Translated by