Configuring OPC UA Server in FT Optix

Home / FactoryTalk Optix / Optix for Edge

Description
This video looks at how to create and configure an OPC UA Server in FactoryTalk Optix. We look at the various ways that nodes are published to OPC UA. We also look at the “From PLC to Model” script that is available in the Template Library to easily duplicate PLC tags in the Model folder.

Software used for the demonstration:
FactoryTalk Optix v1.7
United Automation UAExpert v2.0.1


Transcript
(00:01) This video I want to look at OPCUA in optics and more specifically the OPCUA server so that we can actually be an opcua server and send data out uh via opcua. For this example um I’m going to use some simulated data that I have um kind of coming into this project. I have a power monitor 1000 where we have some simulated power monitor data being read directly from optics where we’re getting things like our voltage and our power readings.
(00:37) Um so we’re going to take that data from the power monitor and um and serve it out on OPCUA. There’s also a compact objects uh uh driver in here with some tags in there too. Um so we’ll have some additional data to perhaps show And the idea is that uh want to take a look at some of the different ways that the OPCway server kind of works. Um so to do this we simply need to come up here to our OPC way node in the project view rightclick and we’re going to say add a new OPCUA server.
(01:15) By default, uh the endpoint URL is um kind of populated here and it has a standard structure of the OPC.TCP and then it just shows local host and a port of 5910 0 by default. That is the port number that optics will use. Some other things that kind of get preop populated are things like the number of connections. Right now it’s set to one.
(01:44) We can increase that to more connections. Basically, how many uh OPCUA clients can connect to this server simultaneously. Um right now it’ll be set to only one. Uh maximum number of subscribers is set to 10. Uh you can set things like the sampling rate and your array length maximums. And of course, you can set your security um settings.
(02:10) Uh we’re going to leave them all none and uh keep our certificate files, you know, blank for our demonstration purposes just to make uh things easier without having to uh type in passwords and stuff. But you can of course set uh security settings and you know create your uh policy um levels of encryption there and of course uh attach certificate files.
(02:38) And if you need to, you can go up here to the gear symbol and you can actually uh create a certificate uh if you need to. So right now I’m just going to kind of leave it exactly like this completely default. By default, Optics will publish uh kind of the entire node structure that we see here um in the project view. So all these folders uh will kind of get published out to OPCUA.
(03:06) So we don’t have to do anything else uh to this. So to make this work, we’re going to simply start the emulator. And once the emulator starts, we can um we’ll go into our uh OPCUA client, which will be I’m going to use um UA expert um to do that. So our our emulator is working. It’s just in another window over here.
(03:37) Um, but let’s look at how we do this in in UA expert. So, I do need to create a server for here the first time. So, we get the little plus symbol up top. We’ll hit add server. We’ll give it a name such as um optics. And we’ll come to advance. And we’re going to put in the URL, which will basically be this string right here.
(03:56) I can either type it out or I could come into the optics studio and copy it and then come back to my UA expert and paste it. And then uh all the security settings are none and we have anonymous user. So we will say okay. Then we can rightclick on the server that got added and say connect. Now if you’re doing this for the very first time you might get a popup that says certificate.
(04:26) you can just hit the uh the button to accept it and and it’ll um connect. So, we’ll expand this out. Um over here we see we have the um the root and then the objects and then the aliases and then we have our PM1000 demo. So, aliases if we have any aliases we’ll show there. But the PM100 demo here is again the structure the entire structure of that um optics project.
(04:55) We have the alarms, COM drivers, converters, data stores, um the loggers, MQTT. So, you know, we have a data logger going. So, we can actually see the data loggers there. MQTT, we don’t have any of that uh going on right now. um find any net logic opcway right and down to the UI folder where it shows all the various um structure of the UI folder such as the screens I’ve created and stuff.
(05:24) So we kind of expose everything um on OBCUA in this in this manner. Uh but we can actually come to our com drivers and we can come to that micro station. We can see the um Oops. Uh let’s go back up here. to PM 1000. That’s the name of the uh station. And then um there’s our tags. So I have to kind of drill down quite a bit. Here’s our first folder.
(05:57) And then one of our tags. I just bring it up here and show that we are actually getting a real reading from that tag or from that um uh controller or from the power monitor. Right. So, um, so that’s all we have to do there. I’m going to go ahead and disconnect from this server and we’re going to come back to optics and this time we’re going to specify an actual node to publish.
(06:27) So, instead of publishing everything, we’re going to specify the node we want to publish. So, um, since the only thing we have are these com drivers at the moment, I don’t have anything in my model folder. I’m going to come to nodes to publish. I’m going to hit the plus symbol. This will add our configuration one.
(06:45) We now have nodes and users. For nodes, we’ll hit the plus symbol and we will search for our node. And in this case, we’re going to find our comm drivers or our microcontroller. The PM1000 is the station. And let’s just publish the tags folder here. And then for users, um, we can go ahead and add a user and just say it’s the anonymous user.
(07:14) So the difference is when I start my restart my emulator, let me restart the emulator here once optics gets caught up. So I can connect back to the um connect back to the to the optics um server. Notice this time under the objects, if I just expose the objects folder here, it’s a lot less. It’s just the uh the PM1000 demo and now the COM drivers and only the micro controller driver, the PM1000, and then the tags.
(07:57) So, my average current tag is still there. So I’m just seeing the the com driver uh PM1000 um part and not the entire file structure of the project being exposed to OPC way by by specifying the node. One other thing I want to show that might be a bit of a a hidden secret at times, and that is that um let’s say that you want to move all of your tags out of the controller, out of the com drivers, and put them up into a a folder in the model or into the model folder.
(08:39) Um so that you’ll manipulate those variables versus the ones that are directly coming from uh the controller. Well, to do that, you know, obviously you could manually create recreate all the variables and uh link them down here. But in the template library, they give us a a script. Rockwell has a script in uh that comes with optics.
(09:10) And if you come to the template library, hit on scripts and scroll down a little bit, we’re going to see a design time net logic uh routine that is called um let’s see where is it? Let me search for it. uh from PLC to model. I passed it up there. So, it’s called from PLC to model. And if you read the description of that, it says it’s a net logic that exposes methods um for the backup and restore.
(09:58) Oh, well, actually, uh nope, sorry. So, click on the right one. Uh to basically replicate the imported PLC tags into the model folder. So, we’re going to uh to to use this, we’re going to drag this uh script to the net logic folder. So, like that. Now, I don’t need to do anything. I don’t need to open this up in Visual Studio Code and manipulate anything.
(10:26) All I got to do is define over here um what it is I want to do. So, where are we going to where we’re fetching the information from, where we’re sending it to, and do you want to delete any existing tags that are in that target folder? And this is a design time net logic, which means that it’ll only run here while we’re in the design aspect.
(10:50) When the project is running, this C# script will not be something that is exposed to the running application. So we do need to define you know what what we want to do. And you see that we can see up here that our model folder is actually empty. So let’s take our we’re going to take our COM driver. Um we got to scroll down com drivers.
(11:15) We’re going to take that micro station the PM1000. We’re going to take the tags. So let’s take the tags the entire you know the full tag folder which will take all these subfolders. We’ll hit select and let’s just move it to the model folder. Say select to execute this. We’ll come back here to the net logic.
(11:36) Rightclick and just say net uh execute uh generate nodes into model. And it just says, you know, gives our little warning and we want to say proceed. And as quick as that, all those tags um from the com driver were copied into the model folder. And not only copied, but also given the link to basically link the value into these values up here.
(12:08) So nice little handy um script that’s in the template library uh to use. Now, if we go back to our opcua server, let’s go ahead and change this from the uh from the um from the uh con driver and let’s take this directly to the model folder. So now we’ll only publish the model folder instead of the uh the actual com driver stuff.
(12:42) Uh we will now rerun our emulator and once that comes up we can reconnect. So now when we come to our objects we will see PM100. All we see now is model and then those are our folders underneath the model folder. And then if we take our average current we can put it there and we can see we are getting a value.
(13:13) So those tags are basically being copied from the com driver to the model folder. Um all done through that script and now being published out to OPCUA server. So just wanted to show some of those features. Um creating the OPCUA server is pretty straightforward. um you know the the the part that might take a little bit of work is how do you want to contextualize that data? Do you want to kind of you know put it into a you know a particular folder structure to just publish that particular folder or do we want to just go ahead and you
(13:51) know publish the entire folder structure of the optics project and then you can kind of go through and find the tags that you need um you know in your opcua client.