Simscape Multibody - model does not react to slider gain changes without stopping and starting the simulation again

조회 수: 17 (최근 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

채택된 답변

Yifeng Tang
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!

추가 답변 (1개)

Martin Novak
Martin Novak 2021년 5월 24일
This works, thank you.

카테고리

Help CenterFile Exchange에서 Assembly에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by