Perspective - advanced connectivity detection

My perspective application has something of a “splash screen” which the user just taps on to proceed through to the main menu (using an iPad as the client). I’m now in the process of not enabling that “tap through” until the PLC is online and has completed its startup sequence, just to avoid the user experience of multiple “unknown quality” banners.

For clarity, my “startup sequence” is a programmed sequence of events within the PLC ladder logic which occurs at power up - this machine is a mobile one, and it will be unplugged and moved and powered up from time to time. The onboard gateway PC is all solid state and boots in about 10 seconds, the iPad will always be powered on, but the PLC takes a good minute or so to boot, and then another 20 seconds to run through startup sequencing. After this time, the user can tap through.

I’d like to give the user as much detail as possible regarding exactly what it is they’re waiting for to be able to tap through. Possibilities I’ve anticipated are:

  1. Not connected to a wireless network
  2. Not connected to the right wireless network
  3. Connected to the right network but unable to connect to PLC (PLC still booting up)
  4. Connected to the PLC but PLC not yet in run mode
  5. Connected to the PLC but PLC still going through startup sequence

Ideas I’ve had so far:

  1. None, really. Is there any way at all perspective can grab information from the host? I’m suspecting not, but hopeful I might be able to do something clever with a script
  2. Ditto
  3. Can probably be achieved with a tag quality binding - there’s an OPC tag which is set to true when the PLC completes its startup sequence, if I monitor that (or any other OPC tag, really) for good quality, I should be able to work out when the connection to the PLC is established. I’ve found a qualifiedValue() function in the expression language of v8, but can’t find any documentation about what exactly I need to feed it and what it returns
  4. Can be extrapolated from the device status tags, easy enough
  5. As easy as monitoring the “startup complete” tag - again, as long as I’ve already established quality and PLC run mode, because the tag won’t be set to false until the PLC enters run mode and resets it

Is anyone able to help me work out a few more details?

Consider creating memory tags for the information you wish to display at that point, containing enough detail to hide not-yet-applicable items. Monitor the real OPC tags with a gateway tag change event script (value+quality) that can programmatically determine what to pass on to the memory tags. The memory tags won’t have bad quality.

I realised last night that I was somewhat overthinking things, given that the perspective session won’t launch if it’s not connected to the right network. So that’s eliminates 1 and 2 from my list.

From there it’s reasonably straightforward:
3. Based on the IsConnected tag of the PLC
4. Based on the Mode tag of the PLC
5. Based on the OPC tag within the PLC

The only thing I’d like to add is a check at step 3 that makes sure my OPC tag is good quality before bothering with the mode of the PLC. If it’s not good quality, I don’t want to do any further checks. I’d have thought it would be as simple as adding {[default]My_Tag.Quality} = 'Good' into my expression, but I can’t make it work. {[default]My_Tag.Quality} = 'Good' always evaluates false. I’ve also tried {[default]My_Tag.Quality} = 192, as per the documentation, same result. It’s strange, because if I put a label on my screen and bind the text to {[default]My_Tag.Quality}, it always shows Good. I thought maybe I’d put in an LED indicator, in case that might help me force it to a number - the LED display just showed GOOD. But no matter how I work it, I can’t get my expression to return true when looking at the quality of an OPC tag. What’s up with that?

1 Like

Quality is an object, not a number or string. Java and jython both convert objects to strings for display, so your confusion is not unusual. In your case, use the expression function toStr() to explicitly make it a string for comparison. In a scripting context, use the quality object’s isGood() method.


Thanks Phil, that’s the piece of the puzzle I was missing.

Helpful to me also. Thanks Phil.

A quick update to Phil’s last post - there’s also now an isGood() (available in latest 7.9, and 8.0) expression function that helps simplify this logic.