[Guide] Simple Hierarchies

Hierarchy Guide for Beginners

Version 1.0

This guide will walk you through making a simple hierarchy structure in N4.
No prior knowledge is required, though I won’t go in-depth with NEQL, which we will use to create the hierarchies.

What are hierarchies in Niagara

A hierarchy in Niagara is a dynamic navigation menu aimed at the users or clients of the station.
It’s built by leveraging tagging on the station and using NEQL statements. Don’t worry, I’ll guide you through it as gently as I can :slight_smile:

So I should always use hierarchies?
God no!!! Hierarchies are great for large-scale systems, where you can get a huge navigation structure that isn’t easily maintained through nav files or simple px menus. Especially if it’s a client that often adds new systems that need to be implemented in N4.
In a shared hosted environment, with multiple clients on the supervisor, I think it’s a great system.
For the local autoshop with minimal equipment and no supervisor, but just a direct connection to the JACE, it’s overkill. Use a nav file instead.

But I can make a menu in px
You can fix most car issues with gaffer tape… That doesn’t make it a good solution.

But hierarchies are ugly!
Yep… I won’t disagree with you. But luckily you can do something about that and customize the look however you wish. You just need to know some bajascript, but that’s a topic for another day :wink:


Let’s begin

This could have been the place I supplied you with a .bog file, with the basic setup… But I won’t :wink: This way you will get a better understanding of the subject

Preparing yourself

This might be a long one, so get your snacks and drinks ready before you read any further!
Ready? Great!
Now start up workbench and a station.

Preparing the station

Before we start building the hierarchy, let’s prepare the station. To do that, we need to install the Haystack tag dictionary and make a folder structure to resemble a site.

Haystack

:warning: I’m assuming you are using Niagara 4.13 to make use of Haystack4 :warning:

Open the haystack palette and drag Haystack4 onto the TagDictionaryService under Services

Folder Structure

Make a folder structure resembling this. It’s not important what you call your equipment, so if you want to call your rooms “Zone00001, Zone00002” and so on, be my guest.
You can make it anywhere on the station. I have made mine in a folder called HierarchyChallenge directly under config… Guess what my next challenge topic will be :wink:


Tags - Semantic Model

Now that everything is set up, we need to tag our folders, so we have something to build the hierarchy with.

Tagging is a way to define every part of your BMS system and it’s a huge topic, which you can read more about here: (6) A BMS ENGINEER’S QUICK GUIDE TO SEMANTIC MODELING (TAGS, HAYSTACK, BRICK, REC, etc…) | LinkedIn
There are no official guidelines yet on how a BMS system should be tagged, but there are efforts made to create standardized semantic models. You can follow the work here, if you are interested: 223 Overview — ASHRAE Standard 223P User Documentation (open223.info)

In this guide, we will ignore all these lengthy guides, that can’t agree on a semantic model, and create our own very simple model.

Our model is gonna look like this:

  • tagDictionary:tag [type] - description
  • h4:siteRef [string] - Every folder will get this tag, to define which site it belongs to.
  • h4:equipRef [string] - Every piece of equipment and room will get this tag, to define what kind of equipment it is.
  • h4:equip [marker] - Every piece of equipment with a px view will get this tag. I know we don't have px views in this setup, but in a real project most of the equipment would have views defined.

Tagging the Station

Start by Right clicking the "London" folder and select Views -> Tag Manager.
This is the Tag Manager view and it’s a great tool to quickly tag many components of the station. Learn to love it!

Right now we only have the London component in the list on the left side of the view, but we want every component in our setup.
Expand all folders and mark them all, except "London" like in the next screenshot and drag them all to the component list in the tag manager.

Let’s start with the first tag in our model, the h4:siteRef tag. We have two locations, London and Tokyo, indicating it’s a huge client and we should charge extra.

  • Select every component belonging to the London location
  • Select the "Haystack4" dictionary in the dropdown box at the top of the view
  • Search for "site"

By selecting multiple components but not all, only the selected components in the list will be tagged.
Drag the siteRef tag down to the lower half of the split screen and a popup should appear. Fill in the "Value" field with "London" and click OK. You should now have something that looks like this:

Now select all "Tokyo" components and give them the siteRef tag with the value of "Tokyo"

Select all equipment, search for the "equip" tag and drag it to the lower split pane like in the screenshot:

The last tag is the h4:equipRef tag.
For this, we will select each group of equipment in turn, give it the h4:equipRef tag and fill in the value like this:

  • AHU[xx] value: Ventilation
  • HWS[xx] value: HotWaterSystem
  • Room[xx] value: Rooms

With everything tagged, we can now start building the hierarchy :tada: :tada: :tada:


Building the Hierarchy

  • Go to the "HierarchyService" under "Services".
  • Open the "hierarchy" palette

The first thing we need to do is drag a "Hierarchy" from the palette and drop it in the "HierarchyService". When prompted for a name, write the company name of the client. In this example, that’s “Acme”.

I usually create a hierarchy per customer, sometimes more, as it’s a great way to control who sees what. If you have multiple hierarchies and make a new user role, you can select which hierarchies are viewable to that role, like in this screenshot:

Here you can see the difference between logging in as an Admin and a user with the “AcmeTokyo” user role:

image

Back to our hierarchy!

  • Go to the AX Property Sheet of our newly created "Acme" hierarchy.
  • Expand the "Scope" property and then expand "Station"
  • Set the "Scope Ord" to the "Acme" folder so we only search for tags in this location

If you look at the Hierarchy, you can see that it’s pretty empty:
image

We have a few tools at our disposal to build a hierarchy, when you look at the palette. In this simple demonstration, we will only use GroupLevelDef and QueryLevelDef, but I strongly suggest that you read the help docs on every tool and play around with them. Hierarchies can be very versatile.

Our structure will look like this:

  • Acme [hierarchy name]
    • Location [GroupLevelDef based on h4:siteRef]
      • Equipment Type [GroupLevelDef based on h4:equipRef]
        • Equipment [QueryLevelDef based on h4:equip]

Let’s drag a "GroupLevelDef" from the palette to the Acme hierarchy and name it "Location".

A GroupLevelDef creates groups based on the value of a tag.
If you have a string tag called h4:superhero on multiple components, where some of the components have the value in the tag set to “Batman”, others to “Superman” and the rest to “Austin Powers”, then three branches would be created in the hierarchy called “Batman”, “Superman” and “Austin Powers”.

In “Group by” we will write h4:siteRef

Now drag another "GroupLevelDef" onto the Acme hierarchy and name it "EquipmentType". Group by h4:equipRef.

Drag a "QueryLevelDef" onto the Acme hierarchy and name it "Equipment". Fill in the “Query” with h4:equip to select all components with this tag.

Hierarchies are read “top-down”, so the “Location” levelDef is evaluated first, then the “EquipmentType” levelDef and lastly the “Equipment” levelDef even though they aren’t nested.

Every time you make changes to a hierarchy setup, remember to right click “Hierarchy” in the station and select “Refresh Tree Node”
image

Check out your super nice hierarchy in the station now


Playing around with the setup

Reordering the hierarchy

Try duplicating the “Acme” hierarchy and reorder the GroupLevelDef’s in the new one, so “EquipmentType” is first.
Refresh Tree Node and check out the new hierarchy

Create new equipment

Try copying the “AHU01” folder and paste it to the “Rooms” folder and rename it “AHU03”
Refresh Tree Node and check to see how AHU03 is still grouped under “Ventilation”, even though we pasted it to the room folder. This is because the hierarchy is only looking at the tags, not the location.

If you pasted it outside the “Acme” folder, it wouldn’t show up, as we set the scope to only look for tags inside “Acme” and its children.

2 Likes

Can’t wait to have a good attempt at this! Thanks Task Master :slight_smile:

I’m with you. I’ll dig into this tomorrow. I’m excited by all this awesome content!!!

1 Like

I had a go at this using pre-existing meta tags used on one of our multi site servers. The tags were applied via robot and don’t belong to a tag dictionary. @Rosenthaler do you know if this only works for tags with a dictionary namespace?

I just did a test, and I think it should work, as it’s not directly looking for a dictionary tag, but a property.
On AHU04 I added a baja:marker through the metadata browser and a baja:boolean through the slot sheet.
They both seem to be picked up by NEQL


image

1 Like

I really had a great time doing this exercise. The article on semantic tagging really drives home my list of @Giantsbane THOU SHALTS! It’s really exciting to be looking to future proofing BAS systems by forming a rational and uniform naming conventions, for what every comes. I’ll just include two snips of my set ups, as I only know enough at this point to be a danger to myself and others. Bravo and such a good exercise!!!

1 Like

This was my hierarchy set up. I just duplicated Acme to Acme1 and reordered it:
image

1 Like

And here were my two results for the reorder query:

2 Likes

Great job @ControlFreak :trophy:
And that right there, displays one of the greatest strengths of a tag based system and hierarchies.
Without changing any folder structure, but simply reordering two components, you just created a new navigation menu, grouped by system first, instead of location.

2 Likes

I do have to say, with your entertaining way of presenting material…you owe me another towel to wipe down my screen with!!!

1 Like

Great manual

Use it always but I don’t use tag manager. I make use of meta data browser. Just a preference but find it more quickly since selecting and applying (including underlying foldes if needed) can be done in the same window, also re selecting others

1 Like

Thanks :blush:

And you are absolutely correct able the metadata browser. I have a tendency to forget about it, even though it’s a great tool :blush:

I’ve always found the meta browser unusably slow on big jobs! I’m interested to know if you have any tricks or experience the same?