TIA portal HMI script question

Pete.S.

Member
Join Date
Mar 2016
Location
Fl
Posts
463
I have a circle that I want to have different colors depending on the value of two different tags.

If it was one tag with a simple bit or something I would define that under Animations > Appearance.

But how do I do it when it's two different tags? I'm guessing I need a script but where does it go?
 
Use the plc to monitor the 2 different tags and just write to HMI_My_Tag for instance.

IMO opinion keep the thinking in the PLC, makes it much easier all round.
 
Use the plc to monitor the 2 different tags and just write to HMI_My_Tag for instance.

IMO opinion keep the thinking in the PLC, makes it much easier all round.


Makes sense but I can't do it in this case. The logic has to be in the HMI.
Actually, my next issue is to put it in a faceplate.
 
In a faceplate it's relatively easy. All things I describe you have to do inside the faceplate.
For example you've got two faceplate properties Val1 and Val2. Then you add a faceplate internal tag "circleAnimVal" under "Tags". The value of "circleAnimVal" you use as animation property of your circle.

You add a Faceplate script which calculates the "circleAnimVal" from both value properties. Simple example:

SmartTags("circleAnimVal") = SmartTags("Properties\Val1") + SmartTags("Properties\Val2") * 100

For the Faceplate properties "Val1" and "Val2" you add a ChangeValue event, where the script you have added is called, so the calulation of the animation value is done whenever one of the values changes.
 
you can make two different circles. Visible only when tag is true.

Also you can try on color selection:

'tag1' && 'Tag2'
or
'Tag1' !& 'Tag2'
 
Even if you can do something in the HMI with scripts, or visibility, it is a cludge that is difficult to maintain. Just my opinion.
What stops you from using 1 address in the PLC ?
 
Even if you can do something in the HMI with scripts, or visibility, it is a cludge that is difficult to maintain. Just my opinion.
What stops you from using 1 address in the PLC ?


It's actually a lot more than 1 address, more like 200. And the PLC is in production 24/7 so I'm reprogramming the HMI on the fly. Objects are in FBs and I can't add tags in those on the fly without clearing the data or risking putting wrong data in them.


On another note, it's putting HMI logic in the PLC that is the kludge IMHO. It's much better to separate presentation (HMI) from the control system (PLC). You shouldn't have to compensate for bad HMI software by putting it in the PLC - even if it's commonly done on Siemens. On a lot of other systems you can just reference multiple tags in the script for the screen object.
 
I cannot know how you have arranged your program, but I still believe in 1 indicator = 1 tag.
Objects are in FBs and I can't add tags in those on the fly without clearing the data or risking putting wrong data in them.
That does sound as if your HMI are accesing instance DBs directly. Well yes, that is one of the reasons why one should not access IDBs directly. It is limiting what you can do online. If the visualisation tags were in a common shared DB, then you wouldnt have to update the FB or IDB.
It could sound as if the FBs in question should be multiinstanced into a higher level FB, and the visualisation tag is then accessed in the higher level FB, wether as IDB or shared DB.
Just a guess, since I dont know your application.
 
In a faceplate it's relatively easy. All things I describe you have to do inside the faceplate.
For example you've got two faceplate properties Val1 and Val2. Then you add a faceplate internal tag "circleAnimVal" under "Tags". The value of "circleAnimVal" you use as animation property of your circle.

You add a Faceplate script which calculates the "circleAnimVal" from both value properties. Simple example:

SmartTags("circleAnimVal") = SmartTags("Properties\Val1") + SmartTags("Properties\Val2") * 100

For the Faceplate properties "Val1" and "Val2" you add a ChangeValue event, where the script you have added is called, so the calulation of the animation value is done whenever one of the values changes.


I implemented this and it works great, thanks Thomas!
 
I cannot know how you have arranged your program, but I still believe in 1 indicator = 1 tag.
That does sound as if your HMI are accesing instance DBs directly. Well yes, that is one of the reasons why one should not access IDBs directly. It is limiting what you can do online. If the visualisation tags were in a common shared DB, then you wouldnt have to update the FB or IDB.
It could sound as if the FBs in question should be multiinstanced into a higher level FB, and the visualisation tag is then accessed in the higher level FB, wether as IDB or shared DB.
Just a guess, since I dont know your application.

I guess we have to disagree on the 1 indicator = 1 tag 🍻
Anyways, I misspoke earlier about the structure. All object such as motors, valves and what not have their own user defined type (UDT) and they are defined in DBs as variables of that type.

The code that run the objects themselves are functions (FCs) with the object variable as a parameter. I do it like this so I can put a bunch of related objects together with settings and other parameters in the same DB. That is basically the DB that is used by the HMI or DCS/SCADA for monitoring and control. No need to create additional DBs since it's already done.

If I need a bunch of other data structures and internal variables I put those in other DBs, not intended for "global" use. Usually my programs don't have loads of DBs everywhere because I use this structure. But maybe there are other ways to accomplish the same thing. One could for instance hide a lot of DBs in different groups when using TIA. I think you can also put the FB instance block inside another DB but I haven't tried it.
 
Last edited:

Similar Topics

Hi guys I after a bit of advice on Tia portal graphics, I would like to add a conveyor belt graphic to a hmi and the conveyor in the basic...
Replies
3
Views
130
hello every one. i'm new to tiaportal, i have created new project and HMI screen the program works fine with PLC-sim, but when i try to cntrol the...
Replies
9
Views
314
My PLC (S7-1200) and HMI (KTP-1200 Basic) has been delivered on-site to the customer. To be able to do "off-line" updates to the code, I am using...
Replies
4
Views
198
...and I agree. Context: TIA Portal/HMI = KTP1200 (12" screen) In the attached redacted image, the values in the white boxes are entered by the...
Replies
10
Views
600
hi everyone. i hope you guys are doing great. i am trying to built communication between aveva intouch hmi 2023 and tia portal v18. i dont have...
Replies
1
Views
465
Back
Top Bottom