Email Us at [email protected]

Download N3uron
Back to videos

Node Setup / Using Templates

Nested Templates


In this video of our N3uron Academy, we’ll focus on templates inheritance and nesting.

  • [04:53]  Templates Overview

  • [06:39]  Creating Templates

  • [04:48]  Nested Templates


[00:00] In our previous video, we covered the creation of template instances. Today our focus shifts to inheritance and nesting. When working with templates, N3uron offers us the ability to add a template instance as a member of another template, that is, we have the ability to nest templates inside of each other. This functionality becomes incredibly handy when dealing with large or complex data structures or when you want to combine multiple templates into one cohesive unit. To illustrate this, I’ll be working with the tracker template we’ve been exploring in earlier lessons. But first, let’s revisit the data provided by the OPC UA Server for my PV plant. To do this, we go to the module instance, expand the menu, and select OPC Browser. From the drop-down menu, let’s select the connection – in this case, we only have one connection named ‘OPC Server’. Let’s expand the ‘Objects’ section, and you’ll see that our plant comprises several cabins, each containing six trackers.

[01:04] Given this repetitive structure, it makes perfect sense to create a ‘Cabin’ template and nest six ‘Tracker’ instances within it. Now let’s come back to the configuration panel. If we select one of the tags in the tracker template, like this one, and examine the tag’s address, you’ll notice that it includes a reference to the cabin it belongs to – in this case, ‘CAB01’. To make this more flexible, let’s add a new custom property to the tracker template, allowing it to work with any cabin and not just ‘Cabin 01’. To do this, I’ll click this button to the right of ‘Custom Properties’ and select ‘New Custom Property’. I’m going to call it ‘Cabin’.Now, let’s update the three tags to use this new custom property. So, I’ll start by selecting ‘POSITION_DIFF’ and in the ‘Node ID’ field, replace ‘CAB01’ with the Custom Property reference. So I’ll add double quotes here, a plus sign, remove ‘CAB01’, add ‘Cabin’ between curly braces, another plus sign, and finally double quotes.

[02:04] Now let’s save these changes and repeat the process for the other two tags. Ok, With that sorted, let’s create our ‘Cabin’ template. So I’m going to find the ‘Templates’ panel, click the button, and select ‘New Group’, then ‘Group’. The first thing that we’ll need is a name for our template. So I’m just going to call it ‘Cabin’. This template needs a custom property because it will utilize our ‘Tracker’ template, and the tracker instances need to know which cabin they belong to. So let’s create a new custom property, and let’s just call it Cabin.

[03:01] And finally, I don’t need to set the value inside the definition;  It will be set on each instance of the template. So I’m just going to save the changes. Remember, we want the ‘Cabin’ custom property of the tracker instance to inherit the value from our ‘Cabin’ template. To configure this, I’m going to modify my ‘Tracker’ template and add an expression, starting with an equal sign, and including the custom property of the ‘Cabin’ template I want to pass through, which is ‘Cabin’ as well. Note that when we’re referencing a Custom Property, we need to include it in curly braces. So with that, I’m going to save the changes. Now, let’s add the first member to our ‘Cabin’ template – a ‘Tracker’ instance for ‘Tracker01’. So I’ll go to my cabin template again, click this button here, and select ‘Tracker’ to embed an instance, and name it ‘TRK01’. And finally, I’ll set the ‘TrackerNum’ custom property to ‘TRK01’. Now we can add the remaining tracker instances similarly by right-clicking on ‘TRK01’ and selecting ‘Duplicate’. Now let’s change both the name of the instance and the value of the ‘TrackerNum’ custom property value to TRK02, and we could repeat this same process for all six trackers.

[04:06] For now, let’s leave it at that and save the changes. I’ll conclude by creating an instance of my ‘Cabin’ template. To do this, I’m just going to find the ‘Model’ panel, then click this button at the top, and select ‘New Group’, then select ‘Cabin’. I could just call this ‘Cabin02’ And then let’s specify the ‘Cabin’ custom property value. So let’s click here and let’s just set the value to ‘CAB02’, then save the changes. We can see that our template instance has been created. And we check the real-time display on the left hand side panel, we can see that all of the values are coming through successfully. That’s a wrap for today’s lesson on nested templates! Thanks for tuning in, and I’ll see you in the next video.

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
Consent to display content from - Youtube
Consent to display content from - Vimeo
Google Maps
Consent to display content from - Google
Consent to display content from - Spotify
Sound Cloud
Consent to display content from - Sound