Why does putting a S function inside an Enabled Subsystem cause an algebraic loop?

4 views (last 30 days)
Hi,
I have a Simulink model consisting of a controller and a plant. The plant is described using a S function with the Directfeedthrough of all inputs set to FALSE. The Simulink model ran well until I put the S function inside an Enabled Subsystem. Even when a constant "1" was connected to the enable port, there was still an algebraic error reported by Simulink. I could not understand why.
BTW, the reason why I put my S function in an Eanbled Subsystem is for resetting the states of the S function at some point of the simulation (following the idea at https://www.mathworks.com/matlabcentral/answers/39407-simulink-change-continuous-state-value-at-a-given-time-point).
It seems that my question may be relevant to the problem that an enabled system introduces direct feedthrough introduced here https://www.mathworks.com/matlabcentral/answers/20220-conditionally-executed-subsystem-introduces-direct-feedthrough?s_tid=answers_rc1-3_p3_MLT. But there is no answer for that question as well.
Any comments are appreciated!

Accepted Answer

Pan Zhao
Pan Zhao on 23 Jun 2017
By referring to the document at http://physics.fme.vutbr.cz/~rudolf/Download/Matlab/Literature/sl_using.pdf, I solved the algebraic problem by 1. right-click the Enabled Subsystem and select Block Parameters (Subsystems) 2. check the option Minimize algebraic loop occurrences
Also see the figures for the solution
.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!