passing tag to screens

Post Reply
stasKanRich
Posts: 12
Joined: Tue Jun 05, 2018 12:10 pm

passing tag to screens

Post by stasKanRich »

Hi all,

I need to create a screen to control a valve, i have many (30+) valves and they are all the same.
is there an option to create once screen and pass tags to it from the button call?
ie the valve control screen will have its own global variables or something that will be populated via the calling button

maybe there is a simpler way of doing this? im sure i am not the only one.....
rockwell HMIs have a parameter file using replace brackets to make this work.. does IXdev have something similar?

Cheers,

prichlin
Posts: 18
Joined: Thu Feb 20, 2020 7:59 am

Re: passing tag to screens

Post by prichlin »

Hello stasKanRich,
I'm not sure I understand your question. If you could clarify what you would like to do, I'll revise my answer!

Do you have the tags built in the panel and/or the PLC?
What button call are you referring to and how would you like it to work?

If you have 30+ valve controls, you may want to consider building your own internal buttons in the Component Library. Then you can drag them onto the screen and change their associated tag(s). That will help keep your look and feel consistent with minimal work.

stasKanRich
Posts: 12
Joined: Tue Jun 05, 2018 12:10 pm

Re: passing tag to screens

Post by stasKanRich »

Hi,
Thank for the reply.

I see what you are Saying, unfortunately I can not control the valves from the main screen, too many options per valve.
I need to open a new popup "valve control" screen that will have all the valve options for each valve..
each valve has many actions that the user can choose. ie intelocks maintenance, override, cip.. etc...

what i am picturing is:
pressing the valves on the main screen will open this "valve control" screen.
but i am reluctant in making multiple screens of the same thing with difrent tags. as all valves have the same control tag types i was hoping i could open the same screen with different tags associated with the control buttons in the new screen. or in other words replacing the associated tags on the screen on screen call/open.

This is a basic function/option that is available in any HMI software i used so far, it is just me?

stasKanRich
Posts: 12
Joined: Tue Jun 05, 2018 12:10 pm

Re: passing tag to screens

Post by stasKanRich »

for example:
if you have 20 rooms, each with the following controls/readings: AC, light, humidity,and lets say 10 more reading and controls.
you wont want to put it all on one screen as it will be too much.
and making 20 screens of the same thing is also not a solution, memory wise or work wise, especially on these low end devices that don't survive well with too many screens and objects.

how would you go about adding a popup screen to each 'room' ?

prichlin
Posts: 18
Joined: Thu Feb 20, 2020 7:59 am

Re: passing tag to screens

Post by prichlin »

Hello stasKanRich,
Thanks for the clarification! There are several ways to accomplish this.

You may want to consider if you want a popup screen or a regular screen with a Parent Screen. They are similar but will have different results for your programming. If you choose to use a popup, see this post if you want to remove the blue border at the top.



Here's one approach. It's designed to give you more control through scripting so you can make quick changes for deployment and future project needs. Let us know if you would favor a different approach.

To call a popup screen, either add a Show Screen Action to a button (ButtonValve) or Globals.YourPopupScreenName.Show(); Also set a tag with an integer representing the valve. Connect the event listener to the button's Click or Mouse event.

Example:

Code: Select all

void ButtonValve_Click(System.Object sender, System.EventArgs e)
{
	Globals.Tags.ValveNumber.Value = 5;
	Globals.YourPopupScreenName.Show();
}



On your popup screen, add controls and indicators for your valve as you need. For controls, use new temp tags. You can use ValveNumber to toggle Visibility (Dynamics) for elements that are only available on some valves.

For readings and indicators, add a ValueChange event listener to copy the value to the temp reading/indicator tag. Also run this once when the window is opened so the displayed values are current.
Example:

Code: Select all

void HumidityInputFromValve_ValueChange(System.Object sender, Core.Api.DataSource.ValueChangedEventArgs e)
{
	Globals.Tags.TempHumidityInputFromValve.Value = Globals.Tags.HumidityInputFromValve.Value;
}
For controls, add events when an operator interacts with the control. Modify the event to fit whatever control type it is (button, dropdown, slider, etc.).
Example:

Code: Select all

void ButtonTempValveOn_Click(System.Object sender, System.EventArgs e)
{
	switch(Globals.Tags.ValveNumber.Value.Int)
	{
		case 1: //valve 1
			Globals.Tags.Valve1On.Value = Globals.Tags.ButtonTempValveOn.Value;
			break;
		case 2: //valve 2
			Globals.Tags.Valve2On.Value = Globals.Tags.ButtonTempValveOn.Value;
			break;
		default:
			break;
	}
}
Add a Close Screen action to a button or Globals.YourPopupScreenName.Close();
Example:

Code: Select all

void ButtonClosePopup_Click(System.Object sender, System.EventArgs e)
{
	Globals.Tags.ValveNumber.Value = 0;
	Globals.YourPopupScreenName.Close();
}
It probably makes the most sense for you to use some of these code snippets and apply them to your project's approach as needed instead. Hope this helps!

stasKanRich
Posts: 12
Joined: Tue Jun 05, 2018 12:10 pm

Re: passing tag to screens

Post by stasKanRich »

Hi,
thanks for the idea.
seems like it will work but it will stop any updates happening on the screen, i will habve to add manual hooks to all the objects i put on the screen.
i was hoping i can change the pointer ref of the associated tags to the objects i use on the screen.
I am having quite allot of trouble finding the tags of the objects from sender or otherwise.

and looking through the forum i dont see any other posts like mine, i am surprised that no one had this problem before me. i cant imagine people just made multiple copies of the same screen for this, that will be absurd...

i will keep digginf but at least i have an option now! thanks!


only other ideas anyone? I was hoping there is a built in option but i am guessing that not the case..

User avatar
Russ C.
Posts: 213
Joined: Thu Nov 16, 2017 3:32 pm
Contact:

Re: passing tag to screens

Post by Russ C. »

Hi stasKanRich,

You may want to look into Aliases for screens.

An aliased screen allows you to assign placeholder tags that will poll data from the tags assigned to the current instance.

You can enable and assign aliases using the Alias option at the bottom of the screen.
aliases.png
aliases.png (8.8 KiB) Viewed 14202 times
There is also a sample Alias project you can review in the Samples tab from the Welcome Screen in iX:
alias_demo_project.png
alias_demo_project.png (67.05 KiB) Viewed 14202 times
Best regards,

Russ
(801) 708-6690
Technical Support
Contact Us

Beijer Electronics AB
http://www.beijerelectronics.us

Post Reply