MaxVal
Computes the maximum value of a user specified function, which could be a MotionSolve expression or a user subroutine.
The maximum value of a signal f(q(t)) satisfies the following condition: If T* is the point in time when is f(q(t)) maximum, then f(q(T*))≤f(q(t)) when t ≠T*. If the expression has no maximum value, the initial value will be returned as the maximum value.
A smooth approximation to the MAX function is implemented in MotionSolve, so that its sensitivities are analytically computed. The smooth approximation, known as the alpha soft approximation, is:
The default value of a is +10 and it should work for most of use cases.
Example
Assume that you are designing a suspension system and there is an upper limit on the maximum acceleration of the chassis.
Here is a code snippet that shows how the response should be defined with MaxVal:
>>> # Define the maximum of acceleration
>>> maxAcc = MaxVal(function = "ACCZ({})".format(p.cm.id))