Download presentation
Presentation is loading. Please wait.
Published byBriana Snow Modified over 9 years ago
1
S2-1 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation SECTION 2 EXPRESSIONS: OVERVIEW
2
S2-2 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation
3
S2-3 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation EXPRESSIONS: OVERVIEW n What’s in this section: u Why Use Expressions? u Expressions: Compute Values u Expressions: Parameterize u Syntax: Data Types u Syntax: Operands u Expression Builder u Syntax Pitfalls
4
S2-4 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation WHY USE EXPRESSIONS? n Compute values n Parameterize
5
S2-5 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation EXPRESSIONS: COMPUTE VALUES n Compute values u ADAMS/View performs the calculations u Prevents errors u Results in higher accuracy Example: Shaft speed converted from rpm to radians/sec You might write the following by hand:
6
S2-6 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation EXPRESSIONS: COMPUTE VALUES (CONT.) In ADAMS/View, you would type the following expression: (500*2*PI/60) Evaluated
7
S2-7 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation EXPRESSIONS: PARAMETERIZE n Parameterize a model u Model characteristics can contain references to other data u Dependencies are established u One change propagates through the model u Similar to defining a spreadsheet cell as a function of another cell
8
S2-8 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation EXPRESSIONS: PARAMETERIZE (CONT.) Example: MOTION_1 references a design variable,.shaft_speed, which references another design variable,.input_RPM. You could also reference the design variables above in other places in the model at the same time. When you change a design variable, the change would then be reflected in multiple places.
9
S2-9 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation EXPRESSIONS: PARAMETERIZE (CONT.) Example: Shaft speed using a design variable to store the expression u When ADAMS/View reads an expression, it either: l Evaluates and then stores it in the database. l Stores the expression itself.
10
S2-10 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation SYNTAX: DATA TYPES n Integer u Whole numbers u Example: 3 n Real u Most numeric values u Example: 3.14159 n String u Character strings of varying length u Example: “x” n Object u Database objects u Example:.model_1.part_1.marker_2 n Matrix u One- or two-dimensional collections of values of the same type, or one of the above objects. u Example: (Array of strings) {“ {“x”, “y”}”} u Example: (Array of reals) {[1.1, 3.4], [2.2, 4.5], [2, 3.3]}
11
S2-11 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation SYNTAX: OPERANDS n Design-time functions n Database objects and their component values n Constants
12
S2-12 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation SYNTAX: OPERANDS (CONT.) n Design-time functions u System-supplied Example: (LOC_RELATIVE_TO({0,0,0{,.model_1.ground.marker_1)) (SIN(30d)*500) (DB_DEFAULT(.system_defaults,“MODEL”)) u User-written Example: MID_PT(marker_2,marker_3) marker_3)
13
S2-13 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation SYNTAX: OPERANDS (CONT.) n Database objects and their component values u Examples: u Other useful operators: l.name l.parent.parent Database access:Type:.some_model.some_part.massReal.model_1.motion_1.comments.model_1.circle_1.adams_id.model_1.part_1.location.model_1.joint_1.i
14
S2-14 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation SYNTAX: OPERANDS (CONT.) n Constants Examples: RTOD180 o / (Radians TO Degrees) PI 3.14159 TRUE1 NONEUsed to erase values in the database. For more information on constants, see the section, Constants & Variables in the ADAMS/View Function Builder help.
15
S2-15 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation EXPRESSION BUILDER n To test or prototype your expressions, you can access the Function Builder in expression-building mode (Expression Builder) by selecting it from the ADAMS/View Tools menu, or from the Design Variable dialog box.
16
S2-16 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation EXPRESSION BUILDER (CONT.) OR Expression work area Expression categories Example Getting object data (Data dictionary)
17
S2-17 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation SYNTAX PITFALLS n Forgetting parentheses u An expression must be wrapped in parentheses to be recognized. u (() n Forming arrays incorrectly u Defining a 3 x 1 array when a 1 x 3 array is expected, or the reverse. u Indexing incorrectly. See the online help for ADAMS/View Function Builder for syntax examples. Need a closing parenthesis
18
S2-18 ADM704-705, Section 2, August 2005 Copyright 2005 MSC.Software Corporation
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.