Remember the TCP Quickpanel screens? One of the things that everyone liked about those screens was the ability to control and monitor which panel was displayed at any time. When GE released the new QuickPanel View and QuickPanel Control screens, this feature wasn't there. Here, we will look at how to get that functionality back.
We'll start with a new project. I created this one for a quickpanel control 12" display, since I have one on my bench. Here is the project navigator:
For this sample, I created four panels. MainScreen, AlarmScreen, PopUpAlarm, and PopUpMenu. There is also a connection to a controller. For this demo I am using a Modbus TCP connection.
Next we create 2 tags:
NewScreenNum wil be the variable that drives the panel changes, and CurrentScreenNum will report which panel we are displaying. Here are the properties for each one.
Both have their DataSource set the PLCAccess. Both have the Device set to Device 1. NewScreeenNum is using address 400001, CurrentScreenNum uses address 400002.
We have our panels, and we have defined our tags. Lets put the script together to make it work. All scripting for this is done in ViewScript. There is nothing special about this code, but it will get a bit tedious if you have many panels in your project. Still, there is no reason that it won't scale up and work without any system degradation.
Create a new script in the Application Script section of the navigator. Make sure that you select ViewScript or the code won't work. I named mine ScreenDriver.
The default is to run the script periodically on a 1000 millisecond (1 second) timebase. Leave it at periodic, but set it for 250 milliseconds instead. Here is what the code looks like.
Nothing special about that. Just a series of if-then statements. Notice that you can continue this indefinitely, adding blocks that check for a value and open the proper panel. Also notice that I didn't use zero. If you set NewScreenNum to zero in your controller, you know that it will always release the screen navigation back to the operator. This is important for proper operation of the panel.
Now that we can control what is displayed, let's close the loop by having the screen report back which panel is open. You will need to add this next bit of script to every panel that you create. You can right-click the panel name in the navigator and select New Script. Make sure to use Viewscript again. Change the Activate property of this script from Periodic to OnOpen. This will make this script run once when the panel is opened, then stop calling it. It won't make a big difference in system performance, but every little bit helps.
Here is the script for MainScreen:
It is critical that this script is attached to the panel, and not an application script. If it isn't attached to the panel, this won't work. This one line of code reports back which screen is being opened as it opens.
Make sure that the value that is being assigned (1 here) is the same as the value that you are checking for in ScreenDriver. That is, if MainScreen is 1 in ScreenDriver, make sure it is 1 in the OnOpen script. Likewise for the rest of the panels.
That's it. Whenever the value of NewScreenNum is set to a panel number, the ScreenDriver script will drive the display to that panel. It will report back via CurrentScreenNum what panel is open. Make sure to put a 0 into NewScreenNum once you verify that the desired panel is being displayed so that the operator can navigate away.
Note that if you actually WANT to lock the display so that the operator cannot get away from that panel, leaving the value in NewScreenNum is a good way to do it.
A link to the project file for Proficy ME 7.0 is HERE.