# RV

Model ElementRv defines a special type of solver state variable. It is used in the evaluation and computation of design sensitivity as a response variable.

Rv

## Attribute Summary

Name Property Modifiable by command? Designable?
id Int () No No
label String ()
ic Double ()
function Function ()
routine Routine ()

## Usage

Rv (ic=0.0, function="USER()", routine=self.routine, optional_attributes)

## Attributes

id
Integer
Specifies the element identification number. This number must be unique among all the Rv objects in the model.
This attribute is optional. MotionSolve automatically creates an ID when one is not specified.
Range of values: id > 0
label
String
Specifies the name of the Rv object.
This attribute is optional. When not specified, MotionSolve creates a label for you.
ic
Double
Specifies the initial condition of the Rv object.
function
String
An expression (that will be set to zero) defining the general constraint.
OR
The list of parameters that are passed from the data file to the user-defined subroutine, GCOSUB.
routine
String or a pointer to a Python function.
Specifies an alternative name for the user subroutine.
The attribute routine is optional.
When function is specified, but routine is not, routine defaults to GCOSUB.

## Example

Create an Rv that measures the displacement along global z axis.
Rv(ic = 0.0, function = 'DZ({I},{J},{J})'.format(I=marker.id,J=part.cm.id))

## Response Classes

Rv is available in MotionSolve as an element that is used to create response variables. The table below summarizes the library of classes currently available for creating commonly used responses. They simplify creating such responses and connect response variables to printing/plotting functions during and after an optimization run.
DeviationSquared
Used to compute a response which is the difference between a function's current value and a desired value.
GenericResponse
Most generic case. A layer over Rv element, it connects response variables given as a function or through a sub-routine to plotting and optimization.
ResponseExpression
Used to compute user defined algebraic expressions containing response and design variables as response.
MaxVal
Computes the maximum value of a user specified function. The function could be a MotionSolve expression or a user subroutine.
MinVal
Computes the minimum value of a user specified function. The function could be a MotionSolve expression or a user subroutine.
RMS2
Used to compute a response that is the root mean square area difference between a measured curve and a target curve.
Slope2
Used to compute a response which is the slope of a curve that is drawn between two quantities at a particular time point.
Slope2Deviation
Used to compute a response that measures the deviation from a desired value of the slope of a curve that is drawn between two quantities.
ValueAtG
Used to compute a response that is a value of a signal when second signal achieves a certain value.
ValueAtTime
Used to compute a response that is a value of a signal at a particular time.