GenericResponse

Model ElementGenericResponse is just a layer over the standard MotionSolve Rv object. The additional layer connects the underlying Rv to plotting and optimization functionality.

Class Name

GenericResponse

Attribute Summary

Name Property Modifiable by Command? Designable
label Str ()    
function Function ()   Yes
routine Routine ()    
scale Double (1)    
useDeriv Bool (False)    
plot Bool ()    

Usage

#1: GenericResponse specified as an expression
GenericResponse (function=expressionString, optional_attributes)

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

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

Attributes

Defined as a MotionSolve expression.
function
String defining a valid MotionSolve expression.
A MotionSolve expression defining the GenericResponse.
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 GenericResponse 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 path name to the shared library containing the function that computes the response of the user-defined GenericResponse. The second is the name of the function in the shared library that does the computation.
An example is: routine="/staff/Altair/engine.dllmyGenericResponse"
  • "/staff/Altair/engine.dll is the DLL
  • "myGenericResponse" 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 GenericResponse is defined.
The function attribute is mandatory.
routine
Pointer to a callable function in Python.
An example is: routine= myGenericResponse
  • myGenericResponse 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 attributes - Available to all variants
label
String
Specifies the name of the GenericResponse object.
This attribute is optional.
When not specified, MotionSolve creates a label for you.
scale
Double
Specifies the scale factor to scale the GenericResponse value. If not specified, it defaults to 1.0.
This attribute is optional.
useDeriv
Boolean
Flag to specify if the derivative of the function is to be used as response. When not specified, useDeriv defaults to False.
The attribute useDeriv is optional.
plot
Bool
When set to True, a subplot will be generated and updated dynamically when a supported optimizer is being used.

Example:

#1: GenericResponse of type expression
energy = GenericResponse (label="Energy", function = "WZ(21,31)*FZ(21,31)", scale=10)

#2: GenericResponse of type interpreted user subroutine
energy = GenericResponse (label="Energy", function = myPowerFunction, scale=10)

#3: GenericResponse of type compiled user subroutine
energy = GenericResponse (label="Energy", function = "myPowerFunction", scale=10)

Comments

  1. See Properties for an explanation about what properties are, why they are used, and how you can extend these.