Description

Learn how to create templates that point indirectly to a set of Tags based on a simple parameter.

Video recorded using: Ignition 7.7

Transcript

(open in window)

[00:00] In this lesson, let's create a template that uses indirect tag bindings. As you can see in my Tag Browser, I have four motors, Motor 1, 2, 3, 4. They all have the same four tags, AMPS, HOA, RUN_CMD, and STATUS. The only difference between the motors is the number, one, two, three, or four. So I can create a template with a single parameter that allows me to point indirectly to one of these motors. Let's go up here to our Templates to create a new template. I'm going to call this template Motor. Every template has to have a parameter, so I'm going to right-click on the checkered area, go down to Customizers, Custom Properties to add a new parameter. Now I want to add a parameter that I can use to point to one of these motors here indirectly. So I'm going to add one. I'm going to call it motorNumber. I'm going to make it integer data type. Go ahead and press OK. And now I'll see that property down the bottom here. I'm going to set the value to one while I'm designing the template. I'm going to put a motor graphic inside of this template. I'm going to put a label on top of that to show the motor name. And right below I'll put the LED display to show the amps. So all three of these graphics here are going to be linked to a tag inside the Motor folder indirectly. Now the top one I want to show the motor name. I don't have the motor name inside the folder, so what I'm going to do is I'm actually going to link it to an expression involving the parameter here. So I'm going to bind it to an expression. It's going to concatenate the string Motor plus, using the link icon in the top right, I'm going to bring in the motorNumber parameter that I added. So as you can see after this, it'll be Motor 1. Now for the graphic here, I want the square here to be changed colors based on the HOA. So I'm going to double-click to get into the square. I'm going to bind the Fill Paint property to an indirect tag. I'm going to first select the tag I want to use. So I'm going to go and insert tag, go and find Motor 1 HOA as a guide. Now what I want to do is figure out what part of this that I'm going to change dynamically. In this case it's going to be that one. I'm going to remove the one. I'll keep my cursor in that location, use the link in the top right, I'm actually going to go find my motorNumber parameter, press OK, it's going to put a curly brace 1 with a reference to that number. So whatever that number of that parameter is is the motor that I'm going to point to. At the bottom I'm going to set the number to color translations. So if it's zero, let's make it red. If it's one, let's make it green. And if it is, add another entry there, if it's two, I'll make it yellow and maybe a blank with orange or something like that. So that's it for that tag binding for the graphic. At the very bottom I'll do the same thing here for the LED display. I'm going to bind the value again to an indirect tag. I'm going to use my tag button to find one as a starting point. Go to my Motors, Motor 1, get the AMPS. Again and I'm not going to point directly to Motor 1, so I'm going to remove the one, use the link icon to go and get the motorNumber, and then press OK. And now both of these are pointing indirectly to that particular motor. Now in the screen I'm going to use this motor I'm going to go ahead and close it and save it. I'm going to drag Motor on the screen twice. Of course by default you'll see that it's going to both point to Motor 1. The second one here, I can just go down to motorNumber, I can change that to a simple like two. Now you can see them pointing to Motor 2. If I duplicate both of these, put them down below, so I have four of them now, I'm going to set this one here to three, and the last one to four. As you can see they're all pointing to a different place here in the PLC, a different folder of those motors.

You are editing this transcript.

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