Information Hub

Good morning,

I would like to a help
I need to create a drawing that groups the status of 5 devices, as the status of any of them changes the color of the drawing is changed. I even created a script that groups the information of the 5, but I couldn’t make this script update every 3 seconds, because the script is linked to the drawing. How can I do this ? Would there be an easier way?

Ignition version? Vision or Perspective? What do you mean by “drawing” ? AutoCAD?

Please show the script you tried. (Use the preformatted text button to make the posted code show indents and color coding.)

Do you have a mock-up of what you want it to look like?

I’m using Ignition Platform 8.1.7, developing in Vision, when I commented on drawing I was referring to the template.
Below is the description of how it was implemented.
I created a template of a device with the parameter called ‘Area’ and I am using a Window with the name of ‘Home’.
Inside the template I have a parameter called Status, where this parameter is linked to a Tag.
I need to link several tags to a single parameter.
In Home(Window ) I fill the Area parameter with the route of the group of tags that will be linked to this template, example: ‘[default]Area_28_Validacao/SubArea’ and inside the template I have an expression inside another variable. Ex: runScript(‘AtualizacaoHome.AtualizacaoStatusHome(’+{RoloMotor_Vertical_EspecialInverdo_Validacao.Area}+’)’,0)
Which makes the call from a script.
And in the script I scan the path that was passed in the Area tag and see the status of each variable.
The problem is that I couldn’t get the script to run every 3 seconds, because each template will call the script by passing a different parameter.

You shouldn’t be using a script for this. What you need is indirect binding within the template. Use a string parameter to the template that will contain the tag folder for “Area”. Then, where the template needs specific tags in that folder, you indirect bind to {1}/rest/of/path/to/tag. The {1} gets the pointer to the template parameter.

See this lesson from Inductive University:

Thanks for the answer,
But that doesn’t suit me, because I’ll have several tags for the same object.

Then use another substitution item in the tag binding. Or mock up what you want it to look like so we can understand the problem.

Why does having several tags negate the suggestion of Indirect Binding? They share the Area parameter correct?

Hi,

I made an illustration to better exemplify my question.

As can be seen in the illustration, I have a single template to represent several engines at the same time.

If any of the 5 engines fails, the fault will be indicated by the same tample, I will not have a template for each engine, but a single one that gathered all the information at the same time. I’m doing this because I have more than 600 engines in the plant and I have to show them all in a single window, where that window will represent the whole system.

Another point is that the template changes color according to the fault

It didn’t work using an indirect tag, because the tag indirectly I will use the template and each engine must be identified by a unique design, which is also not for my case.

Do the 5 motors per template, have any part of their path shared?

Only belong to the same division subgroup, but work independently

Sorry, I don’t understand your tag organization, can you provide an example of what the path for two motors looks like?

Sure,
image

As can be seen in the image, the ‘Area_28’ is an area where the engines are located, the ‘SubArea’ is the group to which each engine belongs.
Each area is formed by several subgroups and each subgroup will have only one template

So, in your template, you would create a string parameter, which you would pass the string of the Area you want the template to use.

You would then make an Internal Property for each motor status. These would all have an indirect binding where you substitute the Area parameter into the path.

{0}/SubArea/RM1 for example.

Then use an expression binding for the template color that looks at the Internal Properties.

Perhaps something like:

case(binEnc(motor1,motor2,motor3,motor4,motor5),0,toColor("#000000"),1,toColor("#FF0000"),toColor("#00FF00")

I see no reason why a combination of indirect bindings and expressions can not do what you’re trying to do.

2 Likes

If you just want to update every 3 seconds, you could use the timer component inside your template, but it’ll be more of a gambiarra, really. If you’re going to use scripts, your time will be better spent using a script that just runs once to build your tag path for the template then you use indirect bindings for the rest of what you need, this’ll be faster, easier to implement and debug, but this seems to be the case where scripts aren’t really needed.
Generally when you want something to periodically updated you use bindings and expressions and if you want something more complex, doesn’t need to run often or you can’t really do with expressions, then you proceed to solve it with scripts. At least that’s how i see it