Executing a Behavior Synchronized with Real Time

You can use the Execute command to perform a simulation synchronized with real time and then show a 2D/3D animation.

A simulation synchronized with real time provides the capability for external programs to manipulate the simulation and collect results as they are generated.

Note: Although Coupled Clutches from the Modelica Standard Library is used as an example in this section, the technique can be applied to any Modelica model.


Before you begin:

To simulate synchronized with real time, a license is required for realtime simulation.

Related Topics
About Virtual Execution
Executing a Behavior
Managing a 2D Animation
Managing a 3D Animation
Replaying a 3D Animation
  1. Open the Modelica Standard Library and from the Package Browser select Modelica > Mechanics > Rotational > Examples and then double-click CoupledClutches.

    The CoupledClutches diagram opens.

  2. Click Execution Setup and then do the following:

    1. Under the General tab, in the Stop time box, enter 10.
    2. Under the Realtime tab, select the Synchronize with realtime check box and in the Slowdown factor box, enter 1.

  3. Click Execute in the Execution toolbar.


    • A window containing a status bar is displayed. The status bar shows the progress of the simulation calculations.
    • An external program is launched and appears in the Windows toolbar (see next step).
    • When the simulation calculations are completed, the external program and the status bar window close and the Simulation Player toolbar is displayed.
    • The results of the simulation are shown as a list in the Variable Browser in the Dock.
    • If your model contains a 3D representation, a window containing the 3D representation is displayed.
    • The Messages Reporting dialog box appears to display information about the compilation.

  4. Optional: To interact with the external program (Dymosim ) while it is running, click the external program in the Windows toolbar.

    If the environment variable DYMOSIMGUI is set to TRUE, the start of the external program is delayed until you click the Play control.

    A dialog box is displayed. The title of the dialog box is the name of the model; CoupledClutches in this example.

    The top row of the dialog box shows:

    • The simulation time.
    • The amount of time the simulation is delayed at each accepted output point, relative to real time. A negative value indicates that the simulation is faster than real time (in this instance, there is spare time for additional calculations).

    The dialog box includes controls to Pause, Play and Stop the simulation.

    To adjust the Slowdown factor, enter a value in the box and click Set.

    To produce a log file of DDE (Dynamic Data Exchange) events, select the Log on file check box. The log file ddelog.txt is saved in your CATIA environment under Rxxx\Authoring\CATTemp\SVE. For each new execution of a behavior, the logs are appended to this file. More information on DDE communication is available in Related Topics.

    If the environment variable DYMOSIMLOGDDE is set to TRUE, DDE messages shown in the external program will be saved in ddelog.txt. Once the program has started, the setting in the program dialog box takes precedence over this variable.

  5. To view the simulation animation, follow the instructions given previously in step 3 of Execute a Behavior with the Execute Command.

  6. To end the execution, do one of the following:

    • Click Simulate in the Virtual Execution toolbar.
    • Close the Simulation Player toolbar.