PROFINET - Siemens SIMATIC S7 PLC

This topic provides instructions on setting up the Standard Interface communication based on the PROFINET protocol between a Siemens SIMATIC S7 PLC and Mech-Mind Software Suite.

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.

../../../../_images/hardware.png

Software

  • Siemens TIA Portal V15.1

  • Mech-Mind Software Suite: 1.7.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 xxx\Mech-Mind Software Suite-x.x.x\Mech-Center\Robot_Interface\PROFINET in the installation directory of Mech-Mind Software Suite

    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 stored in xxx\Mech-Mind Software Suite-x.x.x\Mech-Center\Robot_Interface\PROFINET\Programming Samples\Siemens TIA Portal S7-1200 PLC PROFINET in the installation directory of Mech-Mind Software Suite.

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

  1. Check the PCI-e slot on the IPC and make sure the HMS IXXAT INpact 40 interface card is installed.

    ../../../../_images/check_pcie_1.png
  2. Make sure the driver software is installed on the IPC: in Device Manager, find VCI4 INpact PCIe under IXXAT VCI V4 Interfaces.

    ../../../../_images/check_pcie_2.png

Set up “Robot and Interface Configuration” in Mech-Vision

  1. Click Robot and Interface Configuration on the toolbar of Mech-Vision.

  2. Select Listed robot from the Select robot drop-down menu, and then click Select robot model.

  3. Select the robot model that you use, and then click Next.

  4. Select the following options and click Apply.

    • Interface Type: Standard Interface

    • Protocol: PROFINET-IRT

  5. Make sure the Interface Service is started: on the toolbar of Mech-Vision, the Interface Service switch on the far right is flipped and turned to blue.

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.

  1. Open TIA Portal and click Create new project.

  2. Put in Project name and Path, and then click Create. Click Open the project view in the pop-up page.

    ../../../../_images/create_plc_project_11.png
  3. 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.

    ../../../../_images/create_plc_project_21.png
  4. 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 ethernet_icon in PLC_1.

    ../../../../_images/create_plc_project_31.png
  5. Down in the Properties ‣ General tab, click Ethernet address to set the IP address of the PLC.

    ../../../../_images/create_plc_project_41.png

Install GSD File and Configure Network

  1. In the menu bar, select Options ‣ Manage general station description files (GSD).

    ../../../../_images/install_gsd_file_1.png
  2. 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.

    ../../../../_images/install_gsd_file_2.png

    Note

    The GSD file can be found in the Mech-Mind IPC. The GSD file is located in xxx\Mech-Mind Software Suite-x.x.x\Mech-Center\Robot_Interface\PROFINET in the installation directory of Mech-Mind Software Suite. Copy the PROFINET folder to the computer on which the TIA Portal is installed, and click on to locate the folder.

  3. 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.

    ../../../../_images/install_gsd_file_3.png
  4. In Network view, click ethernet_icon in PLC_1 and drag it to ethernet_icon in mechmind-pir, and release the button when a black connection line appears.

    ../../../../_images/install_gsd_file_4.png

    A successful connection should look like this:

    ../../../../_images/install_gsd_file_5.png
  5. Click ethernet_icon in mechmind-pir, down in the Properties ‣ General 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.

    ../../../../_images/install_gsd_file_6.png
  6. Click the green connection line, and then click assign_icon.

    ../../../../_images/install_gsd_file_7.png
  7. In the pop-up window, select mechmind-pir for PROFINET device name, and then click Update list.

  8. 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.

    ../../../../_images/install_gsd_file_8.png
  9. Double-click mechmind-pir to enter Device view. You can see all the available modules listed.

    ../../../../_images/install_gsd_file_9.png

Download Hardware Configuration to PLC

  1. In Project tree panel, right-click PLC_1, and select Download to device ‣ Hardware configuration.

    ../../../../_images/download_to_plc_1.png
  2. In the pop-up window, select Show all compatible devices for Select target device, and then click Start search.

    ../../../../_images/download_to_plc_2.png
  3. Select the corresponding device in the search result, and click Load.

    ../../../../_images/download_to_plc_3.png

Check Communication

  1. Return to the project, and click PLC_1 in the Project tree panel. Then, click Go online on the toolbar.

    ../../../../_images/check_communication_11.png
  2. 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.

    ../../../../_images/check_communication_2.png
  3. The PLC is successfully connected if the following message is displayed in the Console tab of Mech-Vision Log panel:

    Connect to PROFINET-IRT controller successfully

Note

If you don’t see this log message, please check:

  • If the hardware is properly connected;

  • If the Interface Service has been started successfully in Mech-Vision;

  • 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

  1. Select PLC_1 in the Project tree panel, and then click Go offline on the toolbar.

    ../../../../_images/import_example_program_13.png
  2. 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.

    Note

    For a module occupying multiple bytes, the addresses assigned must be continuous, and the module start address must be of an even number.

    ../../../../_images/import_example_program_21.png
  3. 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 import_icon to import tags.

    ../../../../_images/import_example_program_31.png
  4. Click to the right of the input field, and locate the PLCTags.xlsx file. Click OK to import the CameraIO tag table.

    ../../../../_images/import_example_program_41.png

    The window should look like the figure below if the tags are imported successfully.

    ../../../../_images/import_example_program_51.png
  5. In the Project tree panel, double-click External source files, and then double-click Add new external file.

    ../../../../_images/import_example_program_61.png
  6. In the pop-up window, locate and select the Camera_IO.scl and MM Profinet Interface Program.scl files. Click Open to import these files.

  7. Select the two imported external files and then right-click these files. In the right-click menu, select Generate blocks from source.

    ../../../../_images/import_example_program_71.png
  8. A message saying that blocks can be overwritten will pop-up. Select OK in the pop-up window.

    ../../../../_images/import_example_program_81.png
  9. 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.

    ../../../../_images/import_example_program_91.png
  10. 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.

    ../../../../_images/import_example_program_101.png
  11. Select all the newly generated functions and data blocks, and move them to the 3D_Camera group.

    ../../../../_images/import_example_program_111.png

Build Program and Download to PLC

  1. 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.

    ../../../../_images/build_program_11.png
  2. In the Project tree panel, right-click PLC_1, and select Download to device ‣ Hardware and software (only changes).

    ../../../../_images/build_program_21.png
  3. 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.

  4. Select the corresponding device in the search result, and click Load.

  5. Once the program is downloaded successfully, select PLC_1[CPU 1211C DC/DC/DC] in the Project tree panel, and click Go online.

    ../../../../_images/build_program_31.png
  6. In the Project tree panel, double-click Program blocks ‣ CameraIO[DB1] and then click monitor_icon. 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.

    ../../../../_images/build_program_41.png

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):

    • Executable

    • Set to autoload: right-click the solution and select Autoload Solution. Projects in the solution are also autoloaded.

  • Mech-Viz project:

    • Executable

    • Set to autoload: right-click the project name in Resources and select Autoload Project

    • Contains a “Branch by Msg” Step that has been renamed to 1.

Obtain Vision Points from Mech-Vision

  1. 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.

  2. 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.

  3. Change the port value of Vision_Proj_Num to the ID of the Mech-Vision project you wish to run. For example, if the value is changed to 1, then project No. 1 in Mech-Vision will be started.

  4. 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.

  5. Set the type of pose 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.

    ../../../../_images/vision1.png
  6. 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.

    ../../../../_images/vision2.png
  7. Drag MM_Get_VisData function to the Main Program/Network 3.

    ../../../../_images/vision3.png
  8. Change the port value of Vision_Proj_Num to the ID of the Mech-Vision project you wish to run. For example, if the value is changed to 1, then project No. 1 in Mech-Vision will be started.

  9. 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.

    ../../../../_images/vision4.png
  10. In the project tree sidebar, right-click to select the device PLC_1, and click Download to device, and click Software (only changes).

  11. The Download Preview window will pop up. Click Load` to download the latest program to the PLC.

Trigger the Mech-Viz Project to Run

  1. In the Main[OB1] main program window, click the button marked in red frame below to enable monitoring.

    ../../../../_images/monitoring1.png
  2. Right-click the variable Camera_User.Start_Empty on the input side of MM_Empty_Target, select Modify ‣ Modify to 1, clear the most recently acquired vision result, and reset this variable.

  3. In the Camera_User data block, the Target Pose variable value is cleared.

    ../../../../_images/cleared_pose.png
  4. Right-click the variable Camera_User.Start_Viz on the input side of MM_Start_Viz, select Modify ‣ Modify to 1, start the Mech-Viz project, and reset this variable.

  5. 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 Troubleshooting for troubleshooting.

    ../../../../_images/status_code.png

Set Mech-Viz Branch Exit

  1. Right-click the variable Camera_User.Set_Branch on the input side of MM_Set_Branch, select Modify ‣ Modify to 1, select the Mech-Viz branch exit, and reset this variable.

  2. 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 Troubleshooting 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 Modify ‣ Modify to 1, get the planned path of Mech-Viz, and then reset this variable.

  1. 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 Troubleshooting for troubleshooting.

  2. The return value of the Target_Pose variable in the Camera_User data block is shown in the figure below.

    ../../../../_images/target_pose.png