-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix position prescribed friction #4256
Fix position prescribed friction #4256
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An improvement compared to the status-quo. As discussed in the earlier PR 4129.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have re-analyzed the solution and propose a slightly different fix. I would have included this fix in the pull request, but I don't manage to quickly do it (and do not have enough time to figure this out). So, someone else has to include this solution.
Issue with current proposal:
a_relfric/unitAngularAcceleration = if locked then 0 else if free then sa
else if startForward then sa - tau0_max/unitTorque
else if startBackward then sa + tau0_max/unitTorque
else sa - sign(w_relfric)*tau0_max/unitTorque;
Assume mode == Forward, so forward sliding, and wrelfric crosses zero. Then previously, the equation "mode = .... w_relfric > 0 ..." triggered a state event at w_relfric=0 and during finding the root w_relfric=0, all signals are continuous. With the change above, this is no longer the case, because sa and a_relfric are computed with "a_relfric = sa - sign(w_relfric)..." during root finding, so a_relfric and sa are discontinuous during root finding (which is bad).
This can be fixed by reformulating the equations to:
a_relfric/unitAngularAcceleration = if locked then 0 else if free then sa
else if startForward then sa - tau0_max/unitTorque
else if startBackward then sa + tau0_max/unitTorque
else if pre(mode) == Forward then sa - tau0_max/unitTorque
else if pre(mode) == Backward then sa + tau0_max/unitTorque
else sa - sign(w_relfric)*tau0_max/unitTorque;
The difference can be seen in the test example ModelicaTest.Rotational.TestFrictionPosition with a small number of output points ("number of intervals = 10" in Dymola).
@MartinOtter I have implemented your suggestion in PR m-kormann#1 |
Enhance a_relfric for forward/backward sliding
The fix from #4129 has been accidentally reverted by #4255 without being the reason for the compiling errors.
The compilation errors should be fixed by recompilation of the binaries as discussed in #3911, #4178 and #4250.