# MinVal

Model ElementMinVal computes the approximate minimum value of a MotionSolve expression or a user subroutine during the simulation.

MinVal

## Description

The minimum is approximated by an alpha-soft function so that the analytical sensitivity can be calculated.(1)
$\mathrm{min}\left(x\right)=\frac{\underset{0}{\overset{T}{\int }}x\left(t\right){e}^{\alpha x\left(t\right)}dt}{\underset{0}{\overset{T}{\int }}{e}^{\alpha x\left(t\right)}dt}$

Where $\alpha$ is a negative constant and satisfies $\alpha =-coef$ . The default of $coef$ is 10 and should work for the majority of use cases.

## Attribute Summary

Name Property Modifiable by Command? Designable
label Str ()
function Function ()   Yes
routine Routine ()
plot Bool ()
wlen Int ()
k Int ()

## Usage

#1: MinVal specified as an expression
MinVal (function=expressionString)

#2: Defined in a compiled user-subroutine
MinVal (function=userString, routine=string, optional_attributes)

#3: Defined in a Python function
MinVal (function=userString, routine=functionPointer, optional_attributes)

## Attributes

Defined as the maximum value of an expression.
function
String
A MotionSolve expression defining the function for which MinVal is required.
The function attribute is mandatory.
Defined as a user-subroutine in a compiled DLL.
function
String defining a valid user function MotionSolve expression.
The list of parameters that are passed from the data file to the user defined subroutine where the MinVal is defined.
The function attribute is mandatory.
routine
Specifies an alternative name for the user subroutine. The name consists of two pieces of information, separated by "∷". The first is the path name to the shared library containing the function that computes the response of the user-defined Variable. The second is the name of the function in the shared library that does the computation.
An example is: routine="/staff/Altair/engine.dllmyMinVal"
• "/staff/Altair/ engine.dll is the DLL
• "myMinVal" is the function within this DLL that performs the calculations.
The attribute routine is optional.
When not specified, routine defaults to VARSUB.
Defined as a user-subroutine in a Python script
function
String defining a valid user function MotionSolve expression
The list of parameters that are passed from the data file to the user defined subroutine where the Variable is defined.
The function attribute is mandatory.
routine
Pointer to a callable function in Python.
An example is: routine = myMinVal
• myMinVal is a Python function or method that can be called from wherever the model resides.
The attribute routine is optional.

When not specified, routine defaults to VARSUB.

Optional attribute
label
String
Specifies the name of the MinVal object.
This attribute is optional. When not specified, MotionSolve creates a label for you.
coef
Double
Specifies the coefficient in the soft-alpha function. The default value is 1.0 and should work for the majority of use cases.
wlen
Integer
The window length for the smoothing function. You can increase its value to smooth the minimum value when the response contains high frequency noise.
k
Integer
The order of the smoothing function. The default value is 1. You can increase its value if you lose the true minimum due to smoothing.

## Example

# Compute the minimum of the absolute value of the z-acceleration of a Marker
zacc = "ABS(ACCZ({},{}))".format(self.block.cm.id,self.ref.id)
zmax = MinVal (function=zacc)