Using MC_MoveLink function block

Updated March 27, 2023

Delete

Disclaimer

In order to run simulation motion within Sysmac Studio additional license is required (SYSMAC-SA401L-64 [only for 64-bit Sysmac Studio installations]). This example has been created using Sysmac Studio version 1.53, NJ501-1500 firmware 1.49, Application Manager version 5.0.

 

Introduction

Omron Sysmac Machine Automation Controllers (MAC) have motion control built-in, which makes a world of difference when developing a system that requires motion axes control. Here we explore the use of MC_MoveLink, a synchronized motion between 2 axes of motion that operates like an electronic CAM that can be used for common applications, such as flying shear.

Configuration

  1. Create a new project in Sysmac Studio based on your MAC unit.

     
  2. Add your servo systems to the EtherCAT network.

     
  3. Add your Motion Axes.

     
  4. Configure your servo axes. For this exercise I have used 1S Servo Systems with the following main settings
    1. Command pulse count per motor rotation is 8388608 (23-bit resolution)
    2. Axis 1/Work travel distance per motor rotation is 1000mm/rev
    3. Axis 2/Work travel distance per motor rotation is 360degree/rev
    4. Axis 2/Count mode is Rotary mode
    5. Axis 2/Modulo maximum position setting value is 360
    6. Axis 2/Modulo minimum position setting value is 0
 Delete 

MAC Programming

  1. Rename existing program to "ProgMoveLink" and the section to "Main".

     
  2. On the first rung program Enable Power function.

     
  3. Implement a routine to home the axes if they are not homed already.

     
  4. Implement velocity control for Master Axis.

     
  5. Finally, implement MoveLink operation.
    1. For this example we have set it up to look for an Variable to trigger the operation, but for a real application I would suggest best to use Servo Drive External Trigger input instead (modify LinkTrigIn members to suit).
    2. Slave distance is the amount of travel the slave will perform based on the defined Master distance specified.
    3. Master distance acceleration and deceleration is used to specify the amount of master travel we would like to use for the slave to use this distance to accelerate and decelerate. Note that these distances are consider as part of the Master distance travel not additional. 
    4. Master start distance is not used in this example as LinkOption "2: _mcMasterReach" would be required to use the master start distance and what would happen instead is that the trigger would be disregarded and the master distance would be used instead as a trigger for the move link operation.
Delete


3D Simulation

  1. Add Application Manager to the project.

     
  2. Right click on "3D Visualization" and add "Mechanical Component".

     
  3. Select "Motor Rotation" as the type and then click on OK.

     
  4. Download the 3D model below and add this to the axis as prompted after clicking OK.
    3D Wheel for Sysmac Simulation v1.step

     
  5. Left-click and drag "3D Wheel for Sysmac Simulation v1.step" onto "Motor" and then click Next >

     
  6. On the following window you can leave the current settings and click Next >.

     
  7. Select "new_Controller_0" under Select Controller and then under "Value" column on the table input your slave axis. Finally, click on Finish. 

     
  8. Change the name of the Mechanical Component created to "Dial1"
  9. Now we will add the Conveyor. Right click on "3D Visualization" and add "Mechanical Component".

     
  10. Select "Conveyor" as the type and the click OK.


     
  11. Leave "Linear Direction Adjustment" as default and click on Next >. 
  12. Select "new_Controller_0", under Value column for _sAXIS_REF input your master axis and change the Conveyor Length to 3000. Once done, click on Finish.
  13. Change the name of the Mechanical Component just created to "Conveyor1".
  14. At this stage you should have the following 3D model, next we will look at adding the part we will detect
     
  15. Right-click on "3D Visualization", then go to "Add" and under Add select "Box".
  16. Rename Box0 to Part1 and set the parameters below for it.
  17. Next, we will add the Virtual Sensors we will use to detect the part.
  18. Right-click on "3D Visualization", then go to "Add" and under Add select "Virtual Part Detection Sensor".
     
  19. Rename to "MoveTrig1" and set it to the following.
    1. Assuming it is a through beam sensor, length is the distance between the emitter and receiver. Set to 150.
    2. Offset the sensor from the Parent (Conveyor is the parent) by the amount specified in the image below.
    3. Set Parent to the Conveyor by left-click on ... button to the right of the input box.
    4. Target controller with be our MAC (new_Controller_0) and the I/O in the controller we want to link this sensor with is LinkTrigVar.
    5. Set the output required when the sensors is triggered, which in this case we will set to ON.
    6. Finally, think the Part we are detecting under Virtual Part section.

  20. Repeat steps 15 and 16, but change the name to UnloadTrig1 and use the parameters below for this new sensor.

  21. Now we ill create the C# script used to simulate some of the motions required.
  22. Right-click "3D Visualization", go to Add and then select Shape Script.

  23. Open the Shape Script just created and add your Part to the script section below by left-click and dragging the part from the left hand side onto the script. Change the name from "Box" to "Part"

  24. Lets add the CreateObject function so that we can add the Part as part of the render list and define the function inputs to the same as the image below.
    1. For further information about DefaultFunctions library, please refer to manual W618, Appendix A-1 Functions Used in Shape Scripts
  25. Within the Render section we will add the initializations and functions required for part movement as well as loading and unloading the part.
    1. Define Conveyor and Part by performing the same operation as previously, which is left-click object from the left and drop onto the C# code script at the locations shown below next to 1. Note: will need to change the names as well for each object.
    2. Initialize the objects as well as the Conveyor using the functions below next to section 2. Note: the functions come form the toolbox.
    3. Create a string variable and set it to "new_Controller_0". This is so that if we decide to change the controller name we can just change this string and we don't have to update the name at each location used.
    4. Finally, we define the functions used for loading and operation. LoadPart will de used to load a new Part in the 3D model when the P2PTrigg variable at the controller changes from OFF to ON.
      MoveObjectOnMechnicalConveyor does the work for us and moves the Part loaded on the conveyor based on the current velocity of the axis.
      UnloadPart will remove the part from the 3D model once the Ax1UnloadTrig changes from OFF to ON, which is actually linked to our Virtual Sensor at the moment.
  26. Final step will be to create a Shape Script Sequence.
  27. Right-click on "3D Visualization" and select "Create/Update Part Detection Sensor Scripts and Settings". This will do 2 things, create Shape Script for the Virtual Sensors that we don't need to modify or add to. Second thing create is a  Shape Script Sequence to which we can add our custom Shape Script.
  28. Double click on "__VirtualOutputSequence_new_Controller_0" and add our Shape Script to the sequence by clicking on the + symbol shown in the image below and then allocating our script to the new slot.
  29. Now we have completed the setup of the Simulation. Watch link shared at the end of this article to see how we can simulate the 3D model and Controller together.
Delete

https://youtu.be/hfQBO_vUKsQ





 

 

Start a Conversation
This conversation is closed
Uploading...