Join us today!
Ignition OPC UA Server - TwinCAT OPC UA Client
In the previous tutorial, we have explained how to setup TwinCAT OPC UA Server and Ignition OPC UA Client. This time, we will set Ignition OPC UA Server and TwinCAT OPC UA Client.
If you don't have Ignition installed already, you can download it here. You can open the Ignition gateway on your web browsing by typing localhost:8088/web .
Setting up Ignition OPC UA Server:
On the Ignition gateway, select Config then Server Settings.
Make the following changes and click save changes. More information about Ignition OPC UA Server settings can be found here.
Ignition gateway needs to be restarted for the changes to take effect. You can open Services located at %windir%\system32\services.msc , find Ignition service in the list and restart it.
To add a new user to 'opcua-module' profile, go to Config, then select 'Users,Roles'. Click on 'More' and select manage users.
There's one default user exist already. We will add a new user also. Select add user.
Set the username and the password as 'user' and check the ReadWrite role and save changes.
To find out the OPC UA Server endpoint, go to Config and select OPC Connections.
Click on 'More' option of Ignition OPC UA Server, then select endpoint.
Take a note of this endpoint somewhere, which we will be using later when configuring the TwinCAT OPC UA Client.
go to Config and select OPC Connections again, and select Edit this time to change the Authentication settings.
Change the username and password as below and save changes.
Now we are done with setting up the Ignition OPC UA Server. We will add a simulator program of which tags we will browse in TwinCAT. Go to Config, select Device Connections.
Select Create new device.
Select the 'Programmable Device Simulator' and click Next.
Name the simulator and click create new device.
To load a program into this simulator device, select More, then edit program.
For this tutorial, we loaded the 'generic program' into it. Select a program, click Load Simulator Program. You will see all the tags in this program after loading the program. Save Program.
It is a pretty extensive simulation program and as it can be seen below it has different types of variables already.
Setting up TwinCAT OPC UA Client:
Ignition OPC UA Server and simulator device setup is done and now we will setup the TwinCAT OPC UA Client. If the TF6100 OPC-UA-Client is not installed on your system, you can downlead it from here.
Create a TwinCAT project. Right click on 'Devices' and add new item.
Select the 'Virtual OPC UA Device' and click OK.
Right click on the Device 1(OPC UA Virtual) and select add new item.
Select OPC UA Client and click OK.
Double click on Client#1 and type the endpoint URL that we noted earlier. Set the Identity Type as UserName and type the username and the password as 'user'. Click Select Endpoint.
Ignition OPC UA Server settings for this tutorial are as below:
Discovery URL: opc.tcp://localhost:62541/discovery Endpoint URL: opc.tcp://localhost:62541 Endpoint Host Override: Endpoint Security Mode: None Endpoint Security Policy: None
Increase the timeout and click Update.
It will bring up the available endpoints from the OPC UA Server. Select the first option(None,None) and click OK.
It will automatically adjust the endpoint and security policies. Click Add nodes.
Trust the Ignition OPC UA Server certificate.
In the Select Nodes window, expand the simulator program(Test PLC) that we have created and select the tags that you wan to add into TwinCAT project. 'Enable Write' option allows users to write values to tags from TwinCAT. 'Add Status' adds timestamps and error codes info to the tags.
Double click on 'Write Enable' and set its value to enable client write permission in TwinCAT.
Select a tag and check its value real-time.
You can write values to the writable tags. You can change the read/write permission settings of these tags in your simulator program on Ignition.
You can change the polling rate under OPC UA Client settings if you need the a faster update cycle time for the tags.
You can also see the OPC UA node information for the tags.
Now that we have finished the setup of Ignition OPC UA Server and TwinCAT OPC UA Client, you can write a test program in TwinCAT, link your program variables to OPC UA tags and check the tag values on the Ignition side.
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
- 17 Forums
- 265 Topics
- 932 Posts
- 1 Online
- 688 Members