Add Variables

Add Variables

Add Variables allows the user to add tags, points, and/or vars if needed for the program after its been created.

Note: In FIN 5.0, it is recommended to allow the program to create the tags that are going to be written too by the program. If the user creates the tags first, then tries to use them in the program to write to them, it will throw a "transient" error because the program cannot update persistent tags (Logic Builder Troubleshooting).

How to use Add Variables

The user will first select Add Variables in the right menu when the program is open.

Once selected, the user will find three options:

  • Tag - this would be if the user wants to add a tag variable

  • Point - this would allow the user to pick a point from under the target or from a ref that the program is running on

  • Var - this would be for creating a virtual variable to be used within the program

Tag

If the user wants to create a tag variable, you can select the Tag option. Within the tags option, there are 4 "On" type from where they can choose to select tags from. We'll go over them below.

First, one the user selects Tag, they'll be prompted with the below pop up.

The fields required are:

  • Tag Name - name of tag user is looking to add (case sensitive)

  • On - select the location from where the tag is found

    • Target - a tag that exists on the target that the program is running on. Example: navName - get the navName of the target which the program is running on.

    • Target Ref - from a ref on the current target. Example: dis - get the display name of the site that the equip has a siteRef too.

    • Binding - queries for anything in database. Example: curVal - get the curVal of a point from somewhere else in the database

    • Point - a tag from a point under target that the program is running on. Example: description - get the description tag found on a point under target

  • Data Type - user would specify what type of data the tag is returning (Note: Enum is considered a string)

  • Is - the user would specify if the tag is read-only or read-write

We'll go through an example of Target, Target Ref, Binding, and Point below.

Target

If the user wants to add a Tag variable found on the current target, they would use this option.

Lets say the user wants to get the navName of current target that the program is running on. The user would fill out the pop up like below.

The fields would be:

  • Tag Name: we would use "navName" because that is the tag that contains the name of whatever the target is

  • On: this would stay as "target" because the program is running on the equip, which means the equip is the target. And because the equip is the target, it'll return us the name of the equip

  • Data Type: this would be a string because the navName tag is a string. It contains text as the value, which can be anything. (Note: Enum is considered a string)

  • Is: this will stay as is on read only because we are just reading the value. We are not trying to write to it to change it

Once done select Okay to be prompted with the below pop up. The user will be able to pick a name for the variable. They can leave it as is or change it. Keep in mind when creating multiple of same tag names to change variable name accordingly so that you know which is which.

Thats it, the user would just Apply and create the variable to use in the program.

Target Ref

If the user wants to add a Tag variable found on a ref of the current target, they would use this option.

Lets say the user wants to get the display name of the site of the current target equip. The user would fill out the pop up like below.

The fields would be:

  • Tag Name: we would use "dis" because that is the tag on the site that contains the name

  • On: this would be switched to "target ref" because the program is running on the equip and we want to look at the siteRef found on that equip. The siteRef contains the site record which will return us the dis value of that site.

  • Data Type: this would be a string because the dis tag is a string. It contains text as the value, which can be anything. (Note: Enum is considered a string)

  • Is: this will stay as is on read only because we are just reading the value. We are not trying to write to it to change it

 

nce done select Okay to be prompted with the below pop up. The user will be able to pick a name for the variable and select which ref name to look at. In this case from the drop down list, we select "siteRef" because we want to get the display name from the site. Keep in mind when creating multiple of same tag names to change variable name accordingly so that you know which is which.

Thats it, the user would just Apply and create the variable to use in the program.

Binding

If the user wants to add a Tag variable that queries for anything in the database, they would use this option.

Lets say the user wants to get the curVal of an Outside Air Temp (OSAT) point to use in their program and it doesn't exist in the current target equip. Then the user would fill out the pop up like below.

The fields would be:

  • Tag Name: we would use "curVal" because that is the tag the contains the value of the point we want to get

  • On: this would be switched to "binding" because it would allow us to query for anything in the database

  • Data Type: this would be a number because the curVal of a OSAT point is numeric. (Note: Enum is considered a string)

  • Is: this will stay as is on read only because we are just reading the value. We are not trying to write to it to change it

Once done select Okay to be prompted with the below pop up. The user will be able to pick a name for the variable and enter in the binding of whatever record it is they want to look at. This can be the id of the OSAT point, it can be a unique tag found just on that point, or set of tags that only returns that one. In this case, we used the id of the point to make it easier. Keep in mind when creating multiple of same tag names to change variable name accordingly so that you know which is which.

Thats it, the user would just Apply and create the variable to use in the program.

Point

If the user wants to add a Tag variable that is found on another point under the same target equip, they would use this option.

Lets say the user wants to get the description tag value of the Room Temp point under same equip. Then the user would fill out the pop up like below.

The fields would be:

  • Tag Name: we would use "description" because that is the tag we want that is found on the Room Temp point on the same target equip

  • On: this would be switched to "point" because it would allow us to look at the points under the same target and get the tag we want

  • Data Type: this would be a string because the description tag is a string that contains text in it. (Note: Enum is considered a string)

  • Is: this will stay as is on read only because we are just reading the value. We are not trying to write to it to change it

 

Once done select Okay to be prompted with the below pop up. This user will pick a name for the variable and enter a filter to query for the point. This can be the id, navName, unique tag, or set of tags to filter point. In this case, we used the navName tag to find it by the name. Keep in mind when creating multiple of same tag names to change variable name accordingly so that you know which is which.

Thats it, the user would just Apply and create the variable to use in the program.

Point

If the user wants to add a new point variable that they forgot to add when creating the program, they can do so with the Point option.

Once selected, the user will be prompted with the below pop up to pick which point(s) they want to add.

If there are refs on the current target equip, the points from those refs will be available towards the bottom so that the user can also select from those points. They will indicate the ref they are from before the point name.

As you can see below we have ahuRef and boilerRef found on our VAV equip, so we can select points from the AHU and Boiler to use in the program if needed.

Once the user selects the point(s), they can hit Okay to add points and done.

Var

If the user wants to create a virtual variable to use within the program, they would select the Var option.

Once selected, the user will be prompted with the below pop up.

The fields required are:

  • Name - name of variable

  • Then either -

    • Program Variable (mostly used) - to make a virtual variable to use within the program, the user would select this option

    • Project Global Variable - to create a virtual variable that can be used across multiple programs, the user would select this option

    • Ref Variable - to create a virtual variable that would look at a variable in another program that runs on a ref of current target

  • Data Type - the data type that the variable will be utilizing

 

We'll go through an example of either Program Variable, Project Global Variable, and Ref Variable below.

Program Variable

If the user wants to create a Program Variable, they would do the below based on an example.

In the below example we'll create a boolean variable to use for the alarmBlock to trigger an alarm since alarmBlock only takes booleans.

We named it "alarmVar", chose Program Variable, and then "Bool" as the data type.

Once we hit "Okay", we'll be prompted with the below pop up where we choose what the default value would be. In this case, it would be false because we don't want it to trigger an alarm just because the variable is true.

Then we hit Apply and that would be it.

Project Global Variable

If the user wants to create a Project Global Variable, they would do the below based on an example. 

First, it is recommended to run the program that will be used to create the global variable on a single target. The reason is because if the program runs on multiple targets, then the last write wins since multiple of the same variables from each target will be writing to the same global variable.

In the below example, we'll create a numeric variable that grabs the value of x variable so that we can then use this project variable in other programs. This is from a program that was created on a miscellaneous equip.

We named it "total", chose Project Global Variable, and then "Number" as the data type.

Once we hit "Okay", we'll be prompted with the below pop up where we can choose what the default value would be. In this case, we would make it 0 since it doesn't matter what we choose because it will be written too.

Then in our example, we will link our "saf" (supply air flow) variable to the new "total" variable.

That's it, now the global variable can be used in any program and it will return the value of whatever "saf" is.

Using Global Variable

Now that we have a project global variable, we can create a new program where we can use it.

In this example, we'll create a program that runs on all the VAVs. Select "Project Variables" check box in the program creation wizard along with any other point variables you want to add.

Then select the project global variable to use in the program. In our case, it would be "total".

Now the project global variable exists in the program to use as needed.

Then save the program when done.

Adding Global Variable to Existing Program

Forgot to add the project global variable when creating a new program or just want to include it in an existing program? Below are couple ways on how you can add it to an existing program. At the moment we recommend the second way.

First way is to select the output of the "routine start" block and click anywhere on the open space to bring up the Add Points to Logic Program popup.

Then select the "Select an item..." field to choose a statement block. You'll then see the Project Variables section to select the global variable to use.

Then, hit Okay and the global variable will be available to use. You can unlink it and delete the block from the "routine start" block unless you want to use it there.

Second way is to open the existing program and create what appears to be a new Project Global Variable with the same name, type, and default value.

That's it, the project global variable will appear to use. It's the same project variable as the original with the correct value coming in.