Version:

This lesson is part of the OPC-UA and Devices in Ignition course. You can browse the rest of the lessons below.

Supplemental Videos

LESSON

BACnet Addressing

Description

This lession demonstrates how to create OPC tags from a BACnet Remote Device, describes the driver's addressing conventions, and demonstrates how to use a UDT to quickly create multiple tags quickly. The UDT definition used in this video can be found here: https://inductiveautomation.com/exchange/2064/overview

Video recorded using: Ignition 8.0

Transcript

(open in window)

[00:00] In this lesson, we'll take a look at creating tags while using the BACnet Driver. In the previous lesson, we saw how to use the BACnet driver to create a local device configuration, as well as a remote device configuration, which I have right over here. I'm at the point where I'm now ready to start extracting values from this remote device configuration. So to do that, we'll need to head over to the designer. While in the designer, we'll head over to the tag browser, and I'm going to go ahead and click the browse OPC servers button here, which will bring up the OPC browser. And from here, I'm going to drill down into the ignition OPC-UA server that's currently interacting with that remote device, which is really my only option at this point. So I'll go ahead and drill down into there. I'll go into devices. We saw the name of my remote device configuration earlier on the gateway. So we know this is the right one. It's also the only choice.

[01:01] We have a device item here, which I'll expand. And now we have some device level data points that we can actually drag in. So things like the firmware revision and so on, but I want to go a little bit deeper. I want to actually access the objects inside, which would be inside of this object list folder, which we can expand and we can start seeing our various objects. If we take a look at AI zero or analog input zero, we can see some additional tags or items we can drag in. Now, fortunately because of the driver does support browse ability, which is why we can use the OPC browser in the first place, I can actually just create tags here by dragging and dropping. So I can take the present value of my analog input zero, drag it into the tags folder here and now we're getting a live value. So it's really just that easy. Now the status flags here, they are a little bit trickier to use. You can see that if I expand them, they actually have some items under them. So the way status flags works is if I drag this over to the tags folder, you'll see that the type is actually a document. So it's just a JSON document here.

[02:03] The actual flag, so the fault and InAlarm are inside of this value array here. More specifically the first element there. So if you wanted to access those, actually the easiest way to do it would be to just go ahead and grab the flags under status flags here and just drag those over and we'll automatically create some Boolean tags for you. Alternatively, we could use the expression language to parse the string here. We could use the JSON get expression function to start parsing, and then we can use other functions like get bit to identify or single out individual flags. But dragging and dropping is just the easier option. Now I did want to take a look at the actual OPC item path here. So I think I'll go ahead and look at present value here. So I'll double click on this and I do want to take a look at the actual sort of addressing we're using here for the OPC item path. So just to make it a little bit easier to read, I'm actually going to click in here. I'm going to control C to copy, and I'm actually going to close this and get my script console open instead, which is open off screen here.

[03:07] And I'm going to go ahead and just paste that path in there, just so I can kind of see what's going on. If you've ever seen our driver addressing before you'll notice some commonalities. So the path does begin with three namespace notation here. In square brackets, we do have the name of the device configuration. After that, we do have the BACnet object type. So analog input specifically here. Now, if I was trying to manually type this information in and instead I was trying to go to an analog value, well, that's pretty easy, just replaced input there with value. It's not a lot of good reasons to be typing the path in, but just to kind of give you an idea. And then of course, if you wanted to try to access a binary value, well, that'd be just binary value. You get the idea. And then we have the zero here. The zero is just the identifier, the object identifier.

[03:56] So if I was trying to actually access binary value 100 I would need to add a one and a zero there. And then after that dot whatever data point you're trying to access. So in this case .present value. So it's a pretty simplistic naming scheme. If you're familiar with BACnet you probably know a lot of this already, but just kind of wanted to spell out how our drivers actually work in here. Now, because you have those three pieces, it's actually pretty easy to just make a UDT and turn those three pieces into parameters, which is actually something I did here. So I'm going to close a couple of things here. If I go to my data types folder here, I do have a UDT I created a little bit earlier. Double click here to open it up. And this is actually on the ignition exchange. So if you wanted to download a copy of this without having to create it yourself, it's pretty straightforward. It's a pretty small UDT, but I'll put a link in the description for you. If we take a look at parameters here, I'll just click the little edit icon here. I did actually add a fourth sort of parameter just to kind of represent the OPC-UA server in case yours is named differently. But we just need the device name, the identifier, and the type.

[05:00] So what I could do, I'll go ahead and actually close out of this real quick. And instead let's go ahead and create an instance. So what I'll do is I'll go up to the text folder here. I'll go ahead and we'll add a new data type instance. I'll use this BACnet base UDT I created. And the way the UDT works, if we take a look at present value, I'll go ahead and take a look at the OPC item path here, and we'll edit just for viewing. Again, it just uses those three parameters. So just like I've been talking about. So let's go ahead and instead of overriding this here, I'll go to the top item here, and instead of calling a new instance, how about we'll use this to access analog values zero. So I'll just call this AV zero, and then for the parameters here, I'll click the little edit button. For the device name, you saw my device name earlier. For the object identifier, we just need zero here because I want to get analog value zero, and then for the object type, just analog value. So we'll go ahead and hit enter. I'll hit commit.

[06:01] Now, if everything went according to plan, then when I expand the UDT instance here, I should see some live values. And with that, we'll end the lesson here. Now you should have a pretty good idea of how to create tags while using the BACnet driver.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.

close

Share this video