ExpressionBasedCoordinateForce quadratic spring sign issue
Posted: Thu Jun 24, 2021 3:37 pm
Hello,
I'm looking to add a quadratic spring to my model, which can passively suspend a segment in horizontal equilibrium. I came across ExpressionBasedCoordinateForce in the forums, and was wondering if it is possible to set the expression using absolute signs? Otherwise I run into the following issue, assuming arbitrary stiffness of 30 & damping of 3, and a rest angle of 0.2:
The above expression will give a negative moment/torque in all cases, but if q goes below -0.2, this leads to an unstable situation (where the spring torque will lead to greater spring torques). Does EBCF allow for absolute signs, for instance using:
I was also wondering if there are any example snippets of code to add such a force to a model via the MATLAB API?
Best wishes,
Pasha
I'm looking to add a quadratic spring to my model, which can passively suspend a segment in horizontal equilibrium. I came across ExpressionBasedCoordinateForce in the forums, and was wondering if it is possible to set the expression using absolute signs? Otherwise I run into the following issue, assuming arbitrary stiffness of 30 & damping of 3, and a rest angle of 0.2:
Code: Select all
<ExpressionBasedCoordinateForce name="rotational_spring">
<!--Coordinate (name) to apply force to.-->
<coordinate>joint</coordinate>
<!--Expression of the force magnitude as a function of the coordinate value (q)and its time derivative (qdot). Note, expression cannot have any whitespace separating characters-->
<expression>-30*((q-0.2)^2)-3*qdot</expression>
</ExpressionBasedCoordinateForce>
Code: Select all
<expression>-30*(q-0.2)*(|q-0.2|)-3*qdot</expression>
Best wishes,
Pasha