Writing Command Values of Mechanisms

In simulation, you can set the command values of mechanisms with the Write Command activity.

The units of the command magnitude (that is to say length and angle) are the units defined in the Parameters and Measure options.

Note: This command is only available if a Motion Controller is associated to the mechanism.

Refer to the Assembly Design user guide for the creation and the edition of mechanisms.

Refer to the Device Designer user guide for the creation and the edition of mechanisms.

This task shows you how to:


Before you begin: The System and Device Designer workbench should be opened.
Related Topics
About Live Simulation
Reading Joint Values of Mechanisms

Write Command in SFC+

You can program a Write Command activity in SFC+.

  1. Open a device that has a previously-defined mechanism, motion controller and a Simulation Logic. The Main block must be a SFC+ block (see a typical example below).



  2. To open the SFC+ Editor, do one of the following:

    • Expand the content of the Main block and double-click Behavior.
    • Right-click the Main block and select Behavior Editor.
    • Select Behavior Editor in the Main window toolbar.




    • The SFC+ Editor appears as an immersive window at the center of the screen.
    • A toolbox containing all the SFC+ Editor commands appears at the right side of the screen.

    Note: In our example, the resource logic is undefined, so the editor is empty.

  3. Select Write Command in the Activities toolbar and click the 2D immersive window to position the Write Command action.

    The Command Properties dialog box appears:


    • In the Data frame, you can define the value of one mechanism command.
    • In the Declaration frame, you can choose to create the port or the signal used in the Value box.
    • In the Action frame, you can define the settings of the Write Command action.

  4. Enter Rail_Command in the Value box. That means that the value of the Rail_Command signal will be assigned to the first command of the device.

  5. Click As Port.

    The Rail_command port will be created with the activity.

  6. Click Sustain.

    The Write Command activity will be executed at each cycle the step is active.

  7. Click OK.

    The step S0 is created in the SFC+ graph. The action calling the Write Command activity is identified by the icon and the command name.

    Tip: To have more details about the action, scroll-over it to display the tool tip.

  8. Create a new Write Command activity to pilot the second command:

    1. Select Write Command in the Activities toolbar and click the 2D immersive window to position the Write Command action.

      The Command Properties dialog box appears.

    2. Enter Filler_Command in the Value box.
    3. Select Command.3 in the list.



    4. Click As Port.
    5. Click Sustain.
    6. Click OK.



    A new Write Command action is added to the step S0.

  9. Close the SFC+ Editor window.

    Tip: To modify the Write Command activity, double-click the action. The Write Command Properties dialog box appears. Then, you can modify its parameters.

  10. To test the behavior of the activities in simulation:

    1. Select the Main block and click the Play of the compass.

      The block is compiled and the simulation is initialized. The Simulation toolbar and the Signals Monitoring window appear.

    2. Expand the ports of the Main block in the Signals Monitoring window.



    3. Enter the value of the commands in the Force Value cells.



    4. Click Next .

      The commands moves to the defined target values.

    5. Click the Play of the compass to end the simulation.

Write Command in Dataflow

You can program a Write Command in Dataflow.

  1. Open a device that has a previously-defined mechanism, motion controller and a Simulation Logic. The Main block must be a Dataflow block (see a typical example below).



  2. Double-click the Main block.




    • The Block Editor appears as an immersive window at the center of the screen.
    • A toolbox containing all the Block Editor commands appears at the right side of the screen.

    Note: In our example, the resource logic is undefined, so the editor is empty.

  3. Click Write Command in the Activities toolbox. Then, click the Block Editor window to position the activity.



    The Write Command Properties dialog box appears.

  4. Click OK.




    • The activity is created as a block instance.
    • Value (type float 64) is the command value of the mechanism.

  5. Scroll_over the instance to see the Write Command activity parameter.



  6. Create a new Write Command activity to pilot the second command.

    1. Click Write Command in the Activities toolbox. Then, click the Block Editor window to position the activity.

      The Write Command Properties dialog box appears.

    2. Select Command.3 in the list.
    3. Click OK.



  7. Press Ctrl and select Selected Objects > Map To New Port in the ports contextual menu.



  8. To get shorter port names,

    1. Double-click the new port.

      The Block Properties dialog box appears.

    2. Modify the name of the ports.



    3. Click OK.

  9. Close the Block Editor window.

  10. To test the behavior of the activities in simulation:

    1. Select the Main block and click the Play of the compass.

      The block is compiled and the simulation is initialized. The Simulation toolbar and the Signals Monitoring window appear.

    2. Click Next in the compass.

      Note: The commands are not changed. In Dataflow, the activities are enabled only if the input values are emitted.

    3. Enter the values of the commands in the Force Value cells.



    4. Click Next in the compass.

      The commands moves to the defined target values.

    5. Click the Play of the compass to end the simulation.