Email Us at [email protected]

Download N3uron
Back to videos

Node Setup / Using Templates

Creating Templates

Description

In this video of our N3uron Academy, we will focus on creating and configuring templates, which essentially means we’ll be working with template definitions.

  • [04:53]  Templates Overview

  • [06:39]  Creating Templates

  • [04:48]  Nested Templates

Transcription

[00:00] As we discussed in our previous video, templates are custom, complex data types that we can use to represent recurring tag structures in a way that ensures organization and maintainability. In today’s lesson, our focus will be on creating and configuring these structures, which essentially means we’ll be working with template definitions in this video. To start, I’ll select ‘Tags’ in the Explorer Panel, and you’ll find the ‘Templates’ panel up here on the right-hand side. Now, I’ll click this button in the top left, which allows us to choose between ‘New Group,’ ‘New Tag,’ or ‘New Folder’ if we want to create folders to better organize our templates. So, to begin, let’s choose ‘Group’ and give our new template a name. We’ll call it ‘Tracker.’ Now, I’m ready to add some member tags. To do that, I just need to click this button to add folders, tags, or even nested template instances into my structure.

[01:02] In this case, I’ll be working with OPC tags for my tracker since my template is intended to model an actual device. Let’s select ‘New Tag,’ expand the configuration section, and under the ‘Source’ options, I’ll enable the data source. I’ll choose ‘OPC UA Client’ from the ‘Module Type’ drop-down menu. Here, I need to select the name of the OPC UA Client instance I’ve created previously, which is ‘OPC UA Client,’ as we can see here. Finally, I need to enter the name of the connection I configured earlier, which, in this case, is ‘OPC Server.’ Now, I’m going to click this icon here, which allows me to browse the OPC UA Server. Naturally, this option will only be useful if your device supports browsing. Inside this interface, I’ll expand ‘Objects,’ ‘BLK01,’ ‘CAB01,’ and here I find my six trackers. If I expand those trackers, we’ll see that they contain the same three tags, which makes this a perfect time to use templates. In this case, I just want my definition to model a single tracker.

[02:02] Then, ultimately, I can create a template instance for each of my six trackers. So, to model just one tracker, I’ll find ‘Tracker 01’ here, click on ‘POSITION_VAL,’ and click the ‘Select’ button on the right. Now, let’s give the tag a consistent name and save the changes. If I take a look at the ‘Node ID’ property on the tag, we’ll see that the item path is set to ‘TRK01.’ This makes perfect sense, it’s the OPC item we selected in our picker a moment ago. However, our tracker template isn’t supposed to work for just ‘Tracker 01.’ We want it to work for any of the trackers. So, in a way, this OPC item path can’t be the same on every template instance. It’s going to need to change somehow. Thankfully, templates can handle this inherently. All we need to do is configure a template Custom Property, which will be set whenever we make an instance of this template, to control which tracker we’re looking at on the device.

[03:02] To do this, I’ll click this button to the right of ‘Custom Properties’ and select ‘New Custom Property.’ Now, we have several options for the custom property, but let’s keep it simple and name our custom property ‘TrackerNum.’ So, we’ll expect a value like ‘TRK01,’ ‘TRK02,’ ‘TRK03,’ and so on, that we can use to make our tags work. Let’s leave the remaining configuration fields with their default values and save the changes. We have this value field on the right. It might be tempting to put something in the value field, but remember, we’re on the template definition here, and we’re meant to decide which tracker to look at when we create instances. So, it’s fine to leave that field blank here. We’re almost done. We just need to modify our ‘POSITION_VAL’ tag to use our new custom property. So, I’ll select ‘POSITION_VAL’ here and then find the ‘Node ID’ field. Now, on this field, I just want to change this text here, ‘TRK01,’ and replace it with the Custom Property reference. To do this, I’m going to use an expression.

[04:01] First, I’ll add an equal sign at the beginning to indicate it’s an expression. Now, I’m going to build a text expression by concatenating different text strings. So, this part will go between quotes. Up to here, I’ll add a plus sign. And now, I’m going to delete ‘Tracker 01’ and I will add our Custom Property, which will be ‘TrackerName,’ between curly braces. I’ll add another plus sign, open quotes, and close quotes at the end. That’s it. It’s worth noting that any part of the ‘Node ID’ or any other field can be made dynamic. Here on the right, in the ‘Output’ field, I have this text, which is how N3uron is resolving this expression. Let’s save the changes. To complete the setup, we just need to add the other two tags that are found in every tracker.

[05:00] There are two approaches we can take. We can either repeat the process we’ve followed so far, or we can choose an alternative method by clicking here to export the configuration to a CSV file. Let’s do it that way and download the CSV file. Now I’m going to open and edit the file. Firstly, I’ll change the data type of every cell to text. Next, I’m going to copy and paste this row here twice. Then, I’ll update the names of the new tags to ‘POSITION_SP’ and ‘POSITION_DIFF.’ Finally, I’ll adjust their respective expressions as needed.

[06:09] After making these changes, we can save the modifications and close the file. Once we’ve finished with the CSV file, we can return to the Web UI. Here, we’ll click this button again and select ‘Load CSV.’ After selecting the file, we’ll click the ‘Load’ button to import the changes. With this step completed, our TEMPLATE is now fully configured and ready to be deployed across our data model.

Privacy Settings
We use cookies to enhance your experience while using our website. If you are using our Services via a browser you can restrict, block or remove cookies through your web browser settings. We also use content and scripts from third parties that may use tracking technologies. You can selectively provide your consent below to allow such third party embeds. For complete information about the cookies we use, data we collect and how we process them, please check our Privacy Policy
Youtube
Consent to display content from - Youtube
Vimeo
Consent to display content from - Vimeo
Google Maps
Consent to display content from - Google
Spotify
Consent to display content from - Spotify
Sound Cloud
Consent to display content from - Sound