Simscape Multibody - model does not react to slider gain changes without stopping and starting the simulation again
18 次查看(过去 30 天)
显示 更早的评论
Hi,
i am trying to make a simple mechanism in Simscape Multibody. A fixed platform with a rotating leg. I would like that the rotation is controlled by the user, with a slider gain. The result is viewed in Mechanics Explorer. However the changes in the gain are taken into account ONLY when I stop the simulation and then start it again. The animation viewed in Mechanics Explorer does not display the changes.
I have connected a scope to the Sensing (position) output of the joint and it does display the changing gain, but the joint is not moving.
When i replace the source with a sine wave, the joint rotates corectly.
Any ideas what is wrong? Model is attached.
Martin
0 个评论
采纳的回答
Yifeng Tang
2021-5-21
The answer is that the slider gain actually is working as intended. It's changing the position of the swing bar, but we were not seeing that in the Mechanics Explorer, because your computer is too FAST :p
OK, seriously, the slider gain works. The simulation clock is running at about 100 times faster than the wall clock (YMMV), because this is a fairly simple model. The Mechanics Explorer, however, is playing the animation at 1x wall clock speed by default. So when you change anything on the slider gain, it's at like 300 sec simulation time (probably even longer because nothing is happening and the simulation just runs FAST), and you'll need to wait that long for it to show up in the Mechanics Explorer.
The solution is to slow the simulation down by "pacing it". Very simple to do: https://www.mathworks.com/help/simulink/ug/simulation-pacing.html
Make it 1x wall clock and you'll see the action of your slider in real speed.
Happy Modeling!
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assembly 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!