Sinumerik OPC UA Device Driver

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

inventcom

SINUMERIK OPC UA DEVICE DRIVER


This CNCnetPDM device driver for Siemens Sinumerik 840D SL and 828D controllers with OPC
Unified Architecture (UA) enables you to monitor and output machine-, process- and quality data
from machines with these controllers. It also allows you to change or write parameters and
variables on these devices.

This driver supports all controllers running Sinumerik Operate version 4.5 (>= SP3), 4.7 and 4.8.

You can dynamically define your own set of items (up to 30) that can be enabled and disabled on a
per machine basis by an INI file that is automatically created with reasonable default values for
each machine configured. This INI file also allows you to define your own names for every tag.

PREREQUISITES
1. Please make sure that your controller is properly setup and you get data with our utility tool
CNCnetPDM.OpcUA.SimpleClient (Sinumerik Operate 4.5) (Sinumerik Operate 4.7 and 4.8)
Setup instructions can be found here: Sinumerik Operate 4.5, Sinumerik Operate 4.7 and 4.8.
2. Microsoft .NET 4.0 has to be installed on your PC
3. OPC Core Components have to be installed on your PC
4. Firewall at your PC has to be switched off or an exception for TCP Port 4840 has to be added.

SETUP CNCNETPDM
 Download CNCnetPDM and install it as described in the quick-start-guide.
 Download the Sinumerik OPC UA device driver, extract all content of sinumerikua_dll.zip into
the folder where you have CNCnetPDM installed.
 Edit CNCnetPDM.ini and add a new device as described in the quick start guide point 7. If you
already have an entry in section [RS232] for a machine with a Sinumerik controller you can
simply copy and paste this line and change its content.
 Change the line as follows:

FIG 1: Configure Sinumerik OPC UA device driver in CNCnetPDM.ini

SINUMERIK OPC UA DEVICE DRIVER - DESCRIPTION AND USAGE


Inventcom · www.inventcom.net · [email protected]
Version: March 2018 V1.1
Page 1 of 9
inventcom

For machines with Sinumerik 840D SL and 828D controllers you only have to change the last
parameter (1) to sinumerikua.dll. Of course you also have to make sure that IP Address or DNS
Hostname of your controller are correct.

USAGE
 Start CNCnetPDM foreground program is sufficient (Start thread)
 CNCnetPDM automatically copies the original sinumerikua.dll and appends the machine
number as configured in the INI file, e.g. sinumerikua_1001.dll for machine 1001.
 In addition an INI file with the same name is automatically created by the device driver, e.g.
sinumerikua_1001.ini for machine with device number 1001.
 Double click CNCnetControl, if your device number is 1001 and the device name is
SINUMERIK #1 the output should be similar to the one below:

FIG 2: CNCnetControl (Sinumerik)

Here the machine (1) shows up as connected (2) which is good. On the right side (3) you see the
acquired data:

 The line starting with O contains items defined in the INI file of the device that should be
output to section 1. If you didn’t change the INI file you get something like the following:

1001 01/30/2018 02:05:38 PM O STATN| 3| STATT| Manual| MODEN| 2| MODET| AUTO| PRGSN|
5| PRGST| Aborted| 10000000008

Every item has a description followed by its value. All descriptions and values are delimited by
pipe ‘|’ symbols. This allows CNCnetPDM to create a database record for every item.

SINUMERIK OPC UA DEVICE DRIVER - DESCRIPTION AND USAGE


Inventcom · www.inventcom.net · [email protected]
Version: March 2018 V1.1
Page 2 of 9
inventcom

With an unmodified INI file the initially configured items are:

ID NAME DESCRIPTION

0 AUTOM Automatic mode (numeric)

1 PRGST Program status (numeric)

2 PARTC Part counter (numeric)

3 STATN OEE Device state (numeric)

4 STATT OEE Device state (text)

5 MODEN Device mode (number)

6 MODET Device mode (text)

7 PRGSN Program state (number)

8 PRGST Program state (text)

9 PRGMN Name of the selected program

10 STOPC Stop condition

11 CHANS Channel status

12 TOOLN Tool number

13 SPDSP Spindle speed

14 OVRSP Override spindle percent

15 FEEDR Actual feed rate

16 OVRFD Override feed

17 PARTC Actual part count

SINUMERIK OPC UA DEVICE DRIVER - DESCRIPTION AND USAGE


Inventcom · www.inventcom.net · [email protected]
Version: March 2018 V1.1
Page 3 of 9
inventcom

18 PARTR Required parts

19 MFUNC Active M functions

20 RVAR1 Value of R variable 1

21 RVAR2 Value of R variable 2

FIG 3: IDs, names and description of items

SETUP BACKGROUND SERVICE


To setup a CNCnetPDM background service proceed as follows:

 Right click CNCnetPDM, select ‘Run as Administrator’


 Click button [Install]
 Check ‘Automatic Startup’ if the service should start automatically
 In dropdown field ‘Depends on service’ you can select a service that has to be started before
CNCnetPDM starts (e.g. a database service)
 Leave all fields in section ‘Service Account’ blank.
 Click button [Ok], the dialog closes.
 You can now click button [Start] to manually start the service.

See also: Setup CNCnetPDM as a background service

ADJUST ITEMS
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.

Section [GENERAL] 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.

‘Alive command’ defines the OPC item number (section) that should be queried to detect if your
controller replies to OPC commands. Please only change this to another number if your controller
does NOT reply to command ‘/Bag/State/opMode’. Use our CNCnetPDM.OpcUA.SimpleClient
(Sinumerik Operate 4.5) (Sinumerik Operate 4.7 and 4.8) program to check if you can read this
OPC item.

‘Server port’ defines the TCP port number of the OPC Server at the controller, typically 4840.

SINUMERIK OPC UA DEVICE DRIVER - DESCRIPTION AND USAGE


Inventcom · www.inventcom.net · [email protected]
Version: March 2018 V1.1
Page 4 of 9
inventcom

‘Namespace’ sets the namespace to be queried, typically ‘SinumerikVarProvider’

‘Username’ and ‘Password’ are only needed for Sinumerik Operate 4.7 and 4.8 for Sinumerik
Operate 4.5 you can leave these values blank.

‘No authentication’ has to be set to 1 for Sinumerik Operate 4.5 and 0 for Sinumerik Operate 4.7
and 4.8. Initially this is set to 1. For version 4.7 and 4.8 this has to be set to 0!

OPC Items you query are organized in sections e.g. [2]. Every section contains entries where you
can define names and parameters for a specific OPC item. Unless otherwise instructed do NOT
change sections [0], [1] and [2].

Description of the numeric sections:

Entry Description

[0] Section identifier, numbers starting with 0 are queried

Active If you set this to 0 the command is not executed

Name A short name (max 5 characters) to describe the item e.g. STATN for status number

Comment A comment that describes the command (optional)

Command OPC command to be executed e.g. ‘/Channel/State/progStatus’ for NC program


status. The command ‘cnc_oeestate’ executes several OPC commands and
calculates output relevant for OEE, see section ‘Output item’ and chapter
‘Commands’ below.

Output For normal OPC commands like ‘/Channel/State/stopCond’ this is NOT needed. Only
item for command ‘cnc_oeestate’ you can enter the values described in chapter
‘Commands’ below.

Output You can output data to 3 sections that may contain up to 256 characters. 1 goes to
section 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

SINUMERIK OPC UA DEVICE DRIVER - DESCRIPTION AND USAGE


Inventcom · www.inventcom.net · [email protected]
Version: March 2018 V1.1
Page 5 of 9
inventcom

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

COMMANDS
Here you can find information about commands and output items that can be used with this
driver. In general you can use all commands supported by Sinumerik 840D SL and 828D
controllers with OPC UA. See the ‘Parameter Manual’ of your controller for details or contact us if
you need help.

Command cnc_oeestate
This special command is not a real OPC item like ‘/Channel/State/progStatus’ for NC program
status. It executes several OPC commands and calculates output relevant for OEE. It also
translates numeric output of specific OPC queries into text.

COMMAND OUTPUT ITEM NOTES

cnc_oeestate statenumber Numeric OEE state of the device (2 = producing, 3 = manual, 4


= interrupted, 5 = error)

cnc_oeestate statetext State of the device as text (producing, manual, interrupted, error)

cnc_oeestate modenumber Numeric running mode of the controller (0 = JOG, 1 = MDA, 2 =


AUTO

cnc_oeestate modetext Running mode of the controller (text output)

cnc_oeestate prgstatenumber NC program state (numeric) (0 = Undefined, 1 = Interrupted, 2 =


Stopped, 3 = Started, 4 =Waiting, 5 = Aborted)

cnc_oeestate prgstatetext NC program state (text)

FIG 5: Description of command ‘cnc_oeestate’

SINUMERIK OPC UA DEVICE DRIVER - DESCRIPTION AND USAGE


Inventcom · www.inventcom.net · [email protected]
Version: March 2018 V1.1
Page 6 of 9
inventcom

WRITE DATA
CNCnetPDM for Sinumerik 840D SL and 828D controllers with OPC UA 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’.
To do so proceed as follows:

With an unmodified INI file for a controller CNCnetPDM queries two ‘R variables’, section [20] = ‘R
variable 1’, section [21] = ‘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 pane (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. Click button [OK] (5). You can see the
new value in the ‘Device Data’ area in the right pane (6).

FIG 6: Change R-Variable on Sinumerik 840D SL or 828D controller

All successful write actions and errors are written to the device’s log file in subfolder \log.

SINUMERIK OPC UA DEVICE DRIVER - DESCRIPTION AND USAGE


Inventcom · www.inventcom.net · [email protected]
Version: March 2018 V1.1
Page 7 of 9
inventcom

TIPS
To quickly test and build a working INI file for your controller you can use our tool
devicedrivertester. If used with this driver the program creates INI file sinumerikua.ini. To use this
file for CNCnetPDM you can simply append an underscore and the machine number e.g.
sinumerikua_1001.ini for device number 1001.

OPC items on Sinumerik Operate 4.5, 4.7 and 4.8 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!

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

TROUBLESHOOTING
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 (Version
4.5) (Version 4.7 and 4.8) and the parameters used in section [RS232] of CNCnetPDM.ini. Please
use the tool CNCnetPDM.OpcUA.SimpleClient (Sinumerik Operate 4.5) (Sinumerik Operate 4.7
and 4.8) to check if the machine replies to commands.

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.

SINUMERIK OPC UA DEVICE DRIVER - DESCRIPTION AND USAGE


Inventcom · www.inventcom.net · [email protected]
Version: March 2018 V1.1
Page 8 of 9
inventcom

If specific items are not acquired check first with CNCnetPDM.OpcUA.SimpleClient (Sinumerik
Operate 4.5) (Sinumerik Operate 4.7 and 4.8) that you get output. 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.

SINUMERIK OPC UA DEVICE DRIVER - DESCRIPTION AND USAGE


Inventcom · www.inventcom.net · [email protected]
Version: March 2018 V1.1
Page 9 of 9

You might also like