This highly configurable CNCnetPDM device driver for machines with Siemens Sinumerik 840D controllers enables to add OPC UA Server, MTConnect and SQL Database output functionality directly to these devices. In addition to monitoring of machine-, process- and quality data it allows to change or write parameters and variables.
You can dynamically define or adjust 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. This INI file also allows you to define your own names for every output tag.
FIG 1: Sinumerik 840D CNC Operator Panel
BENEFITS
Does not require an OPC Server or OPC Licenses at the machine
Works without the need for an additional user account at the remote PC
Effortful adjustment and configuration of DCOM at the remote PC is not necessary
Works in near real time in solicited (time controlled) or unsolicited (event driven) mode
SUPPORTED DEVICES
This driver supports Siemens Sinumerik controllers with MS Windows OS XP or higher that run HMI Advanced or HMI Embedded software. Follow these instructions to find out which software your device runs.
Create a directory at the controller (e.g. C:\CNCnetPDM) and share it to become accessible from the network, otherwise remote control of the service does not work
Open Explorer and type in 2 backslash characters followed by the IPv4 address of your remote PC e.g. \\192.168.1.100, authenticate if needed
Copy all files from the shared folder on your network or the USB Stick to this directory
Important: On controllers with OS Windows XP delete opcuaserver.dll and rename opcuaserver_XP.dll to opcuaserver.dll
Double click CNCnetPDM, select ‘Start Thread’ and check with CNCnetControl if it works
Optionally: It is highly recommended to perform the steps listed in chapter ‘USAGE’ from a remote PC at this stage
Click ‘Stop Thread’ and close CNCnetPDM
Open CNCnetPDM.ini with a text editor, change the last parameter of the first line in section [RS232] from device.dll to dde.dll (1). Optionally adjust device number (2) and name (3):
FIG 2: Configure Sinumerik DDE device driver in CNCnetPDM.ini
For automatic startup of OPC UA Server or MTConnect Adapter you can set ‘StartOffline = 0’ in sections [OPC UA Server] or [MTC Adapter].
To automatically start writing to a SQL Database set ‘StartOffline = 0’ in section [Connect]. Please make sure that connection to your database is setup correctly in this case!
To switch from solicited (time based, default) to unsolicited (event driven) acquisition mode set AcquisitionMethod = 2 in section [GENERAL]
Save CNCnetPDM.ini
ADJUST FIREWALL
If a firewall is running on your controller disable it or, depending on what features you use, add exceptions and change scope to ‘Any computer’ for all rules as your remote PC most likely is in a different subnet:
CNCnetPDM has to start automatically and run at the controller in background with HMI fully started up to be able to read and write data. The setup procedure (still in Service Mode) differs between controllers with OS Windows XP and Windows 7 or 10.
WINDOWS XP
Right click CNCnetPDM, select ‘Run as Administrator’
Click button [Install]
In the following dialog check ‘Automatic Startup’ and ‘Interactive (with Desktop)’ followed by Ok
WINDOWS 7 & 10
Right click CNCnetPDM, drag it to the Desktop and select ‘Create shortcuts here’
Right click ‘CNCnetPDM.exe - Shortcut’ select Properties and append Dialog=windows Aktion=threadstart to line ‘Target’ e.g.: C:\CNCnetPDM\CNCnetPDM.exe Dialog=windows Aktion=threadstart
Click ‘Apply’
Next, open ‘Programs’ -> ‘Startup’ -> right click ‘Open’ and move the shortcut to this folder
Restart the controller in normal mode with HMI
USAGE
On a remote PC with CNCnetPDM installed and a network connection to the controller run Explorer and type in 2 backslashes followed by the IP Address of the controller e.g. \\192.168.1.100
The remote device asks for credentials, in ‘User name’ enter the IP Address of the controller followed by a backslash and auduser e.g. 192.168.1.100\auduser
In ‘Password’ enter SUNRISE (uppercase) followed by Ok.
You should see share CNCnetPDM
Double click it navigate to folder ‘log’, open log_1000_date.txt and check its content. If everything went well you should see: Device 1000 initialization succeeded
Next, double click CNCnetControl and enter the IP Address of your controller under ‘Server DNS Hostname or IP Address’
If your device number is 1000 and the device name is SINUMERIK #1 the output should be similar to the one below:
FIG 3: CNCnetControl (Sinumerik remote)
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:
Every item has a tag name followed by its tag value. Tag names and values are delimited by pipe ‘|’ symbols. This allows CNCnetPDM to create OPC UA, MTConnect or SQL Database output for every Tag | Value pair.
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
18
PARTR
Required parts
19
MFUNC
Active M functions
20
RVAR1
Value of R variable 1
21
RVAR2
Value of R variable 2
FIG 4: IDs, names and description of items
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.
To adjust the INI file double click the shared folder CNCnetPDM on your controller and open dde_1000.ini with a text editor.
Section [GENERAL] contains information about global parameters used by the driver on startup:
‘Dependency’ is the name of the HMI program that has to be started before CNCnetPDM starts, default: maschine.exe
Commands defines the number of DDE commands you’d like to execute, default = 22 maximum = 30.
‘DDE Server Name’ and ‘DDE Server Topic’ are used to identify the DDE Server of the controller, default ‘ncdde’ and ‘machineswitch’
DDE Communication Timeout defines the interval for checking the ‘Alive’ State of the DDE server by using the command of section [0] (/Bag/State/opMode), default 500 (milliseconds).
Items you query are organized in sections e.g. [0]. Every section contains entries where you can define names and parameters for a specific item.
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 TAG name (max 5 characters) that describes the acquired item e.g. STATN for status number
Comment
A comment that describes the command (optional)
Command
DDE command to be executed e.g. ‘/Channel/State/progStatus’ for NC program status. The command ‘cnc_oeestate’ executes several DDE commands and calculates output relevant for OEE, see section ‘Output item’ and chapter ‘Commands’ below.
Output item
For normal DDE commands like ‘/Channel/State/stopCond’ this is NOT needed. Only for command ‘cnc_oeestate’ you can enter the values described in chapter ‘Commands’ below.
Output section
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, CollectQuality and CollectMessages enabled (=1) in CNCnetPDM.ini.
FIG 5: Description of a device INI file section
To change commands, switch items on or off or alter its name while CNCnetPDM is running open the INI file with a text editor, 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 controllers, see the ‘SINUMERIK 840D Parameter Manual’ for details or contact us if you need help.
Command cnc_oeestate
This special command is not a real DDE item like ‘/Channel/State/progStatus’ for NC program status. It executes several DDE commands and calculates output relevant for OEE. It also translates numeric output of specific DDE query results 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
CNCnetPDM for Sinumerik 840D controllers with DDE also supports writing and changing of data on these devices from a remote PC. Although writing of ALL writable DDE 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 [Command] (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 7: Change R-Variable on Sinumerik 840D controller
All successful write actions and errors are written to the device’s log file in subfolder \log.
TIPS
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!
To test this device driver on your local PC you need to have MS Excel installed. Delete dde_1000.ini if it already exists. In CNCnetPDM.ini change the parameter before dde.dll from 0 to 1: 1 = 1000;19200;8;N;1;SINUMERIK #1;127.0.0.1;0;1; localhost;0;0; none;none;1;dde.dll
Open DDE.xlsx and run CNCnetPDM, the first row of the spreadsheet contains the values that are usually sent by the controller. Modify them and check the results with CNCnetControl.
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 the OEE State of the machine output (0 = switched off, 1 = device is reachable but API does not respond, 2 = producing, 3 = manual, 4 = interrupted, 5 = Error). 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 in CNCnetControl, state disconnected and you just get output E = 1 the machine itself is reachable by ping but the controller API does not respond to commands, check setup of CNCnetPDM at the controller and the parameters used in section [RS232] of CNCnetPDM.ini.
If you do get numeric device states but not any of the preconfigured items please make sure that entries CollectOrders, CollectQuality, CollectFeeder and CollectMessages are set to 1 in section [General] of CNCnetPDM.ini.
If specific items are not acquired make sure that the numeric section of the item in the device drivers INI file e.g. dde_1000.ini 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.
UPGRADE DRIVER
If you already have a previous version of the driver installed and would like to upgrade to the most recent version proceed as follows:
Stop the CNCnetPDM background service (Windows XP) or foreground program (Windows 7 & 10)
Extract dde.dll from sinumerikdde_dll.zip into the folder where you have CNCnetPDM installed, overwrite the existing file
Delete the dde_NNNN.dll file (NNNN = machine number). If you already have created an adapted INI file for your controller devices do NOT delete the dde_NNNN.ini file
After restarting your controller an upgraded driver version for your machine is automatically created