I have a small project that records various production information (in this case, cycle counts) via a tablet interface. The operator uses dropdowns to enter a machine, item number, cycle count and start/end times. All of that works fine. However, in the final implemenation we're using wireless PB's connected to an AB Micro for cycle counting. In this case, I have 8 inputs (one from each physical pushbutton).
Initially it was planned to have one pushbutton at each workstation, but that plan has changed to each operator having their own 'portable' button instead. This presents me with a challenge to basically 'register' or associate each counter pushbutton with entered job information.
So I thought, well... on inital job data entry (Operator, Machine, Item, etc) I'll have a component for 'registered' pushbutton. and, if not already assigned, pop up a 'button registration", then have the operator push and hold the physical button for more than 5 or 10 seconds and then programatically assign that button to our cycle counters for each job.
I know.. manual PB's aren't the best solution to this problem and we'll probably implement something more substatial later on, but for now I'm working "proof of concept". I'm starting to get comfortable with Perspective and am certain this could be implemented via Python but my skill level isn't quite there yet and I could use some help!
To summarize, I need code that will scan boolean tags from all 8 physical pushbuttons and identify the first one that' s on or true for more than 5 or 10 seconds. How would you folks handle this?
As always, I'd appreciate your assistance. Thanks!!
Since the user is already selecting machine, item number and other information, could you not also have them select the Id of the button? Add numbers or some other identifier and let them choose.
Otherwise:
Gateway tag change event, write the timestamp on transition to high value to another tag, one tag per physical button. Wipe the timestamp value if the value goes back low.
In a gateway timer event script set to 1s rate, check which timestamps are >5s old, and send a message via system.util.sendMessage to all sessions of the project with a button that includes the button(or tag path to button) that has been held for longer than 5s, and wipe the timestamp value to prevent it from sending on every poll after that.
Let the session then decide if that's the button it wants and do the associated assignment.
You'll need to compare against a timestamp of when the registration mode started for that session to prevent the latest session grabbing an older station's registration. Also, if two stations register at the same time, it is going to be very difficult to determine which button is supposed to go where. Overall this would be a very fragile system.
Thanks Phil, but the problem is the micro still needs to know which machine, item and operator is using for each job as they'll move with operator from machine to machine. This is why I need to associate each button with a particular Perspective session.
I know it's kludgy but it is POC. All would work perfectly if a button stayed with each machine but that's not in the plan... at least right now.
Ryan, I was going to just add a dropdown with choices of say 1-8 (1 for each button) and that would work so long as no-one else had chosen that same button number.
I thought about building my own choices list using which buttons have not been assigned (this would work but also requite Python currently beyond my level of knowledge although I'd love to get some help and LEARN!!).
I'm curious, what is the typical work flow? Users enter identifying information on the tablet, record some items, then press the physical button to complete the item/cycle? I'm trying to determine why there is a requirement for a physical pushbutton/micro PLC at all.
Are you using the Perspective app so you can use the camera and have them scan a QR code attached to each button? Easiest would be to just show a popup or an entry field that only lists available buttons and let the operator select the correct one.
If you really want to do the register button scenario, you'd have to have the operator hit "Register Button" then have them hold the button. This register button would show a popup that shows any button with a timer value longer than 5 that they then click to register.
But that's a lot of work for something that could be just made part of the form.
I very much repect your opinion, sir. I really, really do.
The project was initally developed to gather cycle counts by pushing a button on the UI for each cycle. This will be cumbersome for ~30 second cycle times on equipment that's not automated (manual grinding stations).
Would your only other suggestion be to just use the UI and be done with it?
I honestly believed associating each button to a sesson would be simple but if it's not reliable then I'll have to figure something else out.
Why would it be unreliable, though? Can you give me a failure scenario?
Ryan, there is a requirement for a physicaly PB only to effectively emulate the cycle increment button in the tablet session. The PLC enables us to get the buttons/tags on the network where Ignition can see them.
Micheal, I was originally going in this direction but got stuck on how to do it.
I had set up a dropdown which was populated by a custom prop with static 1-8 choices, but how would I code it so that the choices list will include only available PB's?
You're going to have to track that somehow yourself. Could be as simple as a memory tag on each button that shows the username currently assigned to that button, and if blank it's available.
Thanks. I understand that. I'm just not sure to iterate through each of those memory tags and add the unassigned ones to a dataset my dropdown can use.
You can either do it via scripting to read the tags or if it's a set number of tags, just bind them to some custom properties that have the bindings in place and just iterate over that object to build the data for the dropdown list.