MotionView User's Guide

MV-1051 - Understanding Sequential Simulation

MV-1051 - Understanding Sequential Simulation

Previous topic Next topic No expanding text in this topic  

MV-1051 - Understanding Sequential Simulation

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Sequential Simulation allows you to write simulation instructions to change the model, modify the solver settings and submit analyses.

This tutorials covers the following topics:

Fixed joint definition between non-coinciding points using marker definitions.
Using a sensor to activate the joint when two markers coincide during simulation.
Using Templex statements to:
oDeactivate a fixed joint when markers are non-coincident.
oActivate a fixed joint when markers coincide.
oSimulate until t = 5.00 seconds.

This tutorial illustrates how to build a model with sensor elements to capture the state of a body, use the sensor signal to activate some joints and deactivate others, and carry out a sequential simulation.

Exercise: Running a Sequential Simulation on a Model

Note

Copy all of the files located in the mbd_modeling\interactive\sequential_simulation folder to your <Working directory>.

Step 1: Creating joints, markers and sensors.

1.Start a new MotionView session.
2.From the Standard toolbar, click the Open Model icon, fileOpenModel-24.

OR

From the File menu, select Open > Model to open the model Sequential_simulation.mdl.

The model contains two bodies, namely a slider and a picker.  You need to create markers, joints, and a sensor as well as use Templex statements to perform a sequential simulation.

seqsimul1

2.From the Project Browser, right-click on Model and select Add Constraint > Joint (or right-click on the Joints icon, entityJoints-24, from the toolbar). Under Type, select Translational Joint.  Label the joint slider trans.
3.For Body 1, select slider.

For Body 2, select Ground Body.

For Origin, select slider cg.

Define the Alignment axis using the point slider end.

seqsimul2

4.Add another joint.  For Type, select Fixed Joint and label the joint picker rest fix.

For Body 1, select picker.

For Body 2, select Ground Body.

For Origin, select part fix.

This joint will be deactivated when the slider body coincides with the picker body during simulation.

seqsimul3

When you create a fixed joint between the slider and the picker and they come in contact, you need to define two markers which are initially not coincident, but coincide during the course of simulation.  Creating a joint based on markers must be done using Templex, as it is not possible to create it from the user interface.

5.From the Project Browser, right-click Model and select Add Reference Entity > Marker (or right-click on Marker icon, entityMarkers-24, from the toolbar).  Label it Marker Slider Track and set the properties as shown in the image below:

seqsimul4

6.Similarly, create another marker with the label Marker Picker Track and set the properties of the markers as shown in the image below:

seqsimul5

7.From the Project Browser, right-click Model and select Add Control Entity > Sensor (or right-click the Sensor icon, entitySensors-24, from the toolbar) to add a new sensor.
8.From the Signal field, select the type as Expression and enter the following expression:

`DX({the_model.m_0.idstring},{the_model.m_1.idstring})`

9.In the Compare to field, enter 0.0010 for the Value and 0.0010 for Error.  Set Respond if to Signal is greater than VALUE - ERROR.
10.In the Response field, select Return to Command File.

This directs the solver to look into the template for further instruction on how to proceed once the signal is attained.

11.From the Project Browser, right-click on Model and select Add Constraint > Motion (or right-click on the Motion icon, entityMotions-24, from the toolbar.  Set the properties as shown in the figure below.

seqsimul5a1

seqsimul5a2

Step 2: Creating a fixed joint between two non-coincident markers using Templex.

1.To create a fixed joint between the slider and picker that is activated once the distance between the slider and picker is zero, from the Project Browser, right-click on Model and select Add General MDL Entity > Template (or right-click on the Template icon, entityTemplates-24, from the toolbar).
2.Label it Fixed Joint Defn.  For Type, select Write text to solver input deck.  Enter the following commands as they are listed below in the same order.

<Constraint_Joint

    id                  = "5000"

    type                = "FIXED"

    i_marker_id         = "{the_model.m_0.idstring}"

    j_marker_id         = "{the_model.m_1.idstring}"

/>

 

The panel should look like this:

seqsimul6

Step 3: Creating a template to define the sequential simulation.

In this step, you will write a template to do the following:

Set the type of Output files to be written after the simulation.
Deactivate Joint between Slider and Picker for the initial simulation.
Perform a transient analysis for 3.5 seconds.
Activate Joint between Slider and Picker.
Deactivate Joint between Picker and Ground.
Deactivate the Sensor Element.
Run a transient analysis for 5 seconds.
1.From the Project Browser, right-click on Model and select Add General MDL Entity > Template (or right-click the Template icon, entityTemplates-24, from the toolbar).
2.Set the Type as Write text to solver command file.
3.Type the following commands as listed below.

 

<ResOutput

    plt_angle           = "YAW_PITCH_ROLL"

 />

 <ResOutput

    mrf_file            = "TRUE"

 />

 <ResOutput

    plt_file            = "TRUE"

 />

 <H3DOutput

    switch_on           = "TRUE"

    increment           = "1"

 />

<ResOutput

    abf_file            = "TRUE"

 />

 

<Deactivate

   element_type = "JOINT"

   element_id   = "5000"

/>

<Simulate

    analysis_type       = "Transient"

    end_time            = "3.5"

    print_interval      = "0.01"

/>

<Deactivate

   element_type = "JOINT"

   element_id   = "{the_model.j_1.idstring}"

/>

<Deactivate

   element_type = "SENSOR"

   element_id   = "{the_model.sen_0.idstring}"

/>

<Activate

   element_type = "JOINT"

   element_id   = "5000"

/>

<Simulate

    analysis_type       = "Transient"

    end_time            = "5."

    print_interval      = "0.01"

/>

<Stop/>

Step 4: Running the simulation and animating the results.

1.Click the Run Solver button, run-24, and activate the Export MDL snapshot check box. This will save your model file and export the solver data.
2.Click the Save and run current model button, file_open_icon_new_mv, and enter a name for the solver run file. This will save the model in the current state to run_xml_snapshot.mdl, where run_xml is the base name of the solver run file being provided in the next step.
3.Set End time as 5 and the Print interval as 0.01.
4.Click the Simulation Settings button.  In the pop-up dialog, from the Transient tab, select DSTIFF for the Integrator type.  Click Close.
5.From the Main tab, click Run.
6.Once the solver procedure is complete, the Animate button on the Main tab is activated.  Click Animate to animate the model.  Click animationStart-24 to start the animation and animationStop-24 to stop the animation.

seqsimul7