Using MC_MoveLink function block
Sysmac Studio Motion Control
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
- Create a new project in Sysmac Studio based on your MAC unit.
- Add your servo systems to the EtherCAT network.
- Add your Motion Axes.
- Configure your servo axes. For this exercise I have used 1S Servo Systems with the following main settings
- Command pulse count per motor rotation is 8388608 (23-bit resolution)
- Axis 1/Work travel distance per motor rotation is 1000mm/rev
- Axis 2/Work travel distance per motor rotation is 360degree/rev
- Axis 2/Count mode is Rotary mode
- Axis 2/Modulo maximum position setting value is 360
- Axis 2/Modulo minimum position setting value is 0
MAC Programming
- Rename existing program to "ProgMoveLink" and the section to "Main".
- On the first rung program Enable Power function.
- Implement a routine to home the axes if they are not homed already.
- Implement velocity control for Master Axis.
- Finally, implement MoveLink operation.
- 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).
- Slave distance is the amount of travel the slave will perform based on the defined Master distance specified.
- 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.
- 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.
3D Simulation
- Add Application Manager to the project.
- Right click on "3D Visualization" and add "Mechanical Component".
- Select "Motor Rotation" as the type and then click on OK.
- Download the 3D model below and add this to the axis as prompted after clicking OK.
3D Wheel for Sysmac Simulation v1.step
- Left-click and drag "3D Wheel for Sysmac Simulation v1.step" onto "Motor" and then click Next >
- On the following window you can leave the current settings and click Next >.
- Select "new_Controller_0" under Select Controller and then under "Value" column on the table input your slave axis. Finally, click on Finish.
- Change the name of the Mechanical Component created to "Dial1"
- Now we will add the Conveyor. Right click on "3D Visualization" and add "Mechanical Component".
- Select "Conveyor" as the type and the click OK.
- Leave "Linear Direction Adjustment" as default and click on Next >.
- 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.
- Change the name of the Mechanical Component just created to "Conveyor1".
-
At this stage you should have the following 3D model, next we will look at adding the part we will detect
-
Right-click on "3D Visualization", then go to "Add" and under Add select "Box".
- Rename Box0 to Part1 and set the parameters below for it.
- Next, we will add the Virtual Sensors we will use to detect the part.
-
Right-click on "3D Visualization", then go to "Add" and under Add select "Virtual Part Detection Sensor".
-
Rename to "MoveTrig1" and set it to the following.
- Assuming it is a through beam sensor, length is the distance between the emitter and receiver. Set to 150.
- Offset the sensor from the Parent (Conveyor is the parent) by the amount specified in the image below.
- Set Parent to the Conveyor by left-click on ... button to the right of the input box.
- 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.
- Set the output required when the sensors is triggered, which in this case we will set to ON.
- Finally, think the Part we are detecting under Virtual Part section.
- Repeat steps 15 and 16, but change the name to UnloadTrig1 and use the parameters below for this new sensor.
- Now we ill create the C# script used to simulate some of the motions required.
- Right-click "3D Visualization", go to Add and then select Shape Script.
- 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"
-
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.
- For further information about DefaultFunctions library, please refer to manual W618, Appendix A-1 Functions Used in Shape Scripts
- For further information about DefaultFunctions library, please refer to manual W618, Appendix A-1 Functions Used in Shape Scripts
- Within the Render section we will add the initializations and functions required for part movement as well as loading and unloading the part.
- 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.
- Initialize the objects as well as the Conveyor using the functions below next to section 2. Note: the functions come form the toolbox.
- 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.
- 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.
- Final step will be to create a Shape Script Sequence.
- 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.
- 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.
- 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.
Example Video of MoveLink 3D Simulation Operation.