Simmechanics Weird behaviour when simulating a four bar linkage with an initial condition
Show older comments
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).
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
Swarooph
on 1 Aug 2016
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?
Rodrigo Hernandez
on 1 Aug 2016
Swarooph
on 1 Aug 2016
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.
Rodrigo Hernandez
on 1 Aug 2016
Edited: Rodrigo Hernandez
on 1 Aug 2016
Swarooph
on 1 Aug 2016
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.
Rodrigo Hernandez
on 1 Aug 2016
Edited: Rodrigo Hernandez
on 1 Aug 2016
Answers (1)
Steve Miller
on 17 Nov 2021
0 votes
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
Categories
Find more on Assembly in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!