CNCnetPDM OPC UA for Siemens Sinumerik Operate version 4.5 enables you to monitor machine-, process- and quality-data from Sinumerik 840D SL & 828D controllers from a remote PC. It also allows to write and change a wide range of parameters on these devices.
This document describes setup and configuration of OPC UA components on controllers with software Operate 4.5 SP3 and communication with a remote PC. Instructions on OPC UA setup and test with free SINUTRAIN versions are also included.
Make sure that you have option "Access MyMachine /OPC UA 6FC5800-0AP67-0YB0" activated (Startup->Licenses).
FIG 1: Activate License
Enable the OPC UA communication port (TCP port 4840) by clicking button [change] in area "Startup -> Network ->Company network". Add TCP port 4840 (1) and click [OK] (2).
FIG 2: Add TCP Port 4840
Important note: Please ensure that the date and time on your HMI is correct, otherwise certificate based OPC UA authentication does not work!
Next startup the controller in service mode without HMI: When the SINUMERIK screen is displayed during startup and the PCU base version at the bottom right, press key '3' and log in as user auduser.
To start the OPC UA components when the controller starts up you need to add an additional process to INI file systemconfiguration.ini. To do so, navigate to folder …/siemens/sinumerik/hmi/template/cfg/.
Copy file MiniWeb_linemb_systemconfiguration.ini from this folder to directory .../user/sinumerik/hmi/cfg/
If the target folder does NOT contain a file named systemconfiguration.ini you can simply rename MiniWeb_linemb_systemconfiguration.ini to systemconfiguration.ini.
If this file already exists you have to add the content of MiniWeb_linemb_systemconfiguration.ini to this file.
Open systemconfig.ini with a text editor and look for section [processes]. If it doesn’t exist you can copy the whole content of MiniWeb_linemb_systemconfiguration.ini, add it to the end of systemconfiguration.ini and save the file.
If section [processes] exists, copy the line that starts with PROC100= from MiniWeb_linemb_systemconfiguration.ini, add it to section [processes] in systemconfiguration.ini and save the file. You can also manually add the section to systemconfiguration.ini:
OPC UA setup on the free version of SinuTrain for SINUMERIK Operate V4.5 Ed.3 differs a bit from the procedure on a real controller but exactly works in the same way. You have to register a free account to be able to download the program.
Download and install SinuTrain for SINUMERIK Operate V4.5 Ed.3 - Basic. If you accept all default settings you are able to use the paths mentioned below.
Start SinuTrain and create one new machine f.i. ‘Lathe with driven tool’, it is recommended NOT to use the ‘DEMO-Lathe’ device.
Click [MENU SELECT] - [Setup] - ‘>’ [Licenses] - [All Options] - [Search], enter OPC, activate the license and click [OK].
Restart the machine from the SinuTrain Workbench and make sure that systemconfiguration.ini contains the additional process.
Note: If your PC gets it's IPv4 address from a DHCP server you have to make sure that file UAApplication.xml contains the correct IPv4 address. after startup of SinuTrain. If the IPv4 address changes SinuTrain reverts it to the previous value! Open UAApplication.xml with a text editor while SinuTrain is running, correct the entries, save the file and restart the machine (menu on top Machine -> Restart).
If configured correctly on startup of the machine now an additional command line window opens that shows details about the activities of miniweb.exe. Do NOT close this window!
Download Sinumerik_840D_828D_OPC_UA.zip and extract all files to a folder on your PC.
Make sure that TCP Port 4840 is opened in your Firewall. You can use our tool Device Port Scanner to check if your controller is reachable via this port.
Note: Both programs require .NET Framework 4 components and run on newer Microsoft Windows x86 and x64 OSes (>= Windows 7).
For OPC UA it is required that your PC trusts the Siemens certificate issued by your controller. Therefore it is necessary that it is installed in the certificate store of your PC. As this is a self-signed certificate it is NOT automatically installed. To install the certificate right click CNCnetPDM.OpcUA.Client.exe or CNCnetPDM.OpcUA.SimpleClient.exe, select ‘Run as Administrator’ and connect to your controller. This only has to be done once.
Note: If your PC does NOT have any OPC programs installed you need to install the x86 version of the OPC core components:
The CNCnetPDM OPC UA Client enables you to connect to your controller via OPC UA, browse items, see details of items and add or remove them from a subscription.
Start CNCnetPDM.OpcUA.Client.exe and enter the IP Address of your controller into textbox Node (1).
FIG 3: Connect CNCnetPDM.OpcUA.Client
Click on the arrow in textbox Endpoints (2), you should see 2 entries, select Sinumerik OPC UA OEM [None, None] [opc.tcp://IP-Address:4840] (3).
You are now connected to your controller via OPC UA.
In the upper left pane expand Objects->Sinumerik->/Bag->/Bag/State (1).
Click on /Bag/State/opMode (=Current operation mode of your controller).
FIG 4: CNCnetPDM.OpcUA.Client
Now you can see details of the selected object in the upper right pane (2).
By dragging the item from the upper left pane to the empty area at the bottom of the dialog you can add it to a subscription (3). If you now change the operation mode of your controller to AUTO, MANUAL or MDI you can immediately see the results under ‘Value’. If you right click the item you can change the sampling interval or remove it from the subscription.
You can add additional items to your subscription.
This program enables you to connect to your controller via OPC UA, select a specific namespace of the OPC server, monitor, read and write items.
Start CNCnetPDM.OpcUA.SimpleClient.exe, enter the IP Address of your controller into the textbox right to [Connect] e.g.: 18.104.22.168 (1) change port (2) only if you use a port different from 4840.
FIG 5: Connect CNCnetPDM.OpcUA.SimpleClient
Click [Connect] you now should be connected to the OPC UA server on your controller.
FIG 6: CNCnetPDM.OpcUA.SimpleClient
Initially one item is queried, by changing ‘Active Items’ to a different value you can activate up to 15 items.
The 15 predefined values under ‘ItemID’ are known to work well on most controllers. Of course you can change them according to your requirements. The last two items are 2 writable R Parameters (user variables) that are visible at the controller: [MENU SELECT] - [Parameter] - [User Variable].
If you click on button Read (3) the values of all active items are queried from the controller and shown in the dialog.
For the last two variables R1 and R2 you see their current values as set at the controller.
By entering different values for these two writable items and clicking on [Write] (4) you can change their values at the controller.
Clicking on [Monitor] (2) adds all active variables to a subscription and shows their current value.
In case of errors the program outputs an error log file that can be found in the directory where the program is located. This file contains detailed information about any errors.
On connect CNCnetPDM OPC UA Client shows no connections in textbox Endpoints or CNCnetPDM OPC UA Simple Client opens popup ‘Connect failed: Could not open UA TCP request channel’:
Make sure that the controller is reachable via the network and port 4840 is opened at the controller and your firewall. Use our tool Device Port Scanner to check if communication works.
Verify that process miniweb.exe is started at the controller. On a SinuTrain setup check that an additional command line window exists and one of the last lines contains ‘OPC UA Server started successfully on Port 4840’.
If no additional command line window opens at all check that the required entries in section [processes] of systemconfiguration.ini exist. If not, add them and restart the controller.
If the window is opened but there’s no line with ‘OPC UA Server started successfully on Port 4840’ check file OPC_UAApplication.xml.
If you see multiple lines in this window with text ‘BAILED OUT’ and error messages related to files not found check that the additional entry for miniweb.exe in systemconfiguration.ini points to the directory that contains miniweb.exe (search for it). You can also use the full path to miniweb.exe instead of the relative path. If this does not help, navigate to the folder that contains miniweb.exe, open subfolder \System and open file WebCfg.xml with a text editor. Verify that uncommented lines with long path entries point to directories that contain the specific .xml files.
If you see error message ‘Connect failed Error: cannot add self-signed certificate to certificate store’ on startup run the program one time as Administrator.
If you see error ‘Connect failed BadIdentityTokenRejected’ on SW 4.5 make sure that you didn’t check SW 4.7 in the dialog.