mbsim-env / mbsim

A multi-body simulation software
https://www.mbsim-env.de
GNU Lesser General Public License v2.1
42 stars 16 forks source link

Piecewise linear function #50

Open Jantsche opened 1 year ago

Jantsche commented 1 year ago

Hello, Is there a way to use a piecewise linear function for the generalized position constraint? Im trying to get a varying angle for the rotation of a spinning Disk in an experiment for gyro effects. Using the piecewise polynom function i have managed to get a varying angle but the problem is, that the curve of the angle has quite large overshoots. I thought that i could make the stepsize smaller to reduce these overshoots but that would lead to much manual writing of the data. Could it be a command for the interpolation method different from "cSplineNatural"?

Best regards Jantsche

foerg commented 1 year ago

Hi, when using generalized position constraints, the first derivative of the position function must be continuous. This condition is necessary as the acceleration has to be finite. Thus, a linear interpolation can not be used in conjunction with position constraints. However, you can also define a generalized acceleration constraint, where the acceleration function can even be discontinuous. Discontinuous functions can either be defined with "piecewise defined function" or with "symbolic function" using the keyword "condition".

Jantsche commented 1 year ago

Hello, I understand. Is there any other way to set a defined angle that changes over time? Because with an acceleration constraint, the setting of a predefined angle (i.e. an angle that you simply specify in radians) is not possible, is it?

foerg commented 1 year ago

It is. How does your function look like?