Connection Instructions scanCONTROL PROFINET Integration via 2D/3D Gateway II Interface module Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET Contents 1. General ................................................................................................................................................................................................ 3 2. System setup ...................................................................................................................................................................................... 3 2.1 Components ........................................................................................................................................................................................ 3 2.2 Network structure example .................................................................................................................................................................. 3 2.3 Supply Voltage..................................................................................................................................................................................... 4 3. Sensor configuration ........................................................................................................................................................................... 4 3.1 Changing interface to gateway ............................................................................................................................................................ 5 3.2 Assigning measurement values to the gateway registers.................................................................................................................... 6 3.3 Save settings to the sensor ................................................................................................................................................................. 7 4. Gateway configuration ........................................................................................................................................................................ 7 4.1 Configuration of the secondary network (sensor side) ........................................................................................................................ 7 4.4 Configuration of the primary network (PLC side) ............................................................................................................................... 12 4.5 Generating a GSDML File .................................................................................................................................................................. 13 4.6 Load the settings to the gateway ....................................................................................................................................................... 14 4.7 Check the configuration..................................................................................................................................................................... 15 5. Performance ...................................................................................................................................................................................... 16 6. Communication with a PLC ............................................................................................................................................................... 16 6.1 Integration .......................................................................................................................................................................................... 16 6.2 Interpretation of data / sensor control................................................................................................................................................ 20 7. Transmit the gateway configuration data to other devices via memory card .................................................................................... 21 8. LEDs .................................................................................................................................................................................................. 23 8.1 Location of the LEDs on the device ................................................................................................................................................... 23 8.2 LED SYS ............................................................................................................................................................................................ 23 8.3 LED APL ............................................................................................................................................................................................ 24 8.4 LEDs PROFINET IO Device ............................................................................................................................................................... 24 8.5 LEDs OpenModbus/TCP ................................................................................................................................................................... 25 2 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 1. General This document shows how to integrate scanCONTROL sensors into PROFINET environments using the 2D/3D Gateway. To ensure bi-directional communication with the sensor, the gateway uses Modbus/TCP. In this way, measuring values can be requested and control commands can be sent. Thus no sensor functionality is lost when using the gateway. In the following the necessary settings in scanCONTROL Configuration Tools, the configuration of the gateway and the integration into TwinCAT will be shown. 2. System setup 2.1 Components scanCONTROL SMART Sensor scanCONTROL Configuration Tools 2D/3D Gateway II Hilscher SYCON.net system configurator Ethernet switch (optional) PLC/PC as fieldbus master Windows-PC 24V power supply unit For correct installation of the software components, please consider the installation guides coming with the different software packages. 2.2 Figure 1: 2D/3D Gateway II Network structure example In this example, the scanCONTROL SMART sensor is connected to the X3 Ethernet port of the gateway. At X2, the fieldbus master (in this case a Siemens PLC) is connected. The two X3 ports are switched each and have a maximum transfer rate of 100 Mbit/s. Therefore, the choice of the port doesn’t make any difference. The X3 ports are used for the Modbus connection and X2 for PROFINET connection. Figure 2: Schematic network structure As long as the transfer rate is less than 100 Mbit/s, the sensor can be configured via the second X3 port of the gateway. Operating a second sensor is also possible with the second X3 port. If you want to integrate three or four sensors via the gateway, a gigabit-ready Ethernet switch is necessary. If no switch is available, you can configure the sensor via a direct Ethernet connection between the PC 3 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET and the subscriber and, if necessary, subsequently reconnect to the next participant. When using a switch, please make sure if the device can handle the amount of communication data. Figure 3: Alternative network structure, using several sensors an Ethernet switch will be required 2.3 Supply Voltage Figure 4: Extract from the user manual “netTAP NT 151-RE-RE Real-Time Ethernet gateway“ to be found at www.hilscher.com 3. Sensor configuration To enable the gateway to request measuring values from the sensor, the sensor has to be correctly configured. How to do this with scanCONTROL Configuration Tools 6.7 is shown below. An already fully configured measuring task (e.g. an offset or angle measurement) is necessary. The following steps are then necessary to configure the sensor. 4 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 3.1 Changing interface to gateway 1. 2. 3. Click “Outputs and Results” on the start screen. Change to the “Advanced…” menu and select the “Interface” tab. In “Interface/protocol” choose the “Gateway” option; afterwards click “OK”. Figure 5: Protocol settings 5 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 3.2 Assigning measurement values to the gateway registers 1. 2. 3. Change to the tab “Gateway out” and click “Signals”. Click the “+”-button to add new values and choose the value type in the drop-down menu. Then the register assignment is displayed next to the drop down menu. If necessary, you can delete values with “–” or change the position/register assignment by drag & drop of the symbol at the beginning of the line. Confirm with “OK”. Figure 6: Register assignment 6 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 3.3 Save settings to the sensor 1. 2. Click the button “Save parameters to scanCONTROL” Choose the “User mode” and confirm with “OK”. Figure 7: Save user mode 4. Gateway configuration To configure the gateway the Hilscher SYCON.net system configurator is needed. It is included in the Gateway Solutions DVD, which is available under hilscher.com/downloads. 4.1 Configuration of the secondary network (sensor side) The following configuration steps are necessary for every type of communication / primary fieldbus: • General settings 1. Connect the gateway to a PC via USB cable. 2. Open the Sycon.net software and log in as admin user. If the software is opened for the first time, a new admin user can be created by choosing a user name and a password. 3. Create a new Project with “File”-> “New” and save it with “File” –> “Save as…”. 4. Search for “NT 151-RE-RE” in the search bar on the right side. 5. Add the “NT 151-RE-RE” device to the project via drag-and-drop. Double-click the pictogram. 7 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET Figure 8: Add NT 151 6. You can add a physical device to the project in “Device Assignment”. If necessary, click “Scan” and then select the correct device. The device has to be listed under “suitable only”. “Apply” will confirm the settings. If the device is not found, following actions can help: checking the USB-connection and the drivers, selection of the COM Port in “netX Driver”, restarting the ODMV3 service. Further information and support can be found in the Hilscher documentation. Figure 9: Device assignment 8 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 4.2 Modbus/TCP configuration Regardless of the target fieldbus protocol, first the Modbus/TCP connection with the sensor has to be established: 1. 2. Double-click the gateway pictogram in the main view. Select “Settings” in the pop-up window. For the “Secondary network (Port X3)” select “Open Modbus/TCP”. Then confirm with “OK”. Figure 10: Select secondary network 3. 4. 5. Back in the main view, right-click the gateway and select “Configuration” “Open Modbus/TCP”. In “Configuration” change the “Protocol mode” to “Client” and “Data swap” to “No”. Deselect “DHCP” and check the “Enable” boxes. Now you can enter the desired IP configuration. Please make sure that the X3 port of the gateway is in the same subnet as the sensor(s). Figure 11: Configuration of Open Modbus/TCP 9 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 6. 7. 8. To add Modbus commands, change to the “Command Table” section and click “Add” once for each new command. These commands are basically telling the sensor how to communicate with the sensor(s). For each command, enter the IP addresses of the sensor(s). It is not recommended to operate more than 4 sensors on one gateway. The max. frequencies with which the data can be polled from the sensors directly depend on the number of sensors connected (refer to chapter 5 for more details). The function code “Read Input Registers” reads the 32 measurement registers (“Register/Coilanzahl”) of the the sensor. By setting the cycle time to 0 ms the values will be fetched as fast as possible. Function code “Preset Multiple Registers” enables controlling the sensor by writing on the Holding Registers 32-37. Therefore the Trigger should be set to “Changed Data”. Therewith the command is only executed if new data was received on the primary network. Furthermore the function code “Read Holding Registers” makes it possible to read Holding Registers 36 & 37. Through this the GETQ command can be used to get settings of the sensor(s). The cycle time can be selected freely. Click “Apply” to confirm. If the 2D/3d Gateway should communicate with several sensors, the listed function codes (8) have to be duplicated with accordingly adjusted IP addresses (7). Figure 12: Command Table Open Modbus/TCP 10 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 4.3 Signal configuration 1. Then select “Signal Configuration” on the left in the navigation area. Here, the signals for the previously determined commands are reflected by modules. The “word area” module types are converted into “byte arrays” so that the signals can be associated with the individual bytes in the PROFINET network. 2. To do this, select the first line to show the module details. Right-click under “Type” and select “Edit Signal…”. 3. In the dialog box that appears, select “byte” as the new data type, set the number to 12, and put a check mark in the box next to “Apply as Array”. Figure 13: Signal configuration Change the remaining modules in an array of bytes with 64 elements and 4 elements. Figure 14: Signal configuration of the remaining modules 11 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 4.4 Configuration of the primary network (PLC side) Once the Modbus communication between gateway and sensor was configured, the PROFINET communication to the PLC has to be established. 1. 2. 3. Setting up the primary port as PROFINET IO Device and downloading the firmware Double-click the gateway pictogram in the main view. Select “Settings” in the pop-up window. For the “Primary network (Port X2)” select “PROFINET IO Device”. The needed firmware is automatically displayed in the “Available Firmware” box. Select it and then click “Download” and confirm the pop-up window. Click “OK” to close the window. If the firmware is not listed, the firmware can be selected manually from the Gateway Solutions DVD or the problem can be solved with a reinstallation of Sycon.net. It should be noted that the setup has to be started within the Gateway Solutions DVD. Therewith the firmware files can be copied from the Gateway Solutions DVD into the installation path. Figure 15: Select primary network and downloading firmware 12 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET Configuration of PROFINET IO Devices A configuration of the primary network is not necessary with PROFINET. The setting of the number of input and output bytes is done by the following automatic signal assignment. • Configure the signal mapping on the gateway 1. 2. Double-click the gateway pictogram in the main view. In the pop-up window select “Signal Mapping”. Select “From Port3 to Port2” in the field “Auto Mapping” and click "Apply". The signal assignment should like as follows: Figure 16: Signal mapping 4.5 Generating a GSDML File When the configuration of the 2D/3D Gateway II has been completed, it is necessary to generate the general station description file for the PROFINET IO controller. 1. In the main view, open the context menu by right-clicking the gateway icon and then select “Additional Functions” 2. “PROFINET IO Device” “Export GSDML”. When the operation is complete, select a storage location and save the file. 13 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET Figure 17: Export GSDML 4.6 Load the settings to the gateway 1. 2. Back in the main view, right-click the gateway icon and select “Download”. Confirm the download. Figure 18: Download configuration 14 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 4.7 Check the configuration 1. Back in the main view, right-click the gateway icon and select “Diagnosis” “Gateway”. 2. Check the general diagnosis window. Figure 19: Diagnosis 3. Check if the gateway sends/receives data. Figure 20: Diagnosis communication data 4. If everything works as expected save the project. 15 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 5. Performance This chapter states the maximum frequencies with which the gateway converts the measured values. To ensure valid performance tests a high-end PLC was used. I/O cycle times were set to 1 ms or less. All limits were empirically tested in a lab environment, so the maximum transmission frequencies might deviate in real-world applications. The maximum measurement frequencies depending on the number of sensors can be seen here: # Sensors 1 2 3 4 Max. measurement frequency 500 Hz 500 Hz 330 Hz 250 Hz 6. Communication with a PLC The integration of the gateway into an automation system based on a Siemens PLC will be shown with Step 7 V14. Furthermore, the basics of sensor data exchange are described. 6.1 Integration To establish a connection between gateway and Siemens PLC, the device has to be added as PROFINET IO Device in the TIA Portal. Therefore the previously created device description file of the gateway has to be installed. This already includes the modules which were specified in the gateway configuration. • Install device description file 1. Click “Options” and then “Manage general station description files (GSD)”. 2. In the window that appears, specify the folder in which the description file is located. Figure 21: Managing the General Station Description File 3. The available description files are then displayed. Choose the file for “NT 151-RE-RE” and click “Install”. 4. Then confirm by clicking “Close”. 16 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET Figure 22: Installing General Station Description File The 2D/3D Gateway II can be added to the hardware configuration as it is now part of the hardware catalog of the project. This example assumes a projected PLC. • Hardware configuration 1. Change to the hardware configuration by clicking “Devices & networks” and select the “Network view” tab. 2. Select the tab “Hardware catalog” on the right and mark the listed device in “Other field devices” “PROFINET IO” 3. “Gateway” “Hilscher Gesellschaft…” “netTAP 151”. Drag the gateway to the "Network view” and drop to add it to the hardware configuration. Figure 23: Adding Gateway 4. Project the PROFINET connection by selecting the gateway port and dragging and dropping to the port of the PLC. 17 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET Figure 24: Projecting Connection 5. Select the gateway in “Network view”. 6. Change to the settings of the Ethernet addresses in “Properties” “General” and assign an address for the PROFINET IO-Device. The device must be in the same address range as the PLC. Figure 25: Gateway PROFINET Interface 18 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET • Assigning Device Names When the device is configured, the device name and the IP address must be transferred to the PROFINET device. 1. 2. 3. To do this, right-click the gateway and select “Assign device name”. “Update list” Based on the MAC address, the gateway can be uniquely identified. Select the device “netTAP 151” and click “Assign name”. Figure 26: Assigning device name The settings are now complete. After transferring and downloading to the PLC, the Modbus register can be reached by 3DInspect via the gateway hardware addresses (see Figure 27). Figure 27: Gateway Hardware addresses 19 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 6.2 Interpretation of data / sensor control • Input data / Conversion of measurement values The input data represents the measurement values which are transmitted in sensor coordinates and therewith have to be converted to REAL values on the PLC side. To do this conversion the incoming data has to be interpreted as an integer and then put into a formula. Depending on the position and type of the data that will be transmitted, see register assignment (Figure 6) the data has to be interpreted the right way and depending on the type of the data the right formula has to be chosen. 20 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET Example: Following data will be transmitted: Figure 28: Example register assignment Therewith following values will be received at the 64 Byte Input module: Byte 1: Byte 2: Byte 3: Byte 4: Byte 5: Byte 6: 0 3 64 138 113 105 Calculation of profile number: The first 4 bytes represent the profile number (2 registers), those bytes have to be interpreted as 24 bit non signed integer. 0 * 2^24 + 3 * 2^16 + 64 * 2^8 + 138 = 213130 Calculation edge X: The bytes 5 & 6 represent the edge. Those bytes have to be interpreted as 16 bit non signed integer. 113 * 2^8 + 105 = 29033 The value then has to be put into the suitable formula with the suitable scaling factor (0.002 at scanCONTROL 30XX-50). y = (29033 – 32768) * 0,002 = -7,470 • Output data / sensor control Output data specifies a control command which will be sent to the sensor. The command is built of 6 registers respectively the twelve configured output bytes and consists of the following values. Bytes 1-2 Bytes 3-4 Bytes 5-6 Bytes 7-8 Bytes 9-10 Bytes 11-12 Function Access (write or read) Always 0 (reserve) Control register (lower 16 Bit) Control register (upper 16 Bit) Data (lower 16 Bit) Data (upper 16 Bit) Example: Switch off laser 0x0002 (SETQ = write) 0 0x0824 0xF0F0 0 0 The control registers addresses as well as the corresponding values can be found in the document OpManPartB. The document is part of the scanCONTROL documentation. For the conversion of the measurement values as well as the control of the sensor exists a TwinCAT example project. This should always be used as example for an own integration and doesn’t represent the ideal for every use case. 7. Transmit the gateway configuration data to other devices via memory card With the help of the memory card management of the gateway in SYCON.net, an already downloaded configuration can be copied together with the firmware from the internal loading memory to an SD memory card, which is plugged into the gateway. Afterwards the card can be removed and plugged into other gateways. As soon as the device is connected to the power supply, the configuration data on the memory card is transferred to the internal loading memory. In this way several gateways can be easily brought to the same configuration status without the need to connect the configuration PC to every single device. Therewith the SD-card also works as backup solution. 21 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET Prerequisites: • A FAT formatted SD-card. • Suitable configuration was created and downloaded to the 2D/3D Gateway • Windows PC with SYCON.net is connected via USB to the 2D/3D Gateway • 2D/3D Gateway is supplied with power Transfer configuration data to the memory card First the device assignment has to be checked or done. Therefore, the configured SYCON project has to be opened or a new project is opened and the device “NT 151-RE-RE” is added. 1. 2. 3. 4. 5. 6. In configuration mode, double-click the gateway icon in the main view. To change into configuration mode, right-click the gateway “Disconnect”. In “Device Assignment” a physical device can be added to the project. If necessary, click “Scan” and then select the correct device. “Apply” will confirm the settings. If the device is not found, following actions can help: checking the USB-connection and the drivers, selection of the COM Port in “netX Driver”, restarting the ODMV3 service. Further information and support can be found in the Hilscher documentation. Insert the SD memory card into the gateway until it locks into place. You may have to remove the write protection. Change to “Memory Card Management” in the navigation area. In the area “Directory” in the field “Folder” the data system of the loading memory of the gateway is displayed. The end of the list should contain the “SDMMC” data system of the SD memory. If not, the memory card has to be removed from the device and inserted again into the gateway. Then refresh the dialog window (e.g. briefly change to another element of the navigation area). Clicking “Backup” copies the data in the loading memory of the gateway to the SD memory card. This might take several minutes (please note to the clock symbol at the bottom of the dialog window). Confirm with “OK” and close SYCON.net. Figure 29: Memory card management Transfer configuration data with an SD memory card to another device 1. Remove the memory card from the first gateway and insert it in the other device. 2. Connect the device to the power supply or interrupt the power supply for a short time if it is already connected. 3. The device loads the configuration data from the memory card into its own loading memory. The SYS LED quickly flashes green and yellow for approx. eight seconds, then yellow for ten seconds, then the LED is off for a short time and finally it should stay green. The gateway automatically starts with the loaded firmware and configuration. 4. Remove the SD memory card from the 2D/3D Gateway. 22 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 8. LEDs This chapter describes the LEDs of the 2D/3D Gateways. More information can be found in the Gateway Solutions DVD. The tables and illustrations in this chapter are based on the mentioned document. 8.1 Location of the LEDs on the device 1 3 2 4 SYS APL 5 8.2 LED 1. 2. 3. 4. 5. 6. Protocol-specific LED (COM2) on X2 Protocol-specific LED (COM3) on X2 SYS LED (System LED) APL LED (Application LED) Protocol-specific LED (COM0) on X3 Protocol-specific LED (COM1) on X3 6 LED SYS Color green yellow yellow Status Meaning ON Device is initialized. See APL LED for further state diagnosis. ON The device hardware is defective and must be replaced. Flashing The device was not able to initialize itself. No bootloader was found in the loading memory. Perhaps the loading memory of the device is defective. In case a USB cable is plugged, pin 4 might be bridged with GND which would prevent the device from starting up. Flashing yellow/green 1 Hz Error state! Bootloader active. The firmware file is missing or corrupted. Make the device operable again using an SD memory card or USB. Flashing yellow/green 16 Hz Data are copied from the SD memory card to the internal loading memory. OFF Missing power supply or there is a hardware defect. SYS yellow/green yellow/green OFF 23 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 8.3 LED APL The APL LED shows the state of the gateway communication of the primary (X2) and the secondary real-time Ethernet network (X3) as well as the configurations state. LED Color green green green APL red red red 8.4 Status Meaning ON Communication at X2 and X3 is in a cyclical data exchange and the gateway function is being carried out. Flashing with 2 s off 0.5 s on Gateway is initialized but communication at X2 is not in a cyclical data exchange. Flashing with 2 s off 0.5 s on 0.5 s off 0.5 s on Gateway is initialized but communication at X3 is not in a cyclical data exchange. Flashing with 2 s off 0.5 s on Gateway is initialized but the configuration for the protocol at X2 is missing or the configuration is faulty. Flashing with 2 s off 0.5 s on 0.5 s off 0.5 s on Gateway is initialized but the configuration for the protocol at X3 is missing or the configuration is faulty. ON During initialization, the device has registered one of the following errors: Missing configuration Faulty configuration Internal error LEDs PROFINET IO Device LED Color OFF SF (System error) LED 1 red red OFF BF (Bus error) LED 2 red red Status Meaning OFF No error Flashing 1 Hz, 3 s DCP signal service is triggered by the bus. ON Watchdog time-out; channel, generic or extended diagnosis exist; system error OFF No error Flashing 2 Hz No data exchange ON No configuration; slow or no physical connection at all 24 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 8.5 LED LEDs OpenModbus/TCP Color Status Meaning ON Connected: OMB-Task communicates. At least one TCP connection is established. green Flashing 1 Hz Ready, not yet configured: OMB task ready, but not yet configured. green Flashing 5 Hz Waiting for Communication: OMB task configured. OFF Not Ready: OMB task not ready. OFF No communication error Flashing 2 Hz System error ON Communication error active green RUN LED 5 OFF OFF ERR LED 6 red red 25 Connection Instructions scanCONTROL // 2D/3D Gateway II // PROFINET 26 X9751453-A012062 MLR