MV-1000: Interactive Model Building and Simulation

In this tutorial, you will learn how to create a model of a four-bar trunk lid mechanism interactively through the MotionView graphical user interface, perform a kinematic analysis on the model using MotionSolve, and post-process the MotionSolve results in the animation and plot windows.

A brief overview of Multi Body Dynamics (MBD) is provided below.
Multi Body Dynamics (MBD)
MBD is defined as the “study of dynamics of a system of interconnected bodies”. A mechanism (MBD system) constitutes a set of links (bodies) connected (constrained) with each other to perform a specified action under application of force or motion. The motion of mechanisms is defined by its kinematic behavior. The dynamic behavior of a mechanism results from the equilibrium of applied forces and the rate of the change of momentum.
MBD Modeling
A classical MBD formulation uses a rigid body modeling approach to model a mechanism. A rigid body is defined as a body in which deformation is negligible. In general, to solve an MBD problem, the solver requires following information:
  • Rigid body inertia and location.
  • Connections – type, bodies involved, location, and orientation.
  • Forces and motions – bodies involved, location, orientation, and value.
MotionView facilitates quick and easy ways of modeling items, such as a system, through graphical visualization.


Figure 1.
Trunk-Lid Model
The trunk-lid shown in the image below uses a four-bar mechanism for its opening and closing motions.


Figure 2. Car Trunk-Lid Mechanism
Below is a schematic diagram of the mechanism:


Figure 3.
The four links (bodies) in a four-bar mechanism are: Ground Body, Follower, Coupler, and Input Link. In this example, the Ground Body is the car body and Input Link is the trunk-lid body. The remaining two bodies (Follower and Coupler) form the part of the mechanism used to aid the opening and closing of car trunk-lid.
The following entities are needed to build this model:
  • Points
  • Bodies
  • Constraints (Joints)
  • Graphics
  • Input (Motion or Force)
  • Output

Create Points

In this step you will learn how to create points for your model.

From the mbd_modeling\interactive folder, copy trunk.hm and trunklid.hm to the <working directory>.
  1. Start a new MotionView Session.
  2. Add a point using one of the following methods:
    • From the Project Browser, right-click on Model and select Add > Reference Entity > Point from the context menu.


      Figure 4.
    • On the Reference Entity toolbar, right-click on the (Points) icon.
    The Add Point or PointPair dialog will be displayed.
    Note: Other entities like Bodies, Markers, and so on can also be created using either of the methods listed above (Project Browser or toolbar).
  3. For Label, enter Point A.
  4. For Variable, enter p_a.


    Figure 5.
    The label allows you to identify an entity in the modeling window, while the variable name is used by MotionView to uniquely identify an entity.
    Note: When using the Add "Entity" dialog for any entity, you can use the label and variable defaults. However, as a best modeling practice, it is recommended that you provide meaningful labels and variables for easy identification of the entities. For this exercise, please follow the prescribed naming conventions.
  5. Click OK.
    The Points panel is displayed. Point A is highlighted in the Points list of the Project Browser.


    Figure 6. Points Panel - Properties Tab
  6. Enter the values for the X, Y, and Z coordinates for point A.


    Figure 7.
  7. Create multiple points.
    1. To create points B through I, repeat steps 2 through 4 and click Apply.
      Remember: Substitute B, C, and so on for A when entering the label and variable names in the Add Point or PointPair dialog. Clicking the Apply button allows you to continue to add points without exiting the Add "Entity" dialog.
    2. After keying in the label and variable name for Point I, click OK to close the dialog.
    3. In the Points panel, click the Data Summary... button.
      The Data Summary dialog shows the table of points and you can enter all the coordinates in this table.


      Figure 8.
      Table 1.
      Point Location
      Label Variable X Y Z
      Point A p_a 921 580 1124
      Point B p_b 918 580 1114
      Point C p_c 918 580 1104
      Point D p_d 915 580 1106
      Point E p_e 878 580 1108
      Point F p_f 878 580 1118
      Point G p_g 830 580 1080
      Point H p_h 790 580 1088
      Point I p_i 825 580 1109
      Since the Y value for all the points are the same, you can parameterize the value for points B through I to the value of Point A. This process is explained in the next step.
  8. Parameterize the value for points B through I to the value of Point A.
    1. Select the Y coordinate field along Point B.
    2. Click on the button to invoke the Expression Builder.
    3. Select the Y value of Point A.


      Figure 9.
    4. Copy the expression and paste into the Y coordinate field of the remaining points.
    5. Enter the X and Z coordinates as listed in the table above.
      Note: On the keyboard, press Enter to move on to the next field in the table.


      Figure 10.
    6. Click Close.
  9. On the Standard Views toolbar, change the view to left by clicking the (XZ Left Plane View) icon.

Create Bodies

In this step, you will create the Input Link, Coupler, and Follower rigid-body links in the mechanism.

The mechanism consists of four rigid-body links: Ground (car body), Input Link, Coupler, and Follower. Ground Body is available by default when a new MotionSolve client is invoked, hence creating the Ground Body separately is not required.
  1. On the Reference Entity toolbar, right-click the (Bodies) icon.
  2. In the Add Body or BodyPair dialog, Specify the label as InputLink and the variable name as b_inputlink.


    Figure 11.
  3. Click OK.
  4. Enter the values for mass and inertia.
    1. Click the Properties tab.
    2. Enter the following values:
      • Mass=1
      • Ixx, Iyy, Izz= 1000, Ixy, Ixz, Iyz=0


      Figure 12.
    3. Click the CM Coordinates tab to specify the location of the center of mass of the body.
  5. Select the Use center of mass coordinate system check box.
  6. Under Origin, click the (Point collector).
    A cyan border will appear around the collector to indicate it is now active for selection.
  7. Select Point G.
    1. Click again to launch the Select a Point dialog.
    2. Select Point G from the Model Tree.


      Figure 13.
    3. Click OK.


      Figure 14.
    4. Retain the default orientation scheme (orient two axes) and accept the default values for .
    Note: This method for selecting a point can also be applied to other entities such as: body, joint, and so on. For selecting the Ground Body or the Global Origin, you can click on the triad representing the Global Coordinate System on the screen .
    Tip: You can also select Point G from the modeling window. Hold down the left mouse button and highlight Point G. Release the button to select it.


    Figure 15.
  8. Repeat step 1 through 7 to create the remaining links with the variable names listed in Table 2.
    Table 2.
    Label Variable Name
    Follower b_follower
    Coupler b_coupler
  9. Specify the mass and inertia for these links.
    1. Mass= 1
    2. Ixx, Iyy, Izz= 1000
    3. Ixy, Ixz, Iyz=0
  10. Specify points B and D as the origin of the center of mass marker for Follower and Coupler, respectively.
  11. Retain the default orientation (Global coordinate system) for the CM marker.

Create Revolute Joints

In this task you will learn how to create the joints necessary for this model.

The mechanism consists of revolute joints at four points: A, C, E, and F. The axis of revolution is parallel to the global Y axis.
  1. Add a Joint in one of the following ways:
    • From the Project Browser, right-click on Model. From the context menu, select Add > Constraint > Joint.
    • Right-click the (Joints) icon.
    The Add Joint or JointPair dialog will display.


    Figure 16.
  2. Specify the label as Follower-Ground and variable names as j_follower_ground for the new joint.
  3. Under Type, select Revolute Joint from the drop-down menu.
  4. Click OK.
    The Joints panel will be displayed. The new joint you added will be highlighted in the Model Tree in the Project Browser.
  5. Under the Connectivity tab, double click (first Body collector).
    The Select a Body dialog is displayed.
  6. From the Model Tree, select Bodies from the left-hand column and Follower from the right-hand column.


    Figure 17.
  7. Click OK.
    Notice that in the Joints panel the Follower Body is selected for and the cyan border moves to
  8. Click in the modeling window. With the left mouse button pressed, move the cursor to the global XYZ triad .
  9. Release the left mouse button when Ground Body is displayed in the modeling window.


    Figure 18.
  10. Under Origin, double click the collector.
    the Select a Point dialog will display.
  11. Select Point A as the joint origin.
  12. Click OK.
  13. To specify an axis of rotation, under Alignment Axis, click the downward pointing arrow next to Point and select Vector.
  14. Specify the Global Y axis vector as the axis of rotation of the revolute joint.


    Figure 19.
  15. Repeat steps 1 through 14 to create the three remaining revolute joints: points C, E, and F. Use the specifications shown in Table 3.
    Table 3. Revolute joint information
    Revolute Joint Label Variable Name Body 1 Body 2 Point Vector
    Follower-Ground j_follower_ground Follower Ground A Global Y
    Follower-Coupler j_follower_coupler Follower Coupler C Global Y
    Coupler-Input j_coupler_input Coupler Input Link E Global Y
    Input-Ground j_input_ground Input Link Ground F Global Y

Specify a Motion for the Mechanism

In this step you will learn how to add motion to your mechanism model.

The input for this model will be in the form of a Motion. A Motion can be specified as Linear, Expression, Spline3D, or Curve. In this step, you will specify a Motion using an Expression.
  1. Bring up the Add Motion or MotionPair dialog in one of the following ways:
    • From the Project Browser, right-click on Model and select Add > Constraint > Motion from the context menu.
    • On the Constraint toolbar, right-click on the (Motion) icon.
  2. Specify the label as Motion_Expression and the variable name as mot_expr.
  3. Click OK.
    The Motion panel is displayed. The new motion is highlighted in the model tree in the Project Browser.
  4. From the Connectivity tab, double click on the (Joint collector).
    The Select a Joint dialog is displayed.
  5. From the Model Tree, select the revolute joint at Point F (Input Ground) that you created in the previous step.


    Figure 20.
  6. Click OK.
    The Motion panel will be displayed.


    Figure 21.
  7. From the Properties tab, under Define by, click on the gray arrow and select Expression.
  8. Click in the Expression field.
    The Expression Builder is now activated.


    Figure 22.
  9. Click on the button to open the Expression Builder and enter following expression between the back quotes `60d*sin(2*0.1*PI*TIME)`.


    Figure 23.
    The expression is a SIN function with an amplitude of 60 degrees and frequency of 0.1 Hz. With this expression the trunk lid is opened to an angle of 60 degrees and back in a total time period of 5 seconds.
  10. Click OK.
    Note: This method of creating an expression can also be used for specifying nonlinear properties of other entities like Force, Spring Damper, Bushing, and so on.

Create Outputs

In this step, you will add a displacement output between two bodies using the default entities. You will also add another output to record the displacement of a particular point G on the input link relative to the global frame based on Expressions.

You can create outputs using bodies, points and markers. You can also directly request force, bushing, and spring-damper entity outputs. Another way to create outputs is to create math expressions dependent on any of the above mentioned entities.
  1. Open the Add Output dialog in one of the following ways:
    • From the Project Browser, right-click on Model and select Add > General MDL Entity > Output from the context menu.
    • On the General MDL toolbar, right-click the (Outputs) icon.
  2. Specify the label as Input Link Displacement and the variable name as o_disp for the new output.


    Figure 24.
  3. Click OK.
  4. Create a Displacement output between two points on two bodies.
    1. For Body 1 and Body 2, select Input Link and Ground Body, respectively.
    2. For Pt on Body 1 and Pt on Body 2, select point I and the Global Origin point respectively.
    3. Record the displacement on Both points, one relative to the other.


      Figure 25.
  5. Add one more output with the label as Input Link CM Displacement and the variable name as o_cm_disp.
  6. Calculate the X displacement between the CM markers Input Link and the global origin.
    1. From the drop-down menu, select Expressions.
    2. Click in the F2 field.
      This activates the button.
    3. To display the Expression Builder dialog, Click on the button.
    4. Clear the value 0 from the back-quotes.
    5. From the Motion tab, click DX.
    6. Place the cursor inside the curly-brackets {} after DX.
    7. From the Properties tab, expand the following trees: Bodies/Input Link/Marker CM.
    8. Select idstring.


      Figure 26.
    9. Click Add to populate the expression.
    10. Add a comma to separate the next expression.
    11. Add a pair of curly brackets "{}".
    12. Place the cursor inside the added brackets.
    13. From the Properties tab, expand the following items in the tree: Markers/Global Frame.
    14. Select idstring.
    15. Click Add to populate the expression.
  7. Click OK
  8. To check for errors, go to the Tools menu and select Check Model.
    Any errors in your model topology are listed in the Message Log.


    Figure 27.
    Attention: The ID numbers appearing in the expressions may vary with the images shown.
    Note: The DX function measures the distance between Input Link’s CM (center of mass) marker and marker representing the Global Frame in the X direction of the Global Frame. Refer to the MotionSolve Reference Guide for more details regarding the syntax and usage of this function.

    The back quotes in the expression are used so that the MDL math parser evaluates the expression. Entity properties like idstring, value, etc. get evaluated when they are placed inside curly braces {}, otherwise they are understood as plain text. Refer to the Appendix to learn more about various kinds of expressions and form of evaluation adopted by MotionSolve.

Add Graphic Primitives

In this step you will add graphics for visualization of the mechanism.

At this stage your trunk lid model does not contain any graphics, and the entities created in previous steps are represented only by implicit graphics (which are not available in solver deck or results file).


Figure 28. Trunk-lid with only implicit graphics
MotionView graphics can be broadly categorized into three types: implicit, explicit, and external graphics.
Implicit Graphics
The small icons that you see in the MotionView interface when you create entities like points, bodies, joints, and so on are called implicit graphics. These are provided only for guidance during the model building process and are not visible when animating simulations.
Explicit Graphics
These graphics are represented in form of a tessellation, are written to the solver deck and subsequently available in the results. Explicit graphics are of two types.
Primitive Graphics
These graphics help in better visualization of the model and are also visible in the animation. The various types of Primitive Graphics in MotionView are Cylinder, Box, Sphere, and so on.
External Graphics
You can import in various CAD formats or HyperMesh files into MotionView. The ‘Import CAD or FE using HyperMesh..’ utility in MotionView can be used to convert a CAD model or a HyperMesh model to h3d graphic format which can be imported into MotionView. One can also import .g, ADAMS View .shl and wavefront .obj files directly into MotionView.

MotionView allows you to turn on and off implicit graphics for some of the commonly used modeling entities

  1. Turn on implicit graphics.
    1. From the Model main menu, select Implicit Graphics...
    2. Turn on the Visible check box.
      Figure 29.
      Note: Implicit graphics of Individual entities can be turned on or off by using the Visible check box for each entity.
    3. Click Close.
      Note: The state of the implicit graphics (whether on or off) is not saved in your model (.mdl) or session (.mvw) files. MotionView uses its default settings when:
      • You create a new model in another model window.
      • You start a new session.
      • You load an existing .mdl/.mvw file into a new MotionView session.

      To visualize the four-bar mechanism, you need to add explicit graphics to the model. In this step, you will add cylinder graphics for Follower, Coupler, and Input Links.

  2. To add explicit graphics to your model, open the Add Cylinder or CylinderPair dialog in one of the following ways:
    • From the Project Browser, right click on Model and select Add > Reference Entity > Graphicfrom the context menu.
    • On the Reference Entity toolbar, right-click on the (Graphics) icon.
  3. In the Add Cylinder or CylinderPair dialog, enter the label as Follower Cylinder and the variable name as gcyl_follower.


    Figure 30.
    Note: The name of the dialog changes with the graphic type. For example, the dialog name changes to Add Box or BoxPair when the Box graphic type is selected.
  4. From the Type drop-down menu, select Cylinder.
  5. Click OK.
  6. In the Connectivity tab, double-click on the (Body button) below Parent.
  7. Select the Follower from the Select a Body list and click OK.
    This assigns the graphics to the parent body.
  8. To select the origin point of the cylinder, click below Origin.
  9. Pick Point A in the modeling window.
  10. Click under Direction.
  11. Select Point C for .


    Figure 31.
  12. From the Properties tab, enter 2 in the Radius 1: field.


    Figure 32.
    Note: The cylinder graphic can also be used to create a conical graphic. By default, the Radius 2 field is parameterized with respect to Radius 1, such that Radius 2 takes the same value of Radius 1. Specify different radii to create a conical graphic.
  13. For the remaining bodies in your model, follow steps 2 through 12 to create the appropriate explicit graphics for other links. Use the specifics given in Table 4.
    Table 4.
    Label Variable Name Graphic type Body Origin Direction Radius
    Follow Cylinder gcyl_follower Cylinder Follower Point A Point C 2
    Coupler Cylinder gcyl_coupler Cylinder Coupler Point C Point E 2
    Input Link Cylinder 1 gcyl_inputlink_1 Cylinder Input Link Point F Point E 2
    Input Link Cylinder 2 gcyl_inputlink_2 Cylinder Input Link Point E Point G 2
    Input Link Cylinder 3 gcyl_inputlink_3 Cylinder Input Link Point G Point H 2
    Input Link Cylinder 4 gcyl_inputlink_4 Cylinder Input Link Point H Point I 2
    After the addition of cylinder graphics for all three links, the Model will look as shown in Figure 33:


    Figure 33.

Add External Graphics and Convert a HyperMesh File to an H3D File.

In this step you will use this conversion utility to convert a HyperMesh file of a car trunk lid into the H3D format.

MotionView has a conversion utility that allows you to generate detailed graphics for an MDL model using HyperMesh, Catia, IGES, STL, VDAFS, ProE, or Unigraphics source files. MotionView uses HyperMesh to perform the conversion.
  1. From the Tools menu, select Import CAD or FE using HyperMesh.
  2. From the Import CAD or FE using HyperMesh dialog, activate the Import CAD or Finite Element Model Only radio button.
  3. From the Input File option drop-down menu, select HyperMesh.
  4. Click the button next to Input File and select trunklid.hm, located in your <working directory>, as your input file.
    The Output Graphic File will be automatically populated with the trunklid_graphic.h3d file from the <working directory>.
  5. Click OK to begin the import process.


    Figure 34.
    The Import CAD or FE using HyperMesh utility runs HyperMesh in the background to translate the HyperMesh file into an H3D file. When the import is complete the Message Log appears with the message "Translating/Importing the file succeeded!"
    Note: The H3D file format is a neutral format in HyperWorks. It finds wide usage such as graphics and result files. The graphic information is generally stored in a tessellated form.
  6. Clear the Message Log.
  7. Use steps 1 through 6 to import the trunk graphics by converting the trunk.hm file to trunk.h3d.

Attach H3D Object to the Input Link and Ground Bodies

In this step, you will attach the trunk lid H3D object to the input link and the trunk H3D object to Ground.

  1. On the Reference Entity toolbar, click (Graphics).
  2. Select g_trunklid_graphic from the modeling window.
  3. In the Connectivity tab, double click the (Body collector).
  4. From the Select a Body dialog, click Input Link.


    Figure 35.
  5. Click OK.
    This will display the Graphics panel.


    Figure 36.
    Note: Observe the change in the trunk lid graphic color to the Input Link body color.
  6. Select the newly created g_trunk_graphic from the Project Browser and set the as Ground Body.
  7. On the Standard toolbar, click the Save Model icon .
    If the model is new you will be prompted to input the name of the model, otherwise the model will be saved in the working directory with the existing name.
    Note: Existing models can be saved to another file using the Save As > Model option located in the File menu.
  8. From the Save As Model dialog, browse to your working directory and specify the file name as trunklid_mechanism.mdl.


    Figure 37.
  9. Click Save.


    Figure 38. Trunk-lid mechanism

Solve the Model with MotionSolve

In this step, you will use MotionSolve to perform a kinematic simulation of the mechanism for a simulation time of 5 seconds, with a step size of 0.01 second.

MotionSolve can be used to perform kinematic, static, quasi-static, and dynamic analyses of multi-body mechanical systems. The input file for MotionSolve is an XML file called MotionSolve XML. The solution in MotionSolve can be executed from MotionSolve.
  1. On the General Actions toolbar, click the (Run) icon.
  2. On the Model Check toolbar, click on the (Check model) button to check the model for errors.
  3. From the Main tab of the Run panel, specify Transient as the Simulation type.
  4. Specify the name for the XML file as trunklid_mechanism_run.xml.
    MotionView uses the base name of your XML file for other result files generated by MotionSolve. See the MotionView User’s Guide for details about the different result file types.
  5. Activate the Export MDL snapshot check box (if it is not already active).
    This will save the model at the stage in which the Run is executed.
  6. Specify an End time of 5 for your simulation and a Print interval of 0.01


    Figure 39.
    Note: The time unit is based on the time unit chosen (default is Seconds).
    You can access the Solver Units and Gravity Data Sets from the Project Browser.


    Figure 40.
    .
  7. To solve the model with MotionSolve, click the Run button.
    Note: Check the Message Log for more information.
    Upon clicking Run, MotionSolve is invoked and solves the model. The Solver View window appears which shows the progress of the solution along with messages from the solver (Run log). This log is also written to a file with the extension .log to the solver file base name.
  8. Review the window for solution information and be sure to watch for any warnings/errors.

View Animation and Plot Results on One Page

In this step you will learn to view your animation and plot result on the same page.

Once the run is successfully complete, both the Animate and Plot buttons are active.


Figure 41.
  1. Click the Animate button.
    This opens HyperView in another window and loads the animation in that window.
  2. On the toolbar, click the icon to start the animation.
    Note: You can click the button again to stop/pause the animation.
  3. Return to the MotionView window.
  4. Click the Plot button.
    This opens HyperGraph and loads the results file in a new window.
  5. Leave the X-axis Data Type as Time.
  6. Input the y-axis data in Table 5.
    Table 5.
    Y Type Marker Displacement
    Y Request REQ/70000000 InputLink from Ground Body (Input Link Displacement)
    Y Component DM (Magnitude)
  7. Click Apply.
    This plots the magnitude of the displacement of Point I relative to the Global Origin.


    Figure 42. Session with model, plot, and animation

Save Your Work as a Session File

Here, you will learn to save your model as a session file.

  1. From the File menu, select Save As > Session File.
  2. Specify the file name as trunklid_mechanism for your session.
  3. Click Save.
    Your work is saved as trunklid_mechanism.mvw session file.

Appendix

Evaluating Expressions in MotionView.

Table 6.
Math Parser
A MotionView parser that evaluates a MotionView expression as real/integer/string for a field as appropriate
Real This type of field can contain a real number or the parametric expression that should evaluate to a real number. This type of field is found in Points, Bodies, Force – Linear. Note that only the value of the expression as evaluated goes into the solver deck and not the parametric equation.

Example: p_a.x, b_0.mass

String This type of field can contain a string or a parametric expression that should evaluate to a string. This type of field is found in entity such as DataSets with strings as Datamember, SolverString etc. As in case of Linear field, only the value of the expression as evaluated goes into the solver deck and not the parametric expression.

Example: b_inputlink.label

Integer This type of field can contain an integer or a parametric expression that evaluates to an integer. This type of field is found such as DataSets with an integer as Datamember. Even in this case, only the value of the expression as evaluated goes into the solver deck and not the parametric equation.
Table 7.
Templex Parser
A math program available in HyperWorks that can perform more complex programming than the math parser, other than evaluating a MotionView expression. The following type of fields in MotionView are evaluated by the templex parser that evaluates a parameterized expression:
Expressions This type of field is different than the three listed above because it can contain a combination of text and parametric expression. It is generally used to define a solver function (or a function that is recognized by the solver). This type of expression is embedded within back quotes ( ` ` ) and any parametric reference is provided within curly braces {}. The presence of back quotes suggests the math parser to pass the expression through Templex. Templexevaluates any expression within curly braces while retaining the other text as is. For example in the expression ` DX({b_inputlink.cm.idstring},{Global_Frame.idstring})`, the templex evaluates the ID (as a string) of the cm of the Input link body (b_ inputlink) and that of marker Global Frame while retaining “DX” as is. These fields are available in entity panels such as: Bushings, Motions, Forces with properties that toggle to Expression, Independent variable for a curve input in these entities, and Outputs of the type Expression.