Setting Displacement of Products and Parts

You can program a Set Displacement activity to move a part or a product in simulation. This part/product must belong to the resource supporting the Simulation Logic.

AlongU, AlongV and AlongW (unit: millimeter) and AboutU, AlboutV and AboutW (unit: degree) are the input values of the activity Set Displacement defined in the resource Simulation Logic.

The reference axis of the displacement vector is:

  • The reference axis of the resource for non-programmable resources.
  • The reference axis of the product supporting the programming context for programmable resources.

For this user task, we will only demonstrate the use of the Set Displacement activity for a non-programmable resource.

This task shows you how to:


Before you begin: The System and Device Designer workbench should be opened in the Live Simulation environment.
Related Topics
About Live Simulation
Getting Positions of Products and Parts

Set Displacement in SFC+

You can program a Set Displacement activity in SFC+.

  1. Open a resource that has sub-products (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.

    A 2D immersive window is opened to edit the block behavior. A toolbox at the right side of the window contains the SFC+ Editor commands.

    Note: In our example, the block behavior is undefined, so the window is empty.

  3. Select Set Displacement in the Activities toolbox.

  4. If the 2D immersive window is in front of the 3D object, click in the 3D view.

    The SFC+ Editor window becomes transparent.

  5. Select the part to move.

    The selected part is highlighted and a bubble attached to it appears.

    Tip: Select another part if you want to change the target.

  6. Click the bubble to confirm the part selection.

    The Set Displacement Properties dialog box appears.

    In the Displacement frame, you can define the displacement vector of the product.

    • Structured: Value is a structured signal containing all the coordinates, that is, positions and angles about U, V and W. The signal type is:
      {AlongU:float64;AlongV:float64;AlongW:float64;AboutU:float64;AboutV:float64;AboutW:float64}
    • Detailed: The coordinates can be set independently.

    In the Action Data frame, you can define:

    • The type of action: Pulse or Sustain
    • A conditional expression applicable on the execution of the action. If the condition is false, the action is not executed.

      See a typical example below.



  7. Select Detailed.

  8. Enter a port name for AboutW.



    Note: You can enter any port or local signal name compliant with the Float64 type.

  9. Select As Port in the Declaration frame.

    So, the State port will be created with the activity.

  10. Click in the SFC+ Editor to position a new step.

    A first step of the SFC+ graph is created. The action contains an icon identifying the activity Set Position followed by the name of the product (or the part) being the target of the activity.

  11. Scroll over the action to see the parameters.



    Tip: To modify the activity, double-click it. You can change the target of the activity and the parameters of the Set Displacement Properties dialog box.

  12. Close the SFC+ Editor window.

  13. To test the behavior of the activity in simulation:

    1. Select the Main block in the Simulation Logic tree and click Play in the compass.

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

    2. Expand the Ports node of the Signals Monitoring window and force the value of State to 10. The part will move to 10 mm along the W axis.



      Note: Only the value of the signal emitted (AlongW in our example) is taken into account by the simulation. The other signals keep their current value.

    3. Press Enter.
    4. Click Next in the control bar of the compass. The device moves along the Z axis.

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

Set Displacement in Dataflow

You can program a Set Displacement activity in Dataflow.

  1. Open a resource that has sub-products. The Main block must be a Dataflow block (see a typical example below).



    Note: To modify the kind of the block, select Block Definition in the block contextual menu and select SFC+ or Dataflow in the Kind drop-down box.

  2. Double-click the Main block in the Simulation Logic tree.

    A 2D immersive window is opened to edit the block behavior. A toolbox at the right side of the window contains the Block Editor commands.

    Note: In our example, the behavior of the block is undefined, so the editor is empty.

  3. Click in the 3D view to be able to select a 3D component through the Block Editor window.

    The Block Editor window becomes transparent.

  4. Select the part to move.

    The selected part is highlighted and a bubble attached to it appears.

  5. Click the bubble to confirm the part selection.

  6. Click the 2D editor to position the activity instance.

    An instance of the activity Set Displacement is created.

    Two inputs ports are displayed:

    • Translation, type Translation {AlongU:float64;AlongV:float64;AlongW:float64}
    • Rotation, type Rotation {AboutU:float64;AboutV:float64;AboutW:float64}

    Note: The Translation and Rotation types are available as predefined types as soon as the activities Set Displacement or Get Position are used.

  7. Select Translation object > Expand Port in the contextual menu of the port Translation.



  8. If you want to change the name of the new port, double-click its icon.

    The Block Properties dialog box appears. Enter a new value in the Name field.

  9. Close the Block Editor window.

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

    1. Select the Main block in the Simulation Logic tree and click Play in the compass.

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

    2. In the IO Monitoring window, expand the node Ports.

    3. Force the value of the Z port to 10 and press Enter.

    4. Click Next in the control bar of the compass. The part moves along the Z axis.

      Important: Only the value of the signal emitted (AlongW in our example) is taken into account by the simulation. The other signals keep their current value.

    5. Repeat the step c. and force the value of Z to -10. The device goes back to its initial position.
    6. Stop the simulation by clicking Play in the PLM compass.