The CNCnetPDM Standard OPC UA Device driver allows reading, writing and monitoring of machine-, process- and quality data from devices that run any OPC UA compliant server. Reading and monitoring can be performed in solicited (time controlled) or unsolicited (event driven) mode.
Download the CNCnetPDM Standard OPC UA device driver, extract all content of OPC_UA_Device_Driver.zip into the folder where you have CNCnetPDM installed.
Open CNCnetPDM.ini with a text editor
In section [GENERAL] set AcquisitionMethod = 1 to read data from the OPC UA server by polling it in a time interval (solicited messaging). For reading based on events at the OPC UA server (unsolicited messaging) set AcquisitionMethod = 2.
For solicited messaging set PollInterval to the interval (seconds) for polling data from the device.
For unsolicited messaging set PollInterval to the interval (seconds) for checking if the device is connected (alive).
In section [RS232] add a new device as described in the quick start guide point 7. Change the line as follows: 2 = 1001;19200;8;N;1;DEVICE #2;192.168.1.100;0;2;DNS Hostname;0;0;none;none;1;opcua451.dll
Adjust IP Address or DNS Hostname according to the setup of your device.
If you use unsolicited messaging change the number before DNS-Hostname to 2. Any other number switches the driver to solicited messaging.
The number before opcua451.dll defines how the default INI file for the device will be created: 0 creates an INI file for devices that use namespace index 4 (Numeric) like PILZ PLCs or GF AGIE Lasers. 1 creates an INI file for devices that use namespace index 2 (String) like Siemens PLCs or Sinumerik CNCs.
Note: The CNCnetPDM OPC UA Client outputs the namespace used by your device if you click on a node in the OPC UA browser and check the value for namespace index in the right area. TOP
Start CNCnetPDM, foreground program is sufficient (Start thread)
CNCnetPDM automatically copies the original opcua451.dll and appends the machine number as configured in the INI file, e.g. opcua451_1001.dll for machine 1001
In addition an INI file with the same name is automatically created by the device driver, e.g. opcua451_1001.ini for machine with device number 1001
Open the device INI file with a text editor and adjust all values in sections [GENERAL] and [SECURITY] as described in chapter ‘ADJUST ITEMS’
Start CNCnetPDM again
Double click CNCnetControl, if your device name is SINUMERIK #1 the output should be similar to the one below:
Every item has a description (Tag name) followed by its value (Tag value). All descriptions and values are delimited by pipe ‘|’ symbols. This allows CNCnetPDM to create database records or MTConnect output for every item. TOP
This device driver enables to dynamically add, group, enable or disable items and change their names. The INI file automatically created by the device driver for every machine contains sections that allow you to control its behavior.
This section contains information about global parameters used by the driver on startup.
‘Commands’ defines the number of OPC commands you’d like to execute, maximum value = 30.
‘Server port’ defines the TCP port number of the OPC UA server at the device, typically 4840.
‘Sampling rate ms’ sets the sampling rate for unsolicited messaging, default = 500, minimum = 100.
‘Operation timeout ms’ defines the time after which the driver assumes that the device is not alive and disconnects.
‘Namespace index’ is the numeric namespace index used by the OPC UA server.
‘Identifier type’ is the identifier type used by the OPC UA server, ‘String’ or ‘Numeric’.
‘Username’ and ‘Password’ define the credentials that the driver uses to access the OPC UA server if anonymous access is not used
‘No authentication’ can be set to 1 if the driver should use anonymous, non-secure access to the OPC UA server, default 0.
‘Server type’ defines how the driver detects OEE machine states, set this to 1 for Sinumerik CNCs. TOP
This section contains information about the OPC UA security mode and policy of the endpoint that the driver should access.
‘Security mode’ can either be None, Sign or SignAndEncrypt.
‘Security policy’ can either be None, Basic128Rsa15, Basic256 or Basic256Sha256.
OPC Items you query are organized in sections e.g. . Every section contains entries where you can define names and parameters for a specific OPC item. Unless otherwise instructed do NOT change sections  and .
Description of the numeric sections:
Section identifier, numbers starting with 0 are queried
If you set this to 0 the command is not executed
A short name (max 5 characters) to describe the item e.g. STATN for status number
A comment that describes the command (optional)
OPC command to be executed e.g. ‘/Channel/State/progStatus’ for identifier type ‘String’ or ‘6112’ for identifier type ‘Numeric’. The command ‘cnc_oeestate’ executes several OPC commands and calculates output relevant for OEE, see section ‘Output item’ and chapter ‘Commands’ below.
For normal OPC commands this is NOT needed. Only for command ‘cnc_oeestate’ you can enter the values described in chapter ‘Commands’ below.
You can output data to 3 sections that may contain up to 256 characters. 1 goes to section ‘O’, 2 to ‘A’ and 3 to ‘F’. If data in one section exceeds the maximum length you can send items to a different section. Make sure you have entries CollectOrders, CollectFeeder and CollectQuality enabled (=1) in CNCnetPDM.ini.
FIG 4: Description of a device INI file section
Note: To change commands, switch items on or off or alter its name while CNCnetPDM is running open the INI file with a text editor such as notepad, make the desired changes and save the file. To apply the changes immediately you can click on the machine in CNCnetControl on the left side followed by clicking buttons ‘Close’ and ‘Open’ above the section ‘Devices’. TOP
Here you can find information about commands and output items that can be used with this driver. In general you can use all OPC UA items output by the CNCnetPDM OPC UA Client with the driver. Also see the ‘Parameter Manual’ of your controller for details or contact us if you need help.
This special command is not a real OPC item like ‘/Channel/State/progStatus’. It uses the output of command = ‘Device Mode’ and command = ‘Program State’ to calculate output relevant for OEE. It also translates numeric output of specific OPC queries into text.
Numeric OEE state of the device (2 = producing, 3 = manual, 4 = interrupted, 5 = error)
State of the device as text (producing, manual, interrupted, error)
Numeric running mode of the controller (0 = JOG, 1 = MDA, 2 = AUTO)
CNCnetPDM for OPC UA servers also supports writing and changing of data on these devices from a remote PC. Although writing of ALL writable OPC items is supported it is highly recommended to start with simple commands like changing ‘R variables’. In case you access the OPC UA server of a Siemens Sinumerik controller you can proceed as follows:
With an unmodified INI file for a device that uses identifier type ‘String’ CNCnetPDM queries two ‘R variables’, section  = ‘R variable 1’, section  = ‘R variable 2’. To change the value of these 2 variables CNCnetPDM has to be running and you should see data for RVAR1 and RVAR2 via CNCnetControl, section ‘F’.
To change the value of a parameter first click on the device in the left area (1). Then click on button [Cmd] (2). In the drop down box below number (3) select or input 21. Enter a new numeric value into the text box below command text (4) here 1500.33. Click button [OK] (5). You can see the new value in the ‘Device Data’ area in the right pane (6). TOP
FIG 6: Change R-Variable on Sinumerik controller with OPC UA server
All successful write actions and errors are written to the device’s log file in subfolder \log. TOP
For correct setup of the CNCnetPDM OPC UA device driver it is highly recommended to start with the CNCnetPDM OPC UA Client and use its output to define correct commands in your device INI file.
To get correct output of OEE device states please make sure that you use a command for section 0 in your device INI file that outputs the device mode and one for section 1 that outputs the program state.
If OEE device states are still incorrect you can set CollectStates = 0 in CNCnetPDM.ini and calculate the values by your application program. To do so you can use different commands for section 0 and 1 and define an output section other than 0 for them.
If your device does not output part counter values set Active = 0 for section 2 in your device INI file.
OPC items on OPC UA servers that use the ‘String’ identifier such as Siemens Sinumerik are case sensitive, for example NC program status has to be queried with /Channel/State/progStatus, if you use /Channel/State/PROGSTATUS you get an error.
If you want to add additional items (up to 30 in total) first adjust the number of commands in section [GENERAL]. Then, copy and paste the last numeric section and do not forget to adjust the section number and its content!
In case you use the device driver in unsolicited mode and you query items that change very fast e.g. Axis position it is recommended to use higher values for the sampling rate. TOP
This device driver requires the most recent version of CNCnetPDM and also works with a free license. However, in this mode you only get output for the first item configured in your INI file. With a valid license you are able to output the result of up to 30 functions per reading cycle, see licensing for details. TOP
The device driver writes a log file entry for any communication issue to the log file of the device. The file can be found in subdirectory \log of your CNCnetPDM program folder. The file format for the log file is log_ + device number + _ + date.txt. Please check this file first if you observe an issue.
If the machine shows a red icon, state disconnected and you get just output E = 0 the machine is not reachable at all. This has nothing to do with the device driver, the controller is switched off, it’s a network issue or DNS Hostname or IP Address is wrong.
If the machine shows a green icon, state connected but you just get output E = 1 the machine is reachable but the controller does not respond to commands, check your controller setup and the parameters used in section [RS232] of CNCnetPDM.ini. Please use the tool CNCnetPDM OPC UA Client to check if you can access the OPC UA server of the device.
If you do get numeric device states but not any of the preconfigured items please make sure that entries CollectOrders, CollectQuality and CollectFeeder are set to 1 in section [General] of CNCnetPDM.ini.
If connection to your device succeeds but you do not get any output please check that the value for AcquisitionMethod in section [GENERAL] of CNCnetPDM.ini matches the setup of your device in section [RS232]. For AcquisitionMethod = 2 you have to use number 2 before DNS-Hostname in the line that defines the device.
If you defined an incorrect device INI file or messed it up you can simply delete it and switch the device off and on via CNCnetControl. The INI file then gets automatically recreated.
If specific items are not acquired check first with CNCnetPDM OPC UA Client if you can access the desired OPC UA node. Also make sure that the numeric section of the item in the device drivers INI file is activated and has an entry for ‘Name’, inactive or items with empty names are not acquired. Also check that you didn’t misspell entries for command and output item in your device driver INI file. TOP
If you already have a previous version of the driver opcua451.dll installed and would like to upgrade to the most recent version proceed as follows:
Stop any CNCnetPDM background service or foreground program that uses the device driver
Extract all content of OPC_UA_Device_Driver.zip into the folder where you have CNCnetPDM installed, overwrite the existing files
Delete all opcua451_NNNN.dll and ClientAPIUA451_NNNN.dll (NNNN = machine number) files. If you already have created adapted INI files for specific devices do NOT delete the opcua451_NNNN.ini files
After restarting CNCnetPDM upgraded device driver versions for all machines are automatically created TOP