Simmechanics Weird behaviour when simulating a four bar linkage with an initial condition

Hello,
Could anyone please take a look to the example attached? It is a four bar linkage made in Simmechanics (Simscape Multibody). It is behaving really weird and I do not know exactly the reason.
I have been doing lately some matlab programming and the weirdest thingy is that this very mechanism, running under my code behaves exactly in the same way!!
It is a four bar mechanism sample slightly modified . One of the joints (Crank-Connector revolute joint) has a State Target Priority to define a specific initial position.
When simulated, the mechanism seems to find an attractor in one of the sides, and keeps oscillating around the position, which is actually supposed to be a repeller. There are not external forces applied (except the ones due to the gravitational field).
See this video .
Can anyone please give me some insight about this issue? I think I am going bananas...
PS: The example is attached as a .zip file. Just need to click on the play button.
Many thanks,
Rodrigo

6 Comments

Hello Rodrigo,
I still don't understand what is the expected result. However, here is some debugging that I did.
1. Even if you specified an initial condition Simscape Multibody (SimMechanics) tries to SOLVE for the condition and decides whether that particular configuration is possible or not. In your case, when you have both the targets specified as a 'low' priority, Simscape tries to solve for it to get the best values for those initial conditions close to the specified value. You can take a look at this by going to the Analysis -> Simscape -> Variable Viewer. You can see that your specified targets are NOT satisfied exactly.
To try to force the initial conditions, you need to set these targets to be high priority. To see how to do this, refer to documentation here.
2. However when you do that for your model (setting both revolute joints to high priority targets that is), you can see that we are unable to satisfy the high priority targets. This 'usually' means that the provided initial condition configuration is perhaps impossible to achieve.
3. So the next approach is to relax the constraint a little bit by setting one of the joints to high and the other one to low and see if we are able to atleast force one of them to be exactly what we want. In this case, we are able to satisfy the high priority target but not the low priority target.
This is the best way to debug initial conditions issues AFAIK. Maybe because the initial conditions are not fully satisfied is why your results are not matching your expectations?
Swarooph, many thanks for your insight. It is very helpful indeed and I do appreciate your tips on debugging initial conditions.
Anyway, there are some things that I am not being clear enough and I do apologise. It is absolutely my fault. Lets keep on looking for an answer, please!
-Expected result can be found here . This is a dynamic simulation of Autodesk Inventor.
-I do not mind how strict initial positions should be considered by Simscape Multibody. For me, a low accuracy is absolutely fine. It is not a problem at all. I just want the simulation to be realistic in order to keep on progressing.
-I have programmed a four bar linkage in matlab, and I am getting this results (see video here ).
I see many similarities between Simscape Multibody and my simulation in Matlab.
I think (and this is just an intuition) that this mechanism should behave (in the reality) as the Autodesk Inventor simulation. It is more realistic indeed.
And the issue is: why theoretically your software and my simulation behaves in this way and the autodesk inventor simulation behaves in the other way around. Is it a bug or where is the mistake?
Is it clear enough now? I hope so... as I do appreciate your time.
Thanks for your time again Swarooph,
Hello Rodrigo,
Thanks for the explanation. I think there are two things at work here.
1. When you look at the 'Translation' of Rocker Base Transform, you see that its 20cm in your model. Now, this is longer than your 'Connector Link' which is only 10cm. These 2 dimensions seem much closer in your Autodesk simulation. I don't know the exact dimensions of your mechanism. But this definitely seems off graphically speaking. Once you change that, you already see a simulation result that can be explained.
2. Notice how the bars are straight down and not criss-crossed. This needs to be set using initial conditions of the joint angles (all that talk about the initial conditions was worth it after all!). So here I have set the initial condition for the 'Base-Crank Revolute' = 40 deg and the 'Base-Rocker Revolute' = -20 deg so that I can get an initial condition similar to the auto desk simulation (criss-crossed bars). After this, we can see the following result:
NOTE: I replaced the original joints with built in revolute blocks when I was playing with this, since I had no idea what parameters were changed and wanted to make sure nothing extra was added in.
Swarooph, great answer. And you are totally right.
Now the last and most important question:
May I assume that if the 'Translation' of Rocker Base Transform is set to 20 cm, the mechanism would behave in the former way in the reality (as we know it XD)?
Again, many many thanks!
Depends on if the former way (Autodesk) also has 20cm as the distance between the rocker and the crank. Otherwise, I would set that to 20cm in Autodesk simulation before comparing it to Simscape multibody.
Sorry, my bad explanation again.
I meant, if I keep 20 cm in Simscape Multibody, should I guess that the simulation in Simscape is behaving realisticly?
Well...
As you have suggested, I have simulated the Simscape configuration right now in Autodesk Inventor and they are the same. It matches with my simulation in Matlab as well.
So yes, my intuition was wrong, and the simulation is ok.
Swarooph, a few words to you. Thank you for being in the front line, dealing with people like me and solving our questions.
Sometimes we come across problems that could be sooo frustrating... It is good to know there are people like you helping us to find ourselves into the dark and complex Maze.
So, thank you very much and wish you the best.
Rodrigo

Sign in to comment.

Answers (1)

As answered by Swarooph above, setting the initial conditions properly and ensuring the linkages are the right length resolved this issue. See the discussion in the comments.
--Steve

Asked:

on 28 Jul 2016

Answered:

on 17 Nov 2021

Community Treasure Hunt

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

Start Hunting!