Algebraic loop within SimMechanics

2 visualizaciones (últimos 30 días)
Frank
Frank el 6 de Mzo. de 2014
Comentada: Sebastian Castro el 28 de Mayo de 2014
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

Respuestas (1)

Sebastian Castro
Sebastian Castro el 28 de Mayo de 2014
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 comentarios
Frank
Frank el 28 de Mayo de 2014
Hi Sebastian,
Your answer is fantastic and I appreciate your help. I encountered the second scenario as you mentioned above where i use: speed-->PS-Simulink Converter-->Matlab Fcn-->Simulink-PS Converter. The reason to use Matlab Fcn is that I need to change the gain during simulation(which is the drag coefficients). Can I achieve the same function by some other blocks and still get rid of the algebraic loop?
Best,
Frank
Sebastian Castro
Sebastian Castro el 28 de Mayo de 2014
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Physical Units en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by