How to handle Algebraic Loops for Simulink Coder to C++ when the model is function fine and Simulink is autosolving the loops?

4 ビュー (過去 30 日間)
I have been delivered a flight controls model developed in Simulink. It appears that the model may or may not have Algebraic loops but simulink seems to be autosolving the loops because it is not preventing the modeling from performing correctly as long as the diagnostics for Algebraic loops is set to none. Setting the diagnostic to error reports 10 loops, none of which look like the types described in the faq. I need to convert this model to C++ but Simulink Coder is reporting that it can't due to Algebraic loops. Is there a shortcut to resolving these loops? I have tried the suggestions from the guides here but am not finding the types of loops displayed such as feedback loops that would allow me to put in delays. Is there a way to see what Simulink is doing to auto solve these loops? Any advice would be great.

回答 (1 件)

Guy Rouleau
Guy Rouleau 2013 年 1 月 18 日
To get a better look at the loop, use the Simulink Debugger. "ashow" will allow you to see each loop (you mention 10). Using "atrace", you will be able to get details how the algebraic loop is solved by the Simulink engine.
To Generate code, you will need to remove the loops. There is no magic solution for that. You will need a good knowledge of the equations in the model to remov the loop appropriately. This can mean:
- Rearranging the equations to avoid loops - If the controller is discrete, break the loop by introducing a delay - If the controller is continuous, introduce some additional dynamics, like a transfer function.
This will change results, but to generate, you have to remove the loops.

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by