MaxVal

Model ElementMaxVal computes the approximate maximum value of a MotionSolve expression or a user subroutine during the simulation.

Class Name

MaxVal

Description

The maximum is approximated by an alpha-soft function so that the analytical sensitivity can be calculated.(1)
max ( x ) = 0 T x ( t ) e α x ( t ) d t 0 T e α x ( t ) d t MathType@MTEF@5@5@+= feaagKart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9 vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=x fr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaciyBaiaacg gacaGG4bGaaiikaiaadIhacaGGPaGaeyypa0ZaaSaaaeaadaWdXbqa aiaadIhadaqadaqaaiaadshaaiaawIcacaGLPaaacaWGLbWaaWbaaS qabeaacqaHXoqycaWG4bWaaeWaaeaacaWG0baacaGLOaGaayzkaaaa aOGaamizaiaadshaaSqaaiaaicdaaeaacaWGubaaniabgUIiYdaake aadaWdXbqaaiaadwgadaahaaWcbeqaaiabeg7aHjaadIhadaqadaqa aiaadshaaiaawIcacaGLPaaaaaGccaWGKbGaamiDaaWcbaGaaGimaa qaaiaadsfaa0Gaey4kIipaaaaaaa@57F9@

Where α MathType@MTEF@5@5@+= feaagKart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9 vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=x fr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaeqySdegaaa@3796@ is a positive constant and satisfies α = c o e f MathType@MTEF@5@5@+= feaagKart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9 vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=x fr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaeqySdeMaey ypa0Jaam4yaiaad+gacaWGLbGaamOzaaaa@3C4D@ . The default value of c o e f MathType@MTEF@5@5@+= feaagKart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9 vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=x fr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaam4yaiaad+ gacaWGLbGaamOzaaaa@39A8@ 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 ()    
coef Double ()    
wlen Int ()    
k Int ()    

Usage

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

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

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

Attributes

Defined as the maximum value of an expression.
function
String
A MotionSolve expression defining the maximum value of a function.
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 MaxVal is defined.
The function attribute is mandatory.
routine
String
Specifies an alternative name for the user subroutine. The name consists of two pieces of information, separated by "∷".
The first is the pathname 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.dllmyMaxVal"
  • "/staff/Altair/ engine.dll is the DLL
  • "myMaxVal" 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= myMaxVal
  • myMaxVal 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 MaxVal 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 maximum 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 maximum due to smoothing.

Example:

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

Comments

  1. See Properties for an explanation about what properties are, why they are used, and how you can extend these.
  2. You can verify the response value by comparing it with the curve in HyperGraph. For a high-frequency signal, the value returned by MotionSolve may not agree with HyperGraph. This is because the maximum returned by MotionSolve is computed at each integration step, while HyperGraph computes only at the output step. The output step is usually larger than the integration step, hence the difference. You can eliminate the difference by reducing the output step returned by MotionSolve.