PROFINET - Siemens SIMATIC S7 PLC¶
This section provides information on setting up communication between a Siemens SIMATIC S7 PLC and Mech-Mind Software Suite via PROFINET.
Hardware and Software Requirements¶
Hardware¶
Siemens SIMATIC S7 PLC:
S7-300 (with PROFINET interface or CP 343-1 integrated to function as a PROFINET IO controller)
S7-400 (with PROFINET interface or CP 443-1 integrated to function as a PROFINET IO controller)
S7-1200
S7-1500
AC 220 V to DC 24 V power adapter
HMS IXXAT INpact 40 interface card installed on the IPC in Mech-Mind Vision System
Switch
Ethernet cables
Note
This example adopts S7-1200, CPU 1211C.
The hardware connection is as follows.
Software¶
Siemens TIA Portal V15.1
Mech-Mind Software Suite: Mech-Center 1.5.1 or above, Mech-Vision 1.5.0 or above, and Mech-Viz 1.5.0 or above.
VCI V4 (driver software for HMS IXXAT INpact 40 interface card)
GSD file:
GSD device description file: GSDML-V2.35-MM-PIR-20220315.xml. If the GSD file version is upgraded, the version or date may differ.
The GSD file is located in the PROFINET folder under the Mech-Center installation path: XXXX/Mech-Center-xxx/Robot_Interface/
Note
Copy this file to the computer with Siemens TIA Portal installed.
PLC Example programs:
Camera_IO.scl (fundamental PROFINET IO communication module)
MM Profinet Interface Program.scl (for functions of various interface commands)
PLCTags.xlsx (Mech-Mind System Variable Table).
The example files are located in the folder in the installation path of Mech-Center: XXXX/Mech-Center-xxx/Robot_Interface/PROFINET/Programming Samples/Siemens TIA Portal S7-1200 PLC PROFINET
Please copy the example file to the computer on which the TIA Portal is installed.
Configure IPC and Initiate Communication¶
Check PCI-e Card and Driver Software¶
Check the PCI-e slot on the IPC and make sure the HMS IXXAT INpact 40 interface card is installed.
Make sure the driver software is installed on the IPC: in Device Manager, find VCI4 INpact PCIe under IXXAT VCI V4 Interfaces.
Configure Mech-Interface in Mech-Center¶
Open Mech-Center, and click Deployment Settings.
Go to Mech-Interface, check Use Mech-Interface and select Standard Interface.
In Interface Options, select PROFINET-IRT, and then click Save.
Click Start Interface in the toolbar.
Install GSD File and Configure Communication¶
Create PLC Project and Set IP Address¶
Hint
If needed, click Save project to save the changes to the project.
Open TIA Portal and click Create new project.
Put in Project name and Path, and then click Create. Click Open the project view in the pop-up page.
In the Project tree panel, double-click Add new device. In the new window, click Controller, and find the CPU module you are using, and name it in Device name. Click OK to confirm adding the device. Here, the device is named PLC_1.
Select Device configuration under PLC_1 in the Project tree panel, and then click Device view tab on the right. In this tab, double-click in PLC_1.
Down in the
tab, click Ethernet address to set the IP address of the PLC.
Install GSD File and Configure Network¶
In the menu bar, select
.In the pop-up window under Installed GSDs tab, click … to the right of Source path. Locate the path where the Mech-Mind GSD file is stored. Check this file in Content of imported path, and then click Install. Close the window after the installation completes.
Return to Device configuration, and go to Network view tab. Click Hardware catalog, and double-click DAP under General/Mech-Mind Robotics Technologies Ltd/MechMind-PIR to display mechmind-pir in Network view.
In Network view, click in PLC_1 and drag it to in mechmind-pir, and release the button when a black connection line appears.
Click in mechmind-pir, down in the tab, click Ethernet address to set the IP address of the IPC. This IP address should be in the same subnet as that of the PLC. Make sure Generate PROFINET device name automatically is checked.
Click the green connection line, and then click .
In the pop-up window, select mechmind-pir for PROFINET device name, and then click Update list.
When the device appears in the list, check whether the PROFINET device name is mechmind-pir. If not, click Assign name. Once Status is OK, click Close to close the window.
Double-click mechmind-pir to enter Device view. You can see all the available modules listed.
Download Hardware Configuration to PLC¶
In Project tree panel, right-click PLC_1, and select
.In the pop-up window, select Show all compatible devices for Select target device, and then click Start search.
Select the corresponding device in the search result, and click Load.
Check Communication¶
Return to the project, and click PLC_1 in the Project tree panel. Then, click Go online in the toolbar.
In the Project tree panel, click Device configuration, and then click Device view tab on the right. Select mechmind-pir. In Device overview, check marks with a green background in front of module names indicate normal connection.
The PLC is successfully connected to Mech-Center if the following message is displayed in Mech-Center Log panel:
Note
If you don’t see this log message, please check if:
The hardware are properly connected;
If Mech-Interface has been started by clicking on Start Interface in the toolbar;
If the hardware configuration has been downloaded to the PLC.
Import Example Program and Download to PLC¶
Note
Before you add the example program to a project already in use, it is recommended to import it to a new project and test it first. In the following steps, the project created earlier is used to import and test the example program.
Import Example Program Files¶
Select PLC_1 in the Project tree panel, and then click Go offline in the toolbar.
In Network view, double-click mechmind-pir to enter Device view. Change the I addresses and Q addresses according to the actual requirement. Here, 500 is used as the lowest module start address.
In Project tree panel, double-click PLC tags under PLC_1, and then double-click Show all tags to open the PLC tags window. Then, click to import tags.
Click … to the right of the input field, and locate the PLCTags.xlsx file. Click OK to import the CameraIO tag table.
The window should look like the figure below if the tags are imported successfully.
In the Project tree panel, double-click External source files, and then double-click Add new external file.
In the pop-up window, locate and select the Camera_IO.scl and ObtainPose.scl files. Click Open to import these files.
Select the two imported external files and then right-click these files. In the right-click menu, select Generate blocks from source.
A message saying that blocks can be overwritten will pop-up. Select OK in the pop-up window.
The functions and data blocks generated from external source files are shown in the figure below. Camera_User[DB2] stores user data. The variable address of CameraIO[DB1] in the variable table must be consistent with the modified starting address in the device configuration.
In the project, to facilitate the maintenance of functions and data blocks, select Program blocks, right-click and select Add new group, and name it 3D_Camera.
Select all the newly generated functions and data blocks, and move them to the 3D_Camera group.
Build Program and Download to PLC¶
In the Project tree panel, double-click the Main OB in Program blocks to open it. Then, select the Camera_IO FC and drag it to Network 1.
In the Project tree panel, right-click PLC_1, and select
.In the pop-up window, select Show all compatible devices for Select target device, and then click Start search to download the program to PLC.
Select the corresponding device in the search result, and click Load.
Once the program is downloaded successfully, select PLC_1[CPU 1211C DC/DC/DC] in the Project tree panel, and click Go online.
In the Project tree panel, double-click . Double-click to expand FromCamera. If the monitor value of HEARTBEAT keeps changing, then the I/Q addresses of modules in mechmind-pir have been successfully transferred to the CameraIO FB.
and then click
Test with Mech-Vision/Mech-Viz Project¶
This section introduces how to run the Mech-Vision/Mech-Viz project and obtain data from the project using the MM Profinet Interface Program FB. For detailed information on the modules, please refer to PROFINET.
Prerequisites¶
Mech-Vision project(s):
Mech-Viz project:
Executable
Set to autoload
Contains a branch_by_msg Task that has been renamed to 1.
Obtain Vision Points from Mech-Vision¶
Establish communication: in the CameraIO DB, double-click the monitor value of COMM_ENABLE in ToCamera. If a warning message pops up, click Yes to confirm changing the monitor value.
In the Project tree panel, double click Main [OB1] to open the main program, and drag the “MM_Start_Vis” function to the main program/block 2.
Set the Mech-Vision project number, which is the ID of the Mech-Vision project in Deployment Settings in Mech-Center. Set the port value of Vision_Proj_Num to 1 so that the Mech-Vision project whose ID is 1 will be run.
Set the number of poses returned by the Mech-Vision project: set the port value of Req_Pose_Num to 0, indicating that Mech-Vision returns all pose results.
Set the image-capturing pose type sent from the robot. Set the port value of Robot_Pose_Type to 0, indicating that the project is in the Eye to Hand mode, and there is no need to send the image-capturing pose. If the project is in Eye in Hand mode, please set the Robot_Pose_Type port value to 1, and set the current robot flange pose to the Robot_Pose port.
Under the project tree/program block, click the data block Camera_User, and drag the variables under the detailed view to the input side interface (the left side) of MM_Start_Vis according to the names.
Drag MM_Get_VisData function to the Main Program/Network 3.
Set the Mech-Vision project number, which is the ID of the Mech-Vision project in Deployment Settings in Mech-Center. Set the port value of Vision_Proj_Num to 1 so that the vision result from the Mech-Vision project whose ID is 1 will be obtained.
Under the project tree/program block, click the data block Camera_User, and drag the variables under the detailed view to the input side interface (the left side) of MM_Get_VisData according to the names.
In the project tree sidebar, right-click to select the device PLC_1, and click Download to device, and click Software (only changes).
The Download Preview window will pop up. Click Load` to download the latest program to the PLC.
Trigger the Mech-Viz Project to Run¶
In the Main[OB1] main program window, click the button marked in red frame below to enable monitoring.
Right-click the variable Camera_User.Start_Empty on the input side of MM_Empty_Target, select
, clear the most recently acquired vision result, and reset this variable.In the Camera_User data block, the Target Pose variable value is cleared.
Right-click the variable Camera_User.Start_Viz on the input side of MM_Start_Viz, select
, start the Mech-Viz project, and reset this variable.Check that the return value of the STATUS_CODE variable in the CameraIO data block becomes 2103, which means that the project starts normally. If the return value is 20XX, please refer to Status Codes and Trouble Shooting for troubleshooting.
Set Mech-Viz Branch Exit¶
Right-click the variable Camera_User.Set_Branch on the input side of MM_Set_Branch, select
, select the Mech-Viz branch exit, and reset this variable.Check that the return value of the STATUS_CODE variable in the CameraIO data block becomes 2105, which means that the branch is set. If the return value is 20XX, please refer to Status Codes and Trouble Shooting for troubleshooting.
Get Planned Path from Mech-Viz¶
Right-click the variable Camera_User.Get_VizData on the input side of MM_Get_VizData, select
, get the planned path of Mech-Viz, and then reset this variable.Check that the return value of the STATUS_CODE variable in the CameraIO data block becomes 2100, which means that the planned path is obtained. If the return value is 20XX, please refer to Status Codes and Trouble Shooting for troubleshooting.
The return value of the Target_Pose variable in the Camera_User data block is shown in the figure below.