Simulating a Behavior Synchronized with Real Time

You can use the Simulate command to perform a simulation synchronized with real time and then show a 2D or 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.

See Also
About Virtual Execution
Managing a 2D Animation
Managing a 3D Animation
Replaying an 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. From the Behavior Authoring section of the action bar, click Simulation Setup and then do the following:

    Tip: You can also access this command from the Simulation section of the action bar.

    1. Under the General tab, in the Stop time box, type 10.
    2. Under the Simulator tab, select DDE Server.

      Any additional license is not needed for the DDE Server if used for real time synchronization.

    3. Select Syncronize with realtime.
    4. Click OK to validate.
  3. Click Simulate .

    Tip: You can also access this command from any of:
    • The Simulation section of the action bar.
    • The Action Pad panel. To access the Action Pad panel, from the Tools section of the action bar, click Action Pad , or right-click an empty area and select Display > Action Pad.

    • A window containing a status bar is displayed. The status bar shows the progress of the simulation calculation, including the simulation time.
    • An external program is launched and appears in the Windows toolbar.
      Note: If the simulation does not start you have to select the program in the toolbar and use it to start the simulation.
  4. Optional: To interact with the external program (Dymosim) while it is running, select the external program in the Windows toolbar.

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

    A dialog box is displayed. For information about how to interact, see Interacting with the Dymosim DDE Server Using the Internal Graphical User Interface.
  5. The simulation can be stopped using the external program interface, if wanted.
    When the simulation compilation is ready;
    • The external program and the status bar window close and the Experience Player toolbar is displayed.
    • The results of the simulation are shown as a list in the Variable Browser.
    • If your model contains a 3D representation, the 3D representation is displayed.
    • The Messages Reporting window appears to display information about the compilation.
    Tip: For about the Experience Player, see Simulate a Behavior with the Simulate Command.
  6. To end the simulation, do one of the following:
    • Click Simulate from the action bar or from the Action Pad panel.
    • Close the Experience Player toolbar. The toolbar must be undocked by dragging to be able to close.