Adams 2020 FP1 Adams View Function Builder User Guide
Adams 2020 FP1 Adams View Function Builder User Guide
Japan Asia-Pacific
MSC Software Japan Ltd. MSC Software (S) Pte. Ltd.
Shinjuku First West 8F 100 Beach Road
23-7 Nishi Shinjuku #16-05 Shaw Tower
1-Chome, Shinjuku-Ku Singapore 189702
Tokyo 160-0023, JAPAN Telephone: 65-6272-0082
Telephone: (81) (3)-6911-1200 Email: [email protected]
Email: [email protected]
Worldwide Web
www.mscsoftware.com
Support
http://www.mscsoftware.com/Contents/Services/Technical-Support/Contact-Technical-Support.aspx
Disclaimer
This documentation, as well as the software described in it, is furnished under license and may be used only in accordance with the
terms of such license.
MSC Software Corporation reserves the right to make changes in specifications and other information contained in this document
without prior notice.
The concepts, methods, and examples presented in this text are for illustrative and educational purposes only, and are not intended
to be exhaustive or to apply to any particular engineering problem or design. MSC Software Corporation assumes no liability or
responsibility to any person or company for direct or indirect damages resulting from the use of any information contained herein.
User Documentation: Copyright © 2020 MSC Software Corporation. Printed in U.S.A. All Rights Reserved.
This notice shall be marked on any reproduction of this documentation, in whole or in part. Any reproduction or distribution of this
document, in whole or in part, without the prior written consent of MSC Software Corporation is prohibited.
This software may contain certain third-party software that is protected by copyright and licensed from MSC Software suppliers.
Additional terms and conditions and/or notices may apply for certain third party software. Such additional third party software terms
and conditions and/or notices may be set forth in documentation and/or at http://www.mscsoftware.com/thirdpartysoftware (or successor
website designated by MSC from time to time). Portions of this software are owned by Siemens Product Lifecycle Management, Inc.
© Copyright 2020
The MSC Software logo, MSC, MSC Adams, MD Adams, and Adams are trademarks or registered trademarks of MSC Software
Corporation in the United States and/or other countries. Hexagon and the Hexagon logo are trademarks or registered trademarks of
Hexagon AB and/or its subsidiaries. FLEXlm and FlexNet Publisher are trademarks or registered trademarks of Flexera Software.
Parasolid is a registered trademark of Siemens Product Lifecycle Management, Inc. All other trademarks are the property of their
respective owners.
ADAM:V2020FP1:Z:Z:Z:DC-FUNC
Documentation Feedback
At MSC Software, we strive to produce the highest quality documentation and welcome your feedback.
If you have comments or suggestions about our documentation, write to us at: documentation-
[email protected].
Please include the following information with your feedback:
Document name
Release/Version number
Chapter/Section name
Topic title (for Online Help)
Brief description of the content (for example, incomplete/incorrect information, grammatical
errors, information that requires clarification or more details and so on).
Your suggestions for correcting/improving documentation
You may also provide your feedback about MSC Software documentation by taking a short 5-minute
survey at: http://msc-documentation.questionpro.com.
Note: The above mentioned e-mail address is only for providing documentation specific
feedback. If you have any technical problems, issues, or queries, please contact Technical
Support.
1
Learning Function Builder Basics
Types of Functions
The following two sections provide details about the two major types of functions you can use in the Function
Builder:
Design-Time Functions
Run-Time Functions
Design-Time Functions
Design-time functions allow you to parametrically configure your model for optimization and sensitivity
studies. Adams View evaluates design-time functions only during the design process, and not during a
simulation, except for optimization and design studies.
The Function Builder gives you access to over two hundred design-time functions. In addition, you can create
your own user-written functions. The Function Builder categorizes all system-supplied functions based on
their functionality. The following table lists the design-time functions categories:
Design-Time Function Categories
Category:
Math Functions
Location/Orientation Functions
Modeling Functions
Matrix/Array Functions
2 Adams View Function Builder
Learning Function Builder Basics
Category:
String Functions
Database Functions
Miscellaneous Functions
Besides the categories listed above, the Function Builder includes a category called All Functions that lists all
design-time functions in alphabetical order.
For more information and examples for each design-time function, see Design-Time Function Descriptions.
Run-Time Functions
Run-time functions allow you to specify mathematical relationships between simulation states that directly
define the behavior of your model. Adams updates the run-time functions only during a simulation.
The Function Builder gives you access to over one hundred run-time functions, that it categorizes based on
their functionality. The following table lists the run-time functions categories:
Run-Time Function Categories
Category:
Displacement Functions
Velocity Functions
Acceleration Functions
Contact Functions
Clearance Functions
Spline Functions
Force in Object Functions
Resultant Force Functions
Math Functions
Vector Functions
Data Element Access
User-Written Subroutine Invocation
Constants & Variables
FE part
Besides the categories listed above, the Function Builder includes a category named All Functions. This
category contains all the run-time functions, grouped by functionality.
For more information and examples for each run-time function, see Run-Time Function Descriptions.
3
Learning Function Builder Basics
The following two sections introduce you to the Function Builder modes:
Expression Mode
Run-Time Mode
Expression Mode
In expression mode you can create expressions, which are the basis of all parameterization. Adams updates
expressions when it detects that dependencies have been changed. Performing optimization and design
studies can affect the dependencies for some expressions.
In addition to design-time functions, expressions can include the following elements:
Design variables
Operators
Operands
Database Access
For detailed information on expressions and their elements, see Expression Language Reference.
To learn more about the expression mode, see Working in Expression Mode.
Run-Time Mode
When working in run-time mode, the Function Builder allows you to combine run-time functions with a
variety of elements to build functions. After you define the functions, Adams Solver uses them during the
simulation process.
The following sections introduce you to the run-time function elements.
Design Variables
Numerical Values
4 Adams View Function Builder
Learning Function Builder Basics
Operators
Design Variables
Design variables are a means of storing data that you can later use and modify. You can use design variables
throughout the Adams View command language. For example, you can define the radius of a cylinder in
terms of a design variable:
variable create variable=my_radius real=40 units=length geometry
modify shape cylinder & cylinder_name =
.model_1.PART_1.CYLINDER_1 & radius = (my_radius)
For more information on design variables, see Expression Language Reference.
Numerical Values
In run-time mode you can use integers and real numbers. Adams doesn't support complex numbers at this
time.
Operators
You can use the standard set of FORTRAN operators in the functions you create in run-time mode. The
operators table below lists the operators Adams View supports in this mode. The table lists the operators by
precedence, with grouping being the highest precedence operator.
Different from FORTRAN convention, when in run-time mode, the unary minus operator has
precedence over the exponentiation operator, and exponentiation associates from left to right.
Operators
To learn more about the run-time mode, see Working in Run-Time Mode.
The following table shows what types of operations you can perform in the run-time mode, and how you can
access it:
Accessing the Run-Time Mode for Basic Operations
The following sections provide step-by-step instructions on accessing the Function Builder modes:
Working in Expression Mode
Working in Run-Time Mode
Building Expressions
You use the expression mode when you want to build expressions to use in various operations. Some of the
operations for which you can use expressions include parameterizing values for point and marker locations,
parameterizing values for geometry dimensions, and working with design variables. For more information on
expressions, see Expression Language Reference.
6 Adams View Function Builder
Learning Function Builder Basics
To perform such operations, you can access the expression mode from the pop-up menus of boxes that can
be parameterized.
or
7
Learning Function Builder Basics
(Classic interface) From the Build menu, point to Measure, point to Computed, and then select
New.
1. Click the Elements tab. From the Function container, click the Create a Function tool .
or
(Classic interface) From the Build menu, point to Function, and then select New.
you intend to use it. For example, if you open the Function Builder to build function measures, it includes
boxes for entering general attributes for the measure.
For information on run-time functions, functions you can use in run-time mode, see Run-Time Functions.
In run-time mode, you can perform two basic types of operations. In addition, you can set how Adams View
references database objects.
Setting Default Database Object References
Building Run-Time Functions
Creating or Modifying Function Measures
Adams View inserts the function in the box from which you displayed the Function Builder.
1. Click the Elements tab. From the Function container, click the Create a Function tool .
or
(Classic interface) From the Build menu, point to Measure, point to Function, and then select New.
For an overview of the Function Builder, see Learning Function Builder Basics. For information on the Function
Builder modes, see Accessing the Function Builder.
Function Builder Operations
The following sections explain the Function Builder operations and also provide some examples of common
Function Builder uses:
Function Builder Operations
Example - Building Functions for Motions
Example - Parameterizing Values for Marker Locations
Adams View inserts the name of the object in the function definition, in the function work area.
The Selections dialog box appears, containing the data dictionary associated with the object you
specified, as shown next.
Evaluating Functions
When in expression mode, the Function Builder gives you the option to see the values to which your
functions evaluate.
17
Performing Operations in the Function Builder
To evaluate a function:
1. Make sure there is a function in the function text area.
2. Select Evaluate.
Adams View displays the value of the function next to Function Value.
Note: Under the model object, there are both "ground" and "ground_part" fields. The latter
was added to determine the ground part of the given model at any given point in time
and provides a workaround for the issue of expressions returning the incorrect ground
part for a model when the name of the model's ground part is not "ground". It is
therefore recommended to use "ground_part" instead of "ground".
Note: You can only plot the run-time functions that are in the math category and can be interpreted
as design-time functions.
A dialog box appears, prompting you for the values that you want to use.
18 Adams View Function Builder
Performing Operations in the Function Builder
3. Enter the beginning and ending values and the number of points to be computed, and then select OK.
Getting Assistance
You can get assistance when working with system-supplied functions in either run-time or expression mode.
The Assist dialog box lists all the arguments specific to the function for which you need assistance, and
prompts you for argument values. Once you enter the argument values and close the Assist dialog box, Adams
View automatically inserts those values into the function work area.
When entering values in the Assist dialog box, do not enclose them in parenthesis, braces, or quotation marks.
Adams View automatically enters these as needed, before displaying expressions in the function work area.
To get assistance:
1. Select a function from the list of system-supplied functions.
2. Select Assist.
The Assist dialog box appears.
20 Adams View Function Builder
Performing Operations in the Function Builder
Note: There are a few functions for which Adams View doesn't provide assistance. When you ask for
assistance with a function for which assistance is not available, a message appears. Select OK
to exit the message dialog box.
Regardless of whether you are in expression or run-time mode, you can use the Operators tool to insert
operators in the function definition, in the function work area.
Category:
Math Functions
Location/Orientation Functions
Modeling Functions
Matrix/Array Functions
String Functions
Database Functions
Miscellaneous Functions
21
Performing Operations in the Function Builder
Category:
Displacement Functions
Velocity Functions
Acceleration Functions
Contact Functions
Spline Functions
Force in Object Functions
Resultant Force Functions
Math Functions
Data Element Access
User-Written Subroutine Invocation
Constants & Variables
The Function Builder displays the list of functions beneath the category name.
The function name and arguments appear under the function list.
22 Adams View Function Builder
Expression Language Reference
To compute values for you, such as when you are entering the radius of a cylinder and the value is
not a simple number, but is the result of a mathematical computation. Instead of using a calculator
to determine the actual number, you can enter the expression directly and let Adams View perform
the computation for you.
To parameterize your model. Expressions can contain references to other data values in Adams View.
These expressions do not remain constant; Adams updates them each time the referenced data
changes. Using expressions in this way allows you to make changes to one value and have this change
propagate throughout your entire model. This is called parameterizing your model. If you are
familiar with spreadsheets, this is identical to defining a cell as a function of another cell.
You construct Adams View expressions during model building. When Adams View reads an expression, it
either evaluates it and stores the value in its database, or stores the expression itself.
Adams View includes variable objects intended for use with expressions. When creating an Adams View
variable, you give it a name and a value. You can then include this variable, by name, in expressions; if you
change the value of the variable, then Adams View updates the expression. In fact, any design variable or other
object that changes will cause any expression that used it to re-evaluate. This allows you to parameterize your
model using design variables. You can use such a parameterized model to do design studies, design of
experiments, and optimizations.
Learn more (Expression Example).
Expression Syntax
The following sections introduce the elements you can use in expressions, and their proper syntax:
Data Types
Operands
Accessing the Database
Data Dictionary
Operators
Naming Conflicts
Data Types
All operands and the computed values of expressions are data that have a particular type. For information on
operands, see Operands. There are five data types that Adams View expressions support: integer, real, string,
matrix, and database object references. You can combine data of different types in an expression and Adams
View coerces the data to the type needed to evaluate the expression. The following table lists the data types
and their use.
24 Adams View Function Builder
Expression Language Reference
Operands
Operands allow you to indicate what you want to operate on. The kinds of operands allowed in Adams View
expressions are:
Literal Constants
Symbolic Constants
Functions
Database Objects and Their Component Values
Literal Constants
The first kind of operand is a literal constant value. Here are some examples of literal constant values:
Constant Value Examples
Symbolic Constants
The second kind of operand in an Adams View expression is the symbolic constant. Adams View defines
some frequently used constants with mnemonics, so you can use them easily and uniformly in your
expressions. The table below lists the symbolic constants and their values.
Symbolic Constants
25
Expression Language Reference
NONE is a constant that behaves in a unique way. It can be coerced to any type and allows you to erase values
from the database when used in certain contexts.
If used in arithmetic expressions, NONE equates to zero (10 + NONE is equal to 10). If used in string
expressions, NONE is the empty string. Both of these facts can occasionally be useful in forcing type
conversion of some value. For instance, the concatenation operator (//) takes a pair of strings and
concatenates them into one: NONE // 2 forces the number 2 to become a character string, and NONE +
"10" forces the string "10" to become the number 10.
The real power of the NONE constant is evident when it is used by itself in an expression, as shown by the
following example.
Certain physical parameters of a model make a distinction between the value zero and a non-existent value.
This is especially true during the solution of initial conditions of a model. Assume that you have an example
model consisting of two parts joined together with a fixed joint. An initial conditions solution computes the
initial velocities of these parts. If you assign one of the parts an explicit velocity, then Adams Solver sees that
the two parts are constrained and sets the initial velocity of the other. This can only work if the second part
has no velocity; if its velocity is undefined.
This command says that this part is not moving in the x direction, so its velocity is zero:
part modify rigid_body initial_velocity part=part_2 vx=0.0
The following command says that the velocity of this part is undefined, so you must examine other parts of
the model to determine its initial velocity:
part modify rigid_body initial_velocity part=part_2 vx=(NONE)
In general, setting a parameter to NONE sets that parameter's value to non-existent.
Functions
26 Adams View Function Builder
Expression Language Reference
A function is an operand that takes an argument list and computes a value based on the values contained in
the list. Each argument is an expression that is evaluated and then given to the function. Common examples
are SIN( ), SQRT( ), and ABS( ).
Adams View offers a wide variety of system-supplied design-time functions. For a complete list of design-time
functions and how to use them, see Design-Time Functions.
The EVAL function is a special purpose design-time function that allows removal of subexpressions and
dependencies from an expression. EVAL computes the value of its argument, without type coercion, and
replaces itself with this value. This means that when you recall an expression from the database it never
contains an EVAL function.
For example, if you create a variable whose value contains EVAL:
variable create variable=test real=(EVAL (2+2) / EVAL (2*3))
the database value for this variable is (4/6) and this is exactly the same as typing:
variable create variable=test real=(4/6)
There are two reasons to use the EVAL function:
To eliminate costly recomputation of constant subexpressions. For example:
(EVAL(SQRT(2.2) + SIN(.55) + ATAN2(3,2)) + x)
is replaced by:
(57.8027713349 + x)
Note that the second expression is significantly faster, but lacks the readability of the first.
It's very difficult to determine how Adams derived the constant 57.8027713349, and
without some documentation you would never guess that it is actually the value
SQRT(2.2) + SIN(.55) + ATAN(3,2).
Therefore, you use EVAL on subexpressions only when you can measure real time-savings,
and document the resulting values thoroughly.
To eliminate dependencies. You might encounter this problem when using loops:
for variable = XXX start=1 end=10
marker create marker=(UNIQUE_NAME("marker")) &
location=(EVAL(xxx)), 0, 0
end
If you don't use EVAL when defining the location of these markers, Adams parameterizes
them to the variable xxx and moves them at each iteration of the loop. This would result
in all of the markers being piled up at 10,0,0 after the loop terminated.
Database Objects and Their Component Values
Through expressions you can access most values stored in the Adams View database, regardless of whether
you entered them through the command language or read them from a file. Adams View lets you access
character strings, real numbers, integers, database objects, arrays, and boolean values.
27
Expression Language Reference
To identify the database values you want to reference, use extensions of their Adams View hierarchical names
by entering an entity's name and appending to it the name of the desired data field. The data an object owns
is listed in the data dictionary. For more information on the data dictionary, see Getting Data Owned by an Object.
References can be either rooted or local. Rooted references have the following characteristics:
Begin with a dot.
Contain each specific component in the naming hierarchy (see the Rooted References table below).
Parse faster than local references because they can be found by looking at the highest level of the
database.
Rooted References
Syntax Examples
The following examples show the proper syntax for a variety of operations.
Setting a value:
part modify rigid_body mass_properties part=part_1 & mass=100!
Computing a mass:
29
Expression Language Reference
tire.inertia_moments
For example, to obtain the x and y locations of Part_1, you could enter the following expression in the
Function Builder:
({(.model_1.PART_1.location[1]),(.model_1.PART_1.loc_y)})
In this case, Adams View would return the location -50.0, -200.0.
Data Dictionary
The data dictionary lists the field names and the aliases associated with them, as they appear in expressions.
You can access the data dictionary through the Function Builder, as explained in Getting Object Data.
Fields
Some database fields can't be parameterized. To determine if a specific field can be parameterized, try to
parameterize it and examine the result. If the result is a constant value, then that field can't be parameterized.
Adams View evaluates any expression that you enter in a field, and stores its result in the database.
Operators
You use operators to specify what you want to do to the operands. The operators table below lists the
operators supported in Adams View expressions. They are listed by precedence, with grouping being the
highest precedence operator.
Note: Just as in FORTRAN, the exponentiation operator has precedence over the unary minus
operator, and exponentiation associates from right to left
Operators
31
Expression Language Reference
Operator: It means:
() Grouping
[] Indexing. Any matrix or multi-valued database object can be indexed.
** Exponentiation
- Unary minus = negation
*/ Multiplication/division
@ Matrix multiplication
+- Addition/subtraction
Relational. These operators allow you to compare objects of the same type.
less than
< less than or equal to
<= equal to
== greater than
> greater than or equal to
>= not equal to
!=
! Logical NOT. True if operand is false.
&& Logical AND. True if both operands are not zero.
|| Logical OR. True if either operand is not zero.
// String/array concatenation. If either operand is a character string, the other is coerced into
a string, and they are combined. If one or both are arrays, then they are coerced to arrays
with like elements and concatenated using the STACK function (see the STACK function
example).
Real expressions containing integer division convert operands to real before division. This results in values as
Adams View computes them, using mixed-mode arithmetic,
1.0 + 1/3 = 1.333
not as Fortran and C compute them,
1.0 + 1/3 = 1.0
Also, in Adams View, 8/10 is equal to 0.8.
Whenever Adams View encounters a value of an inappropriate type in an expression, it attempts to coerce it
to the proper type. If coercion fails, Adams View doesn't evaluate the expression and generates an error
message. Operators determine coercion: the symbol + forces its operands to be numeric. Coercion is not
order-dependent. The following table provides coercion examples:
Coercion Examples
32 Adams View Function Builder
Expression Language Reference
(2+2=4; 4//3=43)
marker_1 + 1 Error Cannot convert database object to integer.
Naming Conflicts
In Adams View you can create objects with names matching symbolic constants or matching the name of a
data field of the created object. However, you should avoid doing this because it can make expressions
confusing. If you must, however, Adams View has precedence rules for resolving these name conflicts.
Consider the commands:
model create model=model_1
part create rigid_body name_and_position part_name=PI
part create rigid_body name_and_position part_name=part_1
marker create marker_name=.model_1.part_1.location
The name of part PI matches the symbolic constant PI, and the marker name .model_1.part_1.location
matches the location field in the part named .model_1.part_1.
In the case of an object name being the same as a symbolic constant, using local names results in an error
because Adams View looks for symbolic constants before database objects. Therefore, you need to use a
rooted name to access the objects. For example:
(PI.mass) Returns errors--PI is interpreted as a symbolic
constant
(.model_1.PI.mass) Returns the mass of part named PI
In the case of naming an object the same as a data field in the object being created, Adams View always returns
the object instead of the field. For example, (part_1.location) returns the marker named location, not the
location of the part.
model similar to the more complex Adams View positioning features, such as RELATIVE_TO,
ALONG_AXIS, and IN_PLANE. Certain functions, such as LOC_RELATIVE_TO, work independently of any
local reference frame. If part, marker or other similar statements have a location or orientation parameter, the
RELATIVE_TO can modify the values you supply.
For example, you might execute the following statements:
part create rigid_body name_and_location create part=part_1 location=1,1,1
part create rigid_body name_and_location create part=part_2 location=2,2,2
marker create marker=marker_2 location=0,0,0 relative_to=part_1
The above statements place marker_2 on part_1. In this case, the RELATIVE_TO parameter modifies the
marker location you supplied.
When you use expressions for location or orientation, Adams View ignores the RELATIVE_TO parameter.
In the following example, the RELATIVE_TO parameter plays no role for the location, but does apply to
the orientation, since it doesn't have an expression:
marker create marker=marker_3
location=(LOC_RELATIVE_TO({0,0,0}, part_1)) &
orientation=90d,0,0
relative_to=(Part_2)
Locating Objects in Both Absolute and Relative Terms
To allow you flexibility in entering locations and orientations for objects, such as parts and markers, Adams
View lets you specify a relative_to reference frame.
For example, you might know where a particular marker should be placed in absolute space, or you might
know its location with respect to its part. In the first case, you could create the marker as follows:
marker create marker=.mod_1.part_1.marker_1
location=0,2,4 relative_to=.mod_1
In the second case, you would create the marker relative to part_1 to which it belongs:
marker create marker=.mod_1.part_1.marker_1
location=0,1,2 relative_to=.mod_1.part_1
This works for any reference frame (marker or part) that you might want. All you need to do is just create an
object (markers are convenient) at the correct location and with the correct orientation, then specify new
locations and orientations relative_to that object.
When defining the locations or orientation of objects using expressions, you cannot use a relative_to reference
frame. With the above commands, Adams View transforms the information you supply for location and
relative_to into a location relative to the part that owns the marker, and discards the values you entered. This
loss of information is usually of no consequence, as you can easily reconstruct it (that is, you can set
relative_to to anything you want and see the location or orientation expressed in that reference frame).
In both of the above cases, the value stored in the database for marker1's location is (0,1,2), and the value you
supplied in the relative_to parameter is discarded. (Not only is the location stored relative to the part, it is
also stored in Cartesian coordinates, so if you are using cylindrical or spherical coordinates on data entry, that
information is also discarded.) Expressions are not this easily manipulated. The original information that you
enter for a location expression must be maintained in the Adams View database to evaluate that expression.
This means that there are restrictions when you want to use expressions:
35
Expression Language Reference
However, LOC_ON_AXIS places the marker one unit off in the direction (it is at a global position of
(5,11,0) instead of the expected (4,11,0)). The LOC_ON_AXIS function computes a location in global
space, so when you use the results of this function directly to locate a marker, the marker might not appear
where you expect it. The solution is to use the results of the LOC_ON_AXIS function as an argument to the
LOC_RELATIVE_TO function, which transforms the global result into that which the marker expects:
marker create marker=.mod1.part_3.marker_3 & location=
(LOC_RELATIVE_TO(LOC_ON_AXIS(marker_2, 5, "X"), .mod1))
Without this, the value is implicitly used relative to the owning part of the marker, therefore marker_3
appears in the wrong location.
36 Adams View Function Builder
Expression Language Reference
Arrays
In the Adams View expression language, an array is a collection of values of the same scalar type.
Array Examples
Array: Example:
{1, 2, 3} Array of integers
{"red", "green", "blue"} Array of character strings
{.model_1, .model_1.part_1, part_3} Array of objects
{1.2, 3.4, 5.6} Array of real numbers
Arrays of real numbers can be multi-dimensional. This type of array is called a matrix and is explained in
Matrices of Real Numbers.
When you create an array with elements of different type, Adams computes the element type to be the least
common denominator, that is, something that works for all of the elements. Here are the rules for
determining element type:
1. A string in an array forces all other elements to become strings:
{1, "red", marker_1} becomes {"1", "red",
".model_1.part_1.marker_1"}
2. If objects and numbers are mixed, the element type is string (since objects cannot be coerced to
numbers and numbers cannot be coerced to objects):
{0, marker_1} becomes {"0", ".model_1.part_1.marker_1"}
3. Mixed integer and real numbers are all converted to real numbers:
{1, 2.5, 3} becomes {1.0, 2.5, 3.0}
The next sections explain the different types of arrays.
Empty Arrays
Concantenating Arrays
Matrices of Real Numbers
Empty Arrays
Adams View allows arrays to be empty. This is denoted by a pair of braces {}.
variable create variable=list real=({})
Note that this is distinctly different than the use of NONE; the value of the variable named list is an array
that contains no values.
The following command creates a variable, named nothing, that contains an undefined value:
variable create variable=nothing real=(NONE)
37
Expression Language Reference
The next section shows how such variables are different in a practical sense.
Concatenating Arrays
The concatenation operator works with arrays to attach one array to the end of another. The following
sequence of commands creates a variable, named list, that contains the 11 values from 10 to 20 (the SERIES
function would provide a more effective way of doing this):
variable create variable=list real=({})
for variable=value start=10 end=20
variable modify variable=list real=(EVAL(list // {value}))
end
The values resulting from the above example are: {10,11,12,13, ..... 20}.
If you create the initial value for list using NONE, as in the following example, you end up with a 12-element
array containing an undefined value as the first element, followed by the values 10 through 20.
variable create variable=list real=(NONE)
The values resulting from the above example are: {0,10,11,12,13,..... 20}. In this case, the undefined value is
0.
For example, if you've obtained a 3x3 transformation matrix via the TMAT function, you could use it to define
a polyline, polyline_3. Here, polyline_3's location matrix has been parametrically defined as being dependent
upon the array of polyline_2's location, and the angular orientation of marker_1.
Adams automatically converts a 1x1 matrix into a scalar if the context demands it, such as if the matrix is
being passed as a parameter to a function that requires a scalar.
Matrix
Adams matrix syntax: General math matrix syntax: dimension:
3x1
1
2
3
3x2
1 2
3 4
5 6
{[11,12,13], [21,22,23], [31,32,33]} = 3x3
11 12 13
21 22 23
{{11,21,31}, {12,22,32}, {13,23,33}}
31 32 33
{[1,2,3]} = {{1}, {2}, {3}} [1 2 3] 1x3
Indexing
Indexing allows you to reference elements within a matrix, as shown in the table below:
Indexing in Adams
40 Adams View Function Builder
Expression Language Reference
Mathematical
Adams index syntax: description: Math result: Adams result:
Element in 2nd row, 8
1st column of the 3 x 9
1 matrix 8
7
{[5,4,3]}[1,2] Element in 1st row, 4
2nd column of the 1 5 4 3
x 3 matrix
{[8,9], [5,6]}[2,1] Element in 2nd row, 5
1st column of 2 x 2 8 9
matrix 5 6
{1,2,3}[2] Element in 2nd row, 2
(see Note below) of the 1
3 x 1 matrix 2
3
Note: You can omit the second index when a matrix is 1xN (1 row) or Nx1 (1 column).
You can use ranges of indexes to reference several elements of a matrix as shown in the table below:
Using Ranges of Indexes
Mathematical
Adams index syntax: description: Math result: Adams result:
{[1,2,3], [4,5,6], 2nd to 3rd rows of {[4,5], [7,8]}
[7,8,9]}[2:3,1:2] the 1st to 2nd 1 2 3
column 4 5 6
7 8 9
You can also extract a complete row of a matrix as shown in the table below:
Extracting a Complete Row
41
Expression Language Reference
Mathematical
Adams index syntax: description: Math result: Adams result:
{9,8,7}[2] Element in 2nd row 8
in 3 x 1 matrix 9
8
7
{9,8,7}[2,1:1] Element in 2nd row, 8
1st column of 3 x 1 9
matrix 8
7
{9,8,7}[2,*] Element in 2nd row, 8
all columns of 3 x 1 9
matrix 8
7
{[8,9], [5,6]} [1,1:2] Element in 1st row, {[8,9]}
1st to 2nd column of 8 9
2 x 2 matrix 5 6
{[8,9], [5,6]}[1,*] Element in 1st row, {[8,9]}
all columns of a 2 x 2 8 9
matrix 5 6
Note: Indexing automatically converts any matrix with one element into a scalar.
Expression: Result:
marker_1.location {8,7,6}
marker_1.location [2] 7
Adams View handles fields containing more than one location or orientation as 3xN matrices. For example,
consider the three-point polyline defined below:
geometry create curve polyline polyline=polyline_1 loc=1,2,3,
4,5,6, 7,8,9
3xN Matrix
43
Expression Language Reference
Expression: Result:
polyline_1.location {{1,2,3}, {4,5,6}, {7,8,9}}
or
Note the usefulness of this matrix format. If you have a 3 x 3 transformation matrix, T (T, as produced by
the TMAT function), then post-multiplication by any matrix of locations or orientations produces a new
matrix of the same shape. For example:
T @ marker_1.location (3x3 times 3x1) produces a 3x1 matrix.
T @ polyline_1.location (3x3 times 3xN) produces a 3xN matrix.
Using matrix composition with database objects, you can create a three-point polyline from marker locations:
geometry create curve polyline polyline=polyline_1 &
loc=({marker_1.location, {0,0,0}, marker_2.location})
The illustration below shows a three-point polyline:
For fields with multiple values, but with a single dimension, you create a 1 X N matrix:
data_element create spline spline=spline_1 x=1,2,3,4,5
y=2,3,4,5,6
1xN Matrix
Expression: Result:
spline_1.x {[1,2,3,4,5]}
spline.x[2] 2
Note: The same indexing operations that you can perform on database fields you can perform on a
matrix with the same shape.
Operators On Matrices
44 Adams View Function Builder
Expression Language Reference
The following table lists the operators by precedence, from highest to lowest. All the standard binary
operators are applicable to same-shape matrices (SSM), that is, matrices with the same row and column order,
in a pair-wise fashion. Only one operator, the matrix multiplication operator (@), is not defined for SSM.
Operators on Matrices
Expression: Result:
SIN({1,2,3}) {0.841471, 0.909297, 0.141120}
ATAN2({1,2,3}, {3,2,1}) {0.321751, 0.785398, 1.249046}
ATAN2(3, {2,1}) {0.982794, 1.249046}
If you write a function ADD(x,y) that computes x+y, then, ADD(1,2) returns 3 and ADD({1,2,3}, {4,5,6})
returns {5,7,9}.
Units
Adams View allows you to assign units to numbers to explicitly define dimensions. For instance, the number
90 might be meaningful in the context of an angle only if it has units of degrees, while the number 3.14159
should probably have units of radians. Therefore, Adams View allows you to place labels on these values:
(90d) or (3.14159r).
The following sections introduce you to unit sensitivity and unit labels:
Unit Sensitivity
Unit Labels
Unit Sensitivity
The expressions you store in the database can be unit-sensitive, meaning that changing the current units
results in a different value for the expression.
For example, if your model mass units are grams (g) and you have the part commands,
part_1 mass = 20
46 Adams View Function Builder
Expression Language Reference
Unit Labels
To label an expression with units, you can use either simple unit labels or composed unit labels:
Simple Unit Labels
Composed Unit Labels
Simple Unit Labels
Simple unit labels are derived from the DEFAULTS UNITS command. Any unique abbreviation for a simple
unit label is acceptable (radians = radian = radia = radi = rad = ra = r, since r doesn't conflict with any
abbreviation for other units).
All of the simple unit labels, and their minimal abbreviations are listed in the table shown next, by their base
units, in alphabetical order:
Simple Unit Labels and Their Minimal Abbreviations
47
Expression Language Reference
Note: For kilopound mass, kilonewton, and kilopound force, enter kpound_mass, knewton, and
kpound_force, respectively
There are three exceptions to unique aliases, as shown in the following table:
Exceptions to Aliases
The next table shows some examples of simple unit labels associated with a number within expressions:
Simple Unit Labels Associated with Numbers
Syntax: Comment:
1millimeter Full label
1.2 inch Spaces are not significant
24in You can use abbreviations
PI rad You can apply unit labels to any expression, including symbolic constants
Note: To eliminate ambiguity, always enclose unit labels in parentheses. In general, if you see units
associated with numbers produced by the list_info command in a command file or anywhere
else, you can take that units string and use it in an expression.
50 Adams View Function Builder
Adams View Function Builder Glossary
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z
A-B
Acceleration Functions
Run-time functions that return a requested magnitude or component of the translational or rotational
acceleration vector between two markers.
Adams View
MSC Software's powerful modeling and simulating environment.
Aliases
Alternate names you can use when referencing fields on objects in the database.
Argument
A value which is applied to a function as an input.
Array
In the Adams View expression language, an array is a collection of values of the same scalar type.
B-spline Fitting Method
Returns a B-spline or a user-written curve created by a CURVE data element.
C-D
Coercion
Changing the type of a value. For example, changing from real numbers to character strings.
Command Window
An Adams View window where you can enter commands directly, instead of using menus. The commands
correspond to menu selections and the parameters correspond to dialog box choices. You can either enter a
full command or an abbreviation of a command.
51
Adams View Function Builder Glossary
Compiled Functions
Functions you can write in C or Fortran, link into Adams View, and then even use in an Adams View
expression. See also the definition for Interpreted Functions.
Constant
An operand which is either literal, such as 3.2 or "hello", or symbolic, such as PI or SQRT2.
Contact Functions
Run-time functions you can use to define collision forces.
Data Dictionary
Lists the names of the object types, and the fields associated with them, as they appear in expressions.
Data Types
The types of operands and computed values of expressions. There are five types: integer, real, string, matrix,
and database object.
Database Access
You can access the database to retrieve values from it to use in computing new values.
Database Functions
Design-time functions that facilitate your access to the database.
Database Objects
Objects stored in the Adams View database.
Design-Time Functions
Allow you to parametrically configure the system being analyzed for such effects as optimization and
sensitivity studies.
Design Variables
Variables that store data which you can later use and modify.
52 Adams View Function Builder
Adams View Function Builder Glossary
Displacement Functions
Run-time functions that return scalar measures associated with a particular component of the translational
displacement vector from one coordinate system marker to another or an angular displacement from one
coordinate system marker to another.
E-F
Empty Array
Array that does not contain any values; denoted by a pair of braces { }.
Expressions
Combinations of constants, operators, functions, and database object references, all enclosed in parentheses.
You use expressions to specify parameters in your model or to allow Adams View to calculate values.
Expression Mode
Function Builder mode in which Adams updates the functions you create during the modeling process.
Force
An effect that has magnitude and direction and that causes motion of a body when there is no other external
effect on that body. In Adams View, force can refer to both translational and rotational forces.
Function
An operand that takes a list of arguments and computes a value based on the values in the list. Each argument
in the list is an expression that is evaluated and given to the function. Common functions are: SIN( ), ABS (
), and THETA( ).
Function Builder
Adams View tool that allows you to build functions and parameterize values for various entities.
Function Category
Collection of functions grouped according to their type. For example, the function categories include: math
functions, string functions, and database functions.
53
Adams View Function Builder Glossary
I-J
Interpreted Functions
User-written design-time functions created in Adams View by using the function create command. They may
be used in Adams View expressions. See also the definition for Compiled Functions.
K-L
M-N
Math Functions
Design-time or run-time functions that apply to scalar numbers or matrices. When working in design-time,
if you input a scalar, Adams returns a scalar, and if you input a matrix, Adams returns a matrix.
Matrix
A multi-dimensional collection of numeric values; a special case of array.
Miscellaneous Functions
Design-time functions that include a variety of functions.
Modeling Functions
Design-time functions that return a requested kinematic measurement between markers or parts.
O-P
Object
See the definition for Database Objects.
Operands
Operands allow you to indicate what you want to operate on. The following are types of operands: literal
constants, symbolic constants, function results, and database objects and their component values.
54 Adams View Function Builder
Adams View Function Builder Glossary
Operators
Operators allow you to specify what you want to do to operands.
Optimization
Helps you find an optimal design. You define the design objective and specify the model parameters that can
change.
Orientation Angles
Angles that define three rotations about the axes of a coordinate system.
Parameterization
Allows you to define an invariant relationship between model objects or their values.
Q-R
Run-Time Functions
Allow you to specify mathematical relationships between variables that directly define the behavior of your
model.
Run-Time Mode
Function Builder mode in which you define the functions Adams Solver uses during a simulation.
S-T
Single-Component Force
A force defined as one resultant magnitude along a direction.
Spline Functions
Run-time functions you can use during a simulation to define smooth functions to approximately fit data
points.
String Functions
Design-time functions that allow you to manipulate character strings.
55
Adams View Function Builder Glossary
Symbolic Constant
A kind of operand in an Adams View expression, represented by an easily understood name, such as PI.
System-supplied Functions
Functions built into Adams View or Adams Solver.
U-V
User-written Functions
Design-time functions you can create yourself. There are two types of user-written functions: interpreted and
compiled.
Velocity Functions
Run-time functions that return a requested magnitude or component of the translational or rotational
velocity vector between two markers.
56 Adams View Function Builder
Adams View Function Builder Glossary
About Design-Time Functions 59
User-Written Functions
Design-Time Functions
About Design-Time Functions
Design-time functions allow you to parametrically configure the system you're analyzing for such effects as
optimization and sensitivity studies.
This section provides examples of Adams design functions by type. The two major types of design-time
functions are:
User-Written Functions
System-Supplied Functions
In the Function Builder, you can enter expressions on multiple lines. Once you apply an expression, however,
it appears in the code on one line.
User-Written Functions
User-written functions are functions you can create yourself. There are two types of user-written functions:
interpreted and compiled.
The following sections explain the user-written functions:
Interpreted Functions
Compiled Functions
Examples Involving Compiled Functions
Interpreted Functions
Interpreted functions consist of text inserted into an expression when Adams evaluates the expression. You
can create these functions in the command window, using the FUNCTION command. When you create
them, you must specify the text of the function and the parameter names. When you use these functions,
Adams substitutes the user parameters into the function text in place of the parameter names.
For example:
function create function_name = MID_PT &
text_of_expression = "LOC_ALONG_LINE(P1,P2,DM(P1,P2)/2)" &
argument_names = "P1", "P2" &
type = location_orientation
In the example above, P1 and P2 are the formal arguments to the function MID_PT.
In the following example, Adams positions marker_3 half way between marker_1 and marker_ 2:
marker create marker_name = marker_3 location=(MID_PT(marker_1,
marker_2))
60 Adams View Function Builder
User-Written Functions
Compiled Functions
You can also write compiled functions in C or FORTRAN, link them into Adams View, and even use them
in an Adams View expression. You can use these functions in the same way you would use the built-in
functions.
Register the user-written functions by calling a subroutine built in to Adams View. You must place this
subroutine call in the registration subroutine supplied in source-code form with Adams View.
The source code for the DMAT function is given below as an example of how to use this interface:
vc_ARRAY vc_dmat(vc_ARRAY A)
{
vc_ARRAY NewArray;
vc_DIMS Dims;
int Size;
int Rank;
BOOL ColV;
REAL *Values;
int i;
vc_array_get_dims(A, Dims, &Rank, &ColV);
/* Verify the shape of the input array */
if ( Rank > 2 || Dims[0] != 1 && Dims[1] != 1 )
{ vc_error("DMAT only works with a 1xN or Nx1 matrix, this
one is %dx%d", Dims[0], Dims[1]);
}
Size = vc_array_element_count(A);/* Set up dimensions of new
array */
Dims[0] = Size;
Dims[1] = Size;
About Design-Time Functions 63
System-Supplied Functions
System-Supplied Functions
The Function Builder gives you access to over two hundred system-supplied, design-time functions. In
addition, you can create your own user-written functions.
Design-time functions are evaluated only during the modeling process, not during a simulation. Note that
although some design-time functions have the same names as certain run-time functions, they work with the
model definition only, not with the model at an analysis-time step. Adams View does, however, evaluate
design-time functions during design studies and optimization.
The Function Builder categorizes all system-supplied functions based on their functionality. For example, a
category might include all math functions or all database functions. A category named All Functions lists all
the functions in alphabetical order. You can use and access the system-supplied design-time functions from
the Function Builder, as outlined in Working in Expression Mode.
The following sections introduce the system-supplied function categories as they appear in the Function
Builder:
Math Functions
Location/Orientation Functions
Modeling Functions
Matrix/Array Functions
String Functions
Database Functions
Miscellaneous Functions
Math Functions
Math functions apply to scalar numbers or matrixes. If you input a scalar, Adams returns scalar. If you input
a matrix, Adams returns a matrix.
Where to Find the Math Functions
The following table lists the names and definitions for the math functions:
64 Adams View Function Builder
System-Supplied Functions
Location/Orientation Functions
You can use location/orientation functions to compute one or more locations or orientations from a variety
of input parameters.
Where to Find the Location/Orientation Functions
The following table lists the names and definitions for the location/orientation functions:
Modeling Functions
Kinematic modeling functions return a requested displacement measurement between markers or parts.
Although these functions have the same names as certain run-time functions, they only compute an
instantaneous value in the context of a design-time function. These functions work with the model definition
only, not with a model at an analysis-time step.
Modeling functions' arguments use any coordinate system entity (marker, part), any entity implying a
coordinate system (model, geometry) or zero (0). If an argument uses a coordinate system entity or any entity
implying a coordinate system, it is referred to as a coordinate system object. If the argument is zero, Adams
defaults to the global coordinate system.
Where to Find the Modeling Functions
The following table lists the names and definitions for the modeling functions:
Matrix/Array Functions
Matrix/array functions allow you to easily perform common matrix operations.
Where to Find the Matrix/Array Functions
The following table lists the names and definitions for the matrix/array functions:
String Functions
String functions allow you to manipulate character strings.
Where to Find the String Functions
The following table lists the names and definitions for the string functions:
About Design-Time Functions 73
System-Supplied Functions
Some of the functions in the Miscellaneous Functions category are related to the functions in this category.
Those functions are:
ON_OFF
STOI
STOO
STOR
Database Functions
Database functions facilitate your access to the database.
Where to Find the Database Functions
The following table lists the names and definitions for the database functions:
Some of the functions in the Miscellaneous Functions category are related to the functions in this category.
Those functions are:
EXPR_EXISTS UNIQUE_FULL_NAME
EXPR_STRING UNIQUE_NAME
PARAM_STRING USER_STRING
Back to top
Miscellaneous Functions
To further assist you, we've divided the miscellaneous functions into four groups, as listed below.
Database Functions Group
GUI Functions Group
String Functions Group
System Functions Group
Database Functions Group
The following table lists the names and definitions for the functions in the database functions group:
About Design-Time Functions 77
System-Supplied Functions
Functions: A - C
Functions: A - C 83
Design-Time Function Descriptions
ABS
Returns the absolute value of an expression that represents a numerical value.
Format
ABS(x)
Argument
Example
The following example illustrates the use of the ABS function:
Function ABS(3*(-.89))
Result 2.67
ACOS
Returns the arc cosine of an expression that represents a numerical value. The evaluated expression must
return a value whose absolute value is less than or equal to 1.0. The value ACOS returns lies in the range [0, π
], that is, 0 ≤ ACOS(x) ≤ π .
Format
ACOS(x)
Argument
Examples
The following examples illustrate the use of the ACOS function:
Function ACOS(.75)
Result 41
Function ACOS(PI/4)
Result 38
AGGREGATE_MASS
Calculates and stores aggregate mass information, which you can then use in parametrics or store in variables
for future use.
Format
aggregate_mass(array_of_objects, reference_frame_key, type_string)
Arguments
array_of_objects A single object or an array of objects of the type models, bodies, and tires. If you
specify a model, it must be the only object passed in.
reference_frame_key A reference frame for reporting the aggregate mass center of mass (cm) position
and inertia marker angles. If you enter none, the default is with respect to the
global coordinate system.
type_string The type of aggregate mass information desired. The choices are:
Examples
Computing Mass
Note that the objects must be in an array; therefore, the curly braces are required. In this example, the
reference frame key has been set to zero because the value of mass is independent of the reference frame.
Computing CM Location
The following example returns the location of the cm for the aggregation of PART_2 and PART_3. The
location array will be computed and reported with respect to the ground.MARKER_3 reference frame.
AGGREGATE_MASS( {PART_2, PART_3} , ground.MARKER_3 ,"CM_Pos" )
Obtaining Inertia Matrix Entries
The following example returns the off-diagonal entries of the inertia matrix for the aggregation of PART_2
and PART_3 in the ground reference frame. Note that array indexing has been used to return the 4th, 5th,
and 6th entries from the returned array.
86 Adams View Function Builder
Design-Time Function Descriptions
Note: If you use the option all, use a no_units temporary variable to get all of the quantities at once,
and then pass it to individual variables with the proper unit setting.
AINT
Returns the nearest integer whose magnitude is not larger than the integer value of a specified expression that
represents a numerical value.
AINT(x) evaluates to different values under different conditions:
AINT(x) = 0 if ABS(x)< 1
AINT(x) = int(x) if ABS(x) 1
The value of the mathematical function AINT of a variable x is equal to x if x is an integer. If x is not an
integer, then AINT(x) is equal to the integer nearest to x, whose magnitude is not greater than the magnitude
of x.
Format
AINT(x)
Argument
Examples
The following examples illustrate the use of the AINT function:
Function AINT(-6.5)
Result -6
Function AINT(4.6)
Result 4
AKIMA_SPLINE
Creates an interpolated curve from input points with a specified number of values. Interpolates using the
Akima method.
The algorithm that fits the akima spline is from the Journal of the Association of Computing Machinery (Vol.
17, No. 4, October 1970).
The length of the Independent Data array must be the same as the Dependent Data array.
Format
AKIMA SPLINE (Independent Data, Dependent Data, Number of Output Values)
Arguments
Independent Data A 1xN array of x values for the curve to be interpolated. The x values must
be in ascending order, and the length of the array must be greater than or
equal to 4.
Dependent Data A 1xN array of y values for the curve to be interpolated.
Number of Output Values The number of values to be generated in the output array.
Example
The following function interpolates a set of four points with ordinal values from 1 to 4 and abscissal values
as shown, into a series of 10 abscissal values:
To compute the ordinal values for these splined values, you can use the SERIES2 function as follows:
AKIMA_SPLINE2
Returns an Akima-spline fit of the dependent values. It clips the output data to start at the maximum start
point of the two independent value arrays and ending at the minimum end point of the two independent
value arrays.
When the FLAG is 1, AKIMA_SPLINE2 uses the first set of independent values to determine the step size.
When FLAG is 0, it uses the second set of independent values.
Format
AKIMA_SPLINE2 (Independent Data, Dependent Data, Independent Data2, FLAG)
Arguments
Independent Data A 1xN array of x values for curve1 to be interpolated. The x values must be in
ascending order, and the length of the array must be greater than or equal to 4.
Dependent Data A 1xN array of y values for curve1 to be interpolated.
Independent Data2 A 1xN array of x values for curve2 to be interpolated. The x values must be in
ascending order, and the length of the array must be greater than or equal to 4.
FLAG Integer indicating whether the first or second set of independent values were used
to determine the output step size.
ALERT
Returns an alert box using the labels you specify. It is recommended to use EVAL() function when using
ALERT, both to avoid unnecessary parameterization and for it to function properly.
Format
ALERT (Type, Message Text, Button 1 Label, Button 2 Label, Button 3 Label, Default Choice)
Arguments
Type Text string indicating the type of alert box. There are five types from which to choose:
Error
Warning
Information
Working
Question
Message Text Text string making up the alert box message.
Button 1 Label Text string describing a command button.
Button 2 Label Text string describing a command button.
Button 3 Label Text string describing a command button.
Default Choice Integer value (1, 2 or 3) indicating which command button is the default choice.
Example
The following function creates an alert box:
ALERT2
Displays the contents of the variable on separate lines and presents an OK button. It always returns 1. It is
recommended to use EVAL() function when using ALERT2, both to avoid unnecessary parameterization and
for it to function properly.
Format
ALERT2 (var, type)
Arguments
Error
Warning
Information
Working
Question
Example
var set var=msg str="Out of", "disk", "space"
var set var=OK int=(EVAL(ALERT2 (msg.self, "ERROR")))
Learn more about GUI functions.
92 Adams View Function Builder
Design-Time Function Descriptions
ALERT3
Displays the contents of the variable on separate lines and presents an alert window with up to three buttons
containing specified labels. It is recommended to use EVAL() function when using ALERT3, both to avoid
unnecessary parameterization and for it to function properly.
Format
ALERT3 (var, type, b1, b2, b3, choice)
Arguments
Error
Warning
Information
Working
Question
b1 A character string to display on button 1.
b2 A character string to display on button 2.
b3 A character string to display on button 3.
choice An integer designating the default button number.
Example
var set var=msg str="Out of", "disk", "space"
var set var=OK int=(ALERT3 (msg.self, "ERROR", "OK", "Cancel",
"", 1))
Learn more about GUI functions.
Functions: A - C 93
Design-Time Function Descriptions
ALIGN
Shifts values in an array to start at a particular value (often used to shift a curve so that the value at its starting
point is 0--aligning along the curve to 0).
Format
ALIGN (real array, real number)
Argument
Examples
The following example shifts curve_1 to start at the same value as curve_2.
ALIGN (.plot_1.curve_1, .plot_1.curve_2.Y_data[1])
The following example shifts curve_1 to start at 0.
ALIGN (.plot_1.curve_1, 0)
Learn more about matrix/array functions.
94 Adams View Function Builder
Design-Time Function Descriptions
ALLM
Returns the logical product of the elements of a matrix. If all values are nonzero, then the result is nonzero.
Format
ALLM (M)
Argument
Examples
The following examples illustrate the use of the ALLM function:
ANGLES
Returns a 3x1 matrix containing angles from the transformation matrix in D.
Format
ANGLES (D, OriType)
Arguments
Example
The following function performs the inverse of the TMAT function:
ANGLES(DCOS, "body313")
You can obtain the current default orientation type string with this expression:
(user_string(".system_defaults.orientation_type"))
Learn more about matrix/array functions.
96 Adams View Function Builder
Design-Time Function Descriptions
ANINT
Returns the nearest integer whose magnitude is not larger than the real value of an expression that represents
a numerical value.
ANINT(x) evaluates to different values under different conditions, as defined below:
ANINT(x) = int(x + .5) if x > 0
ANINT(x) = int(x - .5) if x < 0
The value of the mathematical function ANINT of a variable x is equal to x if x is an integer. If x is not an
integer, then ANINT(x) is equal to the integer nearest to x whose magnitude is not greater than the
magnitude of x.
Format
ANINT(x)
Argument
Examples
The following examples illustrate the use of the ANINT function:
Function ANINT(-4.6)
Result -5
Function ANINT(4.6)
Result 5
ANYM
Returns the logical sum of the elements of a matrix. If any value is nonzero, the result is nonzero.
Format
ANYM (M)
Argument
Examples
The following examples illustrate the use of the ANYM function:
APPEND
Returns the rows of one matrix appended to the rows of another matrix. The two matrixes must have the
same number of rows. If one matrix is an NxM matrix and the other matrix is an NxP matrix, then APPEND
returns an Nx(M+P) matrix.
Format
APPEND (M1,M2)
Arguments
Example
The following example illustrates the use of the APPEND function:
1,2,3,11,12,13,14
4,5,6,15,16,17,18
Arguments
Name array
• Body: Name of flexible body or part with a rigid stress object.
• Analysis: Name of analysis (optional)
Integer array
• Value: Flag for value of stress or strain to use.
• Type: Flag for stress (1) or strain (2) (optional). Default is stress (1).
Real array
• Threshold: Return all hot spots that exceed this value.
• Radius: Distance between hot spots (unit of length).
• Start: Time to start checking for hot spots (optional). Default is the beginning of the analysis.
• End: Time to stop checking for hot spots (optional). Default is the end of the analysis.
Returns
Real 6 x N array - N rows of hot-spot data with the following information:
• X, Y, Z: Location of hot spot on body, with respect to local part reference frame (LPRF).
• Time: Time when the maximum value occurred.
• Value: Maximum value of hot spot.
• Node: Node ID of hot spot.
100 Adams View Function Builder
Design-Time Function Descriptions
Arguments
Name array
• Body: Name of flexible body or part with a rigid stress object.
• Analysis: Name of analysis (optional)
Integer array
• Value: Flag for value of stress or strain to use.
• Type: Flag for stress (1) or strain (2) (optional). Default is stress (1).
Real array
• Percent: Number of hot spots to return, expressed as a percentage (%). If set to zero (0.0), the
count argument is used to determine how many to return.
• Radius: Distance between hot spots (unit of length).
• Start: Time in the analysis to start checking for hot spots (optional). Default is the beginning of
the analysis (unit of time).
• End: Time in the analysis to end check for hot spots (optional). Default is the end of the analysis
(unit of time).
Count: Number of hot spots to return.
Returns
Real 6xN array - N rows of hot-spot data with the following information:
• X, Y, Z: Location of hot spot on body (with respect to LPRF).
• Time: Time when the maximum value occurred.
• Value: Maximum value of hot spot.
• Node: Node ID of hot spot.
Functions: A - C 101
Design-Time Function Descriptions
ASIN
Returns the arc sine of an expression that represents a numerical value. ASIN is defined only when the
absolute value of the expression is ≤ 1. The range of ASIN is [ – π /2, π /2] (that is, – π /2 < ASIN(x) <
π /2).
Format
ASIN(x)
Argument
Example
The following function calculates the value of the expression DX(marker_2, marker_1, marker_2) /
DM(marker_2, marker_1). It then applies the ASIN function to the result and returns its arc sine. The
location of marker_1 and marker_2 is shown in the figure below.
ATAN
Returns the arc tangent of an expression that represents a numerical value. The range of ATAN is [- π /2, π /2]
(that is, – π /2 < ATAN(x) < π /2).
Format
ATAN(x)
Argument
Example
The following example illustrates the use of the ATAN function. The location of marker_1 and marker_2 is
shown in the figure below.
ATAN2
Returns the arc tangent of two expressions, each representing a numerical value. x1 and x2 themselves can be
expressions.
Format
ATAN2(x1, x2)
Arguments
Example
The following function shows the arc tangent of the expression a/b where a is the x component of the distance
between marker_2 and marker_1 and b is the y component of the distance between marker_2 and marker_1.
The location of marker_1 and marker_2 is shown in the figure below.
AVIEW_EDIT_FILE
This function will invoke given file, open in notepad window for the user to edit as they see fit. Also this
function can be used to view status of the file. View/edit the specified configuration file, input file and so on.
The program used to open the file depends on the environment variable:
MDI_AVIEW_TEXT_EDITOR
However its default value is: C:\Windows\notepad.exe
Format
AVIEW_EDIT_FILE (STRING)
AVIEW_EDIT_FILE( "P:\\work\\aview.cmd" )
Arguments
Example
The following example illustrates the use of the AVIEW_EDIT_FILE function:
AX
Returns the angular displacement from one coordinate system object to another, and accounts for angle
wrapping.
Format
AX (Object, Reference Frame)
Arguments
Symbol
Mathematically, AX is calculated as follows (angle wrapping is accounted for):
AX = atan 2 ( – ẑ o • ŷ R, ẑ o • ẑ R )
where:
• ẑ o is the z-axis of the Object, O.
• ŷ R is the y-axis of the Reference Frame, R.
• ẑ R is the z-axis of the Reference Frame, R.
Example
In the following illustration, the AX function returns the angle between the y-axes of marker_O and
marker_R:
Note: Because this function is independent of the rotation sequence, attempting y-axis and z-axis
rotations in conjunction with it may return an output that doesn't make sense.
Tip: If you want to change the AX function so it does not account for angle wrapping, use the
MOD function. For example, use the function:
(MOD(AX(.model_1.PART_1.MAR_2,
.model_1.ground.MAR_1)+PI,2*PI)-PI)
The MOD function achieves the cyclic effect and the +PI and -PI shift the curve accordingly.
Learn more about modeling functions.
108 Adams View Function Builder
Design-Time Function Descriptions
AY
Returns the angular displacement from one coordinate system object to another, and accounts for angle
wrapping.
Format
AY (Object, Reference Frame)
Arguments
symbol
Mathematically, AY is calculated as follows (angle wrapping is accounted for):
AY = atan 2 ( ẑ o • x̂ R, ẑ o • ẑ R )
Where:
• ẑ o is the z-axis of the Object, O.
• ẑ R is the z-axis of the Reference Frame, R.
• x̂ R is the x-axis of the Reference Frame, R.
Example
In the following illustration, the AY function returns the angle between the x-axes of marker_O and
marker_R:
Note: Because this function is independent of the rotation sequence, attempting y-axis and z-axis
rotations in conjunction with it may return an output that doesn't make sense.
Tip: If you want to change the AY function so it does not account for angle wrapping, use the MOD
function. For example, use the function:
(MOD(AY(.model_1.PART_1.MAR_2,
.model_1.ground.MAR_1)+PI,2*PI)-PI)
The MOD function achieves the cyclic effect and the +PI and -PI shift the curve accordingly.
Learn more about modeling functions.
110 Adams View Function Builder
Design-Time Function Descriptions
AZ
Returns the angular displacement from one coordinate system object to another, and accounts for angle
wrapping.
Format
AZ (Object, Reference Frame)
Arguments
symbol
Mathematically, AZ is calculated as follows (angle wrapping is accounted for):
AZ = atan 2 ( x̂ o • ŷ R, x̂ o • x̂ R )
where:
• x̂ o is the x-axis of the Object, O.
• x̂ R is the x-axis of the Reference Frame, R.
• ŷ R is the y-axis of the Reference Frame, R.
Example
In the following illustration, the AZ function returns the angle between the x-axes of marker_O and
marker_R:
Note: Because this function is independent of the rotation sequence, attempting y-axis and x-axis
rotations in conjunction with it may return an output that doesn't make sense.
Tip: If you want to change the AZ function so it does not account for angle wrapping, use the
MOD function. For example, use the function:
(MOD(AZ(.model_1.PART_1.MAR_2,
.model_1.ground.MAR_1)+PI,2*PI)-PI)
The MOD function achieves the cyclic effect and the +PI and -PI shift the curve accordingly.
Learn more about modeling functions.
112 Adams View Function Builder
Design-Time Function Descriptions
BACKUP_FILE
Renames the specified file to a backup file. The name of the backup file on Linux is file_name appended with
%. On Windows, the last character of file_name is replaced with a q.
Format
BACKUP_FILE( file_name)
Argument
Example
The following example renames foo.dat to foo.dat% (on Linux) or foo.daq (on Windows):
var set var=bkup int=(eval(BACKUP_FILE("foo.dat")))
Learn more about system functions.
Functions: A - C 113
Design-Time Function Descriptions
BALANCE
Finds a similarity transformation T such that B = T/A*T has, as nearly as possible, approximately equal row
and column norms. T is a permutation of a diagonal matrix whose elements are integer powers of two so that
the balancing does not introduce any round-off error, then returns B.
Format
BALANCE(A)
Arguments
A A square matrix.
Example
The following example illustrates the use of the BALANCE function:
Function BALANCE({{1,2},{3,4}})
Result {{1,2}, {3,4}}
BARTLETT
Apply the Bartlett window to the input array and return the new array.
Format
BARTLETT (a)
Arguments
a An array.
Example
The following is an illustration of the BARTLETT function:
BARTLETT_WINDOW
Generate the Bartlett window.
Format
BARTLETT_WINDOW (n)
Arguments
n An integer value.
Example
The following is an illustration of the BARTLETT_WINDOW function:
BLACKMAN
Apply the Blackman window to the input array and return the new array.
Format
BLACKMAN (a)
Arguments
a An array.
Example
The following is an illustration of the BLACKMAN function:
BLACKMAN_WINDOW
Generate the Blackman window.
Format
BLACKMAN_WINDOW (n)
Arguments
n An integer value.
Example
The following is an illustration of the BLACKMAN_WINDOW function:
BODEABCD
Returns gain and/or phase values for the frequency response function for a linear system specified by ABCD
linear state matrices.
Format
BODEABCD (OUTTYPE, OUTINDEX, A, B, C, D, FREQSTART, FREQEND, FREQARG)
Arguments
OUTTYPE Flag used to determine whether to return gain data, phase data, or both.
OUTTYPE Values
The value of OUTTYPE serves as a key to control the type of sampling that Adams View
has to do (linear step size, linear sample count or logarithmic sample count) and whether
the gain, the phase, or both are computed. When both the gain and the phase are
computed, all the gains are followed by all the phases, which is rarely convenient. We
recommend that you compute gain and phase separately, unless CPU time dictates taking
advantage of the efficiencies of computing both at once. The following table explains the
values of OUTTYPE:
FREQARG
linearly- FREQARG
Fixed linear spacing per spaced logarithmically-
FREQARG: samples: spaced samples:
Gain and Phase 0 3 6
Gain 1 4 7
Phase 2 5 8
OUTINDEX Index used to determine whether to return all outputs or a particular one. Index values
are as follows:
Examples
The following example assumes that you have four Adams View matrices, ABCD, as follows:
Functions: A - C 119
Design-Time Function Descriptions
BODELSE
Returns output gain and/or phase values for the frequency response function for an Adams View linear state
equation element.
Format
BODELSE (OUTTYPE, OUTINDEX, O_LSE, FREQSTART, FREQEND, FREQARG)
Arguments
OUTTYPE Flag used to determine whether to return gain data, phase data, or both. For additional
information, see OUTTYPE Values.
OUTINDEX Index used to determine whether to return all outputs or a particular one. Index values
are as follows:
Examples
In the following example, the ABCD matrices from BODEABCD are encapsulated in an Adams linear state
equation element, as follows:
model create model=model_1
measure create function &
measure_name = .model_1.MEASURE_1 &
function = "" &
units = no_units &
create = no
data_element create array x_state_array &
array_name = .model_1.x &
size = 3
data_element create array y_output_array &
array_name = .model_1.y &
size = 1
data_element create array u_input_array &
array_name = .model_1.u &
size = 1 &
variable_name = .model_1.MEASURE_1
part create equation linear_state_equation &
linear_state_equation_name = .model_1.LSE &
Functions: A - C 121
Design-Time Function Descriptions
BODELSM
Computes the Bode response for a given set of A, B, C, and D matrices. These matrices are usually produced
as the result of a linear system analysis.
Format
BODELSM (resultType, outIndex, LSM, freqStart, freqEnd, freqStep)
Arguments
resultType Specifies the components for BODELSM to return, and how the freqStep argument is used.
Below are the values and their meaning:
Value Returned values: Step computation:
0 mag and phase Fixed frequency step
1 mag only Fixed frequency step
2 phase only Fixed frequency step
3 mag and phase Linear sample count
4 mag only Linear sample count
5 phase only Linear sample count
6 mag and phase Logarithmic sample count
7 mag only Logarithmic sample count
8 phase only Logarithmic sample count
outIndex Specifies the row of the two-dimensional output matrix that is to be returned.
For a fixed frequency step, this value is the actual step size of the omega vector. For
example, if freqStart is given as 10 and freqEnd is 20, a value of 2 for freqStep
produces sample frequencies of 10, 12, 14, 16, 18, and 20.
For linear sample count, this value denotes the number of intervals in the omega
vector, and is used to compute a linear step size. Using the same example from
above, but with freqStep =5, we get 10, 12.5, 15, 17.5, and 20.
For logarithmic sample count, the behavior is similar to the linear sample count, but
the increments are used for the exponent resulting in a logarithmic progression.
Using the same values supplied in the previous example, the sample becomes 10.0,
11.9, 14,1, 16.8, and 20.0.
Examples
simulation single statematrix &
state_matrices_name=.model_1.Analysis.Stmat_1 & plant_input_name
= .model_1.pinput & plant_output_name =.model_1.poutput
If the system has a pair of inputs and a pair of outputs, there will be four response curves, corresponding to
the row indices as follows:
row 1 = input 1/output 1
row 2 = input 1/output 2
row 3 = input 2/output 1
row 4 = input 2/output 2
var cre var=mags rea=(BodeLSM (4, 3, Stmat_1, 1, 100, 50))
Learn more about matrix/array functions.
124 Adams View Function Builder
Design-Time Function Descriptions
BODESEQ
Returns the gain and/or phase values calculated from two sequences of time-based values describing the input
and output of a linear system. The sequences are 1xN arrays of time data or measure entities.
Format
BODESEQ (OUTTYPE, SEQ1, SEQ2, NUMOUT)
Arguments
OUTTYPE Flag used to determine whether to return gain data, phase data, or both. For additional
information, please see OUTTYPE Values.
SEQ1 A 1xN array of time-dependent values. A measure element may be used in place of an
array.
SEQ2 A 1xN array of time-dependent values. A measure element may be used in place of an
array.
NUMOUT Integer number of requested output values.
Extended Definition
When a Bode plot is generated for two sequences of values, the sequences are assumed to be the input to a
linear system and the output that corresponds to that input. The sequences are the excitation of the linear
system and the response due to that excitation.
Adams View computes a Fast Fourier Transform (FFT) of the two sequences and the Bode plot is simply the
magnitude and the phase of the complex ratio of the output FFT to the input FFT.
Learn more about matrix/array functions.
Functions: A - C 125
Design-Time Function Descriptions
BODETFCOEF
Returns the gain and/or phase values for the frequency response function of a transfer function specified by
its numerators and denominators.
Format
BODETFCOEF (OUTTYPE, NUMER, DENOM, FREQSTART, FREQEND, FREQARG)
Arguments
OUTTYPE Flag used to determine whether to return gain data, phase data, or both. For additional
information, see OUTTYPE Values.
NUMER A 1xN array of transfer function numerators.
DENOM A 1xN array of transfer function denominators.
FREQSTART First frequency of requested range.
FREQEND Last frequency of requested range.
FREQARG Frequency count that depends on the OUTTYPE. When OUTYPE is 0,1 or 2,
FREQARG is the step size. When OUTTYPE is a number between 4 and 8, FREQARG
is the number of samples.
Examples
You can create Bode data with 100 logarithmically-spaced samples between .01 and 10, by writing the
following command:
variable set variable=bode_log_mag real=(BODETFCOEF & (7, {[
0.01]},{[ 1. , 0.4 , 1.14 , 0.22]},0.01, 10., 100)
Using the OUTTYPE Key
The OUTTYPE key controls the frequencies at which Adams View computes the Bode data. In the example
above, we used OUTTYPE=7 for logarithmically-spaced gain values.
If you want to generate an array of the corresponding frequencies, write the following command:
variable set variable=log_freq real=(10**series(-2., 0.030303,
100))
To sample on a linear scale, write the following command:
variable set variable=bode_log_mag real=(BODETFCOEF (4, {[
0.01]},{[ 1. , 0.4 , 1.14 , 0.22]},0.01, 10., 100)
To generate the corresponding frequencies, write the following command:
variable set variable=lin_freq real=(series(0.01, 0.100909,
100))
Learn more about matrix/array functions.
126 Adams View Function Builder
Design-Time Function Descriptions
BODETFS
Returns the gain and/or phase values for the frequency response function of an Adams transfer function
element.
Format
BODETFS (OUTTYPE, TFSISO, FREQSTART, FREQEND, FREQSTEP)
Arguments
OUTTYPE Flag used to determine whether to return gain data, phase data, or both. For additional
information, see OUTTYPE Values.
TFSISO An Adams transfer function entity.
FREQSTART First frequency of requested range.
FREQEND Last frequency of requested range.
FREQSTEP Frequency count that depends on the OUTTYPE. When OUTTYPE is 0,1 or 2,
FREQARG is the step size. When OUTTYPE is a number between 4 and 8,
FREQARG is the number of samples.
Examples
The following function assumes that you created an Adams transfer function element, as follows:
model create model=model_1
measure create function &
measure_name = .model_1.MEASURE_1 &
function = "" &
units = no_units &
create = no
data_element create array x_state_array &
array_name = .model_1.x &
size = 3
data_element create array y_output_array &
array_name = .model_1.y &
size = 1
data_element create array u_input_array &
array_name = .model_1.u &
size = 1 &
variable_name = .model_1.MEASURE_1
part create equation transfer_function &
transfer_function_name = .model_1.TRANSFER_FUNCTION_1 &
x_state_array_name = .model_1.x &
u_input_array_name = .model_1.u &
y_output_array_name = .model_1.y &
static_hold = on &
numerator_coefficients = 0.01 &
denominator_coefficients = 1.0, 0.4, 1.14, 0.22
Functions: A - C 127
Design-Time Function Descriptions
Because the transfer function is equivalent to the four matrices used in the BODEABCD and BODELSE examples,
you will get identical results when you write the following command (see Using the OUTTYPE Key):
variable set variable=bode_mag_log real=(BODETFS (7,
.model_1.TRANSFER_FUNCTION_1, 0.01, 10.0, 100))
Learn more about matrix/array functions.
128 Adams View Function Builder
Design-Time Function Descriptions
BUTTER_DENOMINATOR
Calculates the denominator coefficients for the Butterworth filter.
Format
BUTTER_DENOMINATOR (n, wn, fType, isDigital) returns ARRAY
Argument
Example
The following example illustrates the BUTTER_DENOMINATOR function:
BUTTER_FILTER
Filter a curve with the Butterworth filter specified by the order and cutoff frequency.
Format
BUTTER_FILTER (x, y, fType, order, cutoff, isAnalog, isTwoPass) returns ARRAY
Argument
BUTTER_NUMERATOR
Calculates the numerator coefficients for the Butterworth filter.
Format
BUTTER_NUMERATOR (n, wn, fType, isDigital) returns ARRAY
Arguments
Example
The following example illustrates the BUTTER_NUMERATOR function:
BUTTORD_FREQUENCY
Calculates the cutoff frequency for the Butterworth filter.
Format
BUTTORD_FREQUENCY (wp, ws, rp, rs, isDigital) returns ARRAY
Arguments
wp ARRAY: Passband corner frequency. wp, the cutoff frequency, has a value between 0 and 1,
where 1 corresponds to half the sampling frequency (the Nyquist frequency).
ws ARRAY: Stopband corner frequency. ws is in the same units as wp; it has a value between 0 and
1, where 1 corresponds to half the sampling frequency (the Nyquist frequency).
rp REAL: Passband ripple, in decibels. This value is the maximum permissible passband loss in
decibels. The passband is 0<w<1p.
rs REAL: Stopband attenuation, in decibels. This value is the number of decibels the stopband is
down from the passband. The stopband is Ws<w<1.
isDigital A Boolean value.
Example
The following is an illustration of the BUTTORD_FREQUENCY function:
Note: wp and ws must have the same array size, either one or two. It returns an array of size 1 or two.
BUTTORD_ORDER
Calculates the order for the Butterworth filter.
Format
BUTTORD_ORDER (wp, ws, rp, rs, isDigital)
Arguments
wp ARRAY: Passband corner frequency. wp, the cutoff frequency, has a value between 0 and 1,
where 1 corresponds to half the sampling frequency (the Nyquist frequency).
ws ARRAY: Stopband corner frequency. ws is in the same units as wp; it has a value between 0 and
1, where 1 corresponds to half the sampling frequency (the Nyquist frequency.)
rp REAL: Passband ripple, in decibels. This value is the maximum permissible passband loss in
decibels. The passband is 0<w<1p.
rs REAL: Stopband attenuation, in decibels. This value is the number of decibels the stopband is
down from the passband. The stopband is Ws<w<1.
isDigital A Boolean value.
Example
The following is an illustration of the BUTTORD_ORDER function:
Note: wp and ws must have the same array size, either one or two.
CEIL
Returns the smallest integer greater than x.
Format
CEIL(x)
Argument
Example
The following example illustrates the use of the CEIL function:
Function CEIL(10.001)
Result 11
CENTER
Returns a non-statistical mean of the values in an array.
Format
CENTER (A)
Argument
Equation
Mathematically, CENTER is calculated as follows:
MIN ( A ) + MAX ( A )
CENTER ( A ) = ------------------------------------------------
2.0
Example
The following example illustrates the use of the CENTER function:
CHDIR
Returns a 1 if CHDIR succeeded in changing to the directory you specified, or a 0 if it failed.
Format
CHDIR (String)
Argument
Example
The result of the following function indicates the change to the /tmp directory:
Function CHDIR("/tmp")
Result 1
CLIP
Returns an MxNumvals matrix of values extracted from an MxN matrix, where:
Output[I,1] = A[I,Start]
Output[I,Numvals] = A[I,Start+Numvals-1]
The following conditions apply to the equations above:
I=1 to M
1 < Start < N
Numvals < (N-Start+1)
Format
CLIP (A, Start, Numvals)
Arguments
Example
The following example illustrates the use of the CLIP function:
COLS
Returns the number of columns in a given matrix.
Format
COLS (M)
Argument
M A given matrix.
Examples
The following examples illustrate the use of the COLS function:
Function COLS(marker_1.location)
Result 1
COMPRESS
Returns an array consisting of the non-empty values in the input array. An entry in the array is empty for a
value type as indicated below:
Reals - Zero
KEYS - Zero (that is, null_key)
Integers - Zero
Strings - The empty string or all spaces
In cases where the entire input array is empty, COMPRESS returns an array with a single value consisting of
zero for integer, real, or key arrays, and the empty string for string arrays.
Format
COMPRESS (any_array)
Arguments
any_array COMPRESS can accept any type of array (integer, real, database object, or string).
Examples
variable create variable=my_ints int=1, 0, 0, 2, 0, 3, 0, 0
variable create variable=my_reals rea=1.1,0.0, 2.2, 3.3,0.0,
0.0, 4.4, 0.0
variable create variable=my_strings str=" ", "a", "", " b", "",
"", "c ", ""
variable create variable=my_strings2 str=" ", "", "", " "
variable create variable=compressed_ints
int=(eval(COMPRESS(my_ints)))
variable create variable=compressed_reals
rea=(eval(COMPRESS(my_reals)))
variable create variable=compressed_strings
str=(eval(COMPRESS(my_strings)))
variable create variable=compressed_strings2
str=(eval(COMPRESS(my_strings2)))
COMPRESS produces the following:
compressed_ints = 1, 2, 3 compressed_reals = 1.1, 2.2,
3.3, 4.4 compressed_strings = "a", " b", "c "
compressed_strings2 = ""
Learn more about matrix/array functions.
COND
Functions: A - C 139
Design-Time Function Descriptions
Returns the condition number of a matrix. The condition number of a matrix measures the sensitivity of the
solution of a system of linear equations to errors in the data. It gives an indication of the accuracy of the results
from matrix inversion and the linear equation solution.
Format
COND (squareMatrix)
Argument
CONVERT_ANGLES
Converts a body-fixed 313 sequence into a user-specified sequence.
Format
CONVERT_ANGLES (E, OriType)
Arguments
The following list contains all the possible values for OriType:
Body121 Space121
Body123 Space123
Body131 Space131
Body132 Space132
Body212 Space212
Body213 Space213
Body231 Space231
Body232 Space232
Body312 Space312
Body313 Space313
Body321 Space321
Body323 Space323
Example
The following function converts input angles into a body-fixed 123 sequence:
CONVERT_ANGLES (E, "body123")
This function is shorthand for:
ANGLES(TMAT(E, "body313"), OriType)
The current default orientation type string can be obtained with the expression:
USER_STRING(".system_defaults.orientation_type")
Learn more about matrix/array functions.
Functions: A - C 141
Design-Time Function Descriptions
COPY_FILES
Copies a file to the specified location. Returns 1 if successful.
Format
COPY_FILES(String Source_File_Path, String Target_File_Path)
Argument
Example
The following example illustrates the use of the COPY_FILES function:
COPY_FILES( "P:\\work\\aview.log" ,"D:\\Some_Dir" )
returns 1
Learn more about system functions.
142 Adams View Function Builder
Design-Time Function Descriptions
COS
Returns the cosine of an expression that represents a numerical value.
Argument
Example
The following example illustrates the use of the COS function. The location of marker_1 and marker_2 is
shown in the figure below.
COSH
Returns the hyperbolic cosine of an expression that represents a numerical value.
Functions: A - C 143
Design-Time Function Descriptions
Argument
Example
The following function returns the hyperbolic cosine of the z component of the displacement of marker_2
with respect to marker_1. The result is computed in the coordinate system of marker_1. The location of
marker_1 and marker_2 is shown in the figure below.
CROSS
Returns the cross-product of two matrices.
Format
CROSS (M1, M2)
Arguments
M1 First matrix.
M2 Second matrix.
Note: CROSS will only accept 3x1 or 1x3 arrays.
CSPLINE
Creates an interpolated curve from input points with a specified number of values. Interpolates using the
cubic splines.
The algorithm that fits the cubic spline is from Computer Methods for Mathematical Computations by
Forsythe, Malcolm and Moler (1977, Prentice-Hall: Englewood Cliffs, NJ). The INTEGR function uses the
same algorithm.
The length of the Independent Data array must be equal to the Dependent Data array.
Format
CSPLINE (Independent Data, Dependent Data, Number of Output Values)
Arguments
Independent Data A 1xN array of x values for the curve to be interpolated. These x values
must be in ascending order, and the length of the array must be greater
than or equal to 4.
Dependent Data A 1xN array of y values for the curve to be interpolated.
Number of Output Values The number of values to be generated in the output array.
Example
The following function interpolates a set of four points with ordinal values from 1 to 4 and abscissal values
as shown, into a series of 10 abscissal values:
To compute the ordinal values for these splined values, you can use the SERIES2 function as follows:
Note: This design function do not exactly represent Solver CUBSPL. The interpolation follows
CUBIC method (closely matches) but extrapolation follows 'linear' of 'cubic' based on type of
spline specified (based on option extrapolate_linear=yes/no).
CUBIC_SPLINE
Creates an interpolated curve from input points with a specified number of values. Interpolates using a third
order Lagrangian polynomial.
The length of the Independent Data array must be equal to the Dependent Data array.
Reference: Digital Computation and Numerical Methods. Southworth, 1965. Chapter 8.7
Format
CUBIC_SPLINE (Independent Data, Dependent Data, Number of Output Values)
Arguments
Independent Data A 1xN array of x values for the curve to be interpolated. The x values
must be in ascending order, and the length of the array must be greater
than or equal to 4.
Dependent Data A 1xN array of y values for the curve to be interpolated.
Number of Output Values The number of values to be generated in the output array.
Example
The following function interpolates a set of four points with ordinal values from 1 to 4 and abscissal values
as shown, into a series of 10 abscissal values:
To compute the ordinal values for these splined values, you can use the SERIES2 function as follows:
Note: This design function do not exactly represent Solver CUBSPL. The interpolation follows
CUBIC method (more closely matching with CSPLINE than this function) but extrapolation
follows 'linear' of 'cubic' based on type of spline specified (based on option
extrapolate_linear=yes/no).
Functions: D - E
Functions: D - E 149
Design-Time Function Descriptions
DB_ACTIVE
Returns a Boolean value indicating that the object will or will not take part in simulations. Activity checking
is done recursively and through the group mechanism, so you get a true indication as to whether this element
is truly active (accessing the attr.active field will not tell you this).
Note: This function will NOT work reliably in the "spreadsheet" mode, and therefore must be
enclosed in an eval ( ) function call.
Format
DB_ACTIVE (object)
Argument
Example
The following is an illustration of how the DB_ACTIVE function is used:
in condition=(eval (db_active(.model_1.part_1))) ! Then the
part and all of its children will be included in ! subsquent
simulations.end
Learn more about database functions.
150 Adams View Function Builder
Design-Time Function Descriptions
DB_ANCESTOR
Returns the first ancestor of an object of the type you specify. This ancestor might be the direct parent of the
given object, its grandparent, or some more distant object.
If the given child has no ancestor of the specified type, then the function returns NONE.
Format
DB_ANCESTOR (Child,Type)
Argument
Example
The following is an illustration of how the DB_ANCESTOR function is used:
DB_CHANGED
Returns a 1 if an element in the database has changed; returns a 0 if there was no change.
Format
DB_CHANGED ( )
Argument
None
Example
The following command sequence prompts you to cancel a file read, if the database contains unsaved
modifications:
DB_CHILDREN
Returns an array of objects of a given type, that are children of the object you specified.
Format
DB_CHILDREN (Object Name, Object Type)
Arguments
Example
The following function provides information on a marker in the default model:
DB_COUNT
Returns the number of values in a given field of the object you specified.
Format
DB_COUNT (Object Name, Field Name)
Arguments
Example
The following function creates a variable with an integer value of 3:
variable create variable=xx real_value=1,2,5variable create
variable=nn & integer_value=(DB_COUNT(xx.self, "real_value"))
Learn more about database functions.
154 Adams View Function Builder
Design-Time Function Descriptions
DB_DEFAULT
Returns the default object of a given type. Uses the database object named system_defaults to specify the
default object.
Format
DB_DEFAULT (Defaults Object Name, Object Type)
Arguments
Defaults Object Name Name of the defaults in the database, always system_defaults.
Object Type Character string (see DB_TYPE).
Example
The following function creates a variable that is the default part:
variable create variable=default_part &
object_value=(DB_DEFAULT(system_defaults, "part"))
Learn more about database functions.
Functions: D - E 155
Design-Time Function Descriptions
DB_DEFAULT_NAME
Returns the name for the given object based on the state of the default for formatting names. The name will
be either a full name or a minimum unique name.
Format
DB_DEFAULT_NAME (object)
Arguments
Examples
If you have two markers (one on par1 and one on ground) and call the function as follows:
DB_DEFAULT_NAME(.model_1.par1.mar1)
you should see the following when the default is set to minimum unique names or Adams IDs:
par1.mar1
and the following when the default is set to full names:
.model_1.par1.mar1
Learn more about database functions.
156 Adams View Function Builder
Design-Time Function Descriptions
DB_DEFAULT_NAME_FOR_TYPE
Returns the name for the given object based on the state of the default for formatting names. The name will
be unique only for objects of the specified type.
Format
DB_DEFAULT_NAME_FOR_TYPE (object, type)
Arguments
Examples
If you have two objects named joint1 (one in the model and one in an analysis) and call the function as
follows:
DB_DEFAULT_NAME_FOR_TYPE(.model_1.joint1, "constraint")
you should see the following when the default is set to minimum unique names or Adams IDs:
joint1
and the following when the default is set to full names:
.model_1.joint1
Learn more about database functions.
Functions: D - E 157
Design-Time Function Descriptions
DB_DELETE_DEPENDENTS
Returns an array of objects that are dependents of the object you specified. Each of the objects in the array
normally prevent the specified object from being deleted.
Format
DB_DELETE_DEPENDENTS (Object Name)
Argument
Example
The following function returns an alert if par_1 has dependent objects:
DB_DEL_PARAM_DEPENDENTS
Returns an array of all the parametric expressions that depend on the object you specified.
Format
DB_DEL_PARAM_DEPENDENTS (Object Name)
Argument
Example
The following sequence of commands finds objects with parametric dependencies on par3:
DB_DEL_UNPARAM_DEPENDENTS
Returns a constant integer value of zero, and deletes all the parametric expressions that depend on the object
you specified.
Format
DB_DEL_UNPARAM_DEPENDENTS (Object Name)
Argument
Example
The following commands delete all parametric dependencies on par3:
DB_DEPENDENTS
Returns an array of all objects of a given type that are dependents of the object you specified.
Format
DB_DEPENDENTS (Object Name, Object Type)
Arguments
Example
The following example lists information about all marker objects that depend on the design variable, DV_1.
Note that .self is appended to DV_1 so the functions refers to the design variable object DV_1 and not the
value in DV_1.
DB_DEPENDENTS_EXHAUSTIVE
Lists a complete chain of dependents (of the specified type) for a given object. That is immediate dependents,
dependents of dependents and so on.
Format
DB_DEPENDENTS_EXHAUSTIVE (Object Name, Object Type)
Arguments
Example
This function is a good way to interrogate parametric models to find all of the objects of a certain type in a
model that are somehow influenced by another object like a design variable. The following example lists
information about all marker objects that depend on the design variable DV_1 or that are further down the
dependency chain (dependents of the first-degree dependent, their dependents and so on). Note that .self is
appended to DV_1 so the functions refers to the design variable object DV_1 and not the value in DV_1.
list_info entity entity_name =
(EVAL(DB_DEPENDENTS_EXHAUSTIVE(.model_1.DV_1.self,"marker")))
Learn more about database functions.
162 Adams View Function Builder
Design-Time Function Descriptions
DB_DESCENDANTS
Returns the objects of a given type, activity, and number of levels beneath the parent.
Format
DB_DESCENDANTS (Object Name, Object Type, Activity Flag, Levels)
Arguments
Example
The following function creates a variable that stores all design variables whose parent model is active and exist
within the first two levels below model_1:
variable create variable=variable_list &
object_value=(DB_DESCENDANTS (.model_1, "variable", 1, 2))
Learn more about database functions.
Functions: D - E 163
Design-Time Function Descriptions
DB_EXISTS
Returns a 1 if the object you specified exists; returns a 0 if it doesn't.
Format
DB_EXISTS (Name String)
Argument
Example
The following function creates marker_3 if .mod1.par1 exists:
if condition=(DB_EXISTS(".mod1.par1")) marker create
marker=marker_3
end
Learn more about database functions.
164 Adams View Function Builder
Design-Time Function Descriptions
DB_FIELD_FILTER
Returns an array, from a given array of field names, containing a subset of the original array. The values in
the array must meet the requirements that you specify in filter parameters.
Format
DB_FIELD_FILTER (Filter Strings, Field Strings)
Arguments
Filter Strings Array of character strings that is similar to the macro parameter specification language
used in Adams View:
If you do not specify an alias, then the field can be either an alias or not.
assoc = relation indicates the field has a particular relationship to the object.
Values for relation are:
• Child
• Reference
• Twoway
Field Strings List of field names you want to filter.
Functions: D - E 165
Design-Time Function Descriptions
Example
The following is a typical calling sequence that produces all the real scalar fields for the spring damper object:
DB_FIELD_TYPE
Returns a string that describes the type of data in a field beneath the object type you specified.
Format
DB_FIELD_TYPE (Object Type, Field Name)
Arguments
Example
The following example determines that the width field on the Graphic_Interface_Dialog_Box object is of the
type REAL (keep the expression on one line):
DB_FILTER_NAME
Returns an array of objects whose names match the filter parameters you specified.
Format
DB_FILTER_NAME (Objects to Filter, Filter String)
Arguments
Example
The following example assigns the color yellow to all the markers whose names start with a or c:
DB_FILTER_TYPE
Returns an array of objects whose types match the filter parameters you specified.
Format
DB_FILTER_TYPE (Objects to Filter, Filter Type String)
Arguments
Example
The following example returns information about markers in the select list:
DB_FULL_NAME_FROM_SHORT
Returns the full name for the named object of the specified type. The input name can be either a full name
or a minimum unique name.
Format
DB_FULL_NAME_FROM SHORT (short_name, type)
Arguments
Examples
If you have two objects named joint1 (one in the model and one in an analysis) and call the function as
follows:
DB_FULL_NAME_FROM_SHORT("joint1", "constraint")
you should see:
.model_1.joint1
Learn more about database functions.
170 Adams View Function Builder
Design-Time Function Descriptions
DB_FULL_TYPE_FIELDS
Returns an array of strings for the names of the fields (including aliases) for the object you specified.
Format
DB_FULL_TYPE_FIELDS (Objects Type String)
Argument
Objects Type String Character string denoting an object type (see DB_TYPE).
Example
The following commands find all the field names on a marker:
DB_IMMEDIATE_CHILDREN
Returns an array of all objects that are immediate children of the object you specified.
Format
DB_IMMEDIATE_CHILDREN (Object Name, Object Type)
Arguments
Examples
The following commands display all the names of the modeling objects in model_1:
DB_OBJECT_COUNT
Returns the number of object names in the array of database objects you specified.
Format
DB_OBJECT_COUNT (Objects)
Argument
Example
The following example stores the number of objects on the select_list in the variable NumSelectedObjects:
variable set variable=NumSelectedObjects
int=(EVAL(DB_OBJECT_COUNT(select_list.objects)))
Learn more about database functions.
Functions: D - E 173
Design-Time Function Descriptions
DB_OBJ_EXISTS
Returns a logical value indicating whether the specified object exists as an immediate child of the parent
object.
Format
DB_OBJ_EXISTS (Parent, Name)
Arguments
Examples
The following illustrates the use of DB_OBJ_EXISTS:
DB_OBJ_EXISTS_EXHAUSTIVE
Returns a Boolean value indicating whether the object specified exists or not. It does an exhaustive search
through the specified object context to find anything with a given name.
Format
DB_OBJ_EXISTS_EXHAUSTIVE (ContextObject, Name)
Arguments
ContextObject The object in which to search for a child with the given name.
Name A character string naming the object.
Examples
You might branch your command file based upon the existence of a particular object:
if condition=(db_obj_exists_exhaustive(.model_1, "marker_1"))
Learn more about database functions.
Functions: D - E 175
Design-Time Function Descriptions
DB_OBJ_FROM_NAME_TYPE
Returns the object of a given name and type.
Format
DB_OBJ_FROM_NAME_TYPE (Parent Object, String Name, String Object Type)
Arguments
Example
The following function will return Link_1 object:
DB_OBJ_FROM_NAME_TYPE(.MODEL_1.PART_2 , "LINK_1" , "geometry")
Learn more about database functions.
176 Adams View Function Builder
Design-Time Function Descriptions
DB_OF_CLASS
Returns a 1 if an object is a member of a given class; returns a 0 if it is not. The class_name is one of the values
the SELECT_TYPE function presents, and can be either a type name or a class name.
Format
DB_OF_CLASS (Object Name, Object Class)
Arguments
Example
The following example changes the color of the object represented by the variable myobject, if the variable is
a marker:
if cond=(DB_OF_CLASS(myobject,"marker")) marker attribute
marker=(myobject) color=red end
Learn more about database functions.
Functions: D - E 177
Design-Time Function Descriptions
DB_OF_TYPE_EXISTS
Returns a 1 if an object with the name and type you specified exits; returns a 0 if it does not exist.
Distinguishes between objects with the same name but different type, and is especially useful when full path
name isn't known.
Format
DB_OF_TYPE_EXISTS (Name String, Object Type)
Argument
Example
if condition=(DB_OF_TYPE_EXISTS(".mod1.par1.node1", "marker"))
marker copy marker=.mod1node1 new_marker=.mod1.ground.node1 end
Learn more about database functions.
178 Adams View Function Builder
Design-Time Function Descriptions
DB_OLDEST_ANCESTOR
Returns the most distant ancestor of an object of the type specified. This ancestor might be the direct parent
of the given object, its grandparent, or some more distant object. This can be helpful to find the top-level
model when submodels are present.
If the given child has no ancestor of the specified type, then the function returns NONE.
Format
DB_OLDEST_ANCESTOR (Child,Type)
Argument
Example
The following example illustrates the use of the DB_OLDEST_ANCESTOR function:
DB_REFERENTS
Returns an array of objects of a given type that are referenced by the object you specified.
Format
DB_REFERENTS (Object Name, Object Type)
Arguments
Example
The following example stores the array of objects that refer to rev1, in the variable db06:
DB_REFERENTS_EXHAUSTIVE
Lists a complete chain of the objects (of the specified type) referred to by a given object. That is immediate
referents, referents of referents and so on.
Format
DB_REFERENTS_EXHAUSTIVE (Object Name, Object Type)
Arguments
Example
This function is a good way to interrogate parametric models to find all of objects of a given type that
influence a certain object in the model. The following example stores the array of objects that are immediate
referents, referents of referents and so on of Marker_1, in the variable db06:
var set var = db06 obj=(eval(DB_REFERENTS_EXHAUSTIVE(Marker_1, "all")))
DB_SHORT_NAME
Returns the shortest unique name for the given object. This name may become non-unique when new objects
are created, so it is best not to use this value to generate names for files that will be present for a long time.
Format
DB_SHORT_NAME (object)
Arguments
Examples
If you have two markers with the same name on two different parts, and call the function as follows:
DB_SHORT_NAME(.model_1.par1.mar1)
you should see:
par1.mar1
as the result.
Learn more about database functions.
182 Adams View Function Builder
Design-Time Function Descriptions
DB_TWO_WAY
Returns an array of objects that have two-way associativity with the object you specified. Two-way
associativity involves a two-way relationship, such as between a model and a view displaying that model,
where one or the other may be deleted and the remaining one will not be affected.
Format
DB_TWO_WAY (Object Name, Object Type)
Arguments
Example
The following commands store the array of objects that have two-way associativity to .mod1 in variable db07:
DB_TYPE
Returns a string representing an object type.
Format
DB_TYPE (Object Name)
Argument
Examples
The following example processes the part1 object only if it is a part:
if cond=(DB_TYPE(part1)=="part") list info part=(part1)end
Learn more about database functions.
184 Adams View Function Builder
Design-Time Function Descriptions
DB_TYPE_FIELDS
Returns an array of strings for the names of the fields (excluding aliases) for the object type you specified.
Format
DB_TYPE_FIELDS (Objects Type String)
Argument
Object Type String Character string denoting an object type (see DB_TYPE).
Example
The following commands return all the field names for marker:
DET
Returns the determinant of a square matrix.
Format
DET (M)
Argument
M A square matrix.
Example
The following example illustrates the use of the DET function:
DETREND
Returns a 1xN array of detrended data computed by subtracting the linear least squares fit from the input
data stream.
Format
DETREND (INDEP, DEPEND)
Arguments
Example
The following example illustrates the use of the DETREND function:
DIFF
Returns a 1xN array of approximations to the derivatives at the points in the input data. To compute the
derivative, the DIFF function fits a cubic spline to the input data and returns the derivatives of the
approximating polynomials at each point.
The length of the INDEP array must be equal to the DEPEND array.
Format
DIFF (INDEP, DEPEND)
Arguments
INDEP A 1xN array of independent data. These x values must be in ascending order, and the length
of the array must be greater than or equal to 4.
DEPEND A 1xN array of dependent data on input independent data.
Example
The following example illustrates the use of the DIFF function:
DIFFERENTIATE
Returns the derivative at each input point on curve C. To compute the derivative at each point, the
DIFFERENTIATE function fits a cubic spline to a 2xN matrix representation of curve C and returns the
derivatives of the approximating polynomials at each point. The curve of derivatives that DIFFERENTIATE
returns has the same x values as curve C.
Format
DIFFERENTIATE (C)
Argument
C Input curve.
Example
The following xy_plot command creates a curve, diff1, whose x values are the same as the x values of curve1
on plot1:
xy_plots curve create curve=diff1 &
x_values=(.plot1.curve1.x_data.values) &
y_values=(DIFFERENTIATE({.plot1.curve1.x_data.values, &
.plot1.curve1.y_data.values})[2,*])
The matrix that DIFFERENTIATE receives is 2xN:
The first row has the x values of curve1.
The second row has the y values of curve1.
DIFFERENTIATE returns two rows:
The first is the same as the x values of curve1.
The second is the derivatives of curve1.
Learn more about matrix/array functions.
Functions: D - E 189
Design-Time Function Descriptions
DIM
Returns the positive difference of the instantaneous values of two expressions, each representing a numerical
value.
DIM(x1, x2) = 0 if x1 ≤ x2
DIM(x1, x2) =x1-x2 if x1 > x2
Format
DIM(x1, x2)
Arguments
Example
The following example illustrates the use of the DIM function:
Function DIM(5*4,5)
Results 15
DM
Returns the magnitude of the translational displacement from one coordinate system object to another.
Format
DM (Object 1,Object 2)
Arguments
Object 1 Coordinate system object to which the translational displacement magnitude is measured.
Object 2 Coordinate system object from which the translational displacement magnitude is measured.
symbol
Mathematically, DM is calculated as follows:
DM = ( [ R 01 – R 02 ] • [ R 01 – R 02 ] )
where:
Example
In the following illustration, the DM function returns a number greater than or equal to 0.
DMAT
Returns a square matrix with the elements of M along the diagonal, and zero elsewhere. This is useful for
scaling locations.
Format
DMAT(M)
Argument
Example
The following example illustrates the use of the DMAT function:
DOE_MATRIX
Returns either a:
Matrix of design of experiments (DOE) a row from that matrix
The count of rows from that matrix
The argument array contains the information needed to construct the matrix and to determine the results
which you want returned.
Format
DOE_MATRIX (ARGUMENT_ARRAY)
Arguments
The first value is the type of algorithm to use to create the matrix.
0 - Casewise
1 - Central Composite
2 - Box-Behnken
3 - Full Factorial
The second entry in the array indicates the number of variables that are to be
used for the DOE.
The fourth entry indicates whether you want the data centered or 1-based.
Centered data is what the SIMULATION and OPTIMIZE commands
require, but 1-based can be useful if you are writing your own DOE loop using
the FOR command. A value of one indicates that the data should be centered,
and a value of zero indicates that it should be 1-based.
If the fifth entry does not exist, then the result of the function is a complete
DOE matrix, which will have nTrials rows and nVariables columns. If you
enter zero as the fifth array value, then the result of the function is just the
number of trials in that DOE matrix. Any other value indicates that just that
row of the matrix is to be returned.
Examples
The following example returns the number of trials for the Box-Behnken matrix with two variables each
having five levels. The value returned is 9.
194 Adams View Function Builder
Design-Time Function Descriptions
DOE_MATRIX({2, 2, 5, 0, 0})
This example returns the fifth row of the Full Factorial matrix with variables variables each having three levels.
The centered values returned are {-1, -1, 0, 0}.
DOE_MATRIX({3, 4, 3, 1, 5})
This example returns the Central Composite matrix for two variables with three levels. The value returned is
the centered data:
DOE_MATRIX({1, 2, 3, 1})
{{0, 0}, {0, -1}, {0, 1}, {-1, 0}, {1, 0}, {-1, -1}, {-1, 1}, {1, -1}, {1, 1}}
Learn more about matrix/array functions.
Functions: D - E 195
Design-Time Function Descriptions
DOE_NUM_TERMS
Returns the number of terms in the polynomial that the OPTIMIZE_FIT_RESPONSE_SURFACE
command produces. The OPTIMIZE_FIT_RESPONSE _SURFACE command takes a parameter to
specify the degree for each variable in the solution, and produces a polynomial, accordingly. The input to
DOE_NUM_TERMS is an array of these same integers that you supply to the
OPTIMIZE_FIT_RESPONSE_SURFACE command in it POLYNOMIAL_DEGREES parameter.
Format
DOE_NUM_TERMS(ORDER_ARRAY)
Arguments
ORDER_ARRAY An array of integers giving the degree of each variable in the polynomial.
Examples
The following examples illustrate the use of the DOE_NUM_TERMS function:
Function DOE_NUM_TERMS({1,1,1})
Result Returns 4 (the intercept term is included)
Function DOE_NUM_TERMS({1,2,2,1})
Result Returns 8
DOT
Returns the dot product of two matrixes.
Format
DOT (M1, M2)
Arguments
M1 First matrix.
M2 Second matrix.
Example
The following example illustrates the use of the DOT function:
Function DOT({1,1,0},{1,0,1})
Result 1
DX
Returns an x component of translational displacement from one coordinate system object to another.
Format
DX (Object 1, Object 2, Reference Frame)
Arguments
symbol
Mathematically, DX is calculated as follows:
DX = [ R 01 – R 02 ] • x̂ R
where:
Example
In the following illustration, the DX function returns the x component of the translational displacement from
marker_O2 to marker_O1, along the x-axis of marker_R:
DY
Returns a y component of translational displacement from one coordinate system object to another.
Format
DY (Object 1, Object 2, Reference Frame)
Arguments
symbol
Mathematically, DY is calculated as follows:
DY = [ R 01 – R 02 ] • ŷ R
where:
Example
In the following illustration, the DY function returns the y component of the translational displacement from
marker_O2 to marker_O1, along the y-axis of marker_R:
DZ
Returns a z component of translational displacement from one coordinate system object to another.
Format
DZ (Object 1, Object 2, Reference Frame)
Arguments
symbol
Mathematically, DZ is calculated as follows:
DZ = [ R 01 – R 02 ] • ẑ R
where:
Example
In the following illustration, the DZ function returns the z component of the translational displacement from
marker_O2 to marker_O1, along the z-axis of marker_R:
EIG_DI
Returns a vector of the imaginary components of the generalized eigenvectors of matrices A and B.
Format
EIG_DI (A, B)
Arguments
Examples
The following example illustrates the use of the EIG_DI function:
EIG_DR
Returns a vector of the real components of the generalized eigenvectors of matrices A and B.
Format
EIG_DR (A, B)
Arguments
Examples
The following illustrates the use of the EIG_DR function:
EIG_VI
Returns a vector of the imaginary components of the generalized eigenvectors of matrices A and B.
Format
EIG_VI (A, B)
Arguments
Examples
The following example illustrates the use of the EIG_VI function:
EIG_VR
Returns a vector of the real components of the generalized eigenvectors of matrices A and B.
Format
EIG_VR (A, B)
Arguments
Examples
The following example illustrates the use of the EIG_VR function:
EIGENVALUES_I
Returns a vector of the imaginary components of the generalized eigenvectors of matrices A and B.
Format
EIGENVALUES_I (A, B)
Arguments
Examples
The following example illustrates the use of the EIGENVALUES_I function:
EIGENVALUES_R
Returns a vector of real components of the generalized eigenvectors of matrices A and B.
Format
EIGENVALUES_R (A, B)
Arguments
Examples
The following example illustrates the use of the EIGENVALUES_R function:
ELEMENT
Indicates if a real value is an element of an array.
Format
ELEMENT (A, X)
Arguments
A An array.
B A real number.
Examples
For the following examples, assume that array A contains a list of integers from 1 through 10:
Function ELEMENT(".MOD1.A",3)
Result true
Function ELEMENT(".MOD1.A",11)
Result false
EXCLUDE
Excludes a value from an array.
Format
EXCLUDE (A, X)
Arguments
A An array.
X A real number.
Example
Assume that the array in the following function contains the values 1 through 10:
Function EXCLUDE(.MOD1.A,4)
Result removes 4 from the list
EXECUTE_VIEW_COMMAND
Returns a numerical value indicating whether EXECUTE_VIEW_COMMAND succeeded or failed in
executing an Adams View command. If the command was successful, EXECUTE_VIEW_COMMAND
returns a 1; otherwise, it returns a 0.
Format
EXECUTE_VIEW_COMMAND (Command)
Argument
Example
The following example illustrates the use of the EXECUTE_VIEW_COMMAND function:
EXP
Returns the exponential for each element of x.
Format
EXP(x)
Argument
Example
The following example illustrates the use of the EXP function. The location of marker_1 and marker_2 is
shown in the figure below.
EXPR_EXISTS
Returns a 1 if an expression exists in a given field of an object that you specify; returns a 0 if it does not.
Functions: D - E 213
Design-Time Function Descriptions
Format
EXPR_EXISTS (Object Field)
Argument
Object Field Character string denoting the name of an object suffixed with a field name.
Examples
The following examples assume that you created a marker as follows:
marker create marker=mar1 location=(loc_relative_to({0,0,0},
mar2)) ori=1,2,3
Function EXPR_EXISTS(".mar1.location")
Result 1 (true)
Function EXPR_EXISTS(".mar1.orientation")
Result 0 (false)
EXPR_REFERENCE
Returns a string containing the name of the reference to the expression. If no expression is found,
EXPR_REFERENCE returns an empty string. Similarly, if the reference index is out of bounds, it returns an
empty string.
Format
EXPR_REFERENCE (Expression, Reference)
Argument
Examples
var set var=load_dep
&str=(eval(expr_reference(".mod.par.mar.loc", 1)))
Learn more about database functions.
Functions: D - E 215
Design-Time Function Descriptions
EXPR_STRING
Returns a text string containing an expression in a given field of an object that you specify.
Format
EXPR_STRING (Object Field)
Argument
Object Field Character string denoting the name of an object suffixed with a field name.
Examples
The following examples assume that you created a marker as follows:
marker create marker=mar1 location=(loc_relative_to({0,0,0},
mar2)) ori=1,2,3
Function EXPR_STRING("mar1.location")
Result "(LOC_RELATIVE_TO({0, 0, 0}, .mod1.ground.mar2))"
Function EXPR_STRING(".mar1.orientation")
Result " " (an empty string)
Functions: F - L
FFTMAG
Returns an array of magnitudes calculated by applying the FFT function to input values. FFTMAG is very
useful in determining the natural frequencies of a data stream.
Format
FFTMAG (A, N)
Arguments
Example
The following example illustrates the use of the FFTMAG function:
FFTPHASE
Returns an array of phase values calculated by applying the FFT function to input values.
Format
FFTPHASE (A, N)
Arguments
Example
The following example illustrates the use of the FFTPHASE function:
FILE_ALERT
Returns an integer representing the command button you selected after Adams View displayed the Alert
dialog box. Returns a 0 if a named file does not exist.
The Alert dialog box contains the message: <file name> exists. Create backup copy? It has three command
buttons labeled Yes, No, and Cancel.
Format
FILE_ALERT (File Name)
Argument
Example
The following example illustrates the use of the FILE_ALERT function:
Function FILE_ALERT("aview.log%")
Result returns an Alert box, as shown below.
FILE_DIRECTORY_NAME
Returns a directory name from the file specification.
Format
FILE_DIRECTORY_NAME(file_name)
Argument
Example
The following example illustrates the use of the FILE_DIRECTORY_NAME function:
var set var=$_self.dir string_value=
(eval (FILE_DIRECTORY_NAME ("my_dir/my_file.dat")))
returns "my_dir"
Learn more about system functions.
220 Adams View Function Builder
Design-Time Function Descriptions
FILE_EXISTS
Returns a 1 if a file exists, and a 0 if it doesn't.
Format
FILE_EXISTS (File Name)
Argument
Examples
For the following examples, assume that a file named aview.log% exists, and avkiew.log% does not.
Function FILE_EXISTS(aview.log%)
Result 1
Function FILE_EXISTS(avkiew.log%)
Result 0
FILE_MINUS_EXT
Returns the file name with its extension removed.
Format
FILE_MINUS_EXT (file_name)
Argument
file_name Character string containing the file name with or without a directory specification.
Examples
The following example illustrates the use of the FILE_MINUS_EXT function:
var set var=.file_no_ext string_value=
(eval (FILE_MINUS_EXT ("my_file.dat")))
returns "my_file"
Learn more about system functions.
222 Adams View Function Builder
Design-Time Function Descriptions
FILE_TEMP_NAME
Returns a string that has a non-existent temporary file name. Each time it is called, it returns a new name, so
you should evaluate it using the EVAL function, as shown in the example below.
Format
FILE_TEMP_NAME (None)
Argument
None
Example
The following command creates a file name and stores it in the variable named new_file:
variable set variable=new_file str=(eval(FILE_TEMP_NAME( )))
Learn more about system functions.
Functions: F - L 223
Design-Time Function Descriptions
FILTER
Returns a 1xN array of filtered input values, where N is the number of input values. The coefficients of the
transfer function define the filter.
Format
FILTER (Independent Variable, Dependent Variable, Numerator Coefficients, Denominator Coefficients,
Filtering Method)
Arguments
Example
The following function returns a 1xN array of numbers that represent the filtered data:
FILTER(.mod1.FUNC_MEA_1.TIME, .mod1.FUNC_MEA_1.Q, {1.0,0,0},
{1.0,12.7,81.0}, 1)
Functions: F - L 225
Design-Time Function Descriptions
FILTFILT
Zero-phase digital filtering.
Format
filtfilt (b, a, x) returns ARRAY
Argument
FIND_MACRO_FROM_COMMAND
Checks if a macro is defined using the specified user_entered_command (command_str). Returns its KEY if
one exists; otherwise, it returns None.
FIND_MACRO_FROM_COMMAND does not check to determine if the user_entered_command
conflicts with the built-in Adams View command language.
Format
FIND_MACRO_FROM_COMMAND(command_str)
FIRST
Returns the first element in an array if an element exists; otherwise, returns a 0.
Format
FIRST (A)
Argument
A An array.
Examples
The following examples illustrate the use of the FIRST function:
FIRST_N
Returns the first N elements of an array.
Format
FIRST_N (A,N)
Arguments
A An array.
N Number of elements to return.
Examples
The following examples illustrate the use of the FIRST_N function:
Function FIRST_N ({ }, 3)
Result {}
FLOOR
Returns the largest integer that is less than x.
Format
FLOOR(x)
Argument
Examples
The following examples illustrate the use of the FLOOR function:
FREQUENCY
Returns the FFT frequencies of an array of time values. The result is given in Hz.
Format
FREQUENCY (A, N)
Arguments
A An array of time values from which the frequencies will be computed. The time values should
be evenly spaced.
N An integer value which indicates the number of output values. This must be greater than or
equal to the number of input values. If N is an odd number, the function returns (N+1)/2
output values. If N is an even number, (N/2 + 1) number of values will be returned.
Example
The following examples assume that the current time units setting is in seconds:
Function FREQUENCY({0,1,2,3,4}, 5)
Result 0.0, 0.2, 0.4
GETCWD
Returns the current working directory as a character string.
Format
GETCWD ()
Argument
None
Example
The following function returns the name of my current working directory:
Function GETCWD()
Result /usr/people/documentation
GETENV
Returns a text string containing the value of the environment variable you specified.
Format
GETENV (Environment Variable)
Argument
Example
The following function returns the name of the registered user, in this case, tmazz:
Function GETENV("USER")
Result tmazz
GRIDDATA
Calls the MATLAB GRIDDATA function. Returns a real array of Zi values corresponding to the ordered
pairs in Xi, and Yi.
Note: GRIDDATA uses only linear interpolation method which is the MATLAB default.
Format
GRIDDATA (x, y, z, Xi, Yi)
Argument
x The x values of the original data for which the grid is to be computed.
y The y values of the original data.
z The z values of the original data.
Xi The x values of the points at which the grid is to be evaluated.
Yi The y values of the points.
Example
variable create variable=Xi real=1,2,3,1,2,3,1,2,3
variable create variable=Yi real=1,1,1,2,2,2,3,3,3
variable create variable=Zi real=(GRIDDATA({1,1,4,4},{5,5,6,6},
Xi, Yi,))
produces a value of
{5,0, 5.33, 5.67, 5.0, 5.33, 5.67, 5.0, 5.33, 5.67}
corresponding to the points
(1,1, 5.0)(2,1, 5.33)(3,1, 5.67)(1,2, 5.0)(2,2, 5.33)(3,2,
5.67)(1,3, 5.0)(2,3, 5.33)(3,3, 5.67)
Learn more about matrix/array functions.
Functions: F - L 235
Design-Time Function Descriptions
GUICLEANUP
The function is effective only on Windows platforms. It takes a dialog name as the single argument and
unloads it, thereby deleting all QT widgets (controls) associated with the dialog, reducing the HANDLE
(USER Objects) count of the parent process e.g. 'aview'. On Windows platforms, the maximum allowable
HANDLE limit for a process is 10,000, after which, programs are known to behave erratically.
The function has been provided so that users can tackle this limitation, inherent to Windows platforms and
can carry on with their normal working. As such, the function, though available on other platforms, does
nothing.
Format
GUICLEANUP(object)
Argument
Example
The function takes just one argument, which is the name of the dialog whose widgets have to be unloaded.
Please note that it is recommended that the function be used only through an eval() call. The following
example describes this in detail,
var cre var = temp int = ( eval ( guicleanup (about_adams) ) ) ... recommended
var cre var = temp int = ( guicleanup (about_adams) ) ... not recommended
Failing to use the GUICLEANUP function in an eval() statement introduces an undesireable dependency
between the dialog and the variable and may lead to unpredictable behaviour.
HAMMING
Returns a 1xN array of values after applying the HAMMING window function.
Format
HAMMING (a)
Argument
Example
The following example illustrates the use of the HAMMING function:
HAMMING_WINDOW
Generate the HAMMING window. The HAMMING window function forces the end points toward zero, and
smooths the remaining points toward the end points.
Format
hamming_window (n)
Arguments
n An integer value.
Example
The following example illustrates the use of the HAMMING_WINDOW function:
HANNING
Returns a 1xN array of values after applying the HANNING window function.
Format
HANNING (A)
Argument
Example
The following example illustrates the use of the HANNING function:
HANNING_WINDOW
Generate the HANNING window. The HANNING window function forces the end points to become zero, and
smooths the remaining points toward the end points.
Format
hanning_window (n)
Arguments
n An integer value.
Example
The following example illustrates the use of the HANNING_WINDOW function:
HERMITE_SPLINE
Creates an interpolated curve from input points with a specified number of values. Interpolates using the
Hermite cubic spline.
The length of the Independent Data array must be equal to the Dependent Data array.
Format
HERMITE_SPLINE (Independent Data, Dependent Data, Number of Output Values)
Arguments
Independent Data A 1xN array of x values for the curve to be interpolated. The x values of the
points must be in ascending order, and the length of the array must be
greater than or equal to 4.
Dependent Data A 1xN array of y values for the curve to be interpolated.
Number of Output Values The number of values to be generated in the output array.
Example
The following function interpolates a set of four points with ordinal values from 1 to 4 and abscissal values
as shown, into a series of 10 abscissal values.
To compute the ordinal values for these splined values, you can use the SERIES2 function as follows:
INCLUDE
Includes a value into an array if the value is not already there.
Format
INCLUDE (A, X)
Arguments
A An array.
X A real value.
Example
Assume that the array in the following function contains the values 1 through 10:
Function INCLUDE(.MOD1.A,11)
Result includes 11 as an element of the array
INT
Returns the nearest real value whose magnitude is not larger than x. If x is less than 0, returns CEIL;
otherwise, returns FLOOR of x.
Format
INT(x)
Argument
Examples
The following examples illustrate the use of the INT function:
Function Result
INT(4.8) 4.0
INT (.38) 0.0
INT (-3.9) -3.0
INTEGR
Produces the integral at each input point on curve C. The curve is presented to this function as two arrays
containing the ordinal and abscissal components of the curve. To compute the integral at each point,
INTEGR fits a cubic spline to the curve and returns the integrals of the approximating polynomials at each
point. The curve of integrals that INTEGR returns has the same number of values as each of the arguments.
The algorithm that fits the cubic spline is from Computer Methods for Mathematical Computations by
Forsythe, Malcolm and Moler (1977, Prentice-Hall: Englewood Cliffs, NJ). The CSPLINE function uses the
same algorithm.
Format
INTEGR (Independent Points, Dependent Points)
Arguments
Example
The following example illustrates the use of the INTEGR function:
INTEGRATE
Produces a curve of integrals from an input curve. To compute the integral at each point, the INTEGRATE
function fits a cubic spline to the 2xN matrix representation of curve C, and returns the integrals of the
approximating polynomials at each point. The curve of integrals that INTEGRATE returns has the same X
values as curve C.
Format
INTEGRATE (C)
Argument
C Input curve.
Example
The following xy_plot command creates a curve, int1, whose x values are the same as the x values of curve1
on plot1. The matrix that INTEGRATE receives, is 2xN:
The first row is the x values of curve1.
The second row is the y values of curve1.
INTEGRATE returns two rows:
The first is the same as the x values of curve1.
The second is the integrals of curve1.
xy_plots curve create curve=diff1 &
x_values=(.curve1.x_data.values) &
y_values (INTEGRATE &
({.curve1.x_data.values,.curve1.y_data.values})[2,*])
Learn more about matrix/array functions.
Functions: F - L 245
Design-Time Function Descriptions
INTERP1
Similar to the MATLAB INTERP1 function and returns a real array. Given a curve described by x and y, the
INTERP1 function returns the Yi values corresponding to the Xi values.
Format
INTERP1 (x, y, Xi, method)
Argument
Example
This example shows the relative shapes of the arrays involved when using the function:
variable create variable=Yi & real=(interp1({1,2,3},
{1,2,3}, {1.2,2.5}, "spline"))
produces a value for Yi of
{1.25,2.5}
corresponding to the points
(1.5,1.5)(2.5,2.5)
Learn more about matrix/array functions.
246 Adams View Function Builder
Design-Time Function Descriptions
INTERP2
Calls the MATLAB INTERP2 function and returns a real array. Given a 3D surface described by x, y, and z,
the INTERP2 function returns the Zi values corresponding to the Xi and Yi points.
Format
INTERP2 (x, y, z, Xi, Yi method)
Argument
Xi and Yi may be of different size, as they describe a grid rather than a collection of ordered pairs,
though the number of Xi's must be greater than or equal to the number of Yi's.
method A character string that indicates the interpolation method to be used. These come directly from
the MATLAB function of the same name:
Example
Note that the z array is a surface corresponding to each x-y pair:
variable create variable=Zi &
real=(interp2({1,2,3},{1,2,3},{{1,2,3},{1,2,3},
{1,2,3}},{1.5,2.5},{1.5,2.5},"spline"))
produces value for ZI
{1.5,2.5,1.5,2.5}
corresponding to the points
(1.5,1.5,1.5)
(1.5,2.5,2.5)
(2.5,1.5,1.5)
(2.5,2.5,2.5)
Learn more about matrix/array functions.
Functions: F - L 247
Design-Time Function Descriptions
INTERPFT
Calls the MATLAB INTERPFT function to perform one-dimensional interpolation using the FFT method.
The INTERPFT function returns an array of Y values nY long if given the x array and integer value nY.
Format
INTERPFT (x, nY,)
Argument
Example
variable create variable=Y real=(interpft({1,2,3},5))
returns a value for Y of
{1.0, 1.1419, 2.4697, 3.1484, 2.2401}
Learn more about matrix/array functions.
248 Adams View Function Builder
Design-Time Function Descriptions
INVERSE
Returns the inverse matrix of a square matrix. If an inverse doesn't exist, it generates an error.
Format
INVERSE(M)
Argument
M A square matrix.
Example
The following example illustrates the use of the INVERSE function:
LAST
Returns the last element of an array if an element exists; otherwise, returns a 0.
Format
LAST (A)
Argument
A An array.
Examples
The following examples illustrate the use of the LAST function:
Function LAST({})
Result 0.0
Function LAST({1})
Result 1
Function LAST({1,2,3})
Result 3
LAST_N
Returns the last N element of an array.
Format
LAST_N (A,N)
Arguments
A An array.
N Number of elements to return.
Examples
The following examples illustrate the use of the LAST function:
Function LAST_N({3},2)
Result {}
Function LAST_N({1,2,3},0)
Result {}
Function LAST_N({1,2,3},2)
Result {2,3}
LINEAR_SPLINE
Creates an interpolated curve from input points with a specified number of values. Interpolates using linear
interpolation.
The length of the Independent Data array must be the same as the Dependent Data array.
The algorithm that fits the linear spline is from Digital Computation and Numerical Methods, chapter 8.1.2
(Southworth, 1965).
Format
LINEAR_SPLINE (Independent Data, Dependent Data, Number of Output Values)
Arguments
Independent Data A 1xN array of x values for the curve to be interpolated. The x values must
be in ascending order, and the length of the array must be greater than or
equal to 4.
Dependent Data A 1xN array of y values for the curve to be interpolated.
Number of Output Values The number of values to be generated in the output array.
Example
The following function interpolates a set of four points with ordinal values from 1 to 4 and abscissal values
as shown, into a series of 10 abscissal values.
To compute the ordinal values for these splined values, you can use the SERIES2 function as follows:
LOC_ALONG_LINE
Returns an array of three numbers defining a location expressed in the global coordinate system. The location
is a specified distance along the line from one coordinate system object to another.
Format
LOC_ALONG_LINE (Object for Start Point, Object for Point on Line, Distance)
Arguments
Object for Start Point Coordinate system object defining the starting point of the line.
Object for Point on Line Coordinate system object defining a point on the line.
Distance Distance along the line.
Example
In the following illustration, the LOC_ALONG_LINE function returns an array of three numbers
representing a location:
Note: The line between the coordinate system objects is not affected by the objects' orientations.
LOC_BY_FLEXBODY_NODEID
Returns the location as a three-dimensional vector of a node on a flexible body.
Format
loc_by_flexbody_nodeid (flex_body, node_id)
Returns
If the node ID does not exist in the flexible body, LOC_BY_FLEXBODY_NODEID returns a location at
the origin (0, 0, 0) with no warning.
Example
The following example creates a marker on ground that is coincident to node 1000 of flexible body link:
marker create marker=.ground.marker_1 &
location = (eval(LOC_BY_FLEXBODY_NODEID(link, 1000)))
Learn about location/orientation functions.
See more node ID functions.
Functions: F - L 255
Design-Time Function Descriptions
LOC_CYLINDRICAL
Returns an array of three numbers that are the Cartesian coordinates (x, y, z) for a point equivalent to the
cylindrical coordinates (r, θ , z) for the same point. Both sets of coordinates are relative to the global
coordinate system origin and axes. The relationship between the coordinates is:
x = r cos θ
y = r sin θ
z=z
Format
LOC_CYLINDRICAL (R, Theta, Z)
Arguments
Example
In the following illustration, the LOC_CYLINDRICAL function returns an array of three numbers that are
the Cartesian coordinates for a point.
Function LOC_CYLINDRICAL(1,30,0)
Result 0.866, 0.5, 0
256 Adams View Function Builder
Design-Time Function Descriptions
Note: Assumes that the default for angular displacement units is degrees.
LOC_FRAME_MIRROR
Returns an array of three numbers representing a location in the global coordinate system, which mirrors
another location across a plane of a coordinate system object.
Format
LOC_FRAME_MIRROR (Location, Frame Object, Plane Name)
Arguments
Location Array of numbers that specifies a location expressed in the global coordinate system.
Frame Object Coordinate system object that defines the plane of reflection.
Plane Name Character string that specifies one of the three planes in a coordinate system object. xy,
yx, xz, zx, yz, and zy (character case is insignificant) are the only possible values. Character
order is insignificant; that is, xy is the same as yx.
Example
In the following illustration, the LOC_FRAME_MIRROR function returns an array of three numbers
representing a location:
Note: In this example, the xy plane of coordinate system object, marker_1, is parallel to the global xz
plane.
258 Adams View Function Builder
Design-Time Function Descriptions
LOC_GLOBAL
Returns an array of three numbers representing the global coordinates of a location obtained from
transforming the local coordinates by a specified location.
Format
LOC_GLOBAL (Location, Frame Object)
Arguments
Location Array of numbers that specify a location expressed relative to a local coordinate system.
Frame Object Coordinate system object in which the local coordinates are expressed.
Example
In the following illustration, the LOC_GLOBAL function returns an array of three numbers representing the
global coordinates of a location:
LOC_INLINE
Returns an array of three numbers representing the transformation and normalization of coordinates for a
location you specified. The location's coordinates are originally expressed in terms of one coordinate system
and then transformed to the equivalent coordinates, as expressed relative to a new coordinate system.
Format
LOC_INLINE (Location, In Frame Object, To Frame Object)
Arguments
Location Array of three numbers specifiying a location expressed in terms of the original
coordinate system.
In Frame Object Starting coordinate system object in which location coordinates are input.
To Frame Object New coordinate system into which the location coordinates are transformed.
Examples
In the following illustration, the LOC_INLINE function returns an array of three numbers representing the
transformation and normalization of coordinates for a specified location:
In the following illustration, the LOC_INLINE function returns an array of three numbers representing the
transformation and normalization of coordinates for a specified location:
LOC_LOC
Returns an array of three numbers representing the transformation of coordinates location in a new
coordinate system object.
Format
LOC_LOC (Location, In Frame Object, To Frame Object)
Arguments
Example
In the following illustration, the LOC_LOC function returns an array of three numbers representing the
transformation of coordinates location in a new coordinate system object:
LOC_LOCAL
Returns an array of three numbers representing a location obtained by transforming a location expressed in
the global coordinate system, to a new local coordinate system object.
Format
LOC_LOCAL (Location, Frame Object)
Arguments
Location An array of numbers specifying a location expressed in the global coordinate system.
Frame Object A new local coordinate system into which the locations are to be transformed.
Example
In the following illustration, the LOC_LOCAL function returns an array of three numbers representing a
location:
LOC_MIRROR
Returns an array of three numbers representing a location in the global coordinate system, which mirrors
another location across a plane of a coordinate system object.
Format
LOC_MIRROR (Location, Frame Object, Plane Name)
Arguments
Location Array of numbers that specifies a location expressed in the global coordinate system.
Frame Object Coordinate system object that defines the plane of reflection.
Plane Name Character string that specifies one of the three planes in a coordinate system object. xy,
yx, xz, zx, yz, and zy (character case is insignificant) are the only possible values. Character
order is insignificant; that is, xy is the same as yx.
Example
In the following illustration, the LOC_MIRROR function returns an array of three numbers representing a
location:
Note: In this example, the xy plane of coordinate system object, marker_1, is parallel to the global xz
plane.
Functions: F - L 269
Design-Time Function Descriptions
LOC_ON_AXIS
Returns an array of three numbers representing a location expressed in the global coordinate system, obtained
from translating a certain distance along a specified axis of a coordinate system object.
Format
LOC_ON_AXIS (Frame Object, Distance, Axis Name)
Arguments
Frame Object Coordinate system object on whose axis you want your point to lie.
Distance Real number stating how far to move along the specified axis.
Axis Name Single-character string denoting the coordinate system axis. Valid values are x, y, and z
(character case is insignificant).
Functions: F - L 271
Design-Time Function Descriptions
Examples
In the following illustration, the LOC_ON_AXIS function returns an array of three numbers representing a
location:
In the following illustration, the LOC_ON_AXIS function returns an array of three numbers representing a
location:
In the following illustration, the LOC_ON_AXIS function returns an array of three numbers representing a
location:
LOC_ON_LINE
Returns an array of three numbers representing the global coordinates of a location along a line defined by
two points.
Format
LOC_ON_LINE (Line Point Locations, Distance)
Arguments
Line Point Locations 3x2 matrix containing two points describing a line. The coordinates of the points
are expressed in the global coordinate system.
Distance Real number, measured from the first point, that determines how far to move
along the line.
Example
In the following illustration, the LOC_ON_LINE function returns an array of three numbers representing
the global coordinates of a location:
Function LOC_ON_LINE({{7,5,0},{15,11,0}}, 7)
Result 12.6, 9.2, 0.0
Functions: F - L 275
Design-Time Function Descriptions
LOC_PERPENDICULAR
Returns a location normal to a plane, one unit away from the first point in the plane.
LOC_PERPENDICULAR can also be used to orient a marker by directing an axis toward a point one unit
away from the first point in the plane.
Format
LOC_PERPENDICULAR (Plane Point Locations)
Arguments
Plane Point Locations 3x3 matrix providing three non-colinear points describing a plane.
Example
The following example illustrates the use of the LOC_PERPENDICULAR function:
Function LOC_PERPENDICULAR({{10,12,0},{14,12,0},{12,10,0}})
Result 10, 12, 1
LOC_PLANE_MIRROR
Returns an array of three numbers representing a location expressed in the global coordinate system of a
location mirrored across the specified plane.
Format
LOC_PLANE_MIRROR (Location, Plane Point Locations)
Arguments
Example
In the following illustration, the LOC_PLANE_MIRROR function returns an array of three numbers
representing a location:
Function LOC_PLANE_MIRROR({2,4,0},{{10,12,0},{14,12,0},{12,10,0}})
Result 2, 4, 0
278 Adams View Function Builder
Design-Time Function Descriptions
LOC_RELATIVE_TO
Returns an array of three numbers representing a location, by transforming a specified location that is relative
to a coordinate system object.
Format
LOC_RELATIVE_TO (Location, Frame Object)
Arguments
Example
In the following illustration, the LOC_RELATIVE_TO function returns an array of three numbers
representing a location:
Notes: Special care should be taken when using the LOC_RELATIVE_TO() function when it
involves nested expressions as arguments involving parameters of database entities such as
markers. A marker's location is stored relative to the coordinate system of the part that owns
the marker and all part locations are stored relative to the coordinate system of the model that
owns the parts. So any expression involving LOC_RELATIVE_TO which belongs to the
marker database entity will automatically return the location relative to the coordinate system
of the part that owns the marker. Consider the following example in which the node_id
parameter of a flexible body f1 is parameterized using the following expression:
If this expression is evaluated using the Function Builder, the results produced will be different
from the actual evaluation of the node_id expression in the database. This is because the
expression evaluation is always relative to the parent expression. In the case of the function
builder expression evaluation, there is no parent expression, hence the
LOC_RELATIVE_TO() function will return the global location whereas when the same
expression is evaluated in the database, the LOC_RELATIVE_TO() will return the location
relative to the flexible body f1 which is the parent of the node_id.
In this case the location returned by LOC_LOC() will always be without any parent reference
frame and hence will return consistent values when evaluated using the function builder or in
the database.
Functions: F - L 281
Design-Time Function Descriptions
LOC_SPHERICAL
Returns Cartesian coordinates (x, y, z) that are equivalent to spherical coordinates ( ρ , θ , φ ). In this case:
x= ρ sin θ cos φ
y= ρ sin θ sin φ
z= ρ cos θ
Format
LOC_SPHERICAL (Rho, Theta, Phi)
Arguments
Example
The following example illustrates the use of the LOC_SPHERICAL function:
LOC_TO_FLEXBODY_NODEID
Returns the node ID of the flexible body that is closest to the specified location.
Format
loc_to_flexbody_nodeid (flex_body, location)
Arguments
Example
The following example assigns the node number on flexible body, link, closest to the point located at (10, 20,
30) to the variable .node_id.
var set var=.node_id int=(eval(LOC_TO_FLEXBODY_NODEID(link,
{10,20,30})))
Learn about location/orientation functions.
Functions: F - L 283
Design-Time Function Descriptions
LOC_X_AXIS
Returns a normal vector defining the x-axis of a coordinate system object in the global coordinate system.
You often use LOC_X_AXIS with the orientation functions or with the function LOC_ON_LINE.
Format
LOC_X_AXIS (Frame Object)
Argument
Example
In the following illustration, the LOC_X_AXIS function returns a normal vector defining the x-axis of
marker_2:
Function LOC_X_AXIS(marker_2)
Result 1, 0, 0
284 Adams View Function Builder
Design-Time Function Descriptions
LOC_Y_AXIS
Returns a normal vector defining the y-axis of a coordinate system object in the global coordinate system.
You often use LOC_Y_AXIS with the orientation functions or with the function LOC_ON_LINE.
Format
LOC_Y_AXIS (Frame Object)
Argument
Example
In the following illustration, the LOC_Y_AXIS function returns a normal vector defining the y-axis of
marker_2:
Function LOC_Y_AXIS(marker_2)
Result 0, 1, 0
Functions: F - L 285
Design-Time Function Descriptions
LOC_Z_AXIS
Returns a normal vector defining the z-axis of a coordinate system object in the global coordinate system.
You often use LOC_Z_AXIS with the orientation functions or with the function LOC_ON_LINE.
Format
LOC_Z_AXIS (Frame Object)
Argument
Example
In the following illustration, the LOC_Z_AXIS function returns a normal vector defining the z-axis of
marker_2:
Function LOC_Z_AXIS(marker_2)
Result 0, 0, 1
286 Adams View Function Builder
Design-Time Function Descriptions
LOCAL_FILE_ NAME
Returns the local name of a file when given a name that may contain the directory specifications:
"/user/coop/source/dbase/file.dat" → "file.dat"
Format
LOCAL_FILE_NAME(full_file_name)
Argument
Example
The following example illustrates the use of the LOCAL_FILE_NAME function:
var set var=$_self.file_name string_value=
(eval (LOCAL_FILE_NAME ("my_dir/my_file.dat")))
returns "my_file.dat"
Learn more about system functions.
Functions: F - L 287
Design-Time Function Descriptions
LOG
Returns the natural logarithm of an expression that represents a numerical value.
If ey= x then LOG(x)= x. The LOG function is defined only for positive values of x (that is, x > 0). It is
undefined for all other values.
Format
LOG(x)
Argument
Example
The following example illustrates the use of the LOG function:
Function LOG(30)
Result 3.4
LOG10
Returns log to base 10 of an expression that represents a numerical value.
If 10y = x, then LOG10(x) = y. The LOG10 function is defined only for positive values of x (that is, x > 0).
It is undefined for all other values.
Format
LOG10(x)
Argument
Example
The following example illustrates the use of the LOG10 function:
Function LOG10(42)
Result 1.6
Functions: M - P
MAG
Returns the magnitude of a vector.
MAG ( x, y, z ) = x2 + y2 + z2
Format
MAG(x, y, z)
Arguments
x Real value.
y Real value.
z Real value.
Example
The following example illustrates the use of the MAG function:
Function MAG(5,3,1)
Result 5.91
MAX
Returns the value of the largest element of a matrix.
Format
MAX (M)
Argument
M A matrix.
Example
The following example illustrates the use of the MAX function:
Function MAX({{2,4,5},{1,8,2}})
Result 8.0
MAXI
Returns the index of the largest element of a matrix.
Format
MAXI (M)
Argument
M A matrix.
Example
The following example illustrates the use of the MAXI function:
MEAN
Returns the mean of a matrix.
Format
MEAN (M)
Argument
M A matrix.
Example
The following example illustrates the use of the MEAN function:
MEASURE
The MEASURE performs calculations using simulation results. The calculations that can be specified are
equivalent to the characteristics that can be measured using Object Measures.
Note that the Measure function uses the results from the most recent simulation. This limitation exists
because any model modification and run after the measured simulation could invalidate the MEASURE
calculations (for example, the measured object no longer exists).
Format
MEASURE (object, CoordSystem, RefFrame, characteristic, component)
Argument
Example
The following example illustrates the use of the MEASURE function:
After simulating, if user want to store the x locations of PART_2's cm then:
MESHGRID
Calls the MATLAB MESHGRID function and returns a real array. Given the x and y vectors, the
MESHGRID function returns the X or Y grid coordinates.
Format
MESHGRID (x, y, XorY)
Arguments
Example
You could use the following to compute the X values for input to the GRIDDATA:
variable create variable=xx real=(meshgrid({1,2},{10,11,12},0))
which produces these values for xx
{1.0,1.0,1.0,2.0,2.0,2.0}
To create the Y vector for the same grid, use:
variable create variable=yy real=(meshgrid({1,2},{10,110,12},
1))
which produces a value for yy of
{10.0,11.0,12.0,10.0,11.0,12.0}
Learn more about matrix/array functions.
Functions: M - P 295
Design-Time Function Descriptions
MIN
Returns the value of the smallest element of a matrix.
Format
MIN (M)
Argument
M A matrix.
Example
The following example illustrates the use of the MIN function:
Function MIN({{2,4,5},{1,8,2}})
Result 1.0
MINI
Returns the index of the smallest element of a matrix.
Format
MINI (M)
Argument
M A matrix.
Example
The following example illustrates the use of the MINI function:
MKDIR
Returns a numerical value indicating whether MKDIR succeeded in creating a user-specified directory. If
successful, it returns a 1; otherwise, it returns a 0.
Format
MKDIR (String)
Argument
Example
The following function creates a new directory, named my_directory:
Function MKDIR("my_directory")
Result 1
MOD
Returns the remainder of one expression, representing a numerical value, divided by another expression
representing a numerical value:
MOD(x1, x2) = x1 - INT(x1/x2) * x2
Format
MOD(x1, x2)
Arguments
Example
The following example illustrates the use of the MOD function:
Function MOD(45,16)
Result 13
NINT
Returns the whole number nearest to the input value.
Format
NINT(x)
Argument
Examples
The following examples illustrate the use of the NINT function:
Function NINT(4.78)
Result 5
Function NINT(-.25)
Result 0
NODE_ID_CLOSEST
Returns an integer node ID associated with the node of a flexible body closest to a marker. If you set intpt to
1, NODE_ID_CLOSEST considers only the interface nodes.
Format
inode_id_closest (marker, flex_body, intpt)
Arguments
Returns
If NODE_ID_CLOSEST finds no node, it returns a integer value of zero (0) with no warning.
Example
The figure on the next page shows a flexible body, link, with two interface points at nodes 10000 and 20000.
There is also a marker on ground, marker_1. The example below finds the interface node on link that is
closest to marker_1 and assigns its node number to the integer variable .int_node.
var set var=.int_node int=(eval(node_id_closest(marker_1, link,
1)))
NODE_ID_IS_INTERFACE
Indicates whether the specified node of a flexible body is an interface node by returning 1 for yes, 0 for no.
Format
NODE_ID_IS_INTERFACE(flexible_body, node_id)
Arguments
Example
if cond=(NODE_ID_IS_INTERFACE(FlexBodyObj, ThisNode))
Learn more about GUI functions.
302 Adams View Function Builder
Design-Time Function Descriptions
NODE_IDS_CLOSEST_TO
Returns array containing node IDs (integers) of the number (num) of
nodes on a flexible body closest to a specified marker.
Format
node_ids_closest_to (marker, flex_body, num, intpt)
Arguments
Returns
If NODES_IDS_CLOSEST_TO finds no nodes, it returns a single
integer value of -1 with no warning.
Example
The following example displays the three nodes on the flexible body
named link closest to marker_1 on ground. It displays the nodes in the
Info window, as shown in the figure below.
var set var=.nodes int=(eval(node_ids_closest_to(marker_1, link,
3, 0))) &
comments = "3 closest nodes to marker"
Functions: M - P 303
Design-Time Function Descriptions
NODE_IDS_IN_VOLUME
Returns an array containing node IDs (integers) for all nodes on a flexible body, which reside inside the
volume of the geometry object, geom. geom must be either a spherical ellipsoid or a cylinder.
Format
node_ids_in_volume (flex_body, geom)
Arguments
Returns
If NODE_IDS_IN_VOLUME finds no nodes, it returns a single integer value of -1 with no warning.
Example
The following example assigns the value of -1 to variable .nodes because none of the nodes of the flexible
body, link, are contained in the geometric object, sphere, as shown in the figure below.
var set var=.nodes int=(eval(node_ids_in_volume(link, sphere)))
Functions: M - P 305
Design-Time Function Descriptions
NODE_IDS_WITHIN_RADIUS
Returns an array of node IDs (integers) associated with all the nodes of a flexible body within a radius of a
marker. If you set intpt to 1, NODE_IDS_WITHIN_RADIUS only considers interface nodes.
Format
node_ids_within_radius (marker, flex_body, radius, intpt)
Arguments
Returns
If NODE_IDS_WITHIN_RADIUS finds no nodes, it returns a single integer value of -1 with no warning.
Example
The figure shown below shows the flexible body, link, with a circle of radius 5.75 centered at the location of
marker, link.marker_2. All 10 nodes located within this circle are labeled in the figure. The following
command assigns these node numbers to the variable .nodes:
var set var=.nodes
int=(eval(node_ids_within_radius(.model_1.link.marker_2,.model_1
.link, 5.75,0)))
Functions: M - P 307
Design-Time Function Descriptions
NODE_NODE_CLOSEST
Returns an integer node ID associated with a node of the flexible body, new_flex, closest to node
old_node_id, on the flexible body old_flex. If intpt is set to 1, only the interface nodes are considered.
Format
NODE_NODE_CLOSEST(old_flex, new_flex, old_node_id, intpt)
Arguments
Example
The following example:
variable set variable = tmp &
integer=(eval(node_node_closest(old_part, new_part,
old_node_id, 1)))
returns the ID of the interface node on new_part closest to the location of the old_node_id on old_part.
Learn more about GUI functions.
Functions: M - P 309
Design-Time Function Descriptions
NORM
Calls the MATLAB NORM function. This returns a real scalar. The norm of a matrix is a scalar that gives
some measure of the magnitude of the elements of the matrix. The NORM function calculates the largest
singular value of the input array, A, max(svd(A)).
Format
NORM (A)
Argument
Example
variable create variable=N real=(norm({1,2,3}))
produces a value of 3.7417 for N.
Learn more about matrix/array functions.
310 Adams View Function Builder
Design-Time Function Descriptions
NORM2
Returns the square root of the sum of the squares of the elements of a matrix.
The NORM2 function could also be written as SQRT(SUM
(N ** 2)) or SQRT(SSQ(N)), but these would execute slower than NORM2.
Format
NORM2 (M)
Argument
M A matrix.
Example
The following example illustrates the use of the NORM2 function:
NORMALIZE
Returns the normalized elements of a matrix.
The function NORMALIZE could also be written as M/NORM2(M), but this would execute much slower
than NORMALIZE.
Format
NORMALIZE (M)
Argument
M A matrix.
Example
The following example illustrates the use of the NORMALIZE function:
Function ({3,4,5})
Result {0.424, 0.566, 0.707}
NOTAKNOT_SPLINE
Creates an interpolated curve from input points with a specified number of values. Interpolates using the
Not-a-knot cubic spline.
The length of the Independent Data array must be the same as the Dependent Data array.
Format
NOTAKNOT_SPLINE (Independent Data, Dependent Data, Number of Output Values)
Arguments
Independent Data A 1xN array of x values for the curve to be interpolated. The x values of the
points must be in ascending order, and the length of the array must be
greater than or equal to 4.
Dependent Data A 1xN array of y values for the curve to be interpolated.
Number of Output Values The number of values to be generated in the output array.
Example
The following function interpolates a set of four points with ordinal values from 1 to 4 and abscissal values
as shown, into a series of 10 abscissal values:
To compute the ordinal values for these splined values, you can use the SERIES2 function as follows:
OBJECTIVE_UNIT
Returns the unit string for a design objective.
Format
OBJECTIVE_UNIT (Objective)
Arguments
Examples
The following is an illustration of the OBJECTIVE_UNIT function:
var set var=obj_unit str=(eval(OBJECTIVE_UNIT(.MODEL_1.OBJECTIVE_1)))
314 Adams View Function Builder
Design-Time Function Descriptions
OBJECTIVE_VALUE
Returns the value of a design objective for a particular analysis.
Format
OBJECTIVE_VALUE (Objective, Analysis)
Arguments
Examples
The following is an illustration of the OBJECTIVE_VALUE function:
var set var=obj_val real=(eval(OBJECTIVE_VALUE(.MODEL_1.OBJECTIVE_1,
.MODEL_1.Last_run)))
Functions: M - P 315
Design-Time Function Descriptions
ON_OFF
Returns the character string on or off, depending on the state of the argument.
Format
ON_OFF (State)
Argument
Example
The following example illustrates the use of the ON_OFF function:
Function ON_OFF(1)
Result on
ORI_ALIGN_AXIS
Returns an orientation that aligns one axis of a coordinate system object with an axis of another. It only aligns
one axis and leaves the others in unspecified orientations.
Format
ORI_ALIGN_AXIS (Frame Object, Axis Spec)
Arguments
All of the valid strings are xx, xy, xz, yx, yy, yz, zx, zy, zz, x+x, x+y, x+z, y+x, y+y, y+z, z+x,
z+y, z+z, x-x, x-y, x-z, y-x, y-y, y-z, z-x, z-y, and z-z. The first character defines the axis of
the result. The last character defines the axis of the coordinate system object to which the
result is aligned. For example, xy aligns the x-axis of the result with the y-axis of the
coordinate system object.
You can insert either "-" or "+" as the middle character. For example, if you insert "-" as
in z-z, this indicates that the z-axis of the result is to be aligned in the opposite direction
of the z-axis in frame.
The Axis Spec parameters xx, x+x, yy, y+y, zz, and z+z are identity values resulting in the
global orientation of the coordinate system object. You can, however, compute this
orientation more efficiently by using the function ORI_GLOBAL.
Example
In the following illustration, the ORI_ALIGN_AXIS function returns all the angles of rotation associated
with a body-fixed 313 rotation sequence:
ORI_ALIGN_AXIS_EUL
Returns an orientation that aligns one axis of a coordinate system object with an axis of another. It only aligns
one axis and leaves the others in undefined orientations.
Format
ORI_ALIGN_AXIS_EUL (Orientation, Axis Spec)
Arguments
Orientation An orientation that defines the axes about which the coordinate system object is to be
oriented.
Axis Spec A character string defining the type of alignment.
All of the valid strings are xx, xy, xz, yx, yy, yz, zx, zy, zz, x+x, x+y, x+z, y+x, y+y, y+z, z+x,
z+y, z+z, x-x, x-y, x-z, y-x, y-y, y-z, z-x, z-y, and z-z. The first character defines the axis of the
result. The last character defines the axis of the frame to which the result is aligned. For
example, xy aligns the x-axis of the result with the y-axis of the coordinate system object.
You can insert either “-” or “+” as the middle character. For example, if you insert “-” as in
z-z, this indicates that the z-axis of the result is to be aligned in the opposite direction of the
z-axis in frame.
The Axis Spec parameters xx, x+x, yy, y+y, zz, and z+z are identity values, resulting in the
global orientation of the coordinate system object. You can, however, compute this
orientation more efficiently by using the function ORI_GLOBAL.
Example
In the following illustration, the ORI_ALIGN_AXIS_EUL function returns all the angles of rotation
associated with a body-fixed 313 rotation sequence:
ORI_ALL_AXES
Returns a body-fixed 313 Euler sequence describing an orientation in which the first axis of a coordinate
system object is parallel to, and co-directed with, a line defined by the first two points in a plane, and its
second axis is parallel to the plane.
Format
ORI_ALL_AXES (Plane Point Locations, Axes Names)
Arguments
Plane Point Locations 3x3 matrix providing three non-colinear points describing a plane. The points
are expressed in the global coordinate system.
Axes Names Character string indicating which two axes to orient.
xy, yx, xz, zx, yz, and zy are the only possible values (character case is
insignificant). Also, since each value defines a distinct orientation, xy is not the
same as yx.
Examples
In the following illustration, the ORI_ALL_AXES function returns a body-fixed 313 Euler sequence
describing an orientation, as specified.
In the following illustration, the ORI_ALL_AXES function returns a body-fixed 313 Euler sequence
describing an orientation, as specified:
Functions: M - P 321
Design-Time Function Descriptions
ORI_ALONG_AXIS
Returns the alignment of a specified axis from one coordinate system object to another. This function has an
underlying parameter that allows it to express the resulting orientation in the proper coordinate system
object.
Format
ORI_ALONG_AXIS (From Frame, To Frame, Axis Name)
From Frame Coordinate system object that defines a starting point for the orientation vector.
To Frame Coordinate system object that defines the ending point for the orientation vector.
Axis Name Character string indicating which axis is to be aligned. The possible values are x, y or z
(character case is not significant).
Example
In the following illustration, the ORI_ALONG_AXIS function returns the alignment of a specified axis:
Note: The returned y axis is aligned with the line through marker_1 and marker_2.
ORI_FRAME_MIRROR
Returns an orientation that has the specified axes mirrored about a plane within a coordinate system object.
Format
ORI_FRAME_MIRROR (Body Fixed 313 Angles, Frame Object, Plane Name, Axes Name)
Body Fixed 313 Angles Array of body-fixed 313 Euler rotation sequences, expressed in the global
coordinate system.
Frame Object Coordinate system object defining the plane of reflection.
Plane Name Character string that selects one of three planes in a coordinate system object.
xy, yx, xz, zx, yz, and zy are the only possible value (character case is
insignificant). Also, order is insignificant; that is, xy is the same as yx.
Axes Name Character string that indicates which axes to mirror. xy, yx, xz, zx, yz, and zy
are the only possible values (character case is insignificant). Also, order is
insignificant; that is, xy is the same as yx.
Example
In the following illustration, the ORI_FRAME_MIRROR function returns an orientation, as specified:
ORI_GLOBAL
Resolves an angle expressed in a coordinate system object to the global coordinate system. ORI_GLOBAL is
the shorthand for ORI_ORI.
Format
ORI_GLOBAL(Orientation, Frame Object)
Arguments
Orientation Array of body-fixed 313 Euler rotations to be transformed to the global coordinate
system.
Frame Object Coordinate system object in which each sequence in the angle is expressed.
Example
In the following illustration, the ORI_GLOBAL function returns an orientation, as specified:
ORI_IN_PLANE
Returns an orientation by directing one of the axes and defining one of the planes within a coordinate system
object. ORI_IN_PLANE has an underlying parameter that allows it to express the resulting orientation in
the proper coordinate system object.
Format
ORI_IN_PLANE (Frame Object 1, Frame Object 2, Frame Object 3, Directed Axes & Coordinate)
Frame Object 1 Coordinate system object defining a starting point for the orientation
plane.
Frame Object 2 Coordinate system object defining another point for the orientation
plane.
Frame Object 3 Coordinate system object defining another point for the orientation
plane.
Directed Axes & Coordinate Character string defining which axis is to be directed and which
coordinate system object plane is to be oriented. The possible values for
this parameter are: x_xy, x_xz, y_yx, y_yz, z_zx, or z_zy.
Example
In the following illustration, the ORI_IN_PLANE function returns an orientation of a plane whose z-axis is
defined from marker_1 (100.0, 100.0, 0.0) to marker_2 (300.0, 300.0, 0.0) and whose y-axis is in the plane
defined by marker_1, marker_2 and marker_3 (350.0, 100.0, 0.0):
ORI_LOCAL
Returns an orientation, expressed in the global frame, in the local frame of the coordinate system object.
ORI_LOCAL is the shorthand for ORI_ORI.
Format
ORI_LOCAL (Orientation, Frame Object)
Arguments
Orientation Array of body-based 313 Euler rotations expressed in the global coordinate system.
Frame Object Coordinate system object into which the rotations are to be transformed.
Example
The following example illustrates the use of the ORI_LOCAL function.
ORI_MIRROR
Returns an orientation by performing a mirroring of the given orientations that reflect the specified axes.
Format
ORI_MIRROR (Body Fixed 313 Angles, Frame Object, Plane Name, Axes Name)
Arguments
Body Fixed 313 Angles Array of body-fixed 313 Euler rotation sequences, expressed in a coordinate
system object.
Frame Object Coordinate system object that defines the plane of reflection.
Plane Name Character string selecting one of three planes in the coordinate system object.
The only possible values are: xy, yx, xz, zx, yz, and zy (character case is
insignificant). Character order is insignificant; that is, xy is the same as yx.
Axes Name Character string indicating which axes to mirror.
The only possible values are: xy, yx, xz, zx, yz, and zy (character case is
insignificant). Character order is insignificant; that is, xy is the same as yx.
Example
In the following illustration, the ORI_MIRROR function returns an orientation, as specified:
Note: Because complete mirroring would change the right-handedness of the mirrored coordinate
system object, only partial mirroring is possible. To perform partial mirroring, you must
choose two axes to be mirrored, with the remaining axis pointing in the direction required to
maintain a right-handed system.
ORI_ONE_AXIS
Returns a body-fixed 313 Euler rotation sequence expressed in the global coordinate system when given a line
that is parallel to, and co-directed with, a specified axis. The resulting rotation about the directed axis is
arbitrary with ORI_ONE_AXIS.
If you want to simultaneously control the orientation of the x, y, and z axes, use the ORI_ALL_AXES function.
Format
ORI_ONE_AXIS (Line Point Locations, Axes Name)
Arguments
Line Point Locations A 3x2 matrix containing two points that describe a line. The points are expressed
in the global coordinate system.
Axed Name A single character string indicating which axis is to be oriented along the line. The
only possible values are x, y, or z (character case is insignificant).
Examples
In the following illustration, the ORI_ONE_AXIS function returns a body-fixed 313 Euler sequence:
In the following illustration, the ORI_ONE_AXIS function returns a body-fixed 313 Euler sequence:
Functions: M - P 333
Design-Time Function Descriptions
In the following illustration, the ORI_ONE_AXIS function returns a body-fixed 313 Euler sequence:
ORI_ORI
Returns an orientation that represents the same orientation as expressed in the local frame of one coordinate
system object, to the local frame of another coordinate system object. Given an orientation expressed in one
coordinate system object, ORI_ORI produces a new orientation (representing the same orientation) that is
expressed in another coordinate system object.
Format
ORI_ORI (Orientation, From Frame Object, To Frame Object)
Arguments
Example
In the following illustration, the ORI_ORI function returns an orientation, as specified:
ORI_PLANE_MIRROR
Returns a sequence of body-fixed 313 Euler rotations by performing a mirroring of orientations. Using an
orientation, ORI_PLANE_MIRROR produces a new sequence describing an orientation that mirrors the
specified axes.
Format
ORI_PLANE_MIRROR (Angles, Plane Point Locations, Axes Names)
Arguments
Angles Array of body-fixed 313 Euler rotation sequences expressed in the global
coordinate system.
Plane Point Locations 3x3 matrix providing three non-colinear points described in a plane. The points
are expressed in the global coordinate system.
Axes Names Character string indicating which axes to mirror.
xy, yx, xz, zx, yz, and zy are the only possible values (character case is
insignificant). Character order is insignificant; that is, xy is the same as yx.
Examples
In the following illustration, the ORI_PLANE_MIRROR function returns a sequence of body-fixed 313
Euler rotations:
In the following illustration, the ORI_PLANE_MIRROR function returns a sequence of body-fixed 313
Euler rotations:
In the following illustration, the ORI_PLANE_MIRROR function returns a sequence of body-fixed 313
Euler rotations:
Note: Because complete mirroring would change the right-handedness of the mirrored coordinate
system object, only partial mirroring is possible. To perform partial mirroring, you must
choose two axes to be mirrored, with the remaining axis pointing in the direction required to
maintain a right-handed system.
In the example that follows, assume an orientation (CSO1) that points z to the right, x to the back, and y up.
Reflecting this orientation about the x-y plane (which is vertical and goes front to back), while specifying a
reflection (CSO2) of the xz axes causes z to point to the left, x to the back, and y down.
338 Adams View Function Builder
Design-Time Function Descriptions
ORI_RELATIVE_TO
Returns an orientation of a coordinate system object as specified by an angle. This parametric representation
of ORI_RELATIVE_TO maintains the relationship regardless of how other objects are moved.
This function is shorthand for ORI_ORI (Orientation, Frame Object, To Frame Object) where the To Frame
Object is the underlying parameter. The underlying parameter determines the proper coordinate system
object for the transformations.
Format
ORI_RELATIVE_TO (Body 313 Rotations, Frame Object)
Arguments
Example
The following example illustrates the use of the ORI_RELATIVE_TO function:
OTABLE_CHANGED_CELLS
Returns true or false (1, 0) depending on whether or not the object table contains any changed cell.
Format
OTABLE_CHANGED_CELLS(KEY o_otable)
Arguments
Example
if cond=(OTABLE_CHANGED_CELLS(my_otable))
342 Adams View Function Builder
Design-Time Function Descriptions
PARAM_STRING
Returns a parameter's values as they appear in an Adams command file.
Format
PARAM_STRING (Object Field)
Argument
Object Field Character string denoting the name of an object followed by a field name (for example,
mar1.orientation).
Examples
The following examples assume that you created a marker as follows:
marker create marker=mar1 location=(loc_relative_to({0,0,0},
mar2)) ori=1,2,3
Function PARAM_STRING("mar1.location")
Result "(LOC_RELATIVE_TO({0, 0, 0}, .mod1.ground.mar2))"
Function PARAM_STRING("mar1.orientation")
Result "1.0, 2.0, 3.0"
PARSE_STATUS
Parses an Adams message file (usually with an .msg extension), and returns an array of integer status codes
corresponding to the given search tag.
Format
PARSE_STATUS(fileName, tag)
Arguments
fileName Name of the message file in which to search for status codes.
tag Character string indicating the status coes to extract.
Examples
A typical message file contains pairs of lines that look like the following:
ALVSIM:STATUS
Simulate status=0
or
A3TERM:STATUS
Termination status=-995
This function finds lines that match the contents of tag, and returns the numeric value following the equal
sign on the line following the tag match. It does this for the entire file, returning an array of status codes, in
the order in which it found them.
For example, if the above lines were to appear in test.msg, then you could execute the following command
and receive an array containing a single element, -995, as the result:
variable create variable=status
integer=(parse_status("test.msg", "A3TERM:STATUS"))
Tip: Use the LAST function if you want to retrieve only the final value. You could change the
example on the previous page to read as follows if you want to retrieve only the final value in
the file:
variable create variable=finalStatus &
integer=(last(parse_status("test.msg",
"A3TERM:STATUS")))
PARZEN
Returns the 1xN array of values after applying the PARZEN window function.
Format
PARZEN (a)
Argument
Example
The following example illustrates the use of the PARZEN function:
PARZEN_WINDOW
Generate the PARZEN window. The PARZEN window function gently forces the end points toward zero, and
smooths the remaining points.
Format
PARZEN_WINDOW (n)
Arguments
n An integer value.
Example
The following is an example of the use of the PARZEN_WINDOW function:
Function PARZEN_WINDOW(5)
Result {0.3333, 0.6667, 1.0000, 0.6667, 0.3333}
PHI
Returns the third angle associated with a Body 313 rotation sequence from one coordinate system object to
another. This third rotation is referred to as the phi, φ , angle, and is used in association with the psi, ψ ,
(1st rotation) and theta, θ , (2nd rotation) angles.
Positive angular displacement is determined by the right-hand rule.
Format
PHI (Object, Reference Frame)
Arguments
Example
The following example illustrates the use of the PHI function:
PHI(marker_O, marker_R)
See the illustration for PSI.
Learn more about modeling functions.
Functions: M - P 347
Design-Time Function Descriptions
PICK_OBJECT
Prompts the user to select an object of a specified type from the screen. Returns the KEY of the selected object.
Format
PICK_OBJECT(obj_type)
Argument
Example
var set var=pick_obj obj=(eval(PICK_OBJECT("marker")))
Learn more about GUI functions.
348 Adams View Function Builder
Design-Time Function Descriptions
PITCH
Returns the negative value of the second angle associated with a Body 321 rotation sequence from one
coordinate system object to another. This angle is referred to as the pitch angle, and is used in association
with the yaw (1st rotation) and roll (3rd rotation) angles.
Note: Opposite from convention, this function calculates the negative of the second Body 321 angle.
Format
PITCH (Object, Reference Frame)
Arguments
Example
The following example illustrates the use of the PITCH function:
PITCH(marker_O, marker_R)
See the illustration for YAW.
Learn more about modeling functions.
Functions: M - P 349
Design-Time Function Descriptions
POLYFIT
Returns the coefficients of a polynomial fitted to the supplied function data.
Format
POLYFIT (x, y, order)
Arguments
Examples
The following commands:
var cre var=xx rea=(series2(0, 20, 20))
var cre var=yy rea=(1.0 + 1.2*xx + 2.5*xx**2 + 2.0*xx**3)
var cre var=pp rea=(polyfit(xx, yy, 5))
produce the array result.
The coefficients are ordered from the 0th order to the nth order from left to right.
[1.0, 1.2, 2.5, 2.0, 0.0, 0.0]
Learn more about matrix/array functions.
350 Adams View Function Builder
Design-Time Function Descriptions
POLYVAL
Calls the MATLAB POLYVAL function and returns a real array. The POLYVAL function returns the y values
on the polynomial curve if given p, containing the polynomial coefficients, and an array of x values. Note
that the list of coefficients, p, is the reverse of that the MATLAB function requires. This function
complements the POLYFIT function, and POLYVAL uses the output coefficients from it directly.
Format
POLYVAL (p, x)
Arguments
Example
variable create variable=Yp real=(polyval({1,2,3},{5,7,9}))
produces a value for Yp of
{86.0, 162.0, 262.0}
Functions: M - P 351
Design-Time Function Descriptions
PROD
Returns the product of the elements of a matrix by performing a matrix reduction using multiplication.
Format
PROD (M)
Argument
M A matrix.
Example
The following example illustrates the use of the PROD function:
PSD
Computes the power spectral density from the complex Fourier coefficients. The PSD function uses the
periodogram estimate, as explained in Numerical Recipes (1989), equations 12.7.5, page 421.
Format
PSD (Values, Number of Output Values)
Arguments
Values The series values from which the FFT coefficients are computed. The PSD
function is computed from these complex coefficients.
Number of Output Values Indicates how many values should be returned; must be at least as many as
the number of input values, but not less than two.
Example
The following example illustrates the use of the PSD function:
Function PSD({0,1,4,9,16},7)
Result 144.0, 250.786, 167.080, 91.006, 51.367, 38.688, 17.016
PSI
Returns the first angle associated with a body-fixed 313 rotation sequence from one coordinate system object
to another. This first rotation is referred to as the psi, ψ , angle, and is used in association with the theta, θ
, (2nd rotation) and phi, φ , (3rd rotation) angles.
Positive angular displacement is determined by the right-hand rule.
Format
PSI (Object, Reference Frame)
Arguments
Example
The following example illustrates the use of the PSI function:
PSI(marker_O, marker_R)
The following illustrations show the rotation sequence for PSI, THETA, and PHI:
354 Adams View Function Builder
Design-Time Function Descriptions
PUTENV
Returns the string value that PUTENV assigned to an environment variable. If successful, it returns a 0;
otherwise, it returns a non-zero value. PUTENV only affects the environment of the current executable.
Format
PUTENV (Environment Variable, Value)
Arguments
Note: If the Value is File or directory path, use below file separator
conventions:
• For Windows, use double backslash, for example:
C:\\Temp\\FilePath.txt
• For Linux, use single forward slash, for example:
./usr/Temp/FilePath.txt
Example
The following function, assigns the value X11 to MDI_AVIEW_WIN:
Function (PUTENV("MDI_AVIEW_WIN","X11"))
Result 0
PWELCH
Estimate the power spectral density (PSD) of a signal using Welch's method. Here we use MATLAB to
compute the PSD. This way the sum of the PSD is equal to the time-integral squared amplitude of the
original signal.
Format
PWELCH+ (a, nFft, Fs, win, nOverLap) returns ARRAY
Arguments
a An array indicating the sequence of signal to estimate the power spectral density.
nFft An integer indicating the length of FFT to be used.
Fs A real value indicating the frequency of the signal.
win An array indicating the array of the window to be used.
nOverLap An integer indicating the number of overlaps.
Functions: R - S
RAND
Returns a pseudo-random value on the closed interval [0.0, 1.0], from a uniform distribution.
Note: The spectral distribution of this sequence may not meet your needs. You might consider
writing your own function if the demands of your application require a high-quality, pseudo-
random sequence. For further information on implementing the RAND( ) function in Adams
View, refer to the main pages on your system to see how the Standard C library function
'rand()' is implemented.
Format
RAND()
Argument
None
Examples
The following examples illustrate the use of the RAND function:
Function RAND ()
Result 0.59893834
Function RAND ()
Result 0.28873462
Arguments
FlexBody: Name of flexible body.
Analysis: Name of analysis (optional)
Returns
Real value: Minimum life of body.
Functions: R - S 359
Design-Time Function Descriptions
Arguments
Body: Name of flexible body or part with a rigid stress object.
Value: Flag for value of stress to use.
Returns
Real value: Minimum life of body.
360 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_OPEN_FILE
Opens a TeimOrbit formatted file for reading. Returns 1 on success, and 0 if any errors occur.
Format
READ_T_O_OPEN_FILE (Filename)
Prerequisites
None
Arguments
Examples
The following example illustrates the use of the READ_T_O_OPEN_FILE function:
Function READ_T_O_OPEN_FILE(“<acar_shared>/springs.tbl/mdi_0001.spr”)
Result 1
Function READ_T_O_OPEN_FILE(“<acar_shared>/springs.tbl/mdi_0001_spr.xml”)
Result 0
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 361
Design-Time Function Descriptions
READ_T_O_CLOSE_FILE
Closes a previously opened TeimOrbit file. Note that only one TO file can be read from at a time, and this
command will close the currently open file. Returns 1 on success, and 0 if any errors occur.
Format
READ_T_O_CLOSE_FILE ()
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
None
Example
The following example illustrates the use of the READ_T_O_CLOSE_FILE function:
Function READ_T_O_CLOSE_FILE()
Result 1
Important: Filenames are case sensitive and parameters are not case sensitive.
362 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_FIND_BLOCK
Searches the currently open TeimOrbit file for a named block, which can then be further processed. Returns
1 on success and 0 if any errors occur.
Format
READ_T_O_FIND_BLOCK (Block Name)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Block Name Name of block to find in TeimOrbit file. In the TO file, a block is
a string separated by brackets, for example, [MDI_HEADER]. Not
case sensitive.
Examples
[The following assumes this file has already been opened (“<acar_shared>/springs.tbl/mdi_0001.spr”)]
Result 1
Result 0
This call will fail because the subblock “FREE_LENGTH” is not a block.
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 363
Design-Time Function Descriptions
READ_T_O_FIND_SUBBLOCK
Searches the current block within the currently open file for a named subblock, which can then be further
processed. Returns 1 on success and 0 if any errors occur.
Format
READ_T_O_FIND_SUBBLOCK (Subblock Name)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
READ_T_O_FIND_BLOCK (Block Name)
Or
READ_T_O_NEXT_BLOCK ()
Arguments
Subblock Name Name of subblock to find in current block within currently open file.
In the TO file, a subblock is a string separated by parentheses, for
example, (Z_DATA). Not case sensitive.
Examples
[The following assumes this file has already been opened
(“<acar_shared>/powertrains.tbl/V12_engine_map.pwr”), and the “ENGINE” block has been selected.]
Result 1
Result 0
This call will fail because the subblock “USER” is not part of the currently selected block.
Important: Filenames are case sensitive and parameters are not case sensitive.
364 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_UNITS
Reads the units specified in the currently open TeimOrbit file into the specified string variable. The variable
contains strings for the units in this order: length, force, angle, mass, time. If the unit is not present in the
TO file, the current unit is returned. Function returns 1 on success and 0 if errors occur.
Format
READ_T_O_UNITS (Unit Variable)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Variable String variable that will hold an array of unit strings read from
the currently open TeimOrbit file. Note that it is necessary to
pass the “self ” attribute to this function.
Example
The following example illustrates the use of the READ_T_O_UNITS function:
READ_T_O_UNITS( .mdi.units_temp.self )
Result 1
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 365
Design-Time Function Descriptions
READ_T_O_CHECK_HEADER
Checks that the header in the currently open file has the specified type and version number. Returns 1 on
success and 0 if errors occur.
Format
READ_T_O_CHECK_HEADER (Type, Version)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Type String denoting the expected type of TeimOrbit file to be read. Not case sensitive.
Version Real number denoting the expected version in the TeimOrbit file.
Examples
The following examples illustrates the use of the READ_T_O_CHECK_HEADER function:
Function READ_T_O_CHECK_HEADER(‘spr’, 4)
Result 1
Function READ_T_O_CHECK_HEADER(‘spring’, 4)
Result 0
Function READ_T_O_CHECK_HEADER(‘spr’, 1)
Result 0
Important: Filenames are case sensitive and parameters are not case sensitive.
366 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_INTEGER
Searches a specified block within the currently open file for an integer attribute. Returns the integer value of
the selected attribute, or 0 if the attribute is not found or other errors occur.
Format
READ_T_O_INTEGER (Block Name, Attribute)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Examples
[The following assumes this file has already been opened
(“<acar_shared>/driver_controls.tbl/constant_radius_cornering.dcf ”).]
Result 3
Result 16
This call returns the integer representing the “INITIAL_SPEED”. Note that in this case,
READ_T_O_REAL is a better choice.
Result 0
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 367
Design-Time Function Descriptions
READ_T_O_SUBBLOCK_INTEGER
Searches for an integer attribute contained in the specified subblock within the specified block. Returns the
integer value of the selected attribute, or 0 if the attribute is not found or other errors occur.
Format
READ_T_O_SUBBLOCK_INTEGER (Block Name, SubBlock Name, Attribute)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Attribute Name of attribute within the specified subblock to retrieve the integer value.
Examples
[The following assumes this file has already been opened
(“<acar_shared>/driver_controls.tbl/constant_radius_cornering.dcf ”).]
Important: Filenames are case sensitive and parameters are not case sensitive.
368 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_REAL
Searches a specified block within the currently open TeimOrbit file for a real number attribute. Returns the
real number value of the selected attribute, or 0 if the attribute is not found or other errors occur.
Format
READ_T_O_REAL (Block Name, Attribute)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Examples
[The following assumes this file has already been opened
(“<acar_shared>/driver_controls.tbl/constant_radius_cornering.dcf ”).]
Result 16.666
Result 0
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 369
Design-Time Function Descriptions
READ_T_O_REAL_ARRAY
Searches a specified block within the currently open TeimOrbit file for a number or array of numbers with
the specified attribute label. Returns the real number(s) of the selected attribute, or 0.0 if the attribute is not
found or other errors occur.
Format
READ_T_O_REAL_ARRAY (Block Name, Attribute)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Examples
[The following assumes this file has already been opened
(“<aride_shared>/general_bushing.tbl/gen_bus001.gbu”)]
Function READ_T_O_REAL_ARRAY(“BUSHING_PARAMETERS”,
“X_ALPHA”)
Result 0.57941891
Function READ_T_O_REAL_ARRAY(“BUSHING_PARAMETERS”,
“RX_ALPHA”)
Result 0.0
Important: Filenames are case sensitive and parameters are not case sensitive.
370 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_SUBBLOCK_REAL
Searches for a real number attribute contained in the specified block and subblock. Returns the real number
value of the selected attribute, or 0 if the attribute is not found or other errors occur.
Format
READ_T_O_SUBBLOCK_REAL (Block Name, SubBlock Name, Attribute)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Attribute Name of attribute within the specified subblock to retrieve the real number
value.
Examples
[The following assumes this file has already been opened
(“<acar_shared>/driver_controls.tbl/constant_radius_cornering.dcf ”).]
Function READ_T_O_SUBBLOCK_REAL(“STEADY_STATE”,
“MACHINE_CONTROL”, “RADIUS”)
Result 80.0
Function READ_T_O_SUBBLOCK_REAL(“STEADY_STATE”,
“MACHINE_CONTROL”, “TURN_DIRECTION”)
Result 0.0
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 371
Design-Time Function Descriptions
READ_T_O_SUBBLOCK_REAL_ARRAY
Searches a specified subblock within the currently selected block within the open TeimOrbit file for a number
or array of numbers with the specified attribute label. Returns the real number(s) of the selected attribute, or
0.0 if the attribute is not found or other errors occur.
Format
READ_T_O_SUBBLOCK_REAL_ARRAY (Block Name, SubBlock Name, Attribute)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Example
[Suppose there is a subblock “BUSHING_A” within the “BUSHING_PARAMETERS” block]
Function READ_T_O_SUBBLOCK_REAL_ARRAY(“BUSHING_PARAMETERS”,
“BUSHING_1”, “X_ALPHA”)
Result 0.57941891
Important: Filenames are case sensitive and parameters are not case sensitive.
372 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_STRING
Searches a specified block within the currently open file for a string attribute. Returns the string value of the
selected attribute, or a null string if the attribute is not found or other errors occur.
Format
READ_T_O_STRING (Block Name, Attribute)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Examples
[The following assumes this file has already been opened
(“<acar_shared>/driver_controls.tbl/constant_radius_cornering.dcf ”).]
Result “STRAIGHT”
Result “”
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 373
Design-Time Function Descriptions
READ_T_O_SUBBLOCK_STRING
Searches for a string attribute contained in the specified block and subblock. Returns the string value of the
selected attribute, or a null string if the attribute is not found or other errors occur.
Format
READ_T_O_SUBBLOCK_STRING (Block Name, SubBlock Name, Attribute)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Attribute Name of attribute within the specified subblock to retrieve the string value.
Examples
[The following assumes this file has already been opened
(“<acar_shared>/driver_controls.tbl/constant_radius_cornering.dcf ”)]
Important: Filenames are case sensitive and parameters are not case sensitive.
374 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_TABLE_COLUMN
Searches a specified block within the currently open TeimOrbit file for column of real numbers with the
specified attribute label. Returns the one-dimensional array of real number values from the selected column,
or 0.0 if the attribute is not found or other errors occur.
Format
READ_T_O_TABLE_COLUMN (Block Name, Column)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Examples
[The following assumes this file has already been opened (“<acar_shared>/springs.tbl/mdi_0001.spr”)]
Result 0.0
This call will fail because “velocity” is not a column within the “CURVE” block.
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 375
Design-Time Function Descriptions
READ_T_O_SUBBLOCK_TABLE_COLUMN
Searches a specified subblock block within selected block in the currently open TeimOrbit file for column of
real numbers with the specified attribute label. Returns the one-dimensional array of real number values from
the selected column, or 0.0 if the attribute is not found or other errors occur.
Format
READ_T_O_SUBBLOCK_TABLE_COLUMN (Block Name, SubBlock Name, Column)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Examples
[The following assumes this file has already been opened
(“<acar_shared>/powertrains.tbl/V12_engine_map.pwr”)]
This call will fail because “throttle” is not within the “XY_DATA” subblock.
Important: Filenames are case sensitive and parameters are not case sensitive.
376 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_START_TABLE_READ
Searches the currently open TeimOrbit file for the specified table, and returns the first line of text from the
table. Returns an empty string if the table is not found or other errors occur.
Format
READ_T_O_START_TABLE_READ (Block Name)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Examples
[The following assumes this file has already been opened (“<acar_shared>/springs.tbl/mdi_0001.spr”)]
Function READ_T_O_START_TABLE_READ(“CURVE”)
Result { disp force}
Function READ_T_O_START_TABLE_READ(“FREE_LENGTH”)
Result “”
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 377
Design-Time Function Descriptions
READ_T_O_START_SUBBLOCK_TABLE_READ
Searches the currently open TeimOrbit file for the specified subblock contained within the selected block,
and returns the first line of text from the subblock table. Returns an empty string if the subblock is not found
or other errors occur.
Format
READ_T_O_START_SUBBLOCK_TABLE_READ (Block Name, SubBlock Name)
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
Examples
[The following assumes this file has already been opened
(“<acar_shared>/powertrains.tbl/V12_engine_map.pwr”)]
Important: Filenames are case sensitive and parameters are not case sensitive.
378 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_READ_TABLE_LINE
Reads next line in current block or subblock.
Format
READ_T_O_READ_TABLE_LINE ()
Prerequisites
READ_T_O_OPEN_FILE (Filename)
READ_T_O_START_TABLE_READ (Block Name)
or
READ_T_O_START_TABLE_SUBBLOCK_READ (Block Name, SubBlock Name)
Arguments
None
Examples
[The following assumes this file has already been opened (“<acar_shared>/springs.tbl/mdi_0001.spr”), and
read_t_o_start_table_read has been used to read the first line in the “CURVE” block.]
Function READ_T_O_READ_TABLE_LINE ()
Result “-110.0 -10750.0”
Note that the first time this is called after the READ_T_O_START_TABLE_READ will return the first
string in the block.
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 379
Design-Time Function Descriptions
READ_T_O_NEXT_BLOCK
Moves to the next block in the currently open TeimOrbit file. Returns a string with the block type, or a null
string if there is no next block in the file.
Format
READ_T_O_NEXT_BLOCK ()
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
None
Examples
[The following assumes this file has already been opened
(“<acar_shared>/driver_controls.tbl/constant_radius_cornering.dcf ”), and the previous read was in the
“EXPERIMENT” block]
Function READ_T_O_NEXT_BLOCK()
Result “STEADY_STATE”
If the function was issued again, a null string would be returned, since “STEADY_STATE” is the last block
in the file:
Function READ_T_O_NEXT_BLOCK()
Result “”
Important: Filenames are case sensitive and parameters are not case sensitive.
380 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_NEXT_ATTRIBUTE
Reads the next attribute in the file. Returns a null string if there are no more attributes in the file.
Format
READ_T_O_NEXT_ATTRIBUTE ()
Prerequisites
READ_T_O_OPEN_FILE (Filename)
Arguments
None
Examples
[The following assumes this file has already been opened
(“<acar_shared>/driver_controls.tbl/constant_radius_cornering.dcf ”), and the previous read was at the start
of the “STEADY_STATE” block]
Function READ_T_O_NEXT_ATTRIBUTE ()
Result ACTUATOR_TYPE = 'TORQUE'
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 381
Design-Time Function Descriptions
READ_T_O_BLOCK_EXISTS
Searches a TeimOrbit file for existence of a specified block. Returns 1 if the block is found, otherwise 0.
Format
READ_T_O_BLOCK_EXISTS (Filename, Block Name)
Arguments
Examples
Function READ_T_O_BLOCK_EXISTS(“<acar_shared>/springs.tbl/mdi_0001.spr”,
“CURVE”)
Result 1
Function READ_T_O_BLOCK_EXISTS(“<acar_shared>/springs.tbl/mdi_0001.spr”,
“FREE_LENGTH”)
Result 0
Important: Filenames are case sensitive and parameters are not case sensitive.
382 Adams View Function Builder
Design-Time Function Descriptions
READ_T_O_ATTRIBUTE_EXISTS
Searches a TeimOrbit file for existence of an attribute in a specified block or subblock. Returns 1 if the block
is found, otherwise 0.
Format
READ_T_O_ATTRIBUTE_EXISTS (Filename, Block Name, SubBlock Name, Attribute Name)
Arguments
Examples
Function READ_T_O_ATTRIBUTE_EXISTS
(“<acar_shared>/springs.tbl/mdi_0001.spr”, “SPRING_DATA”, “”,
“FREE_LENGTH”)
Result 1
Function READ_T_O_ATTRIBUTE_EXISTS
(“<acar_shared>/springs.tbl/mdi_0001.spr”, “SPRING_DATA”,
“FREE_LENGTH”)
Result 0
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: R - S 383
Design-Time Function Descriptions
RECTANGULAR
Returns the 1xN array of values after applying the RECTANGULAR window function.
Format
rectangular (a)
Argument
a An array.
Example
The following example illustrates the use of the RECTANGULAR function:
RECTANGULAR_WINDOW
Generate the RECTANGULAR window.
Format
RECTANGULAR_WINDOW (n)
Argument
n An integer value.
Example
The following example is an illustration of the RECTANGULAR_WINDOW function:
REMOVE_FILE
Removes a file. If successful, it returns a 0; otherwise, it returns a nonzero value. REMOVE_FILE will
succeed in deleting a file that you opened with the file text open command, even if you did not close the file.
Format
REMOVE_FILE (File Name)
Argument
Example
The following example illustrates the use of the REMOVE_FILE function:
Function REMOVE_FILE("Test_File.doc")
Result deletes Test_File.doc and returns a 0
RENAME_FILE
Renames a specified file. If successful, it returns a 0; otherwise, it returns a nonzero value.
Format
RENAME_FILE (File Name, New File Name)
Arguments
Example
The following example illustrates the use of the RENAME_FILE function:
REPLACE_DELIMITER
This will replace delimiter in string path and returns replaced delimiter string.
Format
REPLACE_DELIMITER("P:/work/tests/Test_1.log" )
Argument
Example
The following example illustrates the use of the REPLACE_DELIMITER function:
REPLACE_DELIMITER ("P:/work/tests/Test_1.log")
Return "P:\work\tests\Test_1.log"
Learn more about system functions.
388 Adams View Function Builder
Design-Time Function Descriptions
RESAMPLE
Takes a curve and resamples it over a new interval with the spline algorithm you specified.
Format
RESAMPLE (Curve, Sample Interval, Spline Type, Number of Spline Points)
Arguments
Example
The following example illustrates the use of the RESAMPLE function:
RESHAPE
Creates a new matrix from an existing matrix with dimensions you specified in the shape-descriptor array.
RESHAPE produces valid results for any matrix with any given shape dimensions, getting values from M in
a cyclic fashion.
Format
RESHAPE (M,S)
Arguments
M A matrix.
S A shape-descriptor array. Can contain up to two dimensions.
Examples
The following example illustrates the use of the RESHAPE function:
Because scalars are coerced into 1x1 matrices, you can also have the following:
REVERSE
Reverses the one-dimensional input array. The function type is generic, so it will reverse arrays of integers,
strings, doubles, or anything you specify.
Format
REVERSE (array)
Arguments
Example
The following example illustrates the use of the REVERSE function:
RMDIR
Removes a specified directory .Uses the operating system rmdir function. Returns 1 if successful in removing
the directory; otherwise, it returns 0.
Format
RMDIR (path)
Arguments
Examples
var set var=deldir int=(eval(RMDIR("/usr/people/foo")))
Learn more about system functions.
392 Adams View Function Builder
Design-Time Function Descriptions
RMS
Returns the root mean square of the values.
Format
RMS (Values)
Argument
Values The array of values for which to compute the RMS function.
Example
The following example illustrates the use of the RMS function:
Function RMS({0,1,4,9,16})
Result (SQRT(MEAN({0,1,4,9,16}**2)))
ROLL
Returns the third angle associated with a Body 321 rotation sequence from one coordinate system object to
another. This angle is referred to as the roll angle, and is used in association with the yaw (1st rotation) and
pitch (2nd rotation) angles.
Positive angular displacement is determined by the right-hand rule.
Format
ROLL (Object, Reference Frame)
Arguments
Example
The following example illustrates the use of the ROLL function:
ROLL(marker_O, marker_R)
See the illustration for YAW.
Learn more about modeling functions.
394 Adams View Function Builder
Design-Time Function Descriptions
ROWS
Returns the number of rows in a matrix.
Format
ROWS (M)
Argument
M A matrix.
Example
The following example illustrates the use of the ROWS function:
RTOI
Returns an integer representation of the input value, where the input value is a real number.
Format
RTOI(x)
Argument
Examples
The following examples illustrate the use of the RTOI function:
RUN_PYTHON_CODE
Executes Python code. If successful, it returns a 1; otherwise returns 0.
Format
RUN_PYTHON_CODE(Python code as String)
Arguments
String A string containing the Python source code. It may contain multiple lines, separated by
'\n'.
Example
The following function will return 1:
RUN_PYTHON_CODE("sys.version")
Functions: R - S 397
Design-Time Function Descriptions
RUN_PYTHON_FILE
Imports the input Python file. If successful, it returns a 1; otherwise, it returns 0.
Format
RUN_PYTHON_FILE(Path to python file)
Arguments
Example
The following function will return 1:
RUN_PYTHON_FILE ("Test.py")
398 Adams View Function Builder
Design-Time Function Descriptions
SECURITY_CHECK
Returns a 1 or 0, depending on whether or not the product name is properly licensed.
Format
SECURITY_CHECK (ProductName)
Argument
The string is case sensitive. For example, the product name string for Adams View is
AVIEW, so strings such as Aview, aview, AView, will fail.
Examples
var set var=fea_is_licensed & int=(eval(security_check("FEA")))
Learn more about GUI functions.
Functions: R - S 399
Design-Time Function Descriptions
SELECT_DIRECTORY
Returns the name of the directory you selected from the directory browser.
Format
SELECT_DIRECTORY (Dir)
Argument
Example
SELECT_DIRECTORY("/staff/guest/files")
Learn more about GUI functions.
400 Adams View Function Builder
Design-Time Function Descriptions
Functions: R - S 401
Design-Time Function Descriptions
SELECT_FIELD
Returns a selected field as a string. SELECT_FIELD displays a selection list of fields, belonging to a specified
object, from which you can choose specific fields.
Format
SELECT_FIELD (Object)
Argument
Object A database object used to determine the type of object for which you want to see the fields.
Example
The following example displays a select list allowing you to select a field from the list:
SELECT_FIELD(.model_1.part_1)
Learn more about GUI functions.
402 Adams View Function Builder
Design-Time Function Descriptions
SELECT_FILE
Returns a file name you selected. SELECT_FILE displays the file name in the File Navigator.
Format
SELECT_FILE (File Filter, Directory)
Arguments
File Filter A character string containing a wildcard pattern, used to filter the file selections for display.
Directory The directory where the file of interest is located.
Example
The following function returns a list of command files from which you can make a selection:
SELECT_FILE("*.cmd", "/staff/user")
Learn more about GUI functions.
Functions: R - S 403
Design-Time Function Descriptions
SELECT_MULTI_TEXT
Returns an array of strings you selected. SELECT_MULTI_TEXT displays a list of the strings you supplied,
and allows you to choose specific strings.
Format
SELECT_MULTI_TEXT (Strings)
Argument
Example
The following example illustrates the use of the SELECT_MULTI_TEXT function:
SELECT_MULTI_TEXT({"one", "2", "three", "we"})
Learn more about GUI functions.
404 Adams View Function Builder
Design-Time Function Descriptions
SELECT_OBJECT
Returns a selected object, using the Database Navigator to provide you with selections.
SELECT_OBJECT filters the list of selections using three pieces of information you specify:
Parent of the objects
Name of the objects
Type of the objects
Format
SELECT_OBJECT (Parent, Wildcard, Type)
Arguments
Parent A database object defining the scope of the search used to find the displayed objects.
Wildcard A character string defining a name matching the pattern filter for the displayed objects.
Type A character string defining the type of the object to display.
Example
The following example displays all parts in model_1 whose names start with lin:
SELECT_OBJECT(.model_1, "lin*", "part")
Learn more about GUI functions.
Functions: R - S 405
Design-Time Function Descriptions
SELECT_OBJECTS
Returns an array of selected objects, using the Database Navigator to provide you with selections.
SELECT_OBJECTS filters the list of selections using three pieces of information you specify:
Parent of the objects
Name of the objects
Type of the objects
Format
SELECT_OBJECTS (Parent, Wildcard, Type)
Arguments
Parent A database object defining the scope of the search used to find the displayed objects.
Wildcard A character string defining a name matching pattern filter for the displayed objects.
Type A character string defining the type of the object to display.
Example
The following example displays all the parts in model_1 whose names start with lin:
SELECT_OBJECT(.model_1, "lin*", "part")
Learn more about GUI functions.
406 Adams View Function Builder
Design-Time Function Descriptions
SELECT_REQUEST_IDS
For a given request file, prompts the user to select request IDs of interest and returns an array of integers
representing the selected IDs.
Format
SELECT_REQUEST_IDS(request_file_name)
Argument
Example
variable set variable=myids
int=(eval(SELECT_REQUEST_IDS("testuser.req")))
Learn more about GUI functions.
Functions: R - S 407
Design-Time Function Descriptions
SELECT_TEXT
Returns the string you selected. SELECT_TEXT displays a list of strings from which you can choose a
specific string.
Format
SELECT_TEXT (Strings)
Argument
Example
The following example illustrates the use of the SELECT_TEXT function:
SELECT_TEXT({"one", "yes", "maybe"})
Learn more about GUI functions.
408 Adams View Function Builder
Design-Time Function Descriptions
SELECT_TYPE
Returns a selection list of object types. Returns the selection as a string.
Format
SELECT_TYPE (Object Type)
Argument
Object Type The class or object type for which you want to see derived class or object types. Use the
value all to display the most inclusive list.
Example
The following example displays a list of all constraint types, such as joint and primitive joint:
SELECT_TYPE("Constraint")
Learn more about GUI functions.
Functions: R - S 409
Design-Time Function Descriptions
SERIES
Generates an array based on a start value, an increment value, and an array length.
Format
SERIES (Real, Real, Integer)
Arguments
Example
The following example illustrates the use of the SERIES function:
Function SERIES(1,2,3)
Result 1, 3, 5
SHAPE
Returns the dimensions of a matrix.
Format
SHAPE (M)
Argument
M A matrix.
Example
The following example illustrates the use of the SHAPE function:
SERIES2
Calculates an increment based on start and end values and a given number of increments.
Format
SERIES 2 (Real, Real, Integer)
Arguments
Example
The following example illustrates the use of the SERIES2 function:
Function SERIES2(2, 8, 4)
Result 2, 4, 6, 8
SIGN
Returns a numerical value which takes its sign from one argument and its magnitude from another:
SIGN(x1, x2) = ABS(x1) if x2 > 0SIGN(x1, x2) = -ABS(x1) if x2 <
0
Format
SIGN(x1, x2)
Arguments
Example
The following examples illustrate the use of the SIGN function:
SIM_STATUS
Parses an Adams message file (usually with an .msg extension), and returns an array of simulation status codes
corresponding to the tag: ALVSIM:STATUS.
This function is shorthand for PARSE_STATUS (fileName, ALVSIM:STATUS). For complete details, see
PARSE_STATUS.
Format
SIM_STATUS (fileName)
Argument
fileName Name of the file in which to look for simulation status codes.
Return Codes
Example
Executing the following command, returns an array of integers corresponding to the termination status codes
found in the file test.msg:
variable create variable=status integer=(sim_status("test.msg"))
Learn more about system functions.
Functions: R - S 415
Design-Time Function Descriptions
SIM_TIME
Returns the simulation time for the last step of the default simulation. If there is no default simulation, then
SIM_TIME generates an error.
Format
SIM_TIME ()
Argument
None
Example
The following example illustrates the use of the SIM_TIME function:
Function SIM_TIME()
Result 0.45
SIN
Returns the sine of an expression that represents a numerical value.
Format
SIN(x)
Argument
Example
The following example illustrates the use of the SIN function. The location of marker_1 and marker_2 is
shown in the figure below.
SINH
Returns the hyperbolic sine of an expression that represents a numerical value:
SINH(x) = (ex - e-x) / 2.0Format
SINH(x)
Argument
Example
The following example illustrates the use of the SINH function. The location of marker_1 and marker_2 is
shown in the figure below.
SORT
Returns a matrix sorted in the direction you specified.
Format
SORT (M, D)
Arguments
M A matrix.
D Direction in which the matrix is sorted:
a = ascending
d = descending
Example
The following example illustrates the use of the SORT function:
Function SORT({3,2,1},"a")
Result {1,2,3}
SORT_BY
Returns an array sorted by another array in the direction you specified.
Format
SORT_BY (M1, M2, D)
Arguments
a = ascending
d = descending
Examples
The following examples illustrate the use of the SORT_BY function:
SORT_INDEX
Returns the indexes of a matrix sorted in the direction you specified.
Format
SORT_INDEX (M, D)
Arguments
M A matrix.
D Direction in which the matrix is sorted:
a = ascending
d = descending
Example
The following example illustrates the use of the SORT_INDEX function:
Function SORT_INDEX({3,5,4,2},"a")
Result {4,1,3,2}
SPLINE
Creates an interpolated curve from the input points with the number of points you specified. Interpolates
using the spline algorithm you specified.
Format
SPLINE (Points, Spline Type, Number of Output Points)
Arguments
Points A 2xN array of points to be interpolated. The x values of the points must be
in ascending order, and the length of the array must be greater than or equal
to 4.
Spline Type The spline algorithm to use for interpolation. It must be one of the
following character strings:
Example
The following function interpolates a set of four points with ordinal values from 1 to 4 and abscissal values
as shown, into a series of 10 points using the cubic spline interpolation method.
SQRT
Returns the square root of an expression that represents a numerical value. The square root function is defined
only for non-negative values of the argument x.
Format
SQRT(x)
Argument
Example
The following example illustrates the use of the SQRT function:
Function SQRT(5*45)
Result 15
SSQ
Returns the sum of the squares of the elements of a matrix.
Format
SSQ (M)
Argument
M A matrix.
Example
The following example illustrates the use of the SSQ function:
STACK
Returns the concatenation of two matrixes with the same number of columns.
Format
STACK (M1, M2)
Arguments
Example
The following example illustrates the use of the STACK function:
STATUS_PRINT
Returns a text string to all status bars.
Format
STATUS_PRINT (Status String)
Argument
Example
The following function displays the string in all window status bars, and returns its argument:
Function STATUS_PRINT("List")
Result List
STEP
Returns an array of y values, on a step curve, corresponding to the x values.
Format
STEP (A, xo, ho,x1,h1)
Arguments
A An array of x values.
xo Value of x at which the step starts ramping from ho to h1.
ho Value of h when x is less than or equal to xo.
x1 Value of x at which the step function reaches h1.
h1 Value of h when x is greater than or equal to h1.
Example
The following example steps smoothly from 0.0 to 1.0 over the interval (2.0, 8.0). It has tails from 0 to 2 and
from 8 to 10.
STEP(SERIES(0, 0.1, 100), 2.0, 0.0, 8.0,
1.0)
Learn more about matrix/array functions.
Functions: R - S 427
Design-Time Function Descriptions
STOI
Performs an explicit conversion from string to integer. You usually don't need to use STOI because Adams
automatically coerces strings into integers, when the context demands it.
Format
STOI (String)
Arguments
Examples
The following example illustrates the use of the STOI function:
Function STOI("1")
Result 1
STOO
Performs an explicit conversion of a character string to a database object. You usually don't need to use STOO
because Adams automatically coerces strings naming objects into database objects, when the context demands
it. On the other hand, there are cases, when you need to explicitly convert a string to a database object so you
can use it later. For example, you need to convert a string to a database object when you are synthesizing a
name.
Format
STOO (String)
Arguments
Examples
The following example illustrates the use of the STOO function:
marker create marker=.model_1.ground.mar1
variable create variable=.model_1.Index int=1
variable create variable=obj &
obj=(STOO(".model_1.ground.mar"//.model_1.Index))
list variable
Learn more about string functions.
Functions: R - S 429
Design-Time Function Descriptions
STOR
Perform an explicit conversion from string to real number. You usually don't need to use STOR because
Adams automatically coerces strings into real values, when the context demands it.
Format
STOR (string)
Arguments
Example
The following example illustrates the use of the STOR function:
Function STOR("12")
Result 12.0
STR_CASE
Returns a string from an input string that has been modified according to an integer value.
Format
STR_CASE (String to Change, Case)
Arguments
1 = Upper case
2 = Lower case
3 = Mixed case
4 = Sentence case
Examples
The following functions return modified strings, as specified:
STR_CHR
Returns a character whose ASCII value is mapped to an input integer.
Format
STR_CHR (Integer Value)
Argument
Example
The following example returns the ASCII value of the letter A:
Function STR_CHR(65)
Result A
STR_COMPARE
Returns a numeric value indicating the relative alphabetical ordering of two strings. Returns 0 if the two
strings are the same. Returns a positive number if the second string comes before the first. Returns a negative
number if the second string comes after the first. The ASCII table is used for this, see examples below.
Format
STR_COMPARE (String 1, String 2)
Arguments
Examples
The following function shows that the two strings are identical. Note that the string is not case senstive.
Function STR_COMPARE("adjective","adjective")
or
STR_COMPARE("ADJECTIVE","adjective")
or
STR_COMPARE("AdjEctIVe","adjective")
Result 0
The following function returns a positive number (corresponding to the difference in character order),
indicating that the second string comes before the first string in ASCII character order:
Function STR_COMPARE("verb","subject")
Result 3
The following function returns a negative number (corresponding to the difference in character order),
indicating that the second string comes after the first string in ASCII character order:
Function STR_COMPARE("varb","verb")
Result -4
STR_DATE
Returns a string containing the current time and/or date information according to a format string.
Format
STR_DATE (Format String)
Argument
Note: All of the formatting directives described below are supported on non-Windows platforms, but
some are not supported on Windows. If the specified formatting directive is not supported,
then the function will simply return the input string.
Text string that uses the formatting directives listed below. If you supply an empty string (""), it defaults to
"%d %b %Y %H:%M".
The available formatting directives (expressed as current date, time or time zone) are:
Format String Description Supported on
Windows
(Y/N)
%a Abbreviated weekday name Y
%A Full weekday name Y
%b Abbreviated month name Y
%B Full month name Y
%c Date and time as %a %b %d %H:%M:&S %Y Y
%C Century number (the year divided by 100 and truncated to integer) N
as a decimal number (00-99)
%d Day of month (01-31) Y
%D Date as %m/%d/%y N
%e Day of month (1-31: single digits are preceded by a blank space) N
%h Abbreviated month name N
%H Hour (00-23) Y
%I Hour (01-12) Y
%j Day number of year (001-366) Y
%m Month number (01-12) Y
%M Minute (00-59) Y
%p Equivalent of either AM or PM Y
434 Adams View Function Builder
Design-Time Function Descriptions
Windows Only
If # flag is used as prefix to any formatting code, the meaning of the format changes as described below:
Examples
The following function returns the current date and time in the stated argument format (January 5, 1998, is
the current date):
The following function returns the current date and time in the underlying argument format (January 5,
1998 is the current date):
Function STR_DATE("%c")
Result Mon Jan 5 10:35:01 1998
Functions: R - S 435
Design-Time Function Descriptions
The following function returns the current date and time in the default format (January 5, 1998 is the current
date):
Function STR_DATE("")
Result 05 Jan 1998 13:22
The following function simply returns the input string, if the specified directive is invalid/not supported:
Function STR_DATE("ABC%D")
Result ABC%D
STR_DELETE
Returns a string that results from deleting a specified number of characters starting from a specified location
on an input string.
Format
STR_DELETE (Input String, Starting Position, Number to Delete)
Arguments
Examples
The following function deletes the ninth character in the string and returns the resulting phrase:
In the following function, the out-of-range negative value (-100) of the Starting Position becomes 1:
In the following function, the out of range positive value (100) of the Starting Position doesn't have any effect
on the string:
STR_FIND
Returns the starting location of the first occurrence of a string within another string. If there is no match, it
returns a 0.
Format
STR_FIND (Base String, Search String)
Arguments
Examples
The following examples illustrate the use of the STR_FIND function:
The following function uses a second character in its search criteria to return 4, because letter "l" appears
twice in the word hello:
STR_FIND_COUNT
Returns the number of occurrences of a string found within another string. Overlapping matches are not
included.
Format
STR_FIND_COUNT (Base String, Search String)
Examples
The following examples illustrate the use of the STR_FIND_COUNT function:
The following function returns 2 because the overlapping, matching 9's from 239990 to 129990 are not
included:
STR_FIND_IN_STRINGS
Searches for a string in an array of strings. Returns the index into the array if the string is found, zero if not
found.
Format
STR_FIND_IN_STRINGS(array_of_strings, string)
Arguments
Example
if cond=(STR_FIND_IN_STRINGS(unit_names, "force"))
Learn more about string functions.
440 Adams View Function Builder
Design-Time Function Descriptions
STR_FIND_N
Returns the numerical position of a character in a string found within another string. Returns 0 if not found.
Overlapping matches are not included.
Format
STR_FIND_N (Base String, Search String, Nth Occurrence)
Arguments
Examples
The following function returns 10 because the second occurrence of string an begins at character position 10:
The following function returns 16 because the overlapping, matching #'s from 43### to 55###9 are not
included, so the third occurrence of string ## begins at character position 16:
STR_INSERT
Returns a string constructed by inserting a string into another string at a specified insertion point.
Format
STR_INSERT (Destination String, Source String, Insert Position)
Arguments
Examples
For the following function, blank spaces are needed in the Source String, before and after the text, in order
to return the desired output:
As with the STR_DELETE function, Insert Position can have any value, as shown in the following example:
STR_IS_REAL
Returns a boolean truth value indicating that the input character string argument represents a valid real
number.
Format
STR_IS_REAL (String)
Argument
Examples
The following examples illustrate the use of the STR_IS_REAL function:
if condition=(str_is_real ("Hi, Mom.")) ! returns
false
if condition=(str_is_real ($field_1_value))
Learn more about string functions.
Functions: R - S 443
Design-Time Function Descriptions
STR_IS_SPACE
Returns 1 (true) if a string is empty; otherwise, returns 0 (false).
Format
STR_IS_SPACE (Input String)
Argument
Examples
The following examples illustrate the use of the STR_IS_SPACE function:
STR_LENGTH
Returns a numerical value corresponding to the length of a string.
Format
STR_LENGTH (Input String)
Argument
Examples
The following example illustrates the use of the STR_LENGTH function:
The following function returns 10 because the double slash marks (//) concatenated the two strings into one:
STR_MATCH
Returns 1 (true) if a specified string is found within another string; otherwise, returns 0 (false).
Format
STR_MATCH (Pattern String, Input String)
Arguments
Pattern String Text string. The argument uses wildcards to define the pattern to match.
Examples
The following functions return 1 or 0, depending on whether a match occurred or not:
Function STR_MATCH("f?d","fad")
Result 1
Function STR_MATCH("f[xyz]d","fxd")
Result 1
Function STR_MATCH("f{ab,bc,cd}d","fbcx")
Result 0
446 Adams View Function Builder
Design-Time Function Descriptions
STR_PRINT
Writes a string into the aview.log file. It is very useful for debugging.
Format
STR_PRINT (String)
Argument
Examples
In the following functions, the double slash marks (//) allow two or more strings to be concatenated into a
single string:
STR_REMOVE_WHITESPACE
A string that is the result of removing all leading and trailing spaces (blank spaces, tab spaces) from the input
string.
Format
STR_REMOVE_WHITESPACE (Input String)
Argument
Example
The following function returns the string without the spaces before and after it:
STR_REPLACE_ALL
Returns a string constructed by replacing all the occurrences of the sub string in an input string with another
string
Format
STR_REPLACE_ALL (Destination String, Old Sub String, New Replace String)
Argument
Example
The following function returns string constructed by replacing all the occurrence of old sub string with new
string
Function str_replace_all("aabbccaaaeeffaaaa","aa","cba")
Result "cbabbcccbaaeeffcbacba"
STR_SPLIT
Returns an array of strings built from substrings, which are separated from each other with a specified
character, and are located within another string.
Format
STR_SPLIT (Input Text String, Separator Character)
Arguments
Input Text String Text string. This string is unaltered during the evaluation of the function.
Separator Character Specified character that separates the substrings.
Examples
In the following functions, the second example string looks similar to the first one. It is different, however,
because the separator character has been changed to a # symbol so that a semi-colon could be included with
the first returned string (apple;). If a character needs to be included in the output, it cannot be used as a
separator character.
In all cases, STR_SPLIT trims any leading or trailing white spaces on the substrings:
STR_SPRINTF
Returns a character string constructed by formatting the array of values in the format string.
Format
STR_SPRINTF (Format String, {Array of Values})
Arguments
Example
The following example illustrates the use of the STR_SPRINTF function:
STR_SUBSTR
Returns a substring with a designated number of characters starting at a specified point within a string.
Format
STR_SUBSTR (Input String, Starting Position, Length)
Arguments
Examples
The following function returns a substring of the input string:
The following example shows that the Starting Position and Length arguments can have any value and not
cause errors:
STR_TIMESTAMP
Returns the current date and time in the default format.
Format
STR_TIMESTAMP ()
Argument
None No argument is needed; this function returns the current date in the following format:
%Y/%m/%d,%H:%M:%S
Example
The following function returns the current date and time (Jan 5, 1998, is the current date):
Function STR_TIMESTAMP()
Result 1998/01/05,02:30:28
STR_XLATE
Returns a new string formed by replacing all occurrences of one or more characters found within the input
string, with an equal number of characters.
Format
STR_XLATE(Input String, From String, To String)
Arguments
Example
The following example illustrates the use of the STR_XLATE function:
SUM
Returns the sum of the elements of a matrix by performing a matrix reduction using addition.
Format
SUM (M)
Argument
M A matrix.
Examples
The following examples illustrate the use of the SUM function:
SYS_INFO
Returns a character string containing information that you requested about the system.
Format
SYS_INFO (info_type)
Argument
info_type A character string indicating the type of system information you want returned. Below are
five values that you can query:
Example
variable create variable=HostName str=(sys_info("hostname"))
Returns a value of the host machine, for example, SERV1.
Learn more about system functions.
Functions: T - Z 457
Design-Time Function Descriptions
Functions: T - Z
458 Adams View Function Builder
Design-Time Function Descriptions
TABLE_COLUMN_SELECTED_CELLS
Returns an array of integers representing the 1-based row numbers of selected cells within a specified column
in a table. If no cells are selected in the column, returns a 0.
Format
TABLE_COLUMN_SELECTED_CELLS (Column, O_table, Dummy1, Dummy2, Dummy3)
Arguments
Example
The variable the_selected_cells will contain the row numbers (1-based) for all the cells that you select in
column 1:
TABLE_GET_CELLS
Returns an array of strings representing the contents of the cells within the specified row/column range.
Values are retrieved in column order.
Format
TABLE_GET_CELLS (O_table, Start_row, End_row, Start_col, End_col, Behavior, Ignore trailing blanks)
Arguments
Example
The following function gets the contents of the cells of the first two rows of the first two columns:
TABLE_GET_DIMENSION
Returns an integer representing the number of rows or columns in a table or the number of cells in a row or
column.
Format
TABLE_GET_DIMENSION (O_table, Rows_or_cols)
Arguments
Examples
The following example returns the number of rows in a table:
TABLE_GET_REALS
Returns an array of reals representing the contents of the cells within the specified row/column range. Values
are retrieved in column order.
Format
TABLE_GET_REALS (o_table, startRow,endRow,startCol,endCol, blankBehavior, ignoreTrailingBlanks)
Arguments
Returns an array of reals representing the contents of the cells within the
specified row/column range. Values are retrieved in column order.
TABLE_GET_SELECTED_COLS
Returns the column numbers for the columns in a data table that are currently selected. A column is
considered as 'selected' if at least one of its cells is selected.
The function returns an array of integers representing the selected columns in the specified table.
Format
TABLE_GET_SELECTED_COLS(table)
Arguments
Example
1. interface dialog_box display dialog_box_name = .gui.spline_cremod ...(display any dbox that
contains a data table)
2. Manually select one or more of the cells in the table
3. variable create variable_name = sel_cols integer_value =
(eval(TABLE_GET_SELECTED_COLS(.gui.spline_cremod.c_tabular.dt_2d))) .. (use the
function)
4. Check the value of the created variable against the selection done in step2.
Note: The function returns a zero to indicate a no-selection condition. The function will also return
a zero when the input parameter 'table' is invalid (e.g. the dialog containing the table is not
loaded).
TABLE_GET_SELECTED_ROWS
Returns the row numbers for the rows in a data table that are currently selected. A row is considered as
'selected' if at least one of its cells is selected.
The function returns an array of integers representing the selected rows in the specified table.
Format
TABLE_GET_SELECTED_ROWS(table)
Arguments
Example
1. interface dialog_box display dialog_box_name = .gui.spline_cremod ...(display any dbox that
contains a data table)
2. Manually select one or more of the cells in the table
3. variable create variable_name = sel_rows integer_value =
(eval(TABLE_GET_SELECTED_ROWS(.gui.spline_cremod.c_tabular.dt_2d))) .. (use the
function)
4. Check the value of the created variable against the selection done in step2.
Note: The function returns a zero to indicate a no-selection condition. The function will also return
a zero when the input parameter 'table' is invalid (e.g. the dialog containing the table is not
loaded).
TAN
Returns the tangent of an expression that represents a numerical value.
Format
TAN(x)
Argument
Example
The following example illustrates the use of the TAN function. The location of marker_1 and marker_2 is
shown in the figure below.
TANH
Returns the hyperbolic tangent of an expression that represents a numerical value:
TANH(x) = (ex-e-x)/(ex+e-x)
Format
TANH(x)
Argument
Example
Using a hyperbolic tangent, the following function defines a smooth step function that transitions from a
value of -1 to 1. The smoothness is controlled by the modifier, in this case 5.
Function TANH(5*(TIME-1.5))
Result -6.99
TERM_STATUS
Parses an Adams message file (usually with an .msg extension), and returns an array of simulation status codes
corresponding to the tags: A3TERM:STATUS and TERM:STATUS.
This function is shorthand for the following expression:
STACK(PARSE_STATUS(fileName, "A3TERM:STATUS"), PARSE_STATUS(fileName,
"TERM:STATUS"))
For complete details, see PARSE_STATUS.
Note that this function returns its error codes as indicated in the expression above. First, it returns all the
A3TERM:STATUS codes found in the file. Then, it returns all the TERM:STATUS codes that are appended
to them.
Format
TERM_STATUS (fileName)
Argument
fileName Name of the file in which to look for simulation status codes.
Return Codes
Example
Executing the following command:
variable create variable=status
integer=(term_status("test.msg"))
Returns an array of integers corresponding to the termination status codes found in the file test.msg.
Learn more about system functions.
468 Adams View Function Builder
Design-Time Function Descriptions
THETA
Returns the second angle associated with a Body 313 rotation sequence from one coordinate system object
to another. This second rotation is referred to as the theta, θ , angle, and is used in association with the psi, ψ
, (1st rotation) and phi, φ , (3rd rotation) angles.
Positive angular displacement is determined by the right-hand rule.
Format
THETA (Object, Reference Frame)
Arguments
Example
The following example illustrates the use of the THETA function:
THETA(marker_O, marker_R)See the illustration for PSI.
Learn more about modeling functions.
Functions: T - Z 469
Design-Time Function Descriptions
TILDE
Returns the TILDE function of an array. You can use TILDE only on 3x1 matrixes.
Format
TILDE (A)
Argument
A An array.
Example
The following example illustrates the use of the TILDE function:
TIMER_CPU
Either starts or ends a timer for measuring the accumulated time in CPU seconds used since the beginning
of the process execution.
If the endFlag is 0, then the timer is started and the current cpu runtime is returned. If the endFlag is 1, then
the timer is stopped and the cpu time since the last timer start is returned.
Format
TIMER_CPU(endFlag) returns REAL
Argument
endFlag If the endFlag is 0, then the timer is started and the current elapsed CPU is returned.
If the endFlag is 1, then the timer is stopped and the elapsed CPU time since the last timer
started is returned.
Example
variable set variable=mycpu real=(eval(timer_cpu(0)))
file command read file=mybidcmdfile
variable set variable=mycpu real=(eval(timer_cpu(1)))
variable set var=foo string=(eval(str_print("file read took "
//mycpu//"cpuseconds")))
Learn more about GUI functions.
Functions: T - Z 471
Design-Time Function Descriptions
TIMER_ELAPSED
Either starts or ends a timer for measuring the elapsed time in seconds.
If the endFlag is 0, then the timer is started and the current elapsed time is returned. If the endFlag is 1, then
the timer is stopped and the time since the last timer start is returned.
Note: This measures elapsed time, so time is always ticking away, unlike cpu time, for which time
only ticks away when the cpu is busy.
Format
TIMER_ELAPSED (endFlag) returns REAL
Arguments
endFlag If the endFlag is 0, then the timer is started and the current elapsed CPU is returned.
If the endFlag is 1, then the timer is stopped and the elapsed CPU time since the last timer
started is returned.
Example
variable set variable=myelapse real=(eval(timer_elapsed(0)))
file command read file="mybigcmdfile.cmd"
var set var=foo string=(eval(str_print("File read took"
//timer_elapsed(1)//" seconds")))
Learn more about GUI functions.
472 Adams View Function Builder
Design-Time Function Descriptions
TMAT3
Returns a 3x3 transformation matrix using the values in the orientation sequence you specify.
Format
TMAT3 (E, OriType, OriSequence)
Arguments
Example
A typical invocation of this function might look like this:
TMAT3(mar1.orientation, "s" 123)
Learn more about matrix/array functions.
Functions: T - Z 473
Design-Time Function Descriptions
TMAT
Returns a 3x3 transformation matrix using the values in the orientation sequence you specified.
Format
TMAT (E, OriType)
Arguments
Example
The following example illustrates the use of the TMAT function:
TMAT(mar1.orientation, "space123")
You can obtain the current default orientation type string with the expression:
(user_string(".system_defaults.orientation_type"))
Learn more about matrix/array functions.
474 Adams View Function Builder
Design-Time Function Descriptions
TRANSPOSE
Returns the transpose of a matrix.
Format
TRANSPOSE (M)
Argument
M A matrix.
Examples
The following examples illustrate the use of the TRANSPOSE function:
Function TRANSPOSE({1,2,3}
Result {[1,2,3]}
Function TRANSPOSE({[1,2],[3,4]})
Result {[1,3],[2,4]}
TRIANGULAR
Apply the TRIANGULAR window to the input array and return the new array.
Format
TRIANGULAR (a)
Argument
a An array.
Example
The following example is an illustration of the TRIANGULAR function:
TRIANGULAR_WINDOW
Generate the TRIANGULAR window.
Format
TRIANGULAR_WINDOW (n)
Argument
n An integer.
Example
The following example is an illustration of the TRIANGULAR_WINDOW function:
UNIQUE
Deletes all duplicate elements from an array.
Format
UNIQUE (Array)
Argument
Array An array.
Example
The following example illustrates the use of the UNIQUE function:
UNIQUE_FILE_NAME
Returns a string that is the name of a non-existent file. It is the file system analogous to the database
UNIQUE_NAME function.
Format
UNIQUE_FILE_NAME (Initial File Name)
Argument
Initial File Name Prefix to use when creating the unique name.
Example
The following example illustrates the use of the UNIQUE_FILE_NAME function:
Function UNIQUE_FILE_NAME("test")
Result test_1
UNIQUE_ID
Returns an Adams_ID unique for objects of the specified type.
Format
UNIQUE_ID (char * type)
Argument
Example
var cre var=dv1 int=(eval(UNIQUE_ID("marker")))
Learn more about database functions.
480 Adams View Function Builder
Design-Time Function Descriptions
UNIQUE_FULL_NAME
Returns a text string containing a unique full name for the specified type of object. If no default parent exists
for the type you specified, UNIQUE_FULL_NAME returns an empty string.
Format
UNIQUE_FULL_NAME (Type)
Argument
Example
The following example illustrates the use of the UNIQUE_FULL_NAME function:
Function UNIQUE_FULL_NAME("marker")
Result .model_1.ground.MAR
UNIQUE_LOCAL_NAME
Returns a name of the form BASE_1, where BASE is a prefix that you supply and the number (1 in this case)
is computed by the function. The returned name is unique for children of the specified parent.
Format
UNIQUE_LOCAL_NAME (Parent, Base)
Argument
Examples
The following illustrates the UNIQUE_LOCAL_NAME function:
UNIQUE_NAME
Returns a text string that is a unique database name.
Format
UNIQUE_NAME (Base Name)
Argument
Example
The following example illustrates the use of the UNIQUE_NAME function:
Function UNIQUE_NAME("stat")
Result stat_1
UNIQUE_NAME_IN_HIERARCHY
Returns a text string that is a unique database name, taking into account the inherent hierarchy in the given
input.This function is essentially a smarter form of UNIQUE_NAME. If an entity myname_1 already exists
under .model_1, then UNIQUE_NAME_IN_HIERARCHY(“.model_1.myname”) would return
.model_1.myname_2 ensuring that the output is truly unique in the hierarchy specified in the input. Note
that an entity myname_2 might already exist under a different model, but the value returned would still be
.model_1.myname_2 as this name is still unique within the hierarchy of .model_1.
Format
UNIQUE_NAME_IN_HIERARCHY (Base Name)
Argument
Example
The following example illustrates the use of the UNIQUE_NAME_IN_HIERARCHY function:
Assume that an object stat_1 already exists in the database.
Function UNIQUE_NAME_IN_HIERARCHY("stat")
Result stat_2
UNIQUE_PARTIAL_NAME
Returns a character string containing a unique object name.
Format
UNIQUE_PARTIAL_NAME (Parent, Type)
Arguments
Parent A database object defining the scope within which the name must be unique.
Type A character string defining the type of the object for which this name will be used.
Example
The following example produces PAR_1:
UNIQUE_PARTIAL_NAME(.model_1, "part")
Learn more about database functions.
Functions: T - Z 485
Design-Time Function Descriptions
UNITS_STRING
Returns a text string containing a unit string associated with another string.
Format
UNITS_STRING (Object Field)
Argument
Example
The following example illustrates the use of the UNITS_STRING function:
Function UNITS_STRING(".mod1.part1.density")
Result returns something like kg/mm**3
UNITS_CONVERSION_FACTOR
Returns the numeric conversion factor from the given unit value to the current default units.
Format
UNITS_CONVERSION_FACTOR (UnitsValue)
Argument
UnitsValue A units value string defining the units from which you want to convert.
Examples
The following illustrates the use of the UNITS_CONVERSION_FACTOR function:
Function UNITS_CONVERSION_FACTOR("inch")
Result Returns 12.0 if the default length units are set to foot.
UNITS_TYPE
Returns the character string value of the given unit type using the provided integer value.
Format
UNITS_TYPE (UnitsType)
Arguments
Examples
The following is an illustration of the UNITS_TYPE function:
UNITS_TYPE(x.units)
Result Returns mass/time**3
UNITS_VALUE
Returns the character string value of the given unit type using the default units settings.
Format
UNITS_VALUE (UnitsType)
Argument
Examples
The return values for these examples depend on the current default settings for units, and are given to show
the form of the result, not the actual values
Function UNITS_VALUE("angle")
Result Returns degrees
Function UNITS_VALUE("acceleration*time")
Result Returns foot/second
UNWRAP
Unwraps phase angles in degree by changing absolute jumps greater than 180 degree to their 360 degree
complement.
Format
vc_unwrap (a) returns ARRAY
Argument
USER_STRING
Returns a text string containing a value in the Object Field. The Object Field must be a string.
USER_STRING is similar to EXPR_STRING, except that it always returns a non-empty value; EXPR_STRING
only returns a value when the field's value is defined with an expression.
Format
USER_STRING (Object Field)
Argument
Object Field Character string containing an object name and field reference.
Example
The following example illustrates the use of the USER_STRING function:
USER_STRING(".mod1.mar1.location")
Learn more about database functions.
Functions: T - Z 491
Design-Time Function Descriptions
VAL
Returns an array element nearest the number you specified.
Format
VAL (A, X)
Arguments
A An array.
X A real number.
Example
The following example illustrates the use of the VAL function:
VALAT
Returns a value from the Y_array at the same position as X_value was found in the X_array. X_array and
Y_array must be the same length.
Note: This function expects the values in X_array to be sorted in ascending order.
Format
VALAT(X_array, Y_array, X_value)
Arguments
X_array An array of at least two real values that determine the range of the curve. Values must be in
ascending order.
Y_array An array containing the same number of real values as the X_array. Used to define the domain
of the curve.
value A value which "indexes" into the X_array.
Examples
model create model=mod1
variable create variable=x_array rea=-1,0,2,3
variable create variable=y_array rea= 1,2,3,4
variable create variable=xx rea=0.0
variable create variable=yy rea=(VALAT(x_array, y_array, xx))
VALAT produces values as follows:
xx -2, -1, 0, 1, 2, 3, 4
yy 0, 1, 2, 2.5, 3, 4, 5
VALI
Returns the index of the element in an array nearest to the number you specify.
Format
VALI (A, X)
Arguments
A An array.
X A real number.
Example
The following example illustrates the use of the VALI function:
WELCH
Returns a 1xN array of values after applying the WELCH_WINDOW function.
Format
WELCH (a)
Argument
Example
The following example illustrates the use of the WELCH function:
WELCH_WINDOW
Generate the WELCH window. The WELCH_WINDOW function gently forces the end points toward zero
and smooths the remaining points.
Format
WELCH_WINDOW (n)
Argument
n An integer.
Example
The following example is an illustration of the WELCH_WINDOW function:
WRITE_T_O_OPEN_FILE
Open an TeimOrbit file for writing. Returns 1 on success and 0 if an error occurs.
Format
WRITE_T_O_OPEN_FILE (Filename, Append)
Prerequisites
None
Arguments
Example
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: T - Z 497
Design-Time Function Descriptions
WRITE_T_O_CLOSE_FILE
Close currently open TeimOrbit file. Returns 1 on success and 0 if an error occurs.
Format
WRITE_T_O_CLOSE_FILE ()
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
Arguments
None
Example
Function WRITE_T_O_CLOSE_FILE ()
Result 1
Important: Filenames are case sensitive and parameters are not case sensitive.
498 Adams View Function Builder
Design-Time Function Descriptions
WRITE_T_O_UNITS
Write units to file based on string variable containing an array of strings corresponding to the units, obtained
via a call to “get_units”. Return 1 on success and 0 if errors occur.
Format
WRITE_T_O_UNITS (Variable)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
Arguments
Variable String variable containing an array of strings corresponding to the units length,
angle, force, mass and time. If there is no string at the corresponding index, no
unit is written to the file.
Example
WRITE_T_O_UNITS (.mdi.my_unit_var.self )
Result 1
Writes to file $--------------------------------------------UNITS
[UNITS]
LENGTH = 'mm'
ANGLE = 'degrees'
FORCE = 'newton'
MASS = 'kg'
TIME = 'second'
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: T - Z 499
Design-Time Function Descriptions
WRITE_T_O_DATA_BLOCK
Write a block to the currently open file. Returns 1 on success and 0 if errors occur.
Format
WRITE_T_O_DATA_BLOCK (Block Name)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
Arguments
Example
Result 1
Important: Filenames are case sensitive and parameters are not case sensitive.
500 Adams View Function Builder
Design-Time Function Descriptions
WRITE_T_O_SUBBLOCK
Write subblock to currently selected block in the open file. Returns 1 on success and 0 if errors occur.
Format
WRITE_T_O_SUBBLOCK (SubBlock Name)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
WRITE_T_O_DATA_BLOCK (Block Name)
Arguments
Example
Result 1
Writes to file (Z_DATA)
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: T - Z 501
Design-Time Function Descriptions
WRITE_T_O_INTEGER
Writes an attribute to the current block with the specified integer value. Returns 1 on success and 0 if errors
occur.
Format
WRITE_T_O_INTEGER (Attribute, Value)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
WRITE_T_O_DATA_BLOCK (Block Name)
Arguments
Example
Result 1
Writes to file CONTROL_VALUE = 4
Important: Filenames are case sensitive and parameters are not case sensitive.
502 Adams View Function Builder
Design-Time Function Descriptions
WRITE_T_O_REAL
Writes an attribute to the current block with the specified real number value. Returns 1 on success and 0 if
errors occur.
Format
WRITE_T_O_REAL (Attribute, Value)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
WRITE_T_O_DATA_BLOCK (Block Name)
Arguments
Examples
Result 1
Result 0
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: T - Z 503
Design-Time Function Descriptions
WRITE_T_O_REAL_ARRAY
Writes an array of real numbers to the currently open file with the specified attribute label. Returns 1 on
success and 0 if errors occur.
Format
WRITE_T_O_REAL_ARRAY (Array, Attribute)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
WRITE_T_O_DATA_BLOCK (Block Name)
Arguments
Examples
Result 1
Important: Filenames are case sensitive and parameters are not case sensitive.
504 Adams View Function Builder
Design-Time Function Descriptions
WRITE_T_O_PUSH_PRECISION
Sets the precision of the real numbers written to the currently open file. Returns 1.
Format
WRITE_T_O_PUSH_PRECISION (Precision)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
Arguments
Example
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: T - Z 505
Design-Time Function Descriptions
WRITE_T_O_POP_PRECISION
Sets the precision to the previous precision for the real numbers written to the currently opened file. Returns
1 on success, and 0 if there are errors.
Format
WRITE_T_O_POP_PRECISION ()
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
Arguments
None
Example
Function WRITE_T_O_POP_PRECISION ()
Result 1
Important: Filenames are case sensitive and parameters are not case sensitive.
506 Adams View Function Builder
Design-Time Function Descriptions
WRITE_T_O_STRING
Writes an attribute to the current block with the specified string value. Returns 1 on success and 0 if errors
occur.
Format
WRITE_T_O_STRING (Attribute, Value)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
WRITE_T_O_DATA_BLOCK (Block Name)
Arguments
Examples
Result 1
Writes to File ACTUATOR_TYPE = 'TORQUE'
Result 0
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: T - Z 507
Design-Time Function Descriptions
WRITE_T_O_TABLE_HEADER
Writes a head to the currently selected block or subblock within the currently open file. Writes 1 on success
and 0 if errors occur.
Format
WRITE_T_O_TABLE_HEADER (Value)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
WRITE_T_O_DATA_BLOCK (Block Name)
Arguments
Example
Result 1
Writes to File { disp force }
Important: Filenames are case sensitive and parameters are not case sensitive.
508 Adams View Function Builder
Design-Time Function Descriptions
WRITE_T_O_TABLE_REALS
Writes a single row of array values to the current table. Returns 1 on success and 0 if errors occur.
Format
WRITE_T_O_TABLE_REALS (Array)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
WRITE_T_O_DATA_BLOCK (Block Name)
Arguments
Example
Result 1
Writes to file 1.0 2.0 3.0 4.0
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: T - Z 509
Design-Time Function Descriptions
WRITE_I_N_TABLE_REALS
Writes multiple columns of real values to the current table. Returns 1 on success and 0 if errors occur.
Format
WRITE_I_N_ TABLE_REALS (Array, Value)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
WRITE_T_O_DATA_BLOCK (Block Name)
Arguments
Example
Result 1
Writes to file 1.0 2.0
3.0 4.0
5.0 6.0
7.0 8.0
Important: Filenames are case sensitive and parameters are not case sensitive.
510 Adams View Function Builder
Design-Time Function Descriptions
WRITE_T_O_TABLE_LINE
Writes a line of text to the currently open file. Returns 1 on success and 0 if errors occur.
Format
WRITE_T_O_TABLE_LINE (Line)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
Arguments
Example
Function WRITE_T_O_TABLE_LINE(“$---------STEADY_STATE”)
Result 1
Writes to file $---------STEADY_STATE
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: T - Z 511
Design-Time Function Descriptions
WRITE_T_O_TABLE_STRING
Writes a quoted line of text to the currently open file. Returns 1 on success and 0 if errors occur.
Format
WRITE_T_O_TABLE_LINE (Line)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
Arguments
Example
Important: Filenames are case sensitive and parameters are not case sensitive.
512 Adams View Function Builder
Design-Time Function Descriptions
WRITE_T_O_COMMENT
Writes a commented line of text to the currently open file. Returns 1 on success and 0 if errors occur.
Format
WRITE_T_O_COMMENT (Comment)
Prerequisites
WRITE_T_O_OPEN_FILE (Filename)
Arguments
Example
Result 1
Writes to file $-------------MDI_HEADER
Important: Filenames are case sensitive and parameters are not case sensitive.
Functions: T - Z 513
Design-Time Function Descriptions
YAW
Returns the first angle associated with a body-fixed 321 rotation sequence from one coordinate system object
to another. This angle is referred to as the yaw angle, and is used in association with the pitch (2nd rotation)
and roll (3rd rotation) angles.
Positive angular displacement is determined by the right-hand rule.
Format
YAW (Object, Reference Frame)
Arguments
Example
The following example illustrates the use of the YAW function:
YAW(marker_O, marker_R)
The following illustrations show the rotation sequence for YAW, PITCH, and ROLL:
514 Adams View Function Builder
Design-Time Function Descriptions
In Adams, PITCH is defined as the negative value of the second Body 321 rotation angle.
Functions: T - Z 515
Design-Time Function Descriptions
There are always two equivalent sets of rotation angles that yield the same final rotation.
Learn more about modeling functions.
516 Adams View Function Builder
Design-Time Function Descriptions
About Run-Time Functions 461
Run-Time Functions Categories
Run-Time Functions
About Run-Time Functions
Run-time functions allow you to specify mathematical relationships between the simulation states that
directly define the behavior of the system.
During the run time of your simulation, many system states change: time elapses linearly, parts displace, and
applied forces change in a variety of ways (such as, sinusoidal, and non-linear). Adams View allows you to
manipulate the states of these system variables with run-time functions. Using run-time functions you can
build dependencies, such as a motion that's a function of (TIME)2 or a force that's a function of velocity
vertical displacement.
You can work with run-time functions from boxes that expect run-time functions, most commonly found
when working with applied forces and generated motions. You build a run-time function in the Function
Builder and then insert the function in the box that accepts run-time functions. To learn how to use the
Function Builder to work with run-time functions, please refer to the first three chapters of this guide.
When you enter in the Function Builder a function longer than 80 characters per line, Adams View alerts
you that your function is too long. If your function is longer than 80 characters per line, it is best to split it
into two or more lines.
Note: While writing run-time functions, you can use either full names of objects or Adams IDs. In
run-time functions, you can use design variables that represent real numbers, integers, or
references to objects.
Displacement Functions
Velocity Functions
Acceleration Functions
Contact Functions
Spline Functions
Force in Object Functions
Resultant Force Functions
Math Functions
Vector Functions
Data Element Access
User-Written Subroutine Invocation
Constants & Variables
1. Displacement Functions
Displacement functions return scalar measures associated with a particular component of the translational
displacement vector from one coordinate system marker to another or an angular displacement from one
coordinate system marker to another.
You can use the displacement functions during a simulation to obtain from Adams the displacement
measurements of an object. Displacement functions provide measurements that can be useful in:
Plotting displacement measurements.
Creating equations which depend on the displacement of an object.
Monitoring the displacement of an object and triggering the occurrence of special events when the
displacement reaches a certain value.
The following table lists the names and definitions for the displacement functions:
2. Velocity Functions
Velocity functions return a requested magnitude or component of the translational or rotational velocity
vector between two markers.
You can use the velocity functions during a simulation to obtain from Adams the velocity measurements of
an object. Velocity functions provide measurements that can be useful in:
Plotting velocity measurements.
Creating equations that depend on the velocity of an object.
Monitoring the velocity of an object and triggering the occurrence of special events when the
velocity reaches a certain value.
The following table lists the names and definitions for the velocity functions:
464 Adams View Function Builder
Run-Time Functions Categories
Function: Returns:
Velocity Along X (VX) An x component of the difference between the velocity vectors of
two coordinate system markers.
Velocity Along Y (VY) A y component of the difference between the velocity vectors of two
coordinate system markers.
Velocity Along Z (VZ) A z component of the difference between the velocity vectors of two
coordinate system markers.
Velocity Magnitude (VM) The magnitude of the first time-derivative of the displacement
vector between two coordinate system markers.
Angular Velocity About X (WX) An x component of the difference between the angular velocity
vectors of two coordinate system markers.
Angular Velocity About Y (WY) A y component of the difference between the angular velocity
vectors of two coordinate system markers.
Angular Velocity About Z (WZ) A z component of the difference between the angular velocity
vectors of two coordinate system markers.
Angular Velocity Magnitude (WM) The magnitude of the difference between the angular velocity
vectors of two coordinate system markers.
Velocity Along Line-of-Sight (VR) The radial (relative) velocity to one coordinate system marker from
another.
3. Acceleration Functions
Acceleration functions return a requested magnitude or component of the translational or rotational
acceleration vector between two markers.
You can use the acceleration functions during a simulation to obtain from Adams the acceleration
measurements of an object. Acceleration functions provide measurements that can be useful in:
Plotting acceleration measurements.
Creating equations that depend on the acceleration of an object.
Monitoring the acceleration of an object and triggering the occurrence of special events when the
acceleration reaches a certain value.
·
The WDT prefix used for angular acceleration functions implies ω or omega-dot, the time derivative of
angular velocity.
The following table lists the names and definitions for the acceleration functions:
About Run-Time Functions 465
Run-Time Functions Categories
Function: Returns:
Acceleration Along X (ACCX) An x component of the difference between the acceleration
vectors of two coordinate system markers.
Acceleration Along Y (ACCY) A y component of the difference between the acceleration
vectors of two coordinate system markers.
Acceleration Along Z (ACCZ) A z component of the difference between the acceleration
vectors of two coordinate system markers.
Acceleration Magnitude (ACCM) The magnitude of the second time-derivative of the
displacement vector to one coordinate system marker from
another coordinate system marker.
Angular Acceleration About X (WDTX) An x component of the difference between the angular
acceleration vectors of two coordinate system markers.
Angular Acceleration About Y (WDTY) A y component of the difference between the angular
acceleration vectors of two coordinate system markers.
Angular Acceleration About Z (WDTZ) A z component of the difference between the angular
acceleration vectors of two coordinate system markers.
Angular Acceleration Magnitude (WDTM) The magnitude of the difference between the angular
acceleration vectors of two coordinate system markers.
4. Contact Functions
You can use contact functions to define collision forces. The functions are built so as to turn on and off during
simulation, which makes them useful for representing bodies that come into intermittent contact with one
another.
The following table lists the names and definitions for the contact functions:
Function: Returns:
One-sided Impact (IMPACT) A real number for a force magnitude corresponding to a one-sided
collision, using a compression-only nonlinear spring-damper
formulation.
Two-sided Impact (BISTOP) A real number for a force magnitude corresponding to a two-sided
collision, using a compression-only nonlinear spring-damper
formulation.
5. Spline Functions
Splining is a method of interpolation that allows derivation of intermediate locations on a curve or surface
between known points.
You can use spline functions during a simulation to define smooth functions to approximately fit data points.
Spline functions can be useful when:
466 Adams View Function Builder
Run-Time Functions Categories
CUBSPL, though not as fast as AKISPL, always produces good results for the value of the function being
approximated, as well as its first and second derivatives. The data points don't have to be evenly spaced. The
solution process often requires estimates of derivatives of the functions being defined. The smoother a
derivative is, the easier it is for the solution process to converge.
Smooth (continuous) second derivatives are important if you use the spline in a motion. The second
derivative is the acceleration enforced by the motion, which defines the reaction force required to drive the
motion. A discontinuity in the second derivative means a discontinuity in the acceleration and therefore in
the reaction force. This can cause poor solver performance or even failure to converge at the point of
discontinuity.
The B-spline interpolation method is primarily designed to describe 3D geometric curves. Although the B-
spline can be useful for geometric applications, you should use AKISPL or CUBSPL to construct most
motions, forces, and other such entities.
Where to Find the Spline Functions
The following table lists the names and definitions for the spline functions:
Function: Returns:
Cubic Fitting Method (CUBSPL) Either a derivative of a curve or an interpolated value from a curve or
surface.
B-Spline Fitting Method (CURVE) A B-spline or a user-written curve created by a CURVE data element.
Akima Fitting Method (AKISPL) Either a derivative of a curve or an interpolated value from a curve or
surface.
INTERP Derivative of the interpolated value of a spline.
Monitoring force magnitudes and triggering the occurrence of special events when these forces reach
certain values.
Constraint Characteristics
Most constraints have the following characteristics:
Connect two bodies, referred to as the first body and second body or the action and reaction body
respectively.
Are applied at two distinct points, though sometimes coincident.
Depend on coordinate system axes to define constraint direction.
Apply whatever forces are required to prevent movement in certain directions.
Do not require the user to define the magnitudes of the forces they apply since Adams automatically
calculates force magnitudes.
Force Characteristics
Most forces have the following characteristics:
Are applied to two bodies, referred to as the first body and second body.
Are applied at two distinct points, though sometimes coincident.
Depend on coordinate system axes to define force application.
Require the user to define the magnitudes of the forces they apply.
In Adams, you can define force magnitudes in two ways:
1. With linear spring-damper-like elements that use predefined equations that automatically depend
only on displacement and velocity directly; for these forces you can simply input stiffness and
damping coefficients.
2. With multiple-component, general-equation force elements that have no predefined equations. These
allow you to create your own force magnitude equations with no restrictions on the dependencies.
When you define your own equations for force magnitudes, you have to tell Adams what the force depends
on. For instance, a force could depend on the displacement between two coordinate system markers or their
relative velocity or acceleration, or the force applied to a coordinate system marker by a constraint or force
element.To help you define these dependencies, Adams offers you displacement functions (Displacement
Functions), velocity functions (Velocity Functions), acceleration functions (Acceleration Functions), resultant force
functions (Resultant Force Functions), as well as force in object functions.
Whenever you use the force in object functions, you must tell Adams how you want the force to be measured.
You must specify:
Which force-applying object you want to measure. For example: joint_4, motion_6, sforce_3,
gforce_19, and so on.
On which body you want to take the measurement, the first body or the second body.
Which force vector component you want to obtain.
Using a Force in Object Function
About Run-Time Functions 469
Run-Time Functions Categories
In this example we'll calculate the force acting on a block located on an incline, as illustrated in body 1. Before
working through this example, reference Six-component Force/Torque (GFORCE).
This example consists of a system defined as follows:
A translational joint (JOINT_1) connects a block and an incline by way of coordinate system
markers named block.marker_14 and incline.marker_15.
A fixed joint (JOINT_2) connects the incline to ground by way of incline.marker_32 and
ground.marker_33.
A general-equation, multiple-component force, named GForce_7 is applied to the block, normal to
the surface of the incline.
The GForce_7 is applied to block.marker_28 and ground.marker_29, so that the block is the action
body and ground is the reaction body.
There is no gravity.
GFORCE(GForce_7, 0, 2, block.marker_28) = 0
GFORCE(GForce_7, 0, 3, block.marker_28) = 30
GFORCE(GForce_7, 0, 4, block.marker_28) = 40
470 Adams View Function Builder
Run-Time Functions Categories
GFORCE(GForce_7, 0, 1, block.marker_14) = 50
GFORCE(GForce_7, 0, 2, block.marker_14) = - 40
GFORCE(GForce_7, 0, 3, block.marker_14) = 0
GFORCE(GForce_7, 0, 4, block.marker_14) = - 30
GFORCE(GForce_7, 1, 1, block.marker_28) = 50
GFORCE(GForce_7, 1, 2, block.marker_28) = 0
GFORCE(GForce_7, 1, 3, block.marker_28) = - 30
GFORCE(GForce_7, 1, 4, block.marker_28) = - 40
Where to Find the Force in Object Functions
The following table lists the names and definitions for the force in object functions:
Function: Returns:
Joint Force (JOINT) A force or torque induced by a specified joint on one of the
two bodies connected by the joint object.
Motion Force (MOTION) A force or torque component induced by a specified motion
on one of the two bodies affected by the motion object.
Point-to-Curve Force (PTCV) A force or torque induced by a specified point-to-curve
object on one of the two bodies connected by the point-to-
curve object.
Curve-to-Curve Force (CVCV) A force or torque induced by a specified curve-to-curve
object on one of the two bodies connected by the curve-to-
curve object.
Joint Primitive Force (JPRIM) A force or torque induced by a specified joint primitive on
one of the two bodies connected by the joint primitive.
Single-component Force (SFORCE) A force or torque applied by a specified single-component
force on one or two bodies directly affected by the single-
component force.
Three-component Force (VFORCE) A force or torque applied by a specified three-component
force on one or two bodies directly affected by the three-
component force.
Three-component Torque (VTORQ) A force or torque applied by a specified three-component
torque on one or two bodies directly affected by the three-
component torque.
Six-component Force/Torque (GFORCE) A force or torque applied by a specified six-component
force/torque on one or two bodies directly affected by the
six-component force / torque.
Multipoint Force (NFORCE) A force or torque applied by a specified multipoint force on
one or two bodies directly affected by the multipoint force.
Beam Force (BEAM) A force or torque applied by a specified beam force on one
or two bodies directly affected by the beam force.
About Run-Time Functions 471
Run-Time Functions Categories
Function: Returns:
Bushing Force (BUSH) A force or torque applied by a specified bushing force on
one or two bodies directly affected by the bushing force.
Field Force (FIELD) A force or torque applied by a specified field force on one
or two bodies directly affected by the field force.
Spring-Damper Force (SPDP) A force or torque applied by a specified spring-damper force
on one or two bodies affected by the spring-damper force.
Function: Returns:
Sum of Forces Along X (FX) An x component of the net translational force acting at one
coordinate system marker due to all applied forces and constraints
acting between that coordinate system marker and another.
Sum of Forces Along Y (FY) A y component of the net translational force acting at one coordinate
system marker due to all applied forces and constraints acting
between that coordinate system marker and another.
Sum of Forces Along Z (FZ) A z component of the net translational force acting at one coordinate
system marker due to all applied forces and constraints acting
between that coordinate system marker and another.
Sum of Forces Magnitude (FM) The magnitude of the net translational force acting at one
coordinate system marker due to all applied forces and constraints
acting between that coordinate system marker and another.
Sum of Torques About X (TX) An x component of the net torque acting at one coordinate system
marker due to all applied torques and constraints acting between
that coordinate system marker and another.
Sum of Torques About Y (TY) A y component of the net torque acting at one coordinate system
marker due to all applied torques and constraints acting between
that coordinate system marker and another.
Sum of Torques About Z (TZ) A z component of the net torque acting at one coordinate system
marker due to all applied torques and constraints acting between
that coordinate system marker and another.
Sum of Torques Magnitude (TM) The magnitude of the net torque acting at one coordinate system
marker due to all applied torques and constraints acting between
that coordinate system marker and another.
472 Adams View Function Builder
Run-Time Functions Categories
8. Math Functions
Math functions apply to scalar numbers or matrices. If you input a scalar, Adams returns a scalar. If you input
a matrix, Adams returns a matrix.
Where to Find the Math Functions
The following table lists the names and definitions for the math functions:
9. Vector Functions
Vector functions represent the class of functions that carry out vector operations. The following table lists the
names and definitions for the Vector functions available through the Function Builder:
474 Adams View Function Builder
Run-Time Functions Categories
Function: Returns:
Translational Displacement Vector (DXYZ) A translational displacement vector between two
coordinate system markers.
Unit vector along X (UVX) A unit vector in the X-axis direction of a coordinate system
marker resolved in the coordinate system of another marker
Unit vector along Y (UVY) A unit vector in the Y-axis direction of a coordinate system
marker resolved in the coordinate system of another marker
Unit vector along Z (UVZ) A unit vector in the Z-axis direction of a coordinate system
marker resolved in the coordinate system of another marker
Difference between acceleration vectors (ACCXYZ) Difference between the acceleration vectors of two
coordinate system markers resolved in the coordinate
system of another marker
Translational Force Vector (FXYZ) The net translational force vector acting on a coordinate
system marker expressed in the coordinate system of
another marker
Translational Torque Vector (TXYZ) The net translational torque vector acting on a coordinate
system marker expressed in the coordinate system of
another marker
Difference between translational velocity vectors Difference between the velocity vectors of two coordinate
(VXYZ) system markers resolved in the coordinate system of
another marker
Difference between angular velocity vectors (WXYZ) Difference between the angular velocity vectors of two
coordinate system markers resolved in the coordinate
system of another marker
Difference between angular acceleration vectors Difference between the angular acceleration vectors of two
(WDTXYZ) coordinate system markers resolved in the coordinate
system of another marker
Unit Vector (UV) The unit vector in the direction of an arbitrary vector
expression
Vector Transformation (TRANS) The transformed vector of an arbitrary vector expression
resolved between two coordinate system markers
Function: Returns:
Algebraic Variable Value (VARVAL) The current value of the variable defined by the specified
state variable modeling entity.
Array Element Value (ARYVAL) The value of the specified element of the specified array
modeling entity.
Differential Variable Integrated Value (DIF) The integrated value of the variable defined by the specified
differential equation modeling entity.
Differential Variable Value (DIF1) The value of the variable defined by the specified
differential equation modeling entity.
Plant Input Value (PINVAL) The run-time value of a plant input.
Plant Output Value (POUVAL) The run-time value of a plant output.
Function: Returns:
PI The ratio of the circumference of a circle to its diameter ( π ).
RTOD The radians-to-degree units conversion factor (180/ π ).
DTOR The degrees-to-radian units conversion factor ( π /180).
TIME The current simulation time.
MODE An integer value indicating the current analysis mode.
476 Adams View Function Builder
Run-Time Functions Categories
In the example above, P1 and P2 are the formal arguments to the function runtime_func__1.
We can apply above function on sforce.
For Example:
force modify direct single_component_force &
single_component_force_name = .MODEL_1.SFORCE_1 &
function = "runtime_func__1(.MODEL_1.PART_2.MARKER_1,
.MODEL_1.PART_2.MARKER_2)"
One can also use an Adams ID instead of the full object name.
For Example:
force modify direct single_component_force &
single_component_force_name = .MODEL_1.SFORCE_1 &
function = "runtime_func__1(1,2)"
Expanded form
Adams expands the expression by replacing the arguments for the formal parameters before exporting to an
Adams Solver dataset (.adm file) or passing to Adams Solver from Adams View.
For Example:
Exporting an .adm file, the above runtime_func__1 applied to sforce_1 will be expand like so in the
.adm file:
FUNCTION = -1.0*(DM(1, 2)-400.0)-0.001*VR(1, 2)
Therefore, like other forms of design-time model parameterization, the parametrized version of the
expression can only be found in the Adams View representation of the model.
About Run-Time Functions 477
Run-Time Functions Categories
UI
You can create user-written run-time functions using the function builder. The function builder launched
from two ways:
1. Main menu:
Tools → Function Builder → Runtime Mode
2. Ribbon based menu:
Functions: A - M
480 Adams View Function Builder
Run-Time Functions Descriptions
ABS
Returns the absolute value of an expression that represents a numerical value.
Format
ABS (x)
Argument
Examples
The following function returns the absolute instantaneous value of the expression (-
10*TIME+15*TIME**2), where TIME is the current simulation time:
ABS(-10*TIME+15*TIME**2)
The following use of the ABS function will prevent instances where the argument of the square root function
becomes negative:
SQRT(ABS(10-DX(marker_T, marker_F, marker_A)))
Learn more about math functions.
Functions: A - M 481
Run-Time Functions Descriptions
Format
ACCX (To Marker, From Marker, Along Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose acceleration is being measured.
From Marker (Optional) The coordinate system marker whose acceleration is subtracted off. If you
don't specify this argument, it defaults to the global origin.
Along Marker (Optional) The coordinate system marker along whose x-axis the acceleration is
measured. If you don't specify this argument, it defaults to the global x-axis.
Reference Frame (Optional) The coordinate system marker in which time-derivatives are calculated.
If you don't specify this argument, it defaults to the ground reference frame.
Equation
Mathematically, ACCX is calculated as follows:
(R) 2 (R) 2
d d
ACCX = RT – R F • x̂ A
d t2 d t2
where:
(R) 2
d
RT is the second time-derivative of R T with respect to the Reference Frame, R.
dt2
RF is the position vector from the global origin to the From Marker, F.
(R) 2
d
RF is the second time-derivative of R F with respect to the Reference Frame, R.
dt2
x̂ A is the unit vector along the x-axis of the Along Marker, A.
482 Adams View Function Builder
Run-Time Functions Descriptions
Example
The following function returns the x component of the acceleration vector of marker_T with respect to
marker_F. The vector is expressed in the coordinate system of marker_A. All time-derivatives are taken in the
ground reference frame, since the Reference Frame, R, is not specified.
ACCX(marker_T, marker_F, marker_A)
Learn more about acceleration functions.
Functions: A - M 483
Run-Time Functions Descriptions
Format
ACCY (To Marker, From Marker, Along Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose acceleration is being measured.
From Marker (Optional) The coordinate system marker whose acceleration is subtracted off. If you
don't specify this argument, it defaults to the global origin.
Along Marker (Optional) The coordinate system marker along whose y-axis the acceleration is
measured. If you don't specify this argument, it defaults to the global y-axis.
Reference Frame (Optional) The coordinate system marker in which time-derivatives are calculated. If
you don't specify this argument, it defaults to the ground reference frame.
Equation
Mathematically, ACCY is calculated as follows:
(R) 2 (R) 2
d d
ACCY = RT – R F • ŷ A
dt2 dt2
where:
(R) 2
d
RT is the second time-derivative of R T with respect to the Reference Frame, R.
dt2
RF is the position vector from the global origin to the From Marker, F.
(R) 2
d
RF is the second time-derivative of R F with respect to the Reference Frame, R.
dt2
ŷ A is the unit vector along the y-axis of the Along Marker, A.
484 Adams View Function Builder
Run-Time Functions Descriptions
Example
The following function returns the y component of the acceleration vector of marker_T with respect to
marker_F. The vector is expressed in the coordinate system of marker_A. All time-derivatives are taken in the
ground reference frame, since the Reference Frame, R, is not specified.
ACCY(marker_T, marker_F, marker_A)
Learn more about acceleration functions.
Functions: A - M 485
Run-Time Functions Descriptions
Format
ACCZ (To Marker, From Marker, Along Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose acceleration is being measured.
From Marker (Optional) The coordinate system marker whose acceleration is subtracted off. If you
don't specify this argument, it defaults to the global origin.
Along Marker (Optional) The coordinate system marker along whose z-axis the acceleration is
measured. If you don't specify this argument, it defaults to the global z-axis.
Reference Frame (Optional) The coordinate system marker in which time-derivatives are calculated. If
you don't specify this argument, it defaults to the ground reference frame.
Equation
Mathematically, ACCZ is calculated as follows:
(R) 2 (R) 2
d d
ACCZ = RT – R F • ẑ A
dt2 dt2
where:
(R) 2
d
RT is the second time-derivative of R T with respect to the Reference Frame, R.
dt2
RF is the position vector from the global origin to the From Marker, F.
(R) 2
d
RF is the second time-derivative of R F with respect to the Reference Frame, R.
dt2
ẑ A is the unit vector along the z-axis of the Along Marker, A.
486 Adams View Function Builder
Run-Time Functions Descriptions
Example
The following function returns the z component of the acceleration vector of marker_T with respect to
marker_F. The vector is expressed in the coordinate system of marker_A. All time-derivatives are taken in the
ground reference frame, since the Reference Frame, R, is not specified.
ACCZ(marker_T, marker_F, marker_A)
Learn more about acceleration functions.
Functions: A - M 487
Run-Time Functions Descriptions
Format
ACCM (To Marker, From Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose acceleration is being measured.
From Marker (Optional) The coordinate system marker whose acceleration is being subtracted off.
If you don't specify this argument, it defaults to the global origin.
Reference Frame (Optional) The coordinate system marker in which time-derivatives are calculated. If
you don't specify this argument, it defaults to the ground reference frame.
Equation
Mathematically, ACCM is calculated as follows:
(R) 2
d
RT is the second time-derivative of RT with respect to the Reference Frame, R.
dt2
RF is the position vector from the global origin to the From Marker, F.
(R) 2
d
RF is the second time-derivative of RF with respect to the Reference Frame, R.
dt 2
Example
The following function returns the magnitude of the translational acceleration of marker_T with respect to
marker_F. All vector time-derivatives are taken in the reference frame of marker_R.
ACCM(marker_T, marker_F, marker_R)
488 Adams View Function Builder
Run-Time Functions Descriptions
AINT
Returns the nearest integer whose magnitude is not larger than the integer value of a specified expression that
represents a numerical value:
AINT(x) = 0 if ABS(x)< 1
AINT(x)= int(x) if ABS(x)> 1
The value of int(x) is equal to x if x is an integer. If x is not an integer, then int(x) is equal to the integer nearest
to x, whose magnitude is not greater than the magnitude of x. Thus,
int(-7.0) = -7, int(-4.8) = -4, and int(4.8) = 4.
Note: AINT is not a differentiable function. Be careful when using this function in an expression that
defines a force or motion input to the system.
Format
AINT (x)
Argument
Examples
The following functions show how AINT truncates results towards 0:
Function AINT(0.85)
Result 0
Function AINT(-0.5)
Result 0
Function AINT(4.6)
Result 4
Function AINT(-6.8)
Result -6
ACOS
Returns the arc cosine of an expression that represents a numerical value. The evaluated expression must
return a value whose absolute value is ≤ 1 . The value returned by ACOS lies in the range [0, π ], that is, 0
< ACOS(x) < π.
Format
ACOS (x)
Argument
Example
The following function calculates the angle (in radians) between the line from marker_11 to marker_21 and
the line from marker_41 to marker_31:
ACOS((DX(marker_21, marker_11) * DX(marker_31, marker_41) +
DY(marker_21, marker_11) * DY(marker_31, marker_41) +
DZ(marker_21, marker_11) * DZ(marker_31, marker_41))/
(DM(marker_21, marker_11) * DM(marker_31, marker_41))
Learn more about math functions.
Functions: A - M 491
Run-Time Functions Descriptions
Format
VARVAL(Algebraic Variable Name)
Argument
Algebraic Variable Name Name of an existing state variable modeling entity; defined by an object
name.
Example
The following example illustrates the use of the VARVAL function:
VARVAL(variable_37)
Learn more about data element access.
492 Adams View Function Builder
Run-Time Functions Descriptions
Format
AKISPL (First Independent Variable, Second Independent Variable, Spline Name, Derivative Order)
Arguments
First Independent Variable (Required) Real variable that represents the first independent variable in
the spline.
Second Independent (Optional) Real variable that represents the second independent variable in
Variable the spline.
Spline Name (Required) The name of the existing data element spline modeling entity
that defines the set of discrete data points to be used for the interpolation.
Derivative Order (Optional) The order of the derivative to be taken at the interpolated point
(integer).
Example
A spline, spline_1, is defined with discrete data as shown in the following table. The data is then used to
generate the interpolation function using the Akima spline fitting method. Since the spline defines a curve
rather than a surface, the Second Independent Variable must be set to 0.
In the following example, given the tabular data and a value for the independent variable, the AKISPL returns
the interpolated value for the dependent variable:
f = AKISPL(DX(marker_1, marker_2, marker_2), 0, spline_1)
Format
AX (To Marker, From Marker)
Arguments
To Marker (Required) The coordinate system marker whose rotation is being measured.
From Marker (Optional) The coordinate system marker with respect to which the rotation is being
measured. If you don't specify this argument, it defaults to the global coordinate system.
Equation
Mathematically, AX is calculated as follows:
AX = atan 2 ( ŷ T • ẑ F, ŷ T • ŷ F )
where:
Example
The following function returns the angle between the y-axes of marker_T and marker_F:
Format
AY (To Marker, From Marker)
Arguments
To Marker (Required) The coordinate system marker whose rotation is being measured.
From Marker (Optional) The coordinate system marker with respect to which the rotation is being
measured. If not specified, this argument defaults to the global coordinate system.
Equation
Mathematically, AY is calculated as follows:
AY = atan 2 ( ẑ T • x̂ F, ẑ T • ẑ F )
where:
Example
The following function returns the angle between the x-axes of marker_T and marker_F:
Format
AZ (To Marker, From Marker)
Arguments
To Marker (Required) The coordinate system marker whose rotation is being measured.
From Marker (Optional) The coordinate system marker with respect to which the rotation is being
measured. If not specified, this argument defaults to the global coordinate system.
Equation
Mathematically, AZ is calculated as follows:
AZ = atan 2 ( x̂ T • ŷ F, x̂ T • x̂ F )
where:
Example
The following function returns the angle between the x-axes of marker_T and marker_F:
Format
WDTX (To Marker, From Marker, About Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose angular acceleration is being
measured.
From Marker (Optional) The coordinate system marker whose angular acceleration is subtracted
off. If you don't specify this argument, it defaults to the global origin.
About Marker (Optional) The coordinate system marker about whose x-axis acceleration is
measured. If you don't specify this argument, it defaults to the global coordinate axis.
Reference Frame (Optional) The coordinate system marker in which time-derivatives are calculated.
If you don't specify this argument, it defaults to the ground reference frame.
Equation
Mathematically, WDTX is calculated as follows:
(R) (R) d
d
WDTX = ωT – ω • x̂
dt dt F A
where:
ω T is the angular velocity vector of the To Marker, T, with respect to the ground reference frame.
(R) d
ω T is the time-derivative of ω T with respect to the Reference Frame, R.
dt
ω F is the angular velocity vector of the From Marker, F, with respect to the ground reference
frame.
(R)
d
ω is the time-derivative of ω F with respect to the Reference Frame, R.
dt F
x̂ A is the unit vector along the x-axis of the About Marker, A.
Functions: A - M 501
Run-Time Functions Descriptions
Example
The following example returns the x component of the angular acceleration vector of marker_T, with respect
to marker_F, as seen in the global coordinate system of marker_A and measured in the reference frame of
marker_R:
WDTX(marker_T, marker_F, marker_A, marker_R)
Learn more about acceleration functions.
502 Adams View Function Builder
Run-Time Functions Descriptions
Format
WDTY (To Marker, From Marker, About Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose angular acceleration is being
measured.
From Marker (Optional) The coordinate system marker whose angular acceleration is subtracted
off. If you don't specify this argument, it defaults to the global origin.
About Marker (Optional) The coordinate system marker about whose x-axis acceleration is
measured. If you don't specify this argument, it defaults to the global coordinate
axis.
Reference Frame (Optional) The coordinate system marker in which time-derivatives are calculated.
If you don't specify this argument, it defaults to the ground reference frame.
Equation
Mathematically, WDTY is calculated as follows:
(R) (R) d
d
WDTY = ωT – ω • ŷ
dt dt F A
where:
ω T is the angular velocity vector of the To Marker, T, with respect to the ground reference frame.
(R) d
ω T is the time-derivative of ω T with respect to the Reference Frame, R.
dt
ω F is the angular velocity vector of the From Marker, F, with respect to the ground reference
frame.
(R)
d
ω is the time-derivative of ω F with respect to the Reference Frame, R.
dt F
ŷ A is the unit vector along the y-axis of the About Marker, A.
Functions: A - M 503
Run-Time Functions Descriptions
Example
The following example returns the y component of the angular acceleration vector of marker_T, with respect
to marker_F, as seen in the global coordinate system of marker_A and measured in the reference frame of
marker_R:
WDTY(marker_T, marker_F, marker_A, marker_R)
Learn more about acceleration functions.
504 Adams View Function Builder
Run-Time Functions Descriptions
Format
WDTZ (To Marker, From Marker, About Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose angular acceleration is being
measured.
From Marker (Optional) The coordinate system marker whose angular acceleration is subtracted
off. If you don't specify this argument, it defaults to the global origin.
About Marker (Optional) The coordinate system marker about whose x-axis acceleration is
measured. If you don't specify this argument, it defaults to the global coordinate
axis.
Reference Frame (Optional) The coordinate system marker in which time-derivatives are calculated.
If you don't specify this argument, it defaults to the ground reference frame.
Equation
Mathematically, WDTZ is calculated as follows:
(R) (R) d
d
WDTZ = ωT – ω • ẑ
dt dt F A
where:
ω T is the angular velocity vector of the To Marker, T, with respect to the ground reference frame.
(R) d
ω T is the time-derivative of ω T with respect to the Reference Frame, R.
dt
ω F is the angular velocity vector of the From Marker, F, with respect to the ground reference
frame.
(R)
d
ω is the time-derivative of ω F with respect to the Reference Frame, R.
dt F
ẑ A is the unit vector along the z-axis of the About Marker, A.
Functions: A - M 505
Run-Time Functions Descriptions
Example
The following example returns the z component of the angular acceleration vector of marker_T, with respect
to marker_F, as seen in the global coordinate system of marker_A and measured in the reference frame of
marker_R:
WDTZ(marker_T, marker_F, marker_A, marker_R)
Learn more about acceleration functions.
506 Adams View Function Builder
Run-Time Functions Descriptions
Format
WDTM (To Marker, From Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose angular acceleration is being
measured.
From Marker (Optional) The coordinate system marker whose angular acceleration is subtracted
off. If you don't specify this argument, it defaults to the global origin.
Reference Frame (Optional) The coordinate system marker in which time-derivatives are calculated.
If you don't specify this argument, it defaults to the ground reference frame.
Equation
Mathematically, WDTM is calculated as follows:
(R) d (R)
d (R) d (R)
d
WDTM = ωT – ωF • ωT – ω
dt dt dt d t F
where:
ω T is the angular velocity vector of the To Marker, T, with respect to the ground reference frame.
(R)
d
ω is the time-derivative of ω T with respect to the Reference Frame, R.
dt T
ω F is the angular velocity vector of the From Marker, F, with respect to the ground reference
frame.
(R) d
ω F is the time-derivative of ω F with respect to the Reference Frame, R.
dt
Example
The following example returns the magnitude of the angular acceleration vector of marker_T, with respect to
marker_F, as seen in the global coordinate system of marker_A and measured in the reference frame of
marker_R:
WDTM(marker_T, marker_F)
Learn more about acceleration functions.
Functions: A - M 507
Run-Time Functions Descriptions
Format
WX (To Marker, From Marker, About Marker)
Arguments
To Marker (Required) The coordinate system marker whose angular velocity is being measured.
From Marker (Optional) The coordinate system marker whose angular velocity is subtracted off. If
you don't specify this argument, it defaults to the global coordinate system.
About Marker (Optional) The coordinate system marker about whose x-axis the angular velocity is
measured. If you don't specify this argument, it defaults to the global x-axis.
Equation
Mathematically, WX is calculated as follows:
(G) (G)
WX = [ ωT – ωF ] • x̂ A
where:
(G)
ωT is the angular velocity vector of the To Marker, T, with respect to the ground reference
frame, G.
(G)
ωF is the angular velocity vector of the From Marker, F, with respect to the ground reference
frame, G.
Example
The following function returns the x component of the angular velocity between marker_T and marker_F,
as measured in the coordinate system of marker_A:
WX(marker_T, marker_F, marker_A)
Learn more about velocity functions.
508 Adams View Function Builder
Run-Time Functions Descriptions
Format
WY (To Marker, From Marker, About Marker)
Arguments
To Marker (Required) The coordinate system marker whose angular velocity is being
measured.
From Marker (Optional) The coordinate system marker whose angular velocity is subtracted off.
If you don't specify this argument, it defaults to the global coordinate system.
About Marker (Optional) The coordinate system marker about whose y-axis the angular velocity
is measured. If you don't specify this argument, it defaults to the global y-axis.
Equation
Mathematically, WY is calculated as follows:
(G) (G)
WY = [ ωT – ωF ] • ŷ A
where:
(G)
ωT is the angular velocity vector of the To Marker, T, with respect to the ground reference
frame, G.
(G)
ωF is the angular velocity vector of the From Marker, F, with respect to the ground reference
frame, G.
Example
The following function returns the y component of the angular velocity between marker_T and marker_F,
as measured in the coordinate system of marker_A:
WY(marker_T, marker_F, marker_A)
Learn more about velocity functions.
Functions: A - M 509
Run-Time Functions Descriptions
Format
WZ (To Marker, From Marker, About Marker)
Arguments
To Marker (Required) The coordinate system marker whose angular velocity is being measured.
From Marker (Optional) The coordinate system marker whose angular velocity is subtracted off. If
you don't specify this argument, it defaults to the global coordinate system.
About Marker (Optional) The coordinate system marker about whose z-axis the angular velocity is
measured. If you don't specify this argument, it defaults to the global z-axis.
Equation
Mathematically, WZ is calculated as follows:
(G) (G)
WZ = [ ωT – ωF ] • ẑ A
where:
(G)
ωT is the angular velocity vector of the To Marker, T, with respect to the ground reference
frame, G.
(G)
ωF is the angular velocity vector of the From Marker, F, with respect to the ground reference
frame, G.
Example
The following function returns the z component of the angular velocity between marker_T and marker_F, as
measured in the coordinate system of marker_A:
WZ(marker_T, marker_F, marker_A)
Learn more about velocity functions.
510 Adams View Function Builder
Run-Time Functions Descriptions
Format
WM (To Marker, From Marker)
Arguments
To Marker (Required) The coordinate system marker whose angular velocity is being measured.
From Marker (Optional) The coordinate system marker whose angular velocity is subtracted off. If
not specified, this argument defaults to the global coordinate system.
Equation
Mathematically, WM is calculated as follows:
Example
The following example returns the magnitude of the angular velocity vector between marker_T and
marker_F:
WM(marker_T, marker_F)
Learn more about velocity functions.
Functions: A - M 511
Run-Time Functions Descriptions
ANINT
Returns the nearest integer whose magnitude is not larger than the real value of an expression that represents
a numerical value:
ANINT(x) = INT(x + 0.5) if x > 0
ANINT(x) = INT(x - 0.5) if x < 0
The value of the mathematical function INT of a variable x is equal to x if x is an integer. If x is not an integer,
then INT(x) is equal to the nearest integer to x, whose magnitude is not greater than the magnitude of x.
Thus,
INT(-7.0) = -7, INT(-4.8) = -4, and INT(4.8) = 4.
Format
ANINT (x)
Argument
Examples
The following functions show how ANINT rounds the results to the nearest integer:
Function ANINT(-0.9)
Result -1
Function ANINT(0.33)
Result 0
Function ANINT(-4.6)
Result -5
Function AINT(4.6)
Result 5
Format
ARYVAL(Array Name, Element Number)
Arguments
Array Name Name of an existing array modeling entity; defined by an object name.
Element Number The number of the element within the array whose value you want to get.
Example
The following example illustrates the use of the ARYVAL function:
ARYVAL(array_45,3)
Learn more about data element access.
Functions: A - M 513
Run-Time Functions Descriptions
ASIN
Returns the arc sine of an expression that represents a numerical value. ASIN is defined only when the
absolute value of the expression is <1. The range of ASIN is – π ⁄ 2, π ⁄ 2 (that is,
– π ⁄ 2 ≤ asin ( ( x ) ≤ ( π ⁄ 2 ) ) ).
Format
ASIN(x)
Argument
Example
The following function calculates the value of the expression:
DX(marker_21, marker_11) / DM(marker_21, marker_11)
and then applies the ASIN function to the result and returns its arc sine in radians:
ASIN(DX(marker_21, marker_11) / DM(marker_21, marker_11))
514 Adams View Function Builder
Run-Time Functions Descriptions
ATAN
Returns the arc tangent of an expression that represents a numerical value. The range of ATAN is [-90o, 90o]
(that is, -90o < ATAN(x) < 90o).
Format
ATAN(x)
Argument
Examples
The arc tangent (in radians) of the expression a/b where a is the x component of the distance between
marker_2 and marker_3 and b is the y component of the distance between marker_2 and marker_3.
ATAN(DX(marker_2, marker_3)/ DY(marker_2, marker_3))
The figure below shows angle (in radians) between the line joining marker_3 and marker_4 and the global
x-axis:
ATAN(DY(marker_4, marker_3)/ DX(marker_4, marker_3))
ATAN2
Returns the arc tangent of two expressions, each representing a numerical value. x1 and x2 themselves may
be expressions.
– π < ATAN2(x1, x2) < π
ATAN2(x1, x2) > 0 if x1 > 0
ATAN2(x1, x2) = 0 if x1 = 0, x2 > 0
ATAN2(x1, x2) = π if x1 = 0, x2 < 0
ATAN2(x1, x2) < 0 if x1 < 0
ABS(ATAN2(x1, x2))= π ⁄ 2 if x2 = 0
ATAN2(x1, x2) undefined if x1 = 0, and x2 = 0
Format
ATAN2(x1, x2)
Arguments
Example
The following function shows arc tangent (in radians) of the expression a/b where a is the x component of
the distance between marker_2 and marker_3 and b is the y component of the distance between marker_2
and marker_3:
ATAN2(DY(marker_2, marker_3), DX(marker_2, marker_3))
Learn more about math functions.
516 Adams View Function Builder
Run-Time Functions Descriptions
Format
CURVE (Independent Variable, Derivative Order, Direction, Curve Name)
Arguments
Independent Variable Real variable that represents the independent variable at which the curve will be
evaluated (function).
Example
The following function returns the x direction evaluated value of curve_1 at point TIME, where TIME is the
current simulation time:
CURVE(TIME, 0, 1, curve_1)
Learn more about spline functions.
Functions: A - M 517
Run-Time Functions Descriptions
Format
PSI (To Marker, From Marker)
Arguments
To Marker (Required) The coordinate system marker whose rotation is being measured.
From Marker (Optional) The coordinate system marker with respect to which the rotation is being
measured. If you don't specify this argument, it defaults to the global coordinate
system.
Example
The following example returns all the angles of rotation associated with a body-fixed 313 rotation sequence:
518 Adams View Function Builder
Run-Time Functions Descriptions
There are always at least two equivalent sets of rotation angles that yield the same final orientation. Using the
above example, the same final orientation is achieved by using either of the following sets of rotation angles:
in association with the psi, ψ , (1st rotation) and theta, θ , (2nd rotation) angles.
Format
PHI (To Marker, From Marker)
Arguments
To Marker (Required) The coordinate system marker whose rotation is being measured.
From Marker (Optional) The coordinate system marker with respect to which the rotation is being
measured. If not specified, this argument defaults to the global coordinate system.
Example
The following example illustrates the use of the PHI function:
PHI(marker_T, marker_F)
See the illustration for B313 Sequence: 1st Rotation (PSI).
Learn more about displacement functions.
Functions: A - M 521
Run-Time Functions Descriptions
coordinate system marker to another. This second rotation is referred to as the theta, θ , angle, and is
used in association with the psi, ψ , (1st rotation) and phi, φ , (3rd rotation) angles.
Format
THETA (To Marker, From Marker)
Arguments
To Marker (Required) The coordinate system marker whose rotation is being measured.
From Marker (Optional) The coordinate system marker with respect to which the rotation is being
measured. If not specified, this argument defaults to the global coordinate system.
Example
The following example illustrates the use of the THETA function:
THETA(marker_T, marker_F)
See the illustration for B313 Sequence: 1st Rotation (PSI).
Learn more about displacement functions.
522 Adams View Function Builder
Run-Time Functions Descriptions
Format
YAW (To Marker, From Marker)
Arguments
To Marker (Required) The coordinate system marker whose rotation is being measured.
From Marker (Optional) The coordinate system marker with respect to which the rotation is being
measured. If you don't specify this argument, it defaults to the global coordinate
system.
Example
The following example returns all the angles of rotation associated with a body-fixed 321 rotation sequence:
Functions: A - M 523
Run-Time Functions Descriptions
There are always at least two equivalent sets of rotation angles that yield the same final orientation. Using the
above example, the same final orientation can be achieved by using any of the following sets of rotation angles.
524 Adams View Function Builder
Run-Time Functions Descriptions
Note: Opposite from convention, this function calculates the negative of the second body-fixed
321 angle.
Format
PITCH (To Marker, From Marker)
Arguments
To Marker (Required) The coordinate system marker whose rotation is being measured.
From Marker (Optional) The coordinate system marker with respect to which the rotation is
being measured. If not specified, this argument defaults to the global coordinate
system.
Example
The following example illustrates the use of the PITCH function:
PITCH(marker_T, marker_F)
See the illustration for B321 Sequence: 1st Rotation (YAW).
Learn more about displacement functions.
526 Adams View Function Builder
Run-Time Functions Descriptions
Format
ROLL (To Marker, From Marker)
Arguments
To Marker (Required) The coordinate system marker whose rotation is being measured.
From Marker (Optional) The coordinate system marker with respect to which the rotation is being
measured. If not specified, this argument defaults to the global coordinate system.
Example
The following example illustrates the use of the ROLL function:
ROLL(marker_T, marker_F)
See the illustration for B321 Sequence: 1st Rotation (YAW).
Learn more about displacement functions.
Functions: A - M 527
Run-Time Functions Descriptions
Format
BEAM (Beam Force Name, On This Body, Force Component, Along/About Axes)
Arguments
Beam Force Name (Required) Beam force for which the force is measured.
On This Body (Required) Body on which the force is measured.
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional) Coordinate system marker in which the results are measured.
To have your results measured in the global coordinate system, do one of the
following:
If you're entering your function through the Assist dialog box, leave
the Along/About Axes text box empty.
If you're entering your function directly in the function text box,
enter a 0.
Example
The following function returns the z component of the force vector acting on the first body (at the I marker)
of .model_2.beam_1, measured along the z-axis of the global coordinate system:
528 Adams View Function Builder
Run-Time Functions Descriptions
BEAM(.model_2.beam_1, 0, 4, 0)
Learn more about force in object functions.
Functions: A - M 529
Run-Time Functions Descriptions
Format
BUSH (Bushing Force Name, On This Body, Force Component, Along/About Axes)
Arguments
Bushing Force Name (Required) Bushing force for which the force is measured.
On This Body (Required) Body on which the force is measured.
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional) Coordinate system marker in which the results are measured.
To have your results measured in the global coordinate system, do one of the
following:
If you're entering your function through the Assist dialog box, leave
the Along/About Axes text box empty.
If you're entering your function directly in the function text box,
enter a 0.
Example
The following function returns the y component of the torque vector acting on the first body (at the I marker)
of .model_2.bushing_1, measured along the y-axis of the global coordinate system:
530 Adams View Function Builder
Run-Time Functions Descriptions
BUSH(.model_2.bushing_1, 0, 7, 0)
Learn more about force in object functions.
Functions: A - M 531
Run-Time Functions Descriptions
Format
CHEBY (x, Shift, Coefficients)
Arguments
Example
The following example illustrates the use of the CHEBY function:
CHEBY(TIME, 1, 1, 0, -1)
The above function defines the following quadratic Chebyshev polynomial (where TIME is the current
simulation time):
CHEBY = 1 + 0 * (TIME-1) - 1 * [2 (TIME-1)2 - 1]
= -2*TIME2 + 4*TIME
Learn more about math functions.
532 Adams View Function Builder
Run-Time Functions Descriptions
CONTACT
The CONTACT function returns the component comp of the force in CONTACT/id in the coordinate
system of marker rm. If jflag is set to zero, Adams Solver (FORTRAN) returns the value of the force/torque
that acts on the I marker of CONTACT. If jflag is set to 1, Adams Solver (FORTRAN) returns the value that
acts on the J marker. To obtain results in the global coordinate system, you can specify rm as zero.
Format
CONTACT (id, jflag, comp, rm)
Arguments
Examples
REQUEST/1
, F2= CONTACT(11,0,2,0)\
, F3= CONTACT(11,0,3,0)\
, F4= CONTACT(11,0,4,0)\
, F6= CONTACT(11,0,6,0)\
, F7= CONTACT(11,0,7,0)\
, F8= CONTACT(11,0,8,0)
This REQUEST statement outputs the x-, y- and z-components of the force and torque at the I marker of
CONTACT/11. Since rm is specified as zero, all vectors are expressed in the global coordinate system.
Functions: A - M 533
Run-Time Functions Descriptions
COS
Returns the cosine of an expression that represents a numerical value.
Format
COS (x)
Argument
Example
The following function returns the cosine of 2* π *TIME, where TIME is the current simulation time:
COS(2* π *TIME)
Learn more about math functions.
534 Adams View Function Builder
Run-Time Functions Descriptions
COSH
Returns the hyperbolic cosine of an expression that represents a numerical value.
COSH(x) = (ex + e-x)/2.0
Format
COSH(x)
Argument
Example
The following function returns the hyperbolic cosine of the z component of the displacement of marker_2
with respect to marker_1. The result is computed in the coordinate system of marker_1.
COSH(DZ(marker_2, marker_1, marker_1))
Learn more about math functions.
Functions: A - M 535
Run-Time Functions Descriptions
Format
CUBSPL (First Independent Variable, Second Independent Variable, Spline Name, Derivative Order)
Arguments
First Independent Variable (Required) A real variable that represents the first independent
variable of the spline.
Second Independent Variable (Optional) A real variable that represents the second independent
variable of the spline.
Spline Name (Required) The name of the existing data element spline modeling
entity that defines the set of discrete data points to be used for the
interpolation.
Derivative Order (Optional) The order of the derivative to be taken at the interpolated
point (integer).
Example
A spline, spline_1, is defined with discrete data as shown in the following table. The data is then used to
generate the interpolation function using the Cubic spline fitting method. Since the spline defines a curve
rather than a surface, the Second Independent Variable must be set to 0.
The following example returns the interpolated value of the spline of displacement over time, to define a
motion function:
Motion = CUBSPL(TIME, 0, spline_1)
536 Adams View Function Builder
Run-Time Functions Descriptions
Note: CVCV can only be used for output purposes. Therefore, it can be used only with output
request and sensor objects.
Format
CVCV (Curve-to-curve Name, On This Body, Force Component, Along/About Axes)
Arguments
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional) Coordinate system marker in which the results are measured.
To have your results measured in the global coordinate system, do one of the
following:
If you're entering your function through the Assist dialog box, leave the
Along/About Axes text box empty.
If you're entering your function directly in the function text box, enter a
0.
538 Adams View Function Builder
Run-Time Functions Descriptions
Example
The following function returns the y component of the force vector acting on the first body (at the I marker)
of .model_1.cvcv_31, measured along the y-axis of the global coordinate system:
CVCV(.model_1.cvcv_31, 0, 3, 0)
Learn more about force in object functions.
Functions: A - M 539
Run-Time Functions Descriptions
DELAY
The DELAY function returns the value of an expression at a delayed time.
The DELAY function is useful to define Delay Differential Equations (DDE) or Delay Differential-Algebraic
Equations (DDAE) of the retarded type (when delays are positive). Neither DDE nor DDAE of the advance
type (negative delays) are supported. The DELAY function can be used in MOTION and GCON definitions
(possibly involving neutral type of DDE or DDAE).
During linearization the DELAY function is approximated by a first order polynomial equivalent to an order
1 Padé approximant.
The user does not require to specify a buffer size. Adams Solver (C++) will manage a variable-size buffer
automatically.
Format
DELAY (Delayed_Expression, Delay_Magnitude, Initial_Expression_Value, Delay_Logic_Array)
Arguments
The equations:
x' 1 ( t ) = 5x 2 ( t – τ )
x' 2 ( t ) = 3x 1 ( t )x 2 ( t – τ )
τ = x 1 – 3x 2 > 0
x 2 ( t ) = 0.95 (t < 0)
could be modeled in Adams as follows:
DIF/1, FU=5*DELAY(DIF(2), DIF(1)-3*DIF(2), 0.95))
DIF/2, FU=3*DIF(1)*DELAY(DIF(2), DIF(1)-3*DIF(2), 0.95)
or
VARIABLE/1, FU=DELAY(DIF(2), DIF(1)-3*DIF(2), 0.95)
DIF/1, FU=5*VARVAL(1)
540 Adams View Function Builder
Run-Time Functions Descriptions
DIF/2, FU=3*DIF(1)*VARVAL(1)
Notice that the integrator will take care of using zero for the delay when the expression for the delay
is negative.
Example:
part create equation differential_equation differential_equation_name
= DIFF1 initial_condition = 1 function = (DELAY(DIFF1, 1,1,777)
Learn more about Constants & Variables.
Functions: A - M 541
Run-Time Functions Descriptions
Format
ACCXYZ(i[,j][,k][,l])
Arguments
Extended Definition
Mathematically, ACCXYZ is calculated as follows:
where:
542 Adams View Function Builder
Run-Time Functions Descriptions
(l) 2
d-
------ denotes two time differentiations in the reference frame of the l marker.
2
dt
ACCX is the Acceleration Along X (ACCX) measure.
ACCY is the Acceleration Along Y (ACCY) measure.
ACCZ is the Acceleration Along Z (ACCZ) measure.
Examples
Unlike VR, the Adams function expression language does not provide support for radial acceleration (or
separation acceleration), ACCR. The following variable shows how this quantity could be computed.
VARIABLE/1, FUNCTION = ACCXYZ(21,11) * UV(DXYZ(21,11))
Functions: A - M 543
Run-Time Functions Descriptions
Format
VXYZ(i[,j][,k][,l])
Arguments
Extended Definition
Mathematically, VXYZ is calculated as follows:
where:
(l) d
----- denotes time differentiation in the reference frame of the l marker.
dt
Examples
This variable statement:
VARIABLE/1, FUNCTION = VXYZ(21,11) * UV(DXYZ(21,11))
computes the projection of the velocity vector of marker 21 from marker 11 on a unit vector along the line
of sight to marker 21 from marker 11. This quantity is also known as the radial velocity and can be written
more compactly as:
VARIABLE/1, FUNCTION = VR(21,11)
Functions: A - M 545
Run-Time Functions Descriptions
Format
WXYZ(i[,j][,k])
Arguments
Extended Definition
Mathematically, WXYZ is calculated as:
where:
Examples
A vector expression for angular velocity might be used directly in the definition of a vector torque element:
VTORQUE/3, I=310, JFLOAT=9911, RM=310,
, TXYZ = -6.*WXYZ(310,9900,310)
Functions: A - M 547
Run-Time Functions Descriptions
Format
WDTXYZ(i[,j][,k][,l])
Arguments
Extended Definition
Mathematically, WDTXYZ is calculated as:
where:
(l) d-
---- denotes time differentiation in the reference frame of the l marker.
dt
WDTX is the Angular Acceleration About X (WDTX) measure.
WDTY is the Angular Acceleration About Y (WDTY) measure.
WDTZ is the Angular Acceleration About Z (WDTZ) measure.
Examples
A vector expression for angular acceleration might be used directly in the definition of a vector torque
element:
VTORQUE/3, I=310, JFLOAT=9911, RM=310,
, TXYZ = -6.*WDTXYZ(310,9900,310)
Functions: A - M 549
Run-Time Functions Descriptions
Format
DIF(Differential Variable Name)
Argument
Differential Variable Name Name of an existing differential equation modeling entity; defined by an
object name.
Example
The following example illustrates the use of the DIF function:
DIF(diffeq_6)
Learn more about data element access.
550 Adams View Function Builder
Run-Time Functions Descriptions
Format
DIF1(Differential Variable Name)
Argument
Differential Variable Name Name of an existing differential equation modeling entity; defined by an
object name.
Example
The following example illustrates the use of the DIF1 function:
DIF1(.diffeq_4)
Learn more about data element access.
Functions: A - M 551
Run-Time Functions Descriptions
DIM
Returns the positive difference of the instantaneous values of two expressions, each representing a numerical
value.
DIM(x1, x2) = 0 if x1 ≤ x2
DIM(x1, x2) = x1-x2 if x1 > x2
Format
DIM(x1,x2)
Arguments
Example
The following function returns 0 as long as TIME ≤ 5 , and TIME - 5 for TIME > 5. TIME is the current
simulation time.
DIM(TIME,5)
Learn more about math functions.
552 Adams View Function Builder
Run-Time Functions Descriptions
Format
DX (To Marker, From Marker, Along Marker)
Arguments
Equation
Mathematically, DX is calculated as follows:
DX = [ R T – R F ] • x̂ A
where:
R F is the position vector from the global origin to the From Marker, F.
Example
The following function returns the x component of the displacement vector from marker_F to marker_T,
along the x-axis of marker_A:
Format
DY (To Marker, From Marker, Along Marker)
Arguments
Equation
Mathematically, DY is calculated as follows:
DY = [ R T – R F ] • ŷ A
where:
RF is the position vector from the global origin to the From Marker, F.
Example
The following function returns the y component of the displacement vector from marker_F to marker_T,
along the y-axis of marker_A:
Format
DZ (To Marker, From Marker, Along Marker)
Arguments
Equation
Mathematically, DZ is calculated as follows:
DZ = [ R T – R F ] • ẑ A
where:
R F is the position vector from the global origin to the From Marker, F.
ẑ A is the unit vector along the z-axis of Along Marker, A.
Example
The following function returns the z component of the displacement vector from marker_F to marker_T,
along the z-axis of marker_A:
Format
DM (To Marker, From Marker)
Arguments
Equation
Mathematically, DM is calculated as follows:
DM = [ RT – RF ] • [ RT – RF ]
where:
R F is the position vector from the global origin to the From Marker, F.
Example
The following function returns a number greater than or equal to 0:
DTOR
Returns the degrees-to-radian units conversion factor ( π /180), same as (PI/180).
Format
DTOR
Argument
None
Example
The following example represents a value of 30 degrees in units of radians:
30d*DTOR or (30 *PI/180)
Learn more about Constants and Variables.
Functions: A - M 561
Run-Time Functions Descriptions
EXP
Returns the value ex, where x is any expression that represents a numerical value.
Format
EXP(x)
Argument
Example
The following function returns e2*TIME, where TIME is the current simulation time:
EXP(2*TIME)
Learn more about math functions.
562 Adams View Function Builder
Run-Time Functions Descriptions
Format
FIELD (Field Force Name, On This Body, Force Component, Along/About Axes)
Arguments
Field Force Name (Required) Field force for which the force is measured.
On This Body (Required) Body on which the force is measured.
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional) Coordinate system marker in which the results are measured.
To have your results measured in the global coordinate system, do one of the
following:
If you're entering your function through the Assist dialog box, leave the
Along/About Axes text box empty.
If you're entering your function directly in the function text box, enter a 0.
Example
The following function returns the magnitude of the torque acting on the second body (at the J marker) of
.model_1.field_11, measured in the global coordinate system:
Functions: A - M 563
Run-Time Functions Descriptions
FIELD(.model_1.field_11, 1, 5, 0)
Learn more about force in object functions.
564 Adams View Function Builder
Run-Time Functions Descriptions
Format
FORCOS (x, Shift, Frequency, Coefficients)
Arguments
Example
The following function defines a Fourier Cosine, which is a harmonic function of time with no shift, and a
fundamental frequency of 1 cycle (360 degrees) per time unit:
COS(TIME, 0, 360D, 1, 2, 3, 4)
The function defined is as follows:
FORCOS = 1 + 2*COS(360D*TIME)+
3*COS(2*360D*TIME)+
4*COS(3*360D*TIME)
TIME is the current simulation time.
Learn more about math functions.
Functions: A - M 565
Run-Time Functions Descriptions
Format
FORSIN (x, Shift, Frequency, Coefficients)
Arguments
Example
The following function defines a Fourier Sine, which is a harmonic function of TIME with a -0.25 shift, and
a fundamental frequency of 0.5 cycle ( π radians) per time unit:
FORSIN(TIME,-0.25, PI, 0, 1, 2, 3)
The function defined is as follows:
FORSIN = 0 + SIN( π *(TIME + 0.25))
+ 2*SIN(2 π *(TIME + 0.25))
+ 3*SIN(3 π *(TIME + 0.25))
TIME is the current simulation time.
Learn more about math functions.
566 Adams View Function Builder
Run-Time Functions Descriptions
Note: The HAVSIN function behavior is similar to the behavior of the STEP functions. HAVSIN is
much smoother than either of these functions. The smoothness, however, causes its derivatives
to be slightly larger than that of STEP
The following plot shows a comparison between HAVSIN and STEP, STEP5, and TANH.
Format
HAVSIN (x, Begin At, End At, Initial Function Value, Final Function Value)
Arguments
End At Real variable that specifies the x value at which the haversine function ends.
Initial Function Value Initial value of the haversine function.
Final Function Value Final value of the haversine function.
Example
The following function defines a smooth step function from time 1 to time 2 with a displacement from 0 to 1:
HAVSIN(TIME, 1, 0, 2, 1)
IF
Allows you to conditionally define a function expression.
Note: Using the IF function will likely cause discontinuities in the derivatives of the function
evaluation, which can cause the integrator to decrease the time step size or fail. We recommend
that you use the STEP function instead of the IF.
Format
IF(Expression1: Expression2, Expression3, Expression4)
Arguments
Example
In the following illustration, the expression returns different values depending on the value of the variable
called time:
Function IF(time-2.5:0,0.5,1)
Result 0.0 if time < 2.5
Format
INVPSD (Independent Variable, Spline Name, Min Frequency, Max Frequency, Num Frequencies, Use
Logarithmic, Random Number Seed)
Arguments
Equation
Mathematically, INVPSD is calculated as follows:
nf
The regenerated signal consists of a series of sinusoidal functions where the amplitudes, Ai, are determined
in such a way that the effective value for the PSD and the time signal are the same. The phase
angle, ϕ i ( 0 ≤ ϕ i ≤ 2π ) , is calculated by a pseudo-random number generator.
Using the same seed value will always result in the same set of phase angles.
Functions: A - M 571
Run-Time Functions Descriptions
Example
For the power spectral density data shown in Figure 1, INVPSD(TIME, spline_1, 1, 10, 20, 0, 0) regenerates
the time signal shown in Figure 2.
Figure 1. PSD vs. Frequency in Log-Log Scale
INTERP
The INTERP function returns the iord derivative of the interpolated value of SPLINE/id at time=x. The
INTERP function supports time-series splines, which are splines that include a FILE argument that specifies
a time history file of type DAC or RPC III.
Format
INTERP (Indep_Var, Method, Spline_name, Deriv_order)
Arguments
Independent Variable Enter a real variable that specifies the value of time, the independent variable
along the x-axis of the time series spline that is being interpolated.
Derivative Order Select the order of the derivative that Adams Solver takes at the interpolated
point, and then returns through INTERP.
Linear (1)
Cubic (3)
Spline Name Enter the name of the SPLINE statement in the Adams Solver dataset. The
SPLINE statement must reference time series data from a DAC or RPC III
file.
Examples
As part of the Adams Durability feature, the INTERP function lets you specify how you want to interpolate
spline data from an RPC III or DAC time history file. An example is shown below of how to specify the
INTERP function in Adams Solver for durability analysis.
For durability analysis, the INTERP function appears in a motion or force statement, and looks as follows:
INTERP(time, 3, spline id)
where:
time is the independent variable of the interpolation. For durability analysis, this real variable is
always time or an expression that includes time.
3 is the method of interpolation, which indicates cubic interpolation between data points. 1, which
indicates linear interpolation, is also a valid entry.
spline id is the identifier of the spline that specifies the RPC III or DAC file input. Setting up a Spline
in Adams Durability.
Functions: A - M 573
Run-Time Functions Descriptions
For more information on the INTERP function, see INTERP for Adams Solver (C++) or INTERP for
Adams Solver (FORTRAN).
574 Adams View Function Builder
Run-Time Functions Descriptions
Format
JOINT (Joint Name, On This Body, Force Component, Along/About Axes)
Arguments
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional) Coordinate system marker in which the results are measured.
To have your results measured in the global coordinate system, do one of the
following:
If you're entering your function through the Assist dialog box, leave the
Along/About Axes text box empty.
If you're entering your function directly in the function text box, enter a 0.
Example
The following function returns the magnitude of the force vector acting on the first body (at the I marker)
of .model_1.joint_1 in the global coordinate system.
JOINT(.model_1.joint_1, 0, 1, 0)
Functions: A - M 575
Run-Time Functions Descriptions
Format
JPRIM (Joint Primitive Name, On This Body, Force Component, Along/About Axes)
Arguments
Joint Primitive Name (Required) Joint primitive for which the force is measured.
On This Body (Required) Body on which the force is measured.
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional) Coordinate system marker in which the results are measured.
To have your results measured in the global coordinate system, do one of the
following:
If you're entering your function through the Assist dialog box, leave
the Along/About Axes text box empty.
If you're entering your function directly in the function text box,
enter a 0.
Functions: A - M 577
Run-Time Functions Descriptions
Example
The following function returns the z component of the torque vector acting on the second body (at the J
marker) of .model_1.jprim_21 measured along the z-axis of .model_1.part_1.mar_11:
JPRIM(.model_1.jprim_21, 1, 8, .model_1.part_1.mar_11)
Learn more about force in object functions.
578 Adams View Function Builder
Run-Time Functions Descriptions
LOG
Returns the natural logarithm of an expression that represents a numerical value.
If ex = a then LOG(a) = x. The LOG function is defined only for positive values of a (that is, a > 0). It's
undefined for all other values.
Format
LOG(x)
Argument
Example
The following function returns the natural logarithm of the expression (1+TIME), where TIME is the
current simulation time:
LOG(1+TIME)
Learn more about math functions.
Functions: A - M 579
Run-Time Functions Descriptions
LOG10
Returns log to base 10 of an expression that represents a numerical value.
If 10x = a, then LOG10(a) = x. The LOG10 function is defined only for positive values of a (that is, a > 0).
It is undefined for all other values.
Format
LOG10(x)
Argument
Example
The following function returns the base 10 logarithm of the expression:
LOG10(1+VM(marker_21, marker_31))
Learn more about math functions.
580 Adams View Function Builder
Run-Time Functions Descriptions
MIN
Returns the minimum of two expressions that represent numerical values:
MIN(x1,x2) = x1 if x1 < x2MIN(x1,x2) = x2 if x2 < x1
Note: The MIN function is generally discontinuous. Use this function expression with care when
specifying force or motion input.
Format
MIN(x1,x2)
Arguments
Example
The following function is designed to always return a negative or zero value:
MIN(0, (25D-AZ(marker_2, marker_1)))
Learn more about math functions.
Functions: A - M 581
Run-Time Functions Descriptions
MAX
Returns the maximum of two expressions that represent numerical values:
MAX(x1,x2) = x1 if x1 > x2MAX(x1,x2) = x2 if x2 > x1
Note: MAX is generally discontinuous. Use this function expression with care when specifying force
or motion input.
Format
MAX(x1,x2)
Arguments
Example
The following function is designed to always return a non-negative value:
MAX(0, (25D-AZ(marker_2, marker_1)))
Learn more about math functions.
582 Adams View Function Builder
Run-Time Functions Descriptions
MOD
Returns the remainder when one expression representing a numerical value is divided by another expression
that represents a numerical value:
MOD(a1, a2) = a1 - INT(a1/a2) * a2
Note: MOD is generally discontinuous. Use this function expression with care when specifying force
or motion input.
Format
MOD(x1,x2)
Arguments
Examples
The following examples illustrate the use of the MOD function:
MODE
Returns an integer value indicating the current analysis mode.
The following are possible integer values and their corresponding analysis modes:
1 = Kinematics
2 = Reserved
3 = Initial conditions
4 = Dynamics
5 = Statics
6 = Quasi-statics
7 = Linear analysis
Format
MODE
Argument
None
Example
The following example combines the MODE function with the IF function to define a value applied only
during statics, quasi-static and linear analysis modes. For these analysis modes, we use the value of -50. For
all other analyses modes, we use the value 0.
IF(MODE-4: 0, 0, -50)
Learn more about constants and variables.
584 Adams View Function Builder
Run-Time Functions Descriptions
Format
MOTION (Motion Name, On This Body, Force Component, Along/About Axes)
Arguments
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional)
To have your results measured in the global coordinate system, do one of the
following:
If you're entering your function through the Assist dialog box, leave the
Along/About Axes text box empty.
If you're entering your function directly in the function text box, enter a 0.
Functions: A - M 585
Run-Time Functions Descriptions
Example
The following function returns the z component of the torque vector acting on the second body (at the J
marker) affected by .model_1.motion_1, measured about the z-axis of .model_1.ground.marker_11:
MOTION(.model_1.motion_1, 1, 8, .model_1.ground.marker_11)
Learn more about force in object functions.
586 Adams View Function Builder
Run-Time Functions Descriptions
Functions: N - Z
Functions: N - Z 587
Run-Time Functions Descriptions
Note: NFORCE can only be used for output purposes. Therefore, it can be used only with output
request and sensor objects.
Format
NFORCE (Multipoint Force Name, At This Marker, Force Component, Along/About Axes)
Arguments
Multipoint Force Name (Required) Multipoint force for which the force is measured.
At This Marker (Required) Marker on which the force is measured.
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional) Coordinate system marker in which the results are measured.
Example
The following function returns the y component of the force vector acting on the second body (at the J
marker) of .model_3.nforce_41, measured along the y-axis of .model_3.part_5.marker_3:
NFORCE(.model_3.nfo_5, 1, 3, .model_3.part_5.marker_3)
Learn more about force in object functions.
Functions: N - Z 589
Run-Time Functions Descriptions
Format
IMPACT (Displacement Variable, Velocity Variable, Trigger for Displacement Variable, Stiffness Coefficient,
Stiffness Force Exponent, Damping Coefficient, Damping Ramp-up Distance)
Arguments
Displacement Variable A measure of the distance between colliding bodies; defined by a run-time
displacement function.
Velocity Variable A measure of the time derivative of the distance between colliding bodies;
defined by a run-time velocity function.
Trigger for Displacement Independent variable value at which to turn the one-sided impact on and
Variable off; defined by a real number, a run-time function, a design-time function,
a design variable or an expression.
Stiffness Coefficient or K Stiffness coefficient for spring force; defined by a real number, a run-time
function, a design-time function, a design variable or an expression.
Stiffness Force Exponent Exponent for nonlinear spring force; defined by a real number, a run-time
function, a design-time function, a design variable or an expression.
Damping Coefficient or C Damping coefficient for damper force; defined by a real number, a run-time
function, a design-time function, a design variable or an expression.
Damping Ramp-up Distance over which to gradually turn on damping once impact is triggered;
Distance defined by a real number, a run-time function, a design-time function, a
design variable or an expression.
Equation
The IMPACT function turns a force on and off depending on the value of the independent variable, as
follows:
Off if q > q o
F IMPACT =
On if q ≤ q o
Mathematically, IMPACT is calculated as follows:
Examples
You can use the IMPACT function to create a user-defined collision force (such as a single-component force),
for example, when a sphere hits a flat surface:
Sphere Hitting Flat Surface
Note: Assume that the flat surface being contacted by the sphere is an infinite plane.
PI
Returns the ratio of the circumference of a circle to its diameter ( π ).
Format
PI
Argument
None
Example
The following example illustrates the use of the PI function:
2*PI*50
Learn more about constants and variables.
Functions: N - Z 593
Run-Time Functions Descriptions
Format
PINVAL (Plant Input Name, Element Number)
Arguments
Example
model_1.PIN corresponds to a definition of a plant input list. This plant input list contains three input
variables, defined as follows:
(model_1.VAR_1, model_1.VAR_2, model_1.VAR_3)
where:
model_1.VAR_1 = "sin(TIME)"
model_1.VAR_2 = "2"
model_1.VAR_3 = "5"
Then PINVAL(model_1.PIN, 3) is equal to 5 at all times in the simulation.
Learn more about data element access.
594 Adams View Function Builder
Run-Time Functions Descriptions
Format
POUVAL(Plant Output Name, Element Number)
Arguments
Examples
model_1.POU corresponds to a definition of a plant output list. This plant output list contains three input
variables, defined as follows:
(model_1.VAR_1, model_1.VAR_2, model_1.VAR_3)
where:
model_1.VAR_1 = "sin(2*PI*TIME)"
model_1.VAR_2 = "2"
model_1.VAR_3 = "5"
At any time in the simulation,
Function POUVAL(model_1.POU,1)
Result sin(2*PI*TIME)
Function POUVAL(model_1.PIN,1)
Result -1
Note: PTCV can only be used for output purposes. Therefore, it can be used only with output
request and sensor objects.
Format
PTCV (Point-to-Curve Name, On This Body, Component, Along/About Axes)
Arguments
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional) Coordinate system marker in which the results are measured.
To have your results measured in the global coordinate system, do one of the
following:
If you're entering your function through the Assist dialog box, leave the
Along/About Axes text box empty.
If you're entering your function directly in the function text box, enter a 0.
596 Adams View Function Builder
Run-Time Functions Descriptions
Example
The following function returns the x component of the force vector acting on the first body (at the I marker)
of .model_1.ptcv_31, measured along the x-axis of the global coordinate system:
PTCV(.model_1.ptcv_31, 0, 2, 0)
Learn more about force in object functions.
Functions: N - Z 597
Run-Time Functions Descriptions
Format
POLYFIT (x, y, order)
Arguments
x Array of x values.
y Array of y values.
order Maximum order of the polynomical. The coefficients are returned in increasing order (from
zeroth order to this value).
Examples
The following commands produce the array result.
var cre var=xx rea=(series2(0, 20, 20))
var cre var=yy rea=(1.0 + 1.2*xx + 2.5*xx**2 + 2.0*xx**3)
var cre var=pp rea=(polyfit(xx, yy, 5))
Array result:
[1.0, 1.2, 2.5, 2.0, 0.0, 0.0]
The coefficients are ordered from the zeroth order to the nth order, from left to right.
Learn more about math functions.
598 Adams View Function Builder
Run-Time Functions Descriptions
Polynomial (POLY)
Evaluates a standard polynomial at a user-specified value x.
Format
POLY (x, Shift, Coefficients)
Arguments
Examples
The following function defines a quadratic polynomial function with respect to the system variable TIME:
Function POLY(TIME, 0, 0, 0, 1)
Expanded function POLY = TIME2
The following function defines a linear function with respect to the system variable TIME:
The following function defines a cubic polynomial function with respect to the system variable TIME:
RTOD
Returns the radians-to-degree units conversion factor (180/ π ), same as (180/PI).
Format
RTOD
Argument
None
Example
The following example returns the roll angle, in degrees, to marker_2 from marker_4:
RTOD*ROLL(marker_2, marker_4)
Learn more about constants and variables.
600 Adams View Function Builder
Run-Time Functions Descriptions
SIGN
Transfers the sign of one expression representing a numerical value to the magnitude of another expression
representing a numerical value:
SIGN(a1, a2) = ABS(a1) if a2 > 0
SIGN(a1, a2) = -ABS(a1) if a2 < 0
Note: SIGN is discontinuous. Use this function with care to avoid creating expressions that are
discontinuous.
Format
SIGN (x1,x2)
Arguments
Example
In the following function,
When VZ(marker_2, marker_3) > 0, the value is ABS(TIME). When
VZ(marker_2, marker_3)< 0, the value is -
ABS(TIME). SIGN(TIME,VZ(marker_2, marker_3))
Learn more about math functions.
Functions: N - Z 601
Run-Time Functions Descriptions
Format
SHF (x, Shift, Amplitude, Frequency, Phase Shift, Average Value of Displacement)
Arguments
Equation
Mathematically, SHF is defined as follows:
SHF = a*SIN( ω *(x-x0)-phi)+b
where:
x = Independent variable
x0 = Shift
ω = Frequency
phi = Phase Shift
a = Amplitude
b = Average Value of Displacement
Example
The following example illustrates the use of the SHF function:
SHF(TIME, 25D, PI, 360D, 0, 5)
The following function defines the harmonic function:
SHF = 5+PI*SIN(360D*(TIME-25D))
In the function:
602 Adams View Function Builder
Run-Time Functions Descriptions
x = TIME
x0 = 25 degrees
ω = 1 cycle (360D)
phi = 0
a = PI
b=5
Learn more about math functions.
Functions: N - Z 603
Run-Time Functions Descriptions
SIN
Returns the sine of an expression that represents a numerical value.
Format
SIN(x)
Argument
Example
The following example returns the sine of 10*TIME, where TIME is the current simulation time:
SIN(10*TIME)
Learn more about math functions.
604 Adams View Function Builder
Run-Time Functions Descriptions
Format
SFORCE (Single-component Force, On This Body, Force Component, Along/About Axes)
Arguments
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional)Coordinate system marker in which the results are measured.
To have your results measured in the global coordinate system, do one of the
following:
If you're entering your function through the Assist dialog box, leave the
Along/About Axes text box empty.
If you're entering your function directly in the function text box, enter a
0.
Functions: N - Z 605
Run-Time Functions Descriptions
Example
The following function returns the y component of the torque vector acting on the first body (at the I marker)
of .model_1.force_1, measured along the y-axis of the global coordinate system:
SFORCE(.model_1.force_1, 0, 7, 0)
Learn more about force in object functions.
606 Adams View Function Builder
Run-Time Functions Descriptions
SINH
Returns the hyperbolic sine of an expression that represents a numerical value:
SINH(x) = (ex-e-x)/2.0
Format
SINH(x)
Argument
Example
The following example returns the hyperbolic sine of the x component of the displacement of marker_21
with respect to marker_32:
SINH(DX(marker_21, marker_32))
Learn more about math functions.
Functions: N - Z 607
Run-Time Functions Descriptions
Format
GFORCE (Six-component Force/Torque, On This Body, Force Component, Along/About Axes)
Arguments
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional) Coordinate system marker in which the results are
measured.
The magnitude and units calculated for the six force (Fx, Fy, Fz) and torque (Tx, Ty, Tz) components will
depend upon the expressions or subroutines you supply. These expressions are generally written in terms of
runtime functions displacements, velocities and rotation (velocity) angles by the use of functions like Distance
Along X (DX), Angle About X (AX), Velocity Along X (VX), Angular Velocity About X (WX), and so on.
Example
The following function returns the z component of the force vector acting on the first body (at the I marker)
of .model_3.gforce_31, measured along the z-axis of marker_23:
GFORCE(.model_3.gforce_31, 0, 4, marker_23)
Learn more about force in object functions.
Functions: N - Z 609
Run-Time Functions Descriptions
Format
SPDP (Spring-Damper Force Name, On This Body, Force Component, Along/About Axes)
Arguments
Spring-Damper Force (Required) Spring-damper force for which the force is measured.
Name
On This Body (Required) Body on which the force is measured.
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional) Coordinate system marker in which the results are measured.
To have your results measured in the global coordinate system, do one of the
following:
If you're entering your function through the Assist dialog box, leave
the Along/About Axes text box empty.
If you're entering your function directly in the function text box,
enter a 0.
610 Adams View Function Builder
Run-Time Functions Descriptions
Example
The following function returns the z component of the force vector acting on the first body (at the I marker)
of .model_1.spring_31, measured along the z-axis of the global coordinate system:
SPDP(.model_1.spring_15, 0, 4, 0)
Learn more about force in object functions.
Functions: N - Z 611
Run-Time Functions Descriptions
SQRT
Returns the square root of an expression that represents a numerical value. The square root function is defined
only for non-negative values of x.
Format
SQRT(x)
Argument
Example
The following function returns the square root of the expression TIME:
Function SQRT(TIME*TIME)
Result TIME
STEP
Approximates the Heaviside step function with a cubic polynomial.
Notes: STEP has continuous first derivatives, but its second derivatives are discontinuous at x=x0 and
x=x1. Haversine Step (HAVSIN), STEP5, and TANH offer other approximations for the Heaviside step
function. These have a higher degree of continuity and differentiability, but can have larger
derivatives.
See Haversine Step (HAVSIN) for a plot comparing STEP, STEP5, TANH, and Haversine Step (HAVSIN).
Format
STEP (x, Begin At, Initial Function Value, End At, Final Function Value)
Arguments
x Independent variable.
Begin At or x0 Value of independent variable at which the STEP function begins;
defined by a real number, an expression or a design variable.
Initial Function Value or h0 Initial value of the step; defined by a real number, an expression, a design
variable or a run-time function.
End At or x1 Value of independent variable at which the STEP function ends; defined
by a real number, an expression or a design variable.
Final Function Value or h1 Final value of the step; defined by a real number, an expression, a design
variable or a run-time function.
Extended Definition
The STEP function approximates the Heaviside step function with a cubic polynomial. The following figure
illustrates the STEP function.
Functions: N - Z 613
Run-Time Functions Descriptions
a = h1 – h2
Δ = ( x – xo ) ⁄ ( x1 – xo )
ho : x ≤ xo
STEP = h o – a ⋅ Δ 2 ( 3 – 2Δ ) : xo < x < x 1
h1 : x ≥ x1
Example
Using a cubic polynomial, the following function defines a smooth step function from 3 to 4, with a
displacement from 0 to 1:
STEP((2, 3, 3.5, 4, 5), 3, 0, 4, 1)
This example produces the following results:
0.0, 0.0, 0.5, 1.0, 1.0
Learn more about math functions.
614 Adams View Function Builder
Run-Time Functions Descriptions
STEP5
Provides approximations to the Heaviside step function with a quintic polynomial.
Notes: STEP5 has continuous first and second derivatives, but its third derivative is discontinuous at
x=x0 and x=x1.
See Haversine Step (HAVSIN) for a plot comparing STEP, STEP5, TANH, and Haversine Step
(HAVSIN).
Format
STEP5 (x, Begin At, Initial Function Value, End At, Final Function Value)
Arguments
x Independent variable.
Begin At or x0 Real variable that specifies the x value at which the STEP5 function
begins.
Initial Function Value or h0 Initial value of the step.
End At or x1 Real variable that specifies the x value at which the STEP5 function ends.
Final Function Value or h1 Final value of the step.
Example
Using a quintic polynomial, the following function defines a smooth step function from time 1 to time 2
with a displacement from 0 to 1:
STEP5(TIME, 1, 0, 2, 1)
Learn more about math functions.
Functions: N - Z 615
Run-Time Functions Descriptions
Format
FX (Applied To Marker, Applied From Marker, Along Marker)
Arguments
Applied To Marker (Required) Measure of the sume of all forces applied to this coordinate system
marker.
Applied From Marker (Optional) Measure the sum of all forces applied from this coordinate system
marker. If you don't specify this argument, it returns the x component of all the
action-only single-component forces acting at the Applied To Marker.
Along Marker (Optional) Measure the sum of all forces in the x direction of this coordinate
system marker. If you don't specify this argument, it defaults to the global
origin.
Equation
Mathematically, FX is calculated as follows:
FX = FT, F • x̂A
where:
FT, F is the sum of all applied and constraint forces involving both the Applied To Marker, T,
and the Applied From Marker, F.
Example
The following function returns the x component of the sum of all forces acting at marker_T. All forces acting
between marker_T and marker_F are included in this calculation.
Format
FY (Applied To Marker, Applied From Marker, Along Marker)
Arguments
Applied To Marker (Required) Measure the sum of all forces applied to this coordinate system
marker.
Applied From Marker (Optional) Measure the sum of all forces applied from this coordinate system
marker. If you don't specify this argument, it returns the y component of all
the action-only single-component forces acting at the Applied To Marker.
Along Marker (Optional) Measure the sum of all forces in the y direction of this coordinate
system marker. If you don't specify this argument, it defaults to the global
origin.
Equation
Mathematically, FY is calculated as follows:
FY = FT, F • ŷA
where:
FT, F is the sum of all applied and constraint forces involving both the Applied To Marker, T,
and the Applied From Marker, F.
Example
The following function returns the y component of the sum of all forces acting at marker_T. All forces acting
between marker_T and marker_F are included in this calculation.
Format
FZ (Applied To Marker, Applied From Marker, Along Marker)
Arguments
Applied To Marker (Required) Measure the sum of all forces applied to this coordinate system
marker.
Applied From Marker (Optional) Measure the sum of all forces applied from this coordinate system
marker. If you don't specify this argument, it returns the z component of all
the action-only single-component forces acting at the Applied To Marker.
Along Marker (Optional) Measure the sum of all forces in the z direction of this coordinate
system marker. If you don't specify this argument, it defaults to the global
origin.
Equation
Mathematically, FZ is calculated as follows:
FZ = FT, F • ẑA
where:
F T, F is the sum of all applied and constraint forces involving both the Applied To Marker,
T, and the Applied From Marker, F.
Example
The following function returns the z component of the sum of all forces acting at marker_T. All forces acting
between marker_T and marker_F are included in this calculation.
Format
FM (Applied To Marker, Applied From Marker)
Arguments
Applied To Marker (Required) Measure the sum of all forces applied to this coordinate system
marker.
Applied From Marker (Optional) Measure the sum of all forces applied from this coordinate system
marker. If you don’t specify this argument, it returns the magnitude of the
net translational force at the Applied To Marker due to action-only single-
component forces acting at the Applied To Marker.
Equation
Mathematically, FM is calculated as follows:
FM = FT, F • FT, F
where:
FT, F is the sum of all applied and constraint forces involving both the Applied To Marker,
Example
The following function returns the magnitude of the sum of all forces acting at marker_T. All forces acting
between marker_T and marker_F are included in this calculation:
Format
TX (Applied To Marker, Applied From Marker, About Marker)
Arguments
Applied To Marker (Required) Measure the sum of all torques applied to this coordinate system
marker.
Applied From Marker (Optional) Measure the sum of all torques applied from this coordinate
system marker. If you don't specify this argument, it returns the x
component of all the action-only single-component torques acting at the
Applied To Marker.
About Marker (Optional) Measure the sum of all torques about the x-axis of this
coordinate system marker. If you don't specify this argument, it defaults to
the global coordinate system.
Equation
Mathematically, TX is calculated as follows:
TX = TT, F • x̂A
where:
T T, F is the sum of all applied and constraint torques involving both the Applied To
Marker, T, and the Applied From Marker, F.
Example
The following function returns the x component of the sum of all torques acting at marker_T. All torques
acting between marker_T and marker_F are included in this calculation.
Format
TY (Applied To Marker, Applied From Marker, About Marker)
Arguments
Applied To Marker (Required) Measure the sum of all torques applied to this coordinate system
marker.
Applied From Marker (Optional) Measure the sum of all torques applied from this coordinate system
marker. If you don't specify this argument, it returns the x component of all
the action-only single-component torques acting at the Applied To Marker.
About Marker (Optional) Measure the sum of all torques about the y-axis of this coordinate
system marker. If you don't specify this argument, it defaults to the global
coordinate system.
Equation
Mathematically, TY is calculated as follows:
TY = TT, F • ŷA
where:
T T, F is the sum of all applied and constraint torques involving both the Applied To
Examples
The following function returns the y component of the sum of all torques acting at marker_T. All torques
acting between marker_T and marker_F are included in this calculation.
Format
TZ (Applied To Marker, Applied From Marker, About Marker)
Arguments
Applied To Marker (Required) Measure the sum of all torques applied to this coordinate
system marker.
Applied From Marker (Optional) Measure the sum of all torques applied from this coordinate
system marker. If you don't specify this argument, it returns the x
component of all the action-only single-component torques acting at the
Applied To Marker.
About Marker (Optional) Measure the sum of all torques about the z-axis of this
coordinate system marker. If you don't specify this argument, it defaults to
the global coordinate system.
Equation
Mathematically, TZ is calculated as follows:
TZ = TT, F • ẑA
where:
TT, F • x̂A is the sum of all applied and constraint torques involving both the Applied To
Example
The following function returns the z component of the sum of all torques acting at marker_T. All torques
acting between marker_T and marker_F are included in this calculation.
Format
TM (Applied To Marker, Applied From Marker)
Arguments
Applied To Marker (Required) Measure the sum of all torques applied to this coordinate system
marker.
Applied From Marker (Optional) Measure the sum of all torques applied from this coordinate system
marker. If you don't specify this argument, it returns the magnitude of the sum
of all torques at the Applied To Marker due to action-only torque acting at the
Applied To Marker.
Equation
Mathematically, TM is calculated as follows:
TM = TT, F • TT, F
where:
TT, F • x̂A is the sum of all applied and constraint torques involving both the Applied To Marker, T,
and the Applied From Marker, F.
Example
The following function returns the magnitude of the sum of all torques acting at marker_T. All torques acting
between marker_T and marker_F are included in this calculation.
SWEEP
Returns a constant amplitude sinusoidal function with linearly increasing frequency.
Format
SWEEP (Independent Variable, Amplitude, Start Value, Start Frequency, End Value, End Frequency, Delta
X)
For example:
SWEEP (x, a, x0, f0, x1, f1, dx)
Arguments
Equation
Mathematically, SWEEP is calculated as follows:
632 Adams View Function Builder
Run-Time Functions Descriptions
Example
The following function defines a sinusoidal function with a frequency increasing from 2 to 6Hz within the
time interval 0 to 5:
SWEEP(TIME, 1.0, 0.0, 2.0, 5.0, 6.0, 0.01)
Functions: N - Z 633
Run-Time Functions Descriptions
TAN
Returns the tangent of an expression that represents a numerical value.
Format
TAN(x)
Argument
Example
The following function returns the tangent of 10*TIME, where TIME is the current simulation time:
TAN(10*TIME)
Learn more about math functions.
Functions: N - Z 635
Run-Time Functions Descriptions
TANH
Returns the hyperbolic tangent of an expression that represents a numerical value:
TANH(x) = (ex-e-x)/(xa+exa)
Note: See Haversine Step (HAVSIN) for a plot comparing STEP, STEP5, TANH, and Haversine Step
(HAVSIN).
Format
TANH(x)
Argument
Example
Using a hyperbolic tangent, the following function defines a smooth step function that transitions from a
value of 0 to 1:
TANH(5*(TIME-1.5))
Learn more about math functions.
636 Adams View Function Builder
Run-Time Functions Descriptions
Format
VFORCE (Three-component Force, On This Body, Force Component, Along Axes)
Arguments
Three-component Force (Required) Three-component force for which the force is measured.
On This Body (Required) Body on which the force is measured.
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
Along/About Axes (Optional) Coordinate system marker in which the results are measured.
To have your results measured in the global coordinate system, do one of the
following:
If you're entering your function through the Assist dialog box, leave
the Along/About Axes text box empty.
If you're entering your function directly in the function text box,
enter a 0.
Functions: N - Z 637
Run-Time Functions Descriptions
Examples
The following function returns the x component of the force vector acting on the second body (at the J
marker) due to the three-component force named .model_1.vforce_31, measured along the x-axis of the
global coordinate system:
VFORCE(.model_1.vforce_31, 1, 2, 0)
The following function returns the z component of the force vector acting on the first body (at the I marker)
due to the three-component force named .contact_force, measured along the z-axis of marker_6:
VFORCE(contact_force, 0, 4, marker_6)
Learn more about force in object functions.
638 Adams View Function Builder
Run-Time Functions Descriptions
Format
VTORQ (Three-component Torque, On This Body, Component, About Axes)
Arguments
Three-component Torque (Required) Three-component torque for which the force is measured.
On This Body (Required) Body on which the force is measured.
Fm = 1 = force magnitude
Fx = 2 = x component of the force
Fy = 3 = y component of the force
Fz = 4 = z component of the force
Tm = 5 = torque magnitude
Tx = 6 = x component of the torque
Ty = 7 = y component of the torque
Tz = 8 = z component of the torque
About Axes (Optional) Coordinate system marker in which the results are
measured.
Example
The following function returns the x component of the torque vector acting on the second body (at the J
marker) of .model_1.vtorque_31, measured along the x-axis of marker_2:
VTORQ(.model_1.vtorque_1, 1, 6, marker_2)
Learn more about force in object functions.
640 Adams View Function Builder
Run-Time Functions Descriptions
TIME
Returns the current simulation time.
Format
TIME
Argument
None
Example
The following example and illustration represent a linearly-increasing function of simulation time with a
slope of 2:
2*TIME
Format
DXYZ(i[,j][,k])
Arguments
Extended Definition
where:
Examples
The following statement:
VARIABLE/1, FUNCTION=MAG(DXYZ(21,11,32))
is equivalent to:
VARIABLE/1, FUNCTION=DM(21,11)
and because a magnitude is taken, the use of the coordinate system of marker 32 as an alternative to the
ground coordinate system is redundant (and wasteful).
Functions: N - Z 643
Run-Time Functions Descriptions
Format
FXYZ(i[,j][,k])
Arguments
Applied To Marker (i) An integer that specifies the identifier of the marker at which the
magnitude of the net force is to be calculated.
Applied From Marker (j) A second integer that specifies a marker identifier. All forces acting
between the [i,j] pair are to be included in the calculation. Set j = 0 or do
not specify if you are interested in all forces acting on marker i.
Along Marker (k) An integer that specifies the identifier of a marker (coordinate system) in
which the x-component of the force is to be returned. k defaults to the
global coordinate system when it is not specified.
Extended Definition
Mathematically, FXYZ is calculated as:
FX
FXYZ ( i, j, k ) = FY
FZ
where:
FX is the Sum of Forces Along X (FX) measure.
FY is the Sum of Forces Along Y (FY) measure.
FZ is the Sum of Forces Along Z (FZ) measure.
Examples
Magnitude of torque at marker 5 due to all forces applied at marker 4.
VARIABLE/1, FUN=MAG(DXYZ(4,5)%FXYZ(4))
644 Adams View Function Builder
Run-Time Functions Descriptions
Format
TXYZ(i[,j][,k])
Arguments
Applied To Marker (i) An integer that specifies the identifier of the marker at which the magnitude
of the net torque is to be calculated.
Applied From Marker (j) A second integer that specifies a marker identifier. All forces acting between
the [i,j] pair are to be included in the calculation. Set j = 0 or do not specify if
you are interested in all forces acting on marker i.
Along Marker (k) An integer that specifies the identifier of a marker (coordinate system) in
which the x-component of the torque is to be returned. k defaults to the global
coordinate system when it is not specified.
Extended Definition
Mathematically, TXYZ is calculated as:
TX
TXYZ ( i, j, k ) = TY
TZ
where:
TX is the Sum of Torques About X (TX) measure.
TY is the Sum of Torques About Y (TY) measure.
TZ is the Sum of Torques About Z (TZ) measure.
Examples
The total torque on marker 5, resolved on the x-axis of marker 4.
VARIABLE/1, FUN=TXYZ(5)*UVX(4)
which is alternatively available as TX(5,0,4).
Functions: N - Z 645
Run-Time Functions Descriptions
Format
BISTOP (Displacement Variable, Velocity Variable, Low Trigger for Displacement Variable, High Trigger for
Displacement Variable, Stiffness Coefficient, Stiffness Force Exponent, Damping Coefficient, Damping
Ramp-up Distance)
Arguments
Displacement Variable A measure of the distance between colliding bodies; defined by a run-time
displacement function.
Velocity Variable A measure of the time derivative of the distance between colliding bodies;
defined by a run-time velocity function.
Low Trigger for Lower value for independent variable at which to trigger the first side of
Displacement Value two-sided impact.
High Trigger for Higher value for independent variable at which to trigger the second side
Displacement Value of two-sided impact.
Stiffness Coefficient or K Stiffness coefficient for spring force; defined by a real number, a run-time
function, a design-time function, a design variable or an expression.
Stiffness Force Exponent Exponent for nonlinear spring force; defined by a real number, a run-time
function, a design-time function, a design variable or an expression.
Damping Coefficient or C Damping coefficient for damper force; defined by a real number, a run-
time function, a design-time function, a design variable or an expression.
Damping Ramp-up Distance Distance over which to gradually turn on damping once impact is
triggered; defined by a real number, a run-time function, a design-time
function, a design variable or an expression.
Equation
The BISTOP function turns a force on and off depending on the value of the independent variable q, as
follows:
On if q < q o
F BISTOP =
Off if q 1 ≤ q ≤ q 2
Mathematically, BISTOP is calculated as follows:
646 Adams View Function Builder
Run-Time Functions Descriptions
e ·
K ( q 1 – q ) – Cq ⋅ STEP ( q, q 1 – d, 1, q 1, 0 ) if q < q 1
F BISTOP = 0 if q 1 ≤ q ≤ q 2
K ( q – q 2 ) e – Cq· ⋅ STEP ( q, q 2, 0, q 2 + d, 1 ) if q 2 < q
Example
You can use the BISTOP function for the system shown in the figure below:
BISTOP(DX(marker_1, marker_2, marker_2),VX(marker_1, marker_2,
marker_2, marker_2),5.2, 22.4, 100, 1.2, 2.5, 0.005)where 22.4
was derived from 5.2 + 28.7 - 11.5.
BISTOP Example
Format
UVX(i[,k])
Arguments
Applied To Marker (i) The marker whose x-axis unit vector is being measured.
Reference Frame (k) The marker in whose coordinate system the unit vector is being expressed. If
k is not specified, k defaults to the global coordinate system.
Extended Definition
Mathematically, UVX is calculated as:
where:
Examples
VARIABLE/1, FUN=DXYZ(i,j)*UVX(k)
VARIABLE/2, FUN=DX(i,j,k)
648 Adams View Function Builder
Run-Time Functions Descriptions
Variables 1 and 2 are synonymous. They both produce the translational displacement between markers i and
j along the direction of the x-axis of marker k.
Functions: N - Z 649
Run-Time Functions Descriptions
Format
UVY(i[,k])
Arguments
Applied To Marker (i) The marker whose y-axis unit vector is being measured.
Reference Frame (k) The marker in whose coordinate system the unit vector is being expressed. If
k is not specified, k defaults to the global coordinate system.
Extended Definition
Mathematically, UVY is calculated as:
where:
Examples
VARIABLE/1, FUN=DXYZ(i,j)*UVX(k)
VARIABLE/2, FUN=DX(i,j,k)
Variables 1 and 2 are synonymous. They both produce the translational displacement between markers i and
j along the direction of the x-axis of marker k.
650 Adams View Function Builder
Run-Time Functions Descriptions
Format
UVZ(i[,k])
Arguments
Applied To Marker (i) The marker whose z-axis unit vector is being measured.
Reference Frame (k) The marker in whose coordinate system the unit vector is being expressed. If
k is not specified, k defaults to the global coordinate system.
Extended Definition
Mathematically, UVZ is calculated as:
where:
Examples
VARIABLE/1, FUN=DXYZ(i,j)*UVZ(k)
VARIABLE/2, FUN=DZ(i,j,k)
Variables 1 and 2 are synonymous. They both produce the translational displacement between markers i and
j along the direction of the z-axis of marker k.
Functions: N - Z 651
Run-Time Functions Descriptions
Format
UV(exp)
Arguments
Extended Definition
Mathematically, UV is calculated as:
Note that Adams Solver (C++) attempts to handle the singular case when the vector function expression is
the zero vector. For instance, the expression UV(DXYZ(i,j)) is problematic if markers i and j become
coincident. In this case, Adams Solver (C++) will reuse the last valid direction of the unit vector. It is
recommended that you avoid computing the unit vector in the direction of expressions that start with a zero
value or are persistently zero (such as velocity measurements during a static equilibrium analysis).
Examples
VARIABLE/1, FUN=VXYZ(i,j)*UV(DXYZ(i,j))
VARIABLE/2, FUN=VR(i,j)
Variables 1 and 2 are synonymous. They both compute the separation velocity of markers i and j: the
projection of the relative velocity vector on a unit vector in the direction of the position vector between the
markers.
652 Adams View Function Builder
Run-Time Functions Descriptions
USER
Passes one or more values that are used as parameters in a user-written subroutine.
For information on subroutines, see the online help for Adams Solver Subroutines.
Format
USER(Parameters)
Argument
Parameters Real values that define the parameters for use by the user-written subroutine. Up to
thirty parameters may be defined.
Example
To model a simple spring damper in a SFORCE subroutine, you need information about the i and j marker,
stiffness and damping, as well as the free length. Assume the following:
i marker id = 1
j marker id = 2
stiffness (k) = 1e5N/mm
damping coefficient (c) = 10ns/mm
free length (FL) = 1e3mm
Given the above information, the USER function is:
USER (1, 2, 1e5, 10, 1e3)
Learn more about user-written subroutine invocation.
Functions: N - Z 653
Run-Time Functions Descriptions
Format
TRANS(exp,i[,j])
Arguments
Examples
VFORCE/1, I=1, JFLOAT=2, RM=3, FXYZ=VXYZ(i,j,k)
VFORCE/2, I=1, JFLOAT=2, RM=3, FXYZ=TRANS(VXYZ(i,j),k)
VFORCE/3, I=1, JFLOAT=2, RM=3, FXYZ=TRANS(VXYZ(i,j,l),k,l)
Variables 1, 2 and 3 are synonymous. They all specify a vector force law that is equal to the velocity vector of
marker i with respect to marker j, represented in the coordinate system of marker k.
654 Adams View Function Builder
Run-Time Functions Descriptions
Format
VR (To Marker, From Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose velocity is being measured.
From Marker (Optional) The coordinate system marker whose velocity is subtracted off. If you
don't specify this argument, it defaults to the global origin.
Reference Frame (Optional) The coordinate system marker in which the time-derivatives are
calculated. If you don't specify this argument, it defaults to the ground reference
frame.
Equation
Mathematically, VR is calculated as follows:
(R) d (R) d
RT – R • [ RT – RF ]
dt dt F
VR = -----------------------------------------------------------------------------
DM ( T, F )
where:
R F [ is the position vector from the global origin to the From Marker, F.
(R) d
R F is the time-derivative of R F with respect to the Reference Frame, R.
dt
DM(T,F) is the distance between the To Marker, T, and the From Marker, F.
Example
The following function returns the radial (relative) velocity of the velocity vector between marker_T and
marker_F. The vector time-derivative is taken in the reference frame of marker_R.
Functions: N - Z 655
Run-Time Functions Descriptions
Format
VX (To Marker, From Marker, Along Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose velocity is being measured.
From Marker (Optional) The coordinate system marker whose velocity is subtracted off. If you
don't specify this argument, it defaults to the global origin.
Along Marker (Optional) The coordinate system marker along whose x-axis the velocity is
measured. If you don't specify this argument, it defaults to the global x-axis.
Reference Frame (Optional) The coordinate system marker in which the time derivatives are
calculated. If you don't specify this argument, it defaults to the ground reference
frame.
Equation
Mathematically, VX is calculated as follows:
(R) d (R) d
VX = RT – R F • x̂ A
dt dt
where:
R F is the position vector from the global origin to the From Marker, F.
(R) d
R F is the time-derivative of R F with respect to the Reference Frame, R.
dt
x̂ A is the unit vector along the x-axis of the Along Marker, A.
Example
The following function returns the x component of the velocity vector between marker_T and marker_F. The
vector is expressed in the coordinate system of marker_A. All time-derivatives are calculated in the reference
frame of marker_R.
Functions: N - Z 657
Run-Time Functions Descriptions
Format
VY (To Marker, From Marker, Along Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose velocity is being measured.
From Marker (Optional) The coordinate system marker whose velocity is subtracted off. If you
don't specify this argument, it defaults to the global origin.
Along Marker (Optional) The coordinate system marker along whose y-axis the velocity is
measured. If you don't specify this argument, it defaults to the global y-axis.
Reference Frame (Optional) The coordinate system marker in which the time derivatives are
calculated. If you don't specify this argument, it defaults to the ground reference
frame.
Equation
Mathematically, VY is calculated as follows:
(R) d (R) d
VY = RT – R F • ŷ A
dt dt
where:
R F is the position vector from the global origin to the From Marker, F.
(R) d
R F is the time-derivative of R F with respect to the Reference Frame, R.
dt
ŷ A is the unit vector along the y-axis of the Along Marker, A.
Example
The following function returns the y component of the velocity vector between marker_T and marker_F. The
vector is expressed in the coordinate system of marker_A. All time-derivatives are calculated in the reference
frame of marker_R.
Functions: N - Z 659
Run-Time Functions Descriptions
Format
VZ (To Marker, From Marker, Along Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose velocity is being measured.
From Marker (Optional) The coordinate system marker whose velocity is subtracted off. If you
don't specify this argument, it defaults to the global origin.
Along Marker (Optional) The coordinate system marker along whose z-axis the velocity is
measured. If you don't specify this argument, it defaults to the global z-axis.
Reference Frame (Optional) The coordinate system marker in which the time derivatives are
calculated. If you don't specify this argument, it defaults to the ground reference
frame.
Equation
Mathematically, VZ is calculated as follows:
(R) d (R) d
VZ = RT – R F • ẑ A
dt dt
where:
R F is the position vector from the global origin to the From Marker, F.
(R) d
R F is the time-derivative of R F with respect to the Reference Frame, R.
dt
ẑ A is the unit vector along the z-axis of the Along Marker, A.
Example
The following function returns the z component of the velocity vector between marker_T and marker_F. The
vector is expressed in the coordinate system of marker_A. All time-derivatives are calculated in the reference
frame of marker_R.
Functions: N - Z 661
Run-Time Functions Descriptions
Format
VM (To Marker, From Marker, Reference Frame)
Arguments
To Marker (Required) The coordinate system marker whose velocity is being measured.
From Marker (Optional) The coordinate system marker whose velocity is subtracted off. If you
don't specify this argument, it defaults to the global origin.
Reference Frame (Optional) The coordinate system marker in which the time derivatives are
calculated. If you don't specify this argument, it defaults to the ground reference
frame.
Equation
Mathematically, VM is calculated as follows:
R F is the position vector from the global origin to the From Marker, F.
(R) d
R F is the time-derivative of R F with respect to the Reference Frame, R.
dt
Example
The following function returns the magnitude of the velocity vector between marker_T and marker_F. The
vector time-derivative is taken in the reference frame of marker_R.
VM(marker_T, marker_F, marker_R)
Learn more about velocity functions.
645
Adams Solver (C++)
Product-Specific Functions
When using a template-based or plugin product with Adams View, the Function Builder includes some
product-specific functions.
Q
QDDOT
QDOT
DELAY
AO
CPU
HSIZE
NJAC
NRHS
ORDER
UV
MAG
TRANS
ACCXYZ
DXYZ
FXYZ
TXYZ
UVX
UVY
UVZ
VXYZ
WXYZ
WDTXYZ
Adams Durability
When using Adams Durability, you can use its functions to interrogate a flexible or rigid body for useful
stress, strain, or life data. The user functions are:
HOT_SPOTS
LIFE
646 Adams View Function Builder
Template-Based Products
MAX_STRESS
TOP_SPOTS
These functions facilitate the definition of a design objective or variable that can be used in a design of
experiments (DOE) or optimization study. When Adams Durability is loaded, you can find these functions
in the Misc. Functions category of the Adams View Function Builder.
Template-Based Products
This topic lists utility functions that help you extend the Adams View macro language in template-based
products. The functions help you access information that is not easy to access using the standard Adams View
macro language. You can use the utility functions in macros and in dialog boxes.
Units-Conversion Functions
String Functions
Database Functions
File Functions
Database Lookup Functions
Miscellaneous Functions
649
Expression Example
Expression Example
The following example illustrates how you can parameterize the mass of one part in relation to the mass of
another, using the Adams View command language in the command window.
If you want to define the mass of a part (part_2) as twice the mass of another part (part_1), you could use the
following command:
part modify rigid_body mass_properties part_name=part_2 &
mass=(EVAL(part_1.mass*2))
Using the EVAL function, Adams View instantaneously computes the value for the expression and stores the
value in the database. It maintains no parametric relationship. If the mass of part_1 subsequently changes, it
doesn't affect the mass of part_2.
If you use the same command without the EVAL function, you get the same instantaneous effect as the
previous command. However, if the mass of part_1 changes, then Adams View automatically updates the
mass of part_2. Therefore, Adams View maintains the parametric relationship:
part modify rigid_body mass_properties part_name=part_2 &
mass=(part_1.mass * 2)>
Note that some parameters act as though you supplied the EVAL function, even if you did not.
You can find more examples of using expressions in Adams View in the directory: install_dir/aview/examples,
where install_dir is the directory in which you installed Adams.
Note: Adams View cannot plot the Simple Harmonic function in the Function Builder, because it
can't interpret it as a design-time function.
To parameterize a location:
1. Create three markers, MAR_1, MAR_2, and MAR_3, placed randomly.
2. Right-click the MAR_2 screen icon, and then select Modify.
The Marker Modify dialog box appears.
3. Clear the coordinate values from the Location text box.
652 Adams View Function Builder
Example - Parameterizing Values for Marker Locations
4. Right-click the Location text box, point to Parameterize, and then select Expression Builder.
The Function Builder appears in expression mode.
5. Clear the text from the function work area.
6. From the Location/Orientation function category, select LOC_ALONG_LINE.
7. Select Assist.
The LOC_ALONG_LINE dialog box appears.
8. From the box pop-up menus, use Browse to insert:
• MAR_1 in Object for Start Point text box.
• MAR_3 in Object for Point on Line text box.
9. In the Distance text box, enter 50.
10. Select OK in the following dialog boxes, in the order listed:
• The LOC_ALONG_LINE dialog box.
The function you just defined appears in the function work area of the Function Builder.
• The Function Builder.
The function appears in the Location text box.
• The Marker Modify dialog box.
MAR_2 is now 50 units from MAR_1. MAR_1 and MAR_2 are parameterized. As a result, if you
move one marker, the other marker moves along with it.