SICK VSPM-6F2113, VSPM-6F2113S19, VSPM-6F2313, VSPM-6F2313S20, VSPM-6F2413 Reference Manual

...
Inspector PIM60 ver 2.0
Vision sensor
REFERENCE MANUAL
WARNING
VSPM-6F2113 (Inspector PIM60), VSPM-6B2113 (Inspector PIM60 Base)
The Inspector is equipped with a LED illumination that must be considered as a lamp system of Risk Group 1 (low risk) according to IEC 62471:2006
LB<4 x 104W/(m2sr) within 100 s
LH<106W/(m2sr) within 10 s
WARNING: OPTICAL RADIATION DO NOT STARE INTO BEAM
RISK GROUP 1 (LOW RISK) according to IEC 62471:2006
Visible LED light λ = 400-800 nm
VSPM-6F2313 (Inspector PIM60-LUT)
The Inspector is equipped with a LED illumination that must be considered as a lamp system of Risk Group 1 (low risk) according to IEC 62471:2006
ES< 3 x 10-3W/m2within 104s
E
< 33 W/m2within 300 s
UVA
LR< 7 x 106W/(m2sr) within 10 s
WARNING: OPTICAL RADIATION DO NOT STARE INTO BEAM
RISK GROUP 1 (LOW RISK) according to IEC 62471:2006
UV LED light λ = 385 nm
VSPM-6F2413 (Inspector PIM60-IR), VSPM-6B2413 (Inspector PIM60-IR Base)
The Inspector is equipped with an LED illumin­ation that must be considered as a lamp system of Risk Group 0 / Free Group (exempt risk) ac­cording to IEC 62471:2006
EIR< 100 W/m2within 103s
LIR< 1.2 x 106W/(m2sr) within 103s
NOTICE: IR EMITTED FROM THIS PRODUCT
RISK GROUP 0 (EXEMPT RISK) according to IEC 62471:2006
IR LED light λ = 850 nm
DISCLAIMER
SICK uses standard IP technology for its products, e.g. IO Link, industrial PCs. The focus here is on providing avail­ability of products and services. SICK always assumes that the integrity and confidentiality of data and rights involved in the use of the above-mentioned products are ensured by customers themselves. In all cases, the appropriate security measures, e.g. network separation, firewalls, antivirus protection, patch management, etc., are always im­plemented by customers themselves, according to the situation.
©SICK AG 2013-11-28
All rights reserved
8015726/2013-11
Subject to change without notice
0.1.0.105
Reference Manual
Inspector PIM

Table of Contents

Inspector PIM60
Introduction 5
1 Introduction ................................................. ......................................... 6
1.1 Interfaces overview . .. .. .. .. .. .. .. .. .. ................................................. 6
1.2 Intended readers ....................................................................... 6
Interfaces 7
2 I/O extension box .................................................................................. 8
2.1 Physical network connection ........................................................ 8
2.2 Configuration of the IP address on the I/O extension box ................. 8
2.2.1 Basic configuration of the IP address ........ .. .. .. .. .. .. .. .. .. .. 9
2.3 Setup of the I/O extension box in the SOPAS Single Device applica-
tion .... .. .. .. .. .. .. .. .. .. .. .................................................................. 9
2.3.1 Enabling the I/O extension box ................................... 10
2.4 Input and output connections .................................................... 10
2.4.1 Special conditions during startup .. ............................. 10
2.4.2 Connection to the I/O extension box lost during opera-
tion ...................... .. .. .. .. .. .. .. .. .. .. .. ............................ 11
2.4.3 Object selection with I/O extension box ....................... 11
2.4.4 Timing issues ........................................ .. .. .. .. .. .. .. .. .. 11
2.4.5 Use of the digital outputs for logic .............................. 11
2.4.6 Change of Modules in the I/O extension box ................ 11
2.5 Troubleshooting ........ .. .. .. .. .. .. .. .. .. .. ........................................... 11
2.5.1 The I/O LED flashes 10 times .................................... 11
2.5.2 No contact with the I/O extension box ......................... 11
2.5.3 High number of unanswered requests to the I/O exten-
sion box . .. .. .. .. .. .. .. .. .. .. ............................................. 12
3 Web interface ............................................. ......................................... 13
3.1 Introduction ....................................................................... .. .. .. 13
3.2 Get results via Web API ...... .. .. .. .. .. .. .. .. .. .. ................................... 13
3.2.1 Live image ........... .. .. .. .. .. .. .. .. .. .. .. .............................. 13
3.2.2 Detailed results .................... .. .. .. .. .. .. .. .. .. .. ............... 13
3.2.3 Synchronize live image with result .............................. 14
3.2.4 Logged images ........................................................ 14
3.2.5 Statistics .. .. .. .. ......................................................... 15
3.3 Control the sensor via Web API ... .. .. .. .. .. .. .. .. ................................ 15
3.3.1 Basic principles ............................................ .. .... .. .. . 15
3.3.2 Command syntax ..................................................... 15
3.3.3 Current reference object ........................................... 16
3.3.4 Backup and restore configuration ............................... 16
3.4 Create custom web pages . .. ...................................................... 17
3.4.1 Example: Display live image .. .. .. ................................. 19
3.5 Handle the Web API ........................ .. .. .. .. .. .. .. .. .. ........................ 21
4 Ethernet Raw ................... ...................................................... ............. 22
4.1 Introduction ....................................................................... .. .. .. 22
4.1.1 Port interval ............................................................ 22
4.2 Get results via Ethernet Raw .. .. .. .. .. .. .. .. .. .................................... 22
4.2.1 TCP versus UDP . .. .. .. .. .............................................. 22
4.2.2 ASCII versus binary ................................................... 22
4.2.3 Attributes .................................... .. .. .. .. .. .. .. .. .. .. .. .. .... 23
4.2.4 Example formatting strings . .. .. ................................... 23
4.3 Control the sensor via Ethernet Raw ........................................... 26
4.3.1 Basic principles ............................................ .. .... .. .. . 26
4.3.2 Command syntax ..................................................... 26
8015726/2013-11
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
3
Inspector PIM60
Reference Manual
Inspector PIM
4.3.3 Select reference object .................................. .. .. .. .. .. . 27
4.3.4 Image triggering ....................................................... 27
4.3.5 Single port solution .................................................. 27
5 EtherNet/IP ............................. ........................................................... 28
5.1 Introduction ....................................................................... .. .. .. 28
5.2 Get results via EtherNet/IP ........................................................ 28
5.2.1 Attributes .................................... .. .. .. .. .. .. .. .. .. .. .. .. .... 28
5.2.2 Example formatting strings . .. .. ................................... 28
5.3 Control the sensor via EtherNet/IP . .. .. .. ...................................... 33
5.3.1 Basic principles ............................................ .. .... .. .. . 34
5.3.2 Command syntax ..................................................... 34
5.3.3 Select reference object .................................. .. .. .. .. .. . 34
5.3.4 Image triggering ....................................................... 35
5.3.5 Input assemblies, result channel . ............................... 35
5.3.6 Assemblies command channel ................................... 36
Appendix 38
A Result output formatting ...................................................................... 39
A.1 XML based formatting ............................................................... 39
A.2 XML formatting ........................................................................ 39
A.3 Container specific tags ............................................................ . 40
A.3.1 General tags . ........................................................... 48
A.3.2 Attributes . .. .. .. .. .. .. .. .. ............................................... 49
B Command channel ............................................................................... 52
B.1 Command syntax . .. .................................................................. 52
B.1.1 Commands ID numbers for EtherNet/IP ...................... 53
B.2 Command channel index handling .. ............................................ 54
B.2.1 Introduction ....................... .. .. .. .. .. .. .. .. .. .. .. ................ 54
B.2.2 Blob indexing ........................................................... 54
B.2.3 Polygon indexing . .. .. .. .. .. .. .. .. .. .. ................................. 54
B.2.4 Tools indexing .......................................................... 54
B.3 Command descriptions .. .. .. .. .. .. .. ............................................... 54
B.4 Error codes ... .. .. .. .. .. .. ............................................................... 72
B.5 Version information . ................................................................. 75
B.6 Command examples .. .. .. .. .. .. .. .. .. .. .. ........................................... 75
B.6.1 Command examples Ethernet Raw .. .. .. .. ..................... 75
C Restore configuration over Web API ......................................... ............. 77
C.1 Restore configuration ................................. .. .. .. .. .. .. .. .. .............. 77
C.2 Create session cookie .............................................. .. .. .. .. .. .. .. .. . 77
C.3 Login ................................................................................. .. .. . 77
C.4 Prepare restore mode ............................................................... 78
C.5 Transfer restore file to device ................................................ .. .. . 78
C.6 Device restart ........ .. .. .. .. .. .. .. .. .. .. .............................................. 78
Index ............................................................................................ .. .. .. .. .. .. .. .. 79
4
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
8015726/2013-11
Introduction
Introduction
Introduction
Reference Manual
Inspector PIM
1
Introduction
The Reference Manual is a complement to the Operating Instructions for Inspector PIM60 and covers the functionality of all product variants.
The Reference Manual contains detailed information about the interfaces including syntax and available functionality. It focuses on Inspector PIM60 specific topics and does not describe the basic technology behind each interface.
The details of the result output formatting and the contents and syntax of the command channel are shared by several interfaces. They are described in an appendix valid for all rel­evant interfaces.
For instructions on configuring the interfaces, refer to the Operating Instructions.

1.1 Interfaces overview

The Reference Manual contains detailed information for the following interfaces:
I/O Extension Box is used to increase the number of available input and output connections
Web API interface is intended for integration with external HMI implementations, and for
customized web pages on the Inspector
Ethernet Raw interface is intended for integration with external PLC equipment
EtherNet/IP interface is intended for integration with external PLC equipment following the
EtherNet/IP communication standard

1.2 Intended readers

The intended readers of the Reference Manual are users working with integration between the Inspector PIM60 and other equipment, for example PLC programmers and customized human machineiInterface (HMI) developers.
The readers are assumed to have knowledge about the Inspector PIM60 product and features as described in the Operating Instructions for Inspector PIM60. The readers are also assumed to have knowledge about the basic functionality of the technology of the interfaces used for the integration.
6
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
8015726/2013-11
Interfaces
Interfaces
I/O extension box
Reference Manual
Inspector PIM
2
I/O extension box
The Inspector PIM60 can be connected to an I/O extension box that increases the number of digital inputs and outputs. The I/O Extension box is available as an accessory from SICK. This section covers how the I/O extension box is connected to the Inspector, and how it is configured.
The following basic steps are required to use the I/O extension box with the Inspector. Details about the steps are found in the subsequent sections.
1. Connect the I/O extension box to the network.
2. Configure the IP address of the I/O extension box to match the settings of the network, and the Inspector.
3. Enter the IP address of the I/O extension box in the SOPAS Single Device application.
4. Activate the inputs and/or outputs on the I/O extension box depending on the application.
Note
The SOPAS Single Device application should be closed or set to offline when the power to the I/O box is disconnected. The I/O extension box needs to be restarted if the IP address is changed or if the connections to the inputs and outputs on the box are changed.

2.1 Physical network connection

To minimize network latency, it is recommended that the I/O extension box is connected directly to the Inspector. The I/O box has a network switch so that a PC running SOPAS Single Device can be connected via the I/O box.
InspectorI/O Extension box
PC with SOPAS
Single Device
Figure 2.1 Physical network connection

2.2 Configuration of the IP address on the I/O extension box

This section briefly describes how to configure the I/O extension box for operation with the Inspector. For details, please refer to the user manual delivered with the I/O extension box.
The IP address of the I/O extension box must be compatible with the addresses of the Inspect­or and of the PC. For details of how to set and view the IP address of the Inspector, please refer to the Operating Instructions for Inspector PIM60.
The following is an example of how the IP addresses can be configured for the Inspector, the I/O box and the PC.
PCI/O Extension BoxInspector PIM60
192.168.1.30192.168.1.3192.168.1.110
8
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
8015726/2013-11
Reference Manual
Inspector PIM
I/O extension box
2.2.1 Basic configuration of the IP address
The address selection switch on the I/O extension box configures the host part of the IP ad­dress, that is, the last of the four parts of the IP address. By default, the first three parts of the address (also known as the network address) are set to 192.168.1. If the switch is set to a value other than 0 (all switches set to Off) or 255 (all switches set to On), the I/O extension box will use the host part of the IP address assigned by the switch.
Figure 2.2 Example
The setting above configures the I/O extension box to have a host ID of 3 corresponding to the binary value “00000011” where switch 1 is bit 0 (LSB) and switch 8 is bit 7 (MSB). The I/O box will then have an IP address of 192.168.1.3.
Advanced configuration of the IP address
If the network part of the IP address must be changed from the default 192.168.1 for the I/O extension box, the internal web server of the I/O extension box can be used. For details please refer to the manual delivered with the I/O extension box.
Interfaces

2.3 Setup of the I/O extension box in the SOPAS Single Device application

The communication with the I/O extension box is configured using the Interfacesand I/O Settings dialog from the InspectorPIM60 menu. Check the Digital I/O and I/O extension boxes in the Inter- faces tab. The I/O extension box is disabled if EtherNet/IP is selected in the same tab.
Figure 2.3 I/O Extension Box setup
Communication mode
It is possible to adjust the way that the Inspector is communicating with the I/O extension box. The settings are made in the I/O extension box setup tab in the Interfaces and I/O Settings dialog from InspectorPIM60 menu. There are three modes available:
• Robust mode. This is the default communication mode, and it is the recommended one if
the Inspector is connected to the SOPAS Single Device application during operation.
• Fast mode. This mode allows the Inspector to operate at a higher frame rate but there is
a risk that some data in the communication with the I/O extension box is lost if there is high load on the network. This mode shall not be used if the Inspector is connected to the SOPAS Single Device application during operation.
• User mode. This is the advanced communication mode where it is possible to configure
the number of retries that the Inspector performs, and the timeout for each retry. The timeout is the time (in milliseconds) that the Inspector is waiting for a reply from the I/O extension box for a request to set outputs or read inputs.
8015726/2013-11
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
9
Interfaces
I/O extension box
Reference Manual
Inspector PIM
IP configuration
To be able to connect to the I/O extension box, the IP address of the I/O extension box must be specified in the SOPAS Single Device application.
To specify the IP address of the I/O extension box:
1. Open the Interfaces and I/O Settings dialog from the InspectorPIM60 menu. Enter the selected IP address of the I/O extension box setup tab in the four fields separated with dots.
2. Click Apply to store the settings.
Figure 2.4 Set up mode and IP address
Verify connection
It is possible to verify that the connection to the I/O extension box can be established by clicking the Verify connection button. The SOPAS Single Device application will then try to connect to the I/O extension box, and a message will be displayed informing if the I/O extension box was found.
Note
It is possible to configure the Inspector for use with the I/O extension box even when the I/O extension box is not available. As soon as the Inspector detects the I/O extension box on the network, it will connect to it and start using it as configured.
2.3.1 Enabling the I/O extension box
The use of the inputs and outputs on the I/O extension box is enabled on the Digital I/O tab of the Interface and I/O Settings dialog from the InspectorPIM60 menu.

2.4 Input and output connections

When delivered, the I/O extension box contains 4 digital inputs and 8 digital outputs. The digital outputs can be expanded to 16, and the digital inputs of the Inspector PIM60 can be extended to 5.
Please refer to the manual delivered with the I/O extension box for details on how to connect the power supply to the box, and where to find the digital inputs and outputs.
10
2.4.1 Special conditions during startup
The following applies if the Inspector is configured to use the inputs of the I/O extension box for object selection:
If the I/O extension box is not available when the Inspector starts up, the Inspector will use the last reference object selected in the SOPASSingle Device application before saving to flash.
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
8015726/2013-11
Reference Manual
Inspector PIM
I/O extension box
Interfaces
Once the I/O extension box is available, the Inspector will read the inputs of the box, and select the corresponding reference object.
2.4.2 Connection to the I/O extension box lost during operation
If the connection to the I/O extension box is lost during operation, the last status of the inputs on the box will be used until the connection is re-established.
2.4.3 Object selection with I/O extension box
The status of the inputs on the I/O extension box is checked in the end of each inspection cycle. If the Inspector is configured to use external image trig, the status of the external inputs will only be checked when an image trig signal has been received.
2.4.4 Timing issues
The digital outputs on the I/O extension box shall be read at minimum delay time as displayed in the SOPAS Single Device application.
2.4.5 Use of the digital outputs for logic
The digital outputs on the I/O extension box are not guaranteed to be jitter-free. It is not re­commended to use these outputs for direct control of other devices. The I/O extension box shall be connected to a PLC for process control.
2.4.6 Change of Modules in the I/O extension box
The Inspector PIM60 supports I/O extension box configurations with up to 16 digital outputs and 5 digital inputs (The standard configuration of the I/O extension box contains 8 digital outputs and 4 digital inputs.). The configuration of an I/O extension box can be changed by adding/removing I/O modules to/from the I/O extension box. I/O modules are available as an accessory from SICK. For details about Accessories Ordering information see the Operating Instructions for Inspector PIM60.
Perform the following steps to connect and use more I/O modules:
1. Close the SOPAS Single Device application.
2. Disconnect the power from the I/O extension box.
3. Connect the additional I/O modules (inputs and/or outputs) to the I/O extension box. Please refer to the manual delivered with the I/O extension box for details.
4. Re-connect the power to the I/O extension box.
5. Re-start the SOPAS Single Device application.
The additional digital outputs are now be available in the SOPAS Single Device application.

2.5 Troubleshooting

2.5.1 The I/O LED flashes 10 times
If the power to the I/O extension box has been disconnected for a longer period of time, the internal clock in the box will be reset. The I/O LED on the box will then flash 10 times in red. This is not a serious error, and the I/O extension box can still be used together with the In­spector without any problems.
8015726/2013-11
2.5.2 No contact with the I/O extension box
Ensure that the network card on the PC has the same network address, for instance
192.168.1, as the I/O extension box. The host part of the IP address (that is the last number
in the IP address) must not be the same as for the I/O extension box or the Inspector.
There are two tools available in Windows to check the network connection and the IP settings:
Ping. Open the command prompt, and type ping followed by the IP address of the I/O exten-
sion box. If the I/O extension box is available the following text will be displayed: Reply from x.x.x.x (where x.x.x.x is the IP address of the I/O extension box). If the I/O extension box
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
11
Interfaces
I/O extension box
Reference Manual
Inspector PIM
could not be found an error message is displayed, for instance Requesttimed out or Destination host unreachable. Example: ping 192.168.1.3
Ipconfig. Open the command prompt and type ipconfig. The current status for the network
cards on the PC will then be displayed. Ensure that the network settings are corresponding to the setting for the I/O extension box. The current IP address for the Inspector can be viewed by selecting Device Info from the InspectorPIM60 menu.
The web browser on the PC must be configured not to use a proxy when communicating with the web server in the I/O extension box.
2.5.3 High number of unanswered requests to the I/O extension box
The advanced communication mode, User mode, can be used to fine tune the communication with the I/O extension box. It is recommended to try to increase the timeout as a first step, and if this does not work, try to increase the number of retries. Increasing the number of retries will reduce the inspection speed.
If the problem persists even if the timeout and the number of retries have been increased, verify that the network topology does not block the use of UDP packets.
12
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
8015726/2013-11
Reference Manual
Inspector PIM
Web interface
Interfaces
3
Web interface

3.1 Introduction

The Inspector PIM60's web interface can be used in two different ways:
• Users can use a web browser to open web pages served by the Inspector's built-in web
server. The Inspector PIM60 is delivered with a set of web pages for handling the Inspector, but you can also create custom web pages that can be accessed through the Inspector's built­in web server. When you create custom web pages, all functions available through the Web API can be used.
• Custom applications running on separate systems can use the Web API to directly retrieve
images and results, and retrieve and set parameters on the Inspector.
Details on how to manage and access the web pages served by the Inspector is described in the Operating Instructions for Inspector PIM60.
Note
All URLs on the Inspector are case sensitive. For example, trying to use /LiveImage.jpg to retrieve the live image will not work.

3.2 Get results via Web API

3.2.1 Live image
The live image can be retrieved through the Web API by a live image request using the URL:
http://<IP-address>/LiveImage.jpg
The response to the request is a data buffer containing a JPEG image.
If the image is not available, an empty image is returned with a smaller size than a normal image.
Note
The live image is not available when SOPAS is connected to the Inspector PIM60.
Live image response can be much slower when activating the Send to FTP feature.
Example URLs
Request a live image without overlay graphics:
http://192.168.1.110/LiveImage.jpg
The response to the request is a JPEG image.
Request a live image with overlay graphics:
http://192.168.1.110/LiveImage.jpg?ShowOverlay
Request a live image with simplified overlay graphics:
http://192.168.1.110/LiveImage.jpg?SimplifiedOverlay
3.2.2 Detailed results
The result string, containing the results from the last analyzed image, can be retrieved through the Web API by a request using the URL:
http://<IP-address>/CmdChannel?gRES
The response is a string that has the following syntax:
rgRES <errorCode> <resultString>
8015726/2013-11
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
13
Interfaces
Web interface
Reference Manual
Inspector PIM
The result string is the string that is output over Ethernet, and which is defined in the Ethernet Results Output dialog.
For example, if the current configuration has an object locator and an edge pixel counter, and Ethernet Results Output uses the default example formatting string, the Inspector would return the following string:
rgRES 0 194 Image_number: 9639 Object_locator. Located: 1 Score: 99.00 Scale: 1.00 Position_(X,Y): (237.78,202.05) Rotation: 20.05
------------------------­Edge_pixel_counter_1 Decision: 1 Pixels: 724
The result is not synchronized with the live image. This means that in some situations, if you retrieve a live image and after that a result string, that string may not contain the result for the retrieved image, but for an image captured and analyzed later. See Section 3.2.3, “Syn- chronize live image with result” (page 14) for a solution.
3.2.3 Synchronize live image with result
To synchronize the live image with the result, you need to assign an id to the image. The id can be up to 16 characters long and can consist of numbers, letters, and special characters.
http://<IP-address>/LiveImage.jpg?id=<ID>
The result for the live image assigned to the <ID> can be listed using the following syntax:
http://<IP-address>/ImageResult?id=<ID>
Note
The image might not update if this method is used due to caching, see Section 3.4.1, “Ex­ample: Display live image” (page 19) for more information.
Example URLs
Request a live image without overlay graphics and assign an id to the image:
http://192.168.1.110/LiveImage.jpg?id=ID_ABC123
Request a live image with overlay graphics and assign an id to the image:
http://192.168.1.110/LiveImage.jpg?ShowOverlay&id=ID_ABC123
Request a live image with simplified overlay graphics and assign an id to the image:
http://192.168.1.110/LiveImage.jpg?SimplifiedOverlay&id=ID_ABC123
3.2.4 Logged images
Logged images can be retrieved using the URL:
http://<IP-address>/LogImage.jpg?00
where the argument "00" is the image number. The image number is two digits in the range [00, 29]. The device keeps writing to the log and therefore the log first has to be locked to be able to retrieve an image. This is done by using the URL http://<IP-address>/LockLog
The response to the request is a JPEG image. An empty image with a smaller size than a normal image is returned if no log image is available for a certain position.
To start logging images again the log has to be unlocked first and this is done by using the URL http://<IP-address>/LockLog?Unlock
14
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
8015726/2013-11
Reference Manual
Inspector PIM
Web interface
Interfaces
Example URLs
http://192.168.1.110/LockLog
http://192.168.1.110/LockLog?Unlock
Retrieve a logged image without overlay graphics:
http://192.168.1.110/LogImage.jpg?00
Retrieve a logged image with overlay graphics:
http://192.168.1.110/LogImage.jpg?00&ShowOverlay
Retrieve a logged image with simplified overlay graphics:
http://192.168.1.110/LogImage.jpg?00&SimplifiedOverlay
3.2.5 Statistics
To retrieve statistics using the command channel, execute the following command:
gSTAT
Statistics can also be retrieved using the URL:
http://<IP-address>/CmdChannel?gSTAT
The response is rgSTAT 0 followed by an XML formatted string. To read the response in an web browser, change the view in the web browser to reflect the source code.
Note
The statistic response is only for the active reference object.

3.3 Control the sensor via Web API

The Web API supports using the command channel for reading and updating parts of the device configuration.
The Web API also supports the functionality to do a backup of the device configuration to a file and to restore the configuration again. This is a convenient way to handle configurations without installing and using SOPAS Single Device.
3.3.1 Basic principles
The command channel has a set of basic principles:
• Only one command at a time can be executed.
• Inspector PIM60 responds to each command with a response that includes the result of
the command as well as error codes.
• A specific task to control the Inspector PIM60 includes the command together with its
parameters, see list of command types and parameters in Appendix B, “Command chan- nel” (page 52).
• Writing a parameter can typically only be done when the device is in Edit mode. Reading
a parameter can be done in both Edit and Run mode.
• It is possible to block configuration changes by deselecting Allow changes via Web Server in
the Web Ser ver tab in the dialog Interfaces and I/O Settings in InspectorPIM60 menu.
8015726/2013-11
3.3.2 Command syntax
The Web API command channel has the following syntax:
http://<IP-address>/CmdChannel?<command>_<identifier>_<argument 1>_<ar­gument 2>..._<argument N>
The ACK message has the following syntax:
<ACK Command> <identifier> <errorCode> <returnValue1> <returnValue2> ... <returnValueN> <errorMessage>
The command is sent as an ASCII string. The combination of a command with its parameters will either change the device configuration or fetch information from the device. For more
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
15
Interfaces
Web interface
Reference Manual
Inspector PIM
command examples see Section B.1, “Command syntax” (page 52) and Section B.6, “Com­mand examples” (page 75).
Note
The command syntax differs from other interfaces where the initial part http://<IP-ad-
dress>/CmdChannel? is added and all space characters (" ") are replaced by an underscore
character ("_"). The ACK messages still contain spaces.
Example URL
The successful execution of the following command
http://192.168.1.110/CmdChannel?sINT_1_1
will perform the command (to select reference object with index 1) and then return the fol­lowing string:
rsINT 1 0
while a failed command may return:
rsINT 1 8101 Ref bank index is not used.
3.3.3 Current reference object
The reference image of the current reference object can be retrieved using the URL:
http://<IP-address>/ActiveReferenceImage.jpg
The response to the request is a JPEG image.
The reference image of any reference object in the Inspector can be retrieved using the URL:
http://<IP-address>/getRefObject?0
where the argument "0" is the index of the reference object. The object index that corresponds to each reference object can be found in the Reference object list in the Main view.
The response to the request is a JPEG image. An empty image with a smaller size than a normal image is returned if no reference object is available for a certain position.
Example URL
http://192.168.1.110/ActiveReferenceImage.jpg
http://192.168.1.110/getRefObject?1
3.3.4 Backup and restore configuration
It is possible to backup and restore the device configuration through the Web API. This is the same functionality also available through the standard web pages of the Web Server interface.
The backup data contains the device name and reference objects including corresponding inspection and interface settings.
Note
The backup and restore functionality of the Web Server and the Web API corresponds to the Export Sopas Parameter backup and Import Sopas Parameter backup in the InspectorPIM60 menu.
The backup data used by the Web API is saved as .sbp files, which can be imported to and exported from SOPAS Single Device. The Web API can not use .sdv files.
Backup configuration
The URL to export a configuration is http://<IP-address>/backup_config?config1
Example URL:
http://192.168.1.110/backup_config?config1
The result of the request is an .spb file containing the device configuration. This file can be stored in the file system of the receiving unit and used later in the restore procedure.
16
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
8015726/2013-11
Reference Manual
Inspector PIM
Web interface
Interfaces
The Web Server standard web pages requires a login to perform a backup. A login is not re­quired when doing a backup through the Web API.
Restore configuration
The restore operation takes a device configuration created with the backup functionality and replaces the current configuration with the configuration in the backup file.
The operation is a multiple step procedure that requires a login. The details of the procedure is described in Appendix C, “Restore configuration over Web API” (page 77).
The operation may take several minutes and the Inspector PIM60 is automatically restarted after the configuration has been transferred to the Inspector PIM60.
Warning
During the restore operation the device is set in a special restore mode only expecting restore operation requests. Operations and requests via other interfaces like field buses, SOPAS Single Device, or other web browsers shall then be avoided since they may interfere with the restore operation.

3.4 Create custom web pages

When creating customized web pages to be stored on and served by the Inspector, you use the Web API to display images, retrieve results and settings, and change parameters in the Inspector.
The functions that use the command channel (retrieving results, and getting and setting parameters) returns the result in text strings, which you need to parse in order to extract the information that you are interested in. To make this easier, the Inspector PIM60 provides a JavaScript that you can use in your web pages, and that helps parsing the results.
You use the functions by including the script file inspector.js in your page, and then create an Inspector object in your own script.
Note
The inspector.js script uses JQuery, so you need to also include the provided jquery.js script. For more information on JQuery, see www.jquery.com.
<html>
<head>
<title>Custom page</title> <script type="text/javascript" src="/jquery.js"></script> <script type="text/javascript" src="/inspector.js"></script>
<script type="text/javascript"> //<!--
var inspector = new Inspector();
... //--> </script>
...
The Inspector object has methods that correspond to the commands that can be sent over the command channel. The available methods are listed in Table 3.1, “Methods in inspect­or.js” (page 19). When using these methods, you pass the same arguments as when using the "raw" command channel commands, as described in Appendix B, “Command chan- nel” (page 52).
The Inspector object returns the (parsed) command response through a callback function. To use the response, you define a function that takes a single argument – the response object – and pass that function as an argument to the Inspector's method. In the function you can
8015726/2013-11
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
17
Interfaces
Web interface
Reference Manual
Inspector PIM
then check whether the command succeeded, and retrieve the information you are interested in.
For example, to select the first reference object in the current configuration (with index 0), you would call:
// First, define a callback function that handles the result function setRefObjResponse(response) {
if (response.httpStatus != 200 || response.errorCode != 0) {
alert(response.errorMessage);
}
};
// Then, call the inspector object's setInt function // with the arguments: // identifier = 1 for "Set reference object" // arg1 = 0, for reference object with index 0 function setRefObj() {
inspector.setInt(1, 0, setRefObjResponse );
};
Tip
As an experienced JavaScript developer, you would probably define your callback function as an anonymous function directly in the call to the inspector methods:
inspector.setInt(1, 0, function(response) {
if (response.httpStatus != 200 || response.errorCode != 0) {
alert(response.errorMessage);
}
});
The content of the response object depends on the function that you called, as well as the outcome of the command. The following attributes are common for all methods:
type The response type, which is basically the same as the command type.
See Table B.3, “Command ID numbers - for EtherNet/IP” (page 54).
errorCode If non-zero, the command failed for some reason. See Section B.4, “Error
codes” (page 72).
errorMessage A text message that describes the error. Exists only if the command failed.
httpStatus The HTTP status code. If this is not set to 200, the HTTP request failed
and the Inspector didn't return any result at all.
The following table lists the attributes that are specific to the called method:
18
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
8015726/2013-11
Reference Manual
Inspector PIM
Web interface
Table 3.1 Methods in inspector.js
Interfaces
Method
mand
gINTgetInt(identifier, arg1, ..., argn, callback)
sINTsetInt(identifier, arg1, ..., argn, callback)
gSTRgetString(identifier, arg1, ..., argn, callback)
Response attributesCorresponding com-
protocolVersiongVERgetVersion(callback)
modegMODgetMode(callback)
values[0]sMODsetMode(mode, callback)
identifier
values[0 ... n]
identifier
values[0 ... n]
identifier
value
identifieraACTperformAction(identifier, args, callback)
-TRIGtrig(callback)
resultStringgRESgetResult(callback)
-/LockLoglockLog(callback)
-/LockLog?UnlockunlockLog(callback)
The result string returned by the getResult() method is the same string that is output over Ethernet, and which is defined in the Ethernet Results Output dialog.
Note
Do not make another call to the Inspector before the current call has returned a response.
If you do, the current command will be interrupted and will not return any response at all, making it difficult to figure out whether or not the command was performed on the Inspector.
Normally, this is not a problem, but if you are using timed triggers, you should make sure that the triggered functions don't interrupt any commands that may currently be performed on the Inspector.
3.4.1 Example: Display live image
To display the current live image, simply include the image from /LiveImage.jpg on your web page:
... <image src="/LiveImage.jpg"/> ..
This image will not update automatically, so you could add some JavaScript that makes the live image refresh with a certain interval.
... <script type="text/javascript">
//<!--
function refreshLiveImage() {
var image = document.getElementById("liveImage"); image.src = "/LiveImage.jpg?ShowOverlay" + (new Date()).getTime() );
// The (new Date()...) is a trick to make the browser // retrieve the image from the Inspector and not from cache
setTimeout(refreshLiveImage, 500);
};
8015726/2013-11
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
19
Interfaces
Web interface
Reference Manual
Inspector PIM
// Initiate the image and refresh when page is loaded window.onload = function(){
refreshLiveImage(); }; //-->
</script>
... </head> <body>
<img id="liveImage" src="/LiveImage.jpg?ShowOverlay"/> </body>
Alternatively, you can use the live image component that is used on the Inspector's default Live image page, which has automatic refresh, setting for refresh interval, and magnifier.
Figure 3.1 Inspector's default live image component
To use the default live image component, include the userliveimage.js script in your page, and call the sickLiveImage() function as in the following example:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Live Image</title>
<script type="text/javascript" src="/jquery.js"></script>
<script type="text/javascript" src="/userliveimage.js"></script>
<script type="text/javascript">
//<!-­$(document).ready(function () {
$("#liveImage").sickLiveImage({
width: 640, height: 480, nocache: true, minInterval: 500, refreshInterval: 1000, magnifier: true, imgUrl: "/LiveImage.jpg", refreshText: "Refresh interval"
}); }); //-->
</script> </head> <body>
<div id="liveImage"></div> </body>
</html>
20
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
8015726/2013-11
Reference Manual
Inspector PIM
Web interface
Interfaces
More examples can be found on the installation CD, in the folder hmi_web_example inside the documentation folder. A Custom Web Toolkit can be found on the support pages (vis­ionsupport.sick.com) which provides a framework that simplifies the process of making an HMI as well as additional templates and examples..

3.5 Handle the Web API

The Web Server and Web API interfaces can be activated or deactivated. When activated, it is possible to select port number and to allow command channel changes. The same settings apply both to the Web Server and to the Web API. The Web interfaces are configured in the Interfaces and I/O settings dialog in the InspectorPIM60 menu.
The Web API is based on standard HTTP request and responses. Recommended request timeout time is 3 seconds to allow for images to be transferred properly.
8015726/2013-11
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
21
Interfaces
Ethernet Raw
Reference Manual
Inspector PIM
4
Ethernet Raw

4.1 Introduction

To set up the connection and output results for Inspector PIM60 using Ethernet Raw see Operating Instructions for Inspector PIM60.
4.1.1 Port interval
The default interval for the ports used by the communication channels is 2114-2116. This interval can be changed, e.g. if the controlling device does not support the default interval. The interval is controlled by the field Start port in the Ethernet Raw tab of the Interface and I/O settings dialog.
The ports are assigned according to the following:
• Ethernet Result Output = start port (default 2114)
• Command channel = start port + 1
• Dedicated image trig = start port + 2

4.2 Get results via Ethernet Raw

The following settings are configured in the Ethernet Result Output dialog under InspectorPIM60 menu.
4.2.1 TCP versus UDP
The basic difference between these protocols, for the Ethernet result output function, is which side initiates the connection to receive/send the data.
UDP:TCP:
PC/PLC initiates the connection Inspector sends results to the spe-
Inspector sends results to the PC/PLC
PC/PLC acknowledges that results are re­ceived (built into the TCP protocol)
Note
For TCP the default port number that the Inspector listens to is 2114.
cified IP address and port, without knowing if it has been received
22
4.2.2 ASCII versus binary
The Inspector supports the possibility to choose whether the configured output is to be sent in ASCII format or in a binary format. The parameters that should be transferred in binary format are also defined in the XML based formatting, but some tags are not supported in the binary format.
If such a parameter is added to the formatting it will be ignored by the Inspector. In binary mode all added text and text formatting, for example <SPACE/>, are ignored. Only the values
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
8015726/2013-11
Reference Manual
Inspector PIM
Ethernet Raw
Interfaces
of the parameters describing the results of inspected images or device information will be sent. For details on which tags can be used in binary output see the tables in chapter Ap­pendix A, “Result output formatting” (page 39).
4.2.3 Attributes
Attributes are used to control the formatting and identification of inspections. Some of them can be controlled directly in the Ethernet Result Output dialog in the section Message settings. All available attributes are listed in the table in section XML Formatting in Section A.3.2, “Attrib- utes” (page 49).
Min number of digits Specifies the minimum number of digits (including decimal
point) to include in the result. If the value to be sent out has fewer digits, the result is padded with leading zeros. The de­fault setting is 0 which means the number of digits that will be sent will differ depending on how many digits are needed. The maximum number of digits is 9. Note: This attribute is only applicable for ASCII
Number of decimals Specifies the number of digits to include after the decimal
point for values with decimals. The value will be rounded to the specified number of decimals. Default value is 2. The maximum number of decimals is 9. Note: This attribute is only applicable for ASCII
Degrees/Radians Specifies the unit for the rotation of the object locator, angle
for blobs, angle for edges, and angle measurements.
Little/Big Endian This specifies the order of the bytes transferred from the
device on Ethernet. When using Little endian the least signi­ficant byte is transferred first and for Big endian the most significant byte is transferred first. See the 2-byte example in tables below. Note: Only applicable when using binary format.
Most significant
byte
Least significant
byte
0111000010000100Value to be sent
from device:
First transferred byteTransfer order
Second transferred
byte
1000010001110000Little endian
0111000010000100Big endian
Pixels/Millimeters Specifies whether position coordinates and distance meas-
urements should be expressed in pixels or millimeters. Note: The device must be calibrated to be able to use millimeters as unit of measurement.
4.2.4 Example formatting strings
The auto-generated example string will vary depending on the configuration in the selected reference object. The intention with the example string is to give an idea of the available tags and to be a good starting point for creating a suitable format.
Below follow some short descriptions of example strings for different configurations. For more information about the XML formatting see Appendix A, “Result output formatting” (page 39).
8015726/2013-11
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
23
Interfaces
Ethernet Raw
Reference Manual
Inspector PIM
Example string for configuration with only an Object locator
<MESSAGE_SIZE/><NEWLINE/>
Image_number:<SPACE/><IMAGE_NUMBER/><NEWLINE/>
Object_locator.<NEWLINE/>
<OBJECT_LOC>
Located:<SPACE/><DECISION/><NEWLINE/>
Score:<SPACE/><SCORE/><NEWLINE/>
Scale:<SPACE/><SCALE/><NEWLINE/>
Position_(X,Y):<SPACE/>(<X/>,<Y/>)<NEWLINE/>
Rotation:<SPACE/><ROTATION/><NEWLINE/>
</OBJECT_LOC>
Size of the message, number of characters (ASCII) or bytes (binary)
Explanatory text and analyzed images number
Explanatory text
Start of container for object locator
Explanatory text and value for locator decision; 0=not found, 1=found
Explanatory text and locator score value, in percent how well of the object is found in the object locator due to match settings Explanatory text and locator scale value, factor of analyzed live image compared to taught reference object Explanatory text and x and y position of the reference point. This can be outside the image and therefore negative. Shown in "pixels" or "mm" Explanatory text and locator rotation, in degrees or radians depending on the configured value in the Ethernet Result Output settings dialog End of container for object locator
Result of validating output string with only an Object locator
The result of validating the example formatting output string with output format ASCII can be as follows:
97 Image_number: 14471 Object_locator. Located: 1 Score: 96.00 Scale: 1.00 Position_(X,Y): (291.52,238.55) Rotation: 0.22
The result of validating the example formatting output string for only an object locator with output format binary will be as follows:
Binary output OK. Number of bytes: 27
Part of example string for configuration with a Blob
Blob_tool.<NEWLINE/>
<BLOB index="0" name="Blob 1">
Found_blobs:<SPACE/><FOUND_BLOBS/><NEWLINE/>
-------------------------<NEWLINE/>
Blob_information:<NEWLINE/>
Position_(X,Y):<SPACE/>(<X/>,<SPACE/><Y/>)<NEWLINE/>
24
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
8015726/2013-11
Reference Manual
Inspector PIM
Ethernet Raw
Area:<SPACE/><AREA/><NEWLINE/>
Angle:<SPACE/><ANGLE/><NEWLINE/>
Structure:<SPACE/><EDGE_PIXELS/><NEWLINE/>
Touches_ROI_border:<SPACE/><EDGE_FLAG/><NEWLINE/>
</BLOB>
Explanatory text
Start of container for the blob tool named "Blob 1" and instruction to fetch the first (in­dex="0") blob in accordance with the Sort by criteria Explanatory text and number of found blobs in analyzed image
Separator
Explanatory text
Explanatory text and information of blob with index="0" concerning position and center of gravity (x and y position), in "pixels" or "mm" Explanatory text and blob (index="0") area, in "pixels"
Explanatory text and blob (index="0") angle value, in degrees or radians depending on the configured value in the Ethernet Result Output settings dialog Explanatory text and blob (index="0") structure value, number of edge pixels inside the blob Explanatory text and blob (index="0") edge value, 0=blob fully within ROI, 1= blob touches ROI border End of container for blob tool
Interfaces
Result of validating output string with a Blob
The result of validating the example formatting output string with output format ASCII can be as follows:
Blob_tool. Found_blobs: 16
------------------------­Blob_information: Position_(X,Y): (177.00, 156.89) Area: 75 Angle: 154.33 Structure: 0 Touches_ROI_border: 0
The result of validating the example formatting output string for a blob with output format binary will be as follows:
Binary output OK. Number of bytes: 28
Part of example string for configuration with a Polygon
Polygon1<POLYGON name="Polygon1"><NEWLINE/>
Corners:<SPACE/><NUM_CORNERS/><NEWLINE/>
<CORNERS corners="all">(X,Y):<SPACE/>(<X/>,<Y/>)<NEWLINE/>
</CORNERS>
</POLYGON>
8015726/2013-11
Explanatory text and start of polygon container tag for the polygon tool named "Polygon 1" Explanatory text and number of polygon corners
Start of container tag for polygon corners with instruction to loop over all polygon corners, explanatory text, and corner position End of container for polygon corners
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
25
Loading...
+ 57 hidden pages