Algebraic loop within SimMechanics
2 次查看(过去 30 天)
显示 更早的评论
Before I post this, I've been reading thousands of posts about algebraic loop. But I still couldn't get any useful results.
Here is the issue:
I'm trying to represent a snake-shaped worm with several rigid pieces of cylinders. Under visco-elastic environment, The viscous force/external drag on one piece depends on the velocity of the current piece. I implemented this in SimMechanics,and I got a algebraic loop because the input somehow is dependent on the output (or a direct feed-through issue).
Following some advices on Matlab Answers, I've tried to add a unit delay or memory block to break the loop. The loop was broken in that way, however, the result was definitely wrong.
Could someone think about an idea to break the loop and also maintain the correct simulation results?
Let me know if more information is needed.
Best,
Frank
0 个评论
回答(1 个)
Sebastian Castro
2014-5-28
The algebraic loop is created when you measure something in SimMechanics and directly feed it back as an input to the same physical network.
For a simple linear viscous force, I would consider 2 things that would avoid any algebraic loops in your model.
1. If the external drag is fully viscous, is it possible to simply specify a damping coefficient in the "Internal Mechanics" section of the Joint block itself?
2. If you are sending a speed in one location and applying the drag force elsewhere, you're probably using a PS-Simulink Converter, Gain, and Simulink-PS Converter block. Instead of this, you could use a PS Gain block in the Physical Signals Simscape library.
This approach will not give rise to an algebraic loop because you are not converting any values to Simulink signals. In other words, you're keeping this drag relationship as part of the physical network of equations.
The Algebraic Loops section of this documentation page explains this better. Don't worry about the fact that this uses SimMechanics First Generation -- the same principles hold for all Simscape/SimMechanics/etc. products.
2 个评论
Sebastian Castro
2014-5-28
If you are changing the gain coefficient, you can try a PS Product block, where one input is the velocity signal and the other input could be a time-varying multiplication factor that comes in as an input from Simulink.
The PS Lookup Table block is also another really useful block that lets you specify a vector of (in this case) damping forces as a function of speed.
Finally: If you want everything to stay in Simscape, you could always check out the Simscape Language to make custom components.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Physical Units 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!