interfaces mvtec

资料

OPC_Classic I/O Interface for OPC Classic compliant devices

Interface: OPC_Classic
Revision: 13.0.3
Date: 2017-11-28
This product includes cryptographic software written by Eric Young (eay@cryptsoft.com).

This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/).

General

This page provides the documentation of the HALCON OPC Classic interface. Only interface-specific parameters and features are described here. For general information of the operators for I/O interfaces please have a look at the HALCON Operator Reference.
Registered customers can download the latest revision of this interface from the MVTec WWW server.

System Requirements

  • Intel compatible PC with Windows 7 (32-bit or 64-bit) or newer that is also supported by the vendor-specific SDK, also WoW64 (using 32-bit HALCON on 64-bit Windows).
  • OPC Core Components Redistributable package for Windows x86 or Windows x64. If this package is not installed, please download and install it from the OPC Foundation website.
  • Windows: HALCON I/O device interface hioOPC_Classic.dll or hioOPC_Classicxl.dll, respectively. Also required are libeay32.dll, ssleay32.dll, and uastack.dll. If you have properly installed the interface, all these DLLs should reside in bin\%HALCONARCH% within the HALCON base directory %HALCONROOT% you have chosen during the installation of HALCON. Please note that the HALCON OPC_UA interface uses the same DLLs.

Installation

Only when installing or updating the interface manually follow these steps:
  • Windows: Extract the archive containing the interface files to the HALCON base directory %HALCONROOT% (Note: Administrator privileges may be required for this step). Additionally, you have to move the interface examples to the directory %HALCONEXAMPLES% manually.
  • Linux: Extract the archive containing the interface files to the HALCON base directory $HALCONROOT.

Features

  • Implementation of an OPC Classic (also known as OPC DA, OPC ComDA) client.

Limitations

  • Only OPC Data Access (OPC DA) is supported.
  • No OPC device discovery. OPC Classic server name must be set according to the setup of the server.
  • No support for public groups.
  • The OPC Classic I/O interface returns and expects all strings in UTF-8 encoding.
  • All dates and times are assumed to be UTC.
  • The OPC Classic I/O interface only supports one-dimensional arrays, and it can only do so if a single OPC value is being read or written (i.e., if read_io_channel or write_io_channel are used with multiple channel handles, only scalar values are allowed in each channel).
  • On 32-bit systems, 64-bit OPC integer values (both signed and unsigned) cannot be properly represented. They can only be used if the actual value fits within a 32-bit integer.

Connecting to an OPC Classic server

The open_io_device operator is used to connect to an OPC Classic server. Specify the URL of the server to connect to with the IODeviceName parameter. The server URL is generally in the form 'opcda://<machine name>/<server ProgID>[/<CLSID>]'.

Converting data between HALCON and OPC Classic

OPC Classic has a rich set of data types that have to be mapped to the HALCON control tuple data types integer, real and string on input and output. The HALCON OPC Classic I/O device interface supports the following built-in OPC data types:
  • Boolean
    A boolean value, translated to and from the HALCON strings 'true' and 'false'.
  • SByte, Int16, Int32, and Int64
    These types are translated to and from HALCON integer values. On 32-bit systems, 64-bit integers outside the range of a 32-bit integer cannot be represented.
  • Byte, UInt16, UInt32, and UInt64
    These types are translated to and from HALCON signed integer values. An unsigned value outside the range of HALCON's signed integers is represented as the signed integer corresponding to the bit pattern of the unsigned integer. On 32-bit systems, 64-bit integers outside the range of a 32-bit integer cannot be represented.
  • DateTime
    The date is translated to and from the number of seconds since January 1, 1970 as a HALCON real value.
  • Double and Float
    These types are translated to and from HALCON real values.
  • String
    This type is represented as a HALCON string. Please note that the OPC Classic I/O interface returns and expects all strings in UTF-8 encoding.

Specifying OPC Classic variables

OPC Classic items are referenced by using their item ID written as a string as the channel parameter in the query_io_device and open_io_channel operators.

Operator control_io_interface

Not supported by this interface.

Operator query_io_interface

query_io_interface(::IOInterfaceName, Query:Result)
Query information about the specified I/O device interface.
Parameter Values Type Description
IOInterfaceName 'OPC_Classic' string HALCON I/O interface name.
Query string Parameter name of the query.
     'param_name' string Returns the possible parameter names.
     'revision' string Revision number of the OPC COM DataAccess interface.
Result integer, real, string List of result values (according to Query).

Operator open_io_device

open_io_device(::IOInterfaceName, IODeviceName, GenParamName, GenParamValue:IODeviceHandle)
Open and configure an I/O device.
Parameter Values Default Type Description
IOInterfaceName 'OPC_Classic' [] string HALCON I/O interface name.
IODeviceName [] string I/O device name.
GenParamName [] string Dynamic parameter names.
     'browse_interface' 'Default', 'ComDA2', 'ComDA3' 'Default' string Override automatic choice of interface to use for browsing.
     'keep_alive_time' <milliseconds> integer Time interval to do cyclic keep-alive read.
     'locale_id' 'en-US' string Locale to set for the connection.
     'reconnect_after_connection_error' 'true', 'false' 'true' bool Flag to indicate if the server shall do an automatic reconnect after the connection was interrupted.
GenParamValue [] integer, real, string Dynamic parameter values.
IODeviceHandle integer Handle of the opened I/O device.

Operator control_io_device

Not supported by this interface.

Operator set_io_device_param

Not supported by this interface.

Operator get_io_device_param

get_io_device_param(::IODeviceHandle, GenParamName:GenParamValue)
Query settings of an I/O device instance.

There may exist additional parameter attributes, which can be accessed as 'ParamNames.AttributeName'. The following standard attributes may be available:
  • '.access': This attribute provides the access permissions of the corresponding parameter as a string. Possible values are 'ro' (read-only), 'wo' (write-only), 'rw' (read/write), 'na' (unavailable, perhaps due to insufficient access rights), and 'ni' (unavailable, not defined for this device or channel).
  • '.category': This attribute provides the category of the corresponding parameter as a string. 'I/O interface' for all pre-defined I/O interface parameters.
  • '.default': This attribute provides the default value of the corresponding parameter.
  • '.description': This attribute provides the description of the corresponding parameter as a string.
  • '.displayname': This attribute provides the displayname of the corresponding parameter as a string.
  • '.range': This attribute provides the minimum and maximum, (and the step width, if applicable) for the corresponding integer or float parameter as a tuple with 2 (or 3) elements.
  • '.representation': This attribute provides how the value of the parameter should be displayed in a GUI: 'ip address', 'hex', ...
  • '.tooltip': This attribute provides the tool-tip of the corresponding parameter as a string.
  • '.type': This attribute provides the HALCON value type (integer, real, or string) of the corresponding parameter as a string.
  • '.values': This attribute provides the valid value list for the corresponding parameter as a tuple.
  • '.visibility': This attribute provides the visibility of the corresponding parameter as a string. Possible values are 'common', 'extended', and 'dangerous'.
  • '.unit': This attribute provides the units of the corresponding parameter as a string. For example: 'ns', 'us' and 'ms', or 'mm', 'cm', 'dm' and 'm'.
Parameter Values Type Description
IODeviceHandle integer Handle of the opened I/O device.
GenParamName string Parameter names.
     'browse_interface' 'Default', 'ComDA2', 'ComDA3' string Override automatic choice of interface to use for browsing.
     'io_device_name' <device URL> string Returns the name of the device.
     'keep_alive_time' <milliseconds> integer Time interval to do cyclic keep-alive read.
     'locale_id' string Locale to set for the connection.
     'param_name' string Returns the possible parameter names.
     'reconnect_after_connection_error' 'true', 'false' bool Flag to indicate if the server shall do an automatic reconnect after the connection was interrupted.
GenParamValue integer, real, string Parameter values.

Operator query_io_device

query_io_device(::IODeviceHandle, IOChannelName, Query:Result)
Query information about channels of the specified I/O device.
Parameter Values Type Description
IODeviceHandle integer Handle of the opened I/O device.
IOChannelName string Channel names to query.
Query string Name of the query.
     'access_rights' 'Readable', 'Writeable', 'ReadWriteable', 'Unknown' string Item access rights.
     'browse' <ItemId>,<IsItem>,<HasChildren>[,<ItemId>,<IsItem>,<HasChildren>,...] string Returns a list of subnodes of the specified node. Only a single node may be specified. If an empty node ([]) is specified, browsing starts at the root of the OPC COM DA node tree. For each node the OPC ItemId is returned. The ItemId can be used as a channel name for subsequent channel operations. No other queries may be requested in this call to query_io_device.
     'data_type' 'Boolean', 'Byte', 'DateTime', 'Double', 'Float', 'Int16', 'Int32', 'Int64', 'SByte', 'String', 'UInt16', 'UInt32', 'UInt64', 'Unknown' string Canonical datatype of the OPC item on the server.
     'param_name' string Returns the possible parameter names.
Result integer, real, string List of values (according to Query).

Operator open_io_channel

open_io_channel(::IODeviceHandle, IOChannelName, GenParamName, GenParamValue:IOChannelHandle)
Open and configure I/O channels.
Parameter Values Default Type Description
IODeviceHandle integer Handle of the opened I/O device.
IOChannelName string HALCON I/O channel names of the specified device.
GenParamName [] string Parameter names.
     'deadband' <number> float Minimum interval between 2 updates for this item in milliseconds. 0 means the item is not added to a subscription.
     'read_from_cache' 'true', 'false' 'false' bool Read values from cache instead of reading directly from the server. Read from the server anyway if the updaterate = 0 or if no value is available.
     'update_rate' <milliseconds> integer Interval in milliseconds to receive datachange updates from the server. 0 means the item is not added to a subscription.
GenParamValue [] integer, real, string Parameter values.
IOChannelHandle integer Handles of the opened I/O channel.

Operator control_io_channel

Not supported by this interface.

Operator set_io_channel_param

set_io_channel_param(::IOChannelHandle, GenParamName, GenParamValue:)
Set specific parameters of I/O channels.
Parameter Values Default Type Description
IOChannelHandle integer Handles of the opened I/O channels.
GenParamName [] string Parameter names.
     'deadband' <number> float Minimum interval between 2 updates for this item in milliseconds. 0 means the item is not added to a subscription.
     'read_from_cache' 'true', 'false' 'false' bool Read values from cache instead of reading directly from the server. Read from the server anyway if the updaterate = 0 or if no value is available.
     'update_rate' <milliseconds> integer Interval in milliseconds to receive datachange updates from the server. 0 means the item is not added to a subscription.
GenParamValue [] integer, real, string Parameter values to set.

Operator get_io_channel_param

get_io_channel_param(::IOChannelHandle, GenParamName:GenParamValue)
Query specific parameters of I/O channels.

There may exist additional parameter attributes, which can be accessed as 'ParamNames.AttributeName'. The following standard attributes may be available:
  • '.access': This attribute provides the access permissions of the corresponding parameter as a string. Possible values are 'ro' (read-only), 'wo' (write-only), 'rw' (read/write), 'na' (unavailable, perhaps due to insufficient access rights), and 'ni' (unavailable, not defined for this device or channel).
  • '.category': This attribute provides the category of the corresponding parameter as a string. 'I/O interface' for all pre-defined I/O interface parameters.
  • '.default': This attribute provides the default value of the corresponding parameter.
  • '.description': This attribute provides the description of the corresponding parameter as a string.
  • '.displayname': This attribute provides the displayname of the corresponding parameter as a string.
  • '.range': This attribute provides the minimum and maximum, (and the step width, if applicable) for the corresponding integer or float parameter as a tuple with 2 (or 3) elements.
  • '.representation': This attribute provides how the value of the parameter should be displayed in a GUI: 'ip address', 'hex', ...
  • '.tooltip': This attribute provides the tool-tip of the corresponding parameter as a string.
  • '.type': This attribute provides the HALCON value type (integer, real, or string) of the corresponding parameter as a string.
  • '.values': This attribute provides the valid value list for the corresponding parameter as a tuple.
  • '.visibility': This attribute provides the visibility of the corresponding parameter as a string. Possible values are 'common', 'extended', and 'dangerous'.
  • '.unit': This attribute provides the units of the corresponding parameter as a string. For example: 'ns', 'us' and 'ms', or 'mm', 'cm', 'dm' and 'm'.
Parameter Values Type Description
IOChannelHandle integer Handles of the opened I/O channels.
GenParamName string Parameter names.
     'access_rights' 'Readable', 'Writeable', 'ReadWriteable', 'Unknown' string Item access rights.
     'data_type' 'Boolean', 'Byte', 'DateTime', 'Double', 'Float', 'Int16', 'Int32', 'Int64', 'SByte', 'String', 'UInt16', 'UInt32', 'UInt64', 'Unknown' string Canonical datatype of the OPC item on the server.
     'deadband' <number> float Minimum interval between 2 updates for this item in milliseconds. 0 means the item is not added to a subscription.
     'io_channel_name' string Return the name of the channel.
     'param_name' string Returns the possible parameter names.
     'read_from_cache' 'true', 'false' bool Read values from cache instead of reading directly from the server. Read from the server anyway if the updaterate = 0 or if no value is available.
     'update_rate' <milliseconds> integer Interval in milliseconds to receive datachange updates from the server. 0 means the item is not added to a subscription.
GenParamValue integer, real, string Parameter values.

Operator read_io_channel

read_io_channel(::IOChannelHandle:Value, Status)
Read a value from the specified I/O channels.
Parameter Values Type Description
IOChannelHandle integer Handles of the opened I/O channels.
Value integer, real, string Read value.
Status integer Status of read value. A status of '0' indicates success, while any other value indicates an error condition.

Operator write_io_channel

write_io_channel(::IOChannelHandle, Value:Status)
Write a value to the specified I/O channels.
Parameter Values Type Description
IOChannelHandle integer Handles of the opened I/O channels.
Value integer, real, string Write values.
Status integer Status of written values. A status of '0' indicates success, while any other value indicates an error condition.

Operator close_io_channel

close_io_channel(::IOChannelHandle:)
Close I/O channels.
Parameter Type Description
IOChannelHandle integer Handles of the opened I/O channels.

Operator close_io_device

close_io_device(::IODeviceHandle:)
Close the specified I/O device.
Parameter Type Description
IODeviceHandle integer Handle of the opened I/O device.

OpenSSL

This software uses Unified Automation's OPC UA SDK to provide OPC functionality. This toolkit uses OpenSSL 1.0.2j. It was configured and built with the options no-idea, no-mdc2, no-ntt, and no-rc5 to avoid patent issues.

If bugs are found in the version of OpenSSL provided by MVTec and you do not want to wait for an update of the interface, you can compile and use your own version.

HDevelop Examples

For this interface the following examples are available:
  • opc_browse_variables.hdev - Shows how to browse the available items on an OPC Classic server.
  • opc_channel_access.hdev - Shows how to read and write OPC Classic items.
  • opc_parameters.hdev - Shows how to determine which parameters are supported.

Release Notes

  • Revision 13.0.3 (Nov 28, 2017):
    • The technical dependency from the HALCON Library has been removed.
  • Revision 13.0.2 (Mar 06, 2017):
    • Update OpenSSL to version 1.0.2j
    • Update to version 1.5.4 of the Unified Automation OPC UA SDK
  • Revision 13.0.1 (Oct 28, 2016):
    • HALCON 13 version of the interface.
    • Update OpenSSL to version 1.0.1u.
    • Update to version 1.5.2 of the Unified Automation OPC UA SDK.
  • Revision 1.2 (Feb 15, 2016):
    • Update OpenSSL to version 1.0.1r.
    • Update to version 1.5 of the Unified Automation OPC UA SDK.
    • Fix potential memory leak when dealing with byte strings.
  • Revision 1.1 (May 11, 2015):
    • Fixed interface crashing when passing incorrect number of values to write_io_channel.
    • Fixed problem with reading value arrays.
  • Revision 1.0 (Sep 22, 2014):
    • First official release.