I'm looking to add a counter to increase daily to record how many days in a row that the factor was "safe". Is this something I can do in Ignition, or do I need to just build it in a PLC so that I can start it at 100 (for example) and then reset if a safety incident occurs?
You could first create a memory tag (integer data type) that holds the count. Set the starting value to 0 or 1 or whatever you need. Then you should decide where the script or expression should "live", which checks the factor and updates the memory tag as needed. An example of this system could be 3 tags:
- The memory tag which holds the count
- An OPC tag which reads the factor from the PLC (you can decide whether this is read-only in Ignition or if it needs to be written to, depending on your use case)
- A derived or expression tag that reads the above OPC tag, decides if the counter should increase by 1 or be reset to 0, then writes the new value to the memory tag [1]. This should be set to run once per day, maybe by using
getDate
and then a change script with all the necessary reads/writes and other logic.
Just my first thought... There are a lot of ways to do this. It also depends on whether Ignition can "know" whether a safety incident has occurred (unless that all happens in the PLC -- in which case, you should be ok).
Edit: I might have misread and there isn't actually a PLC in the picture currently? The main idea still stands -- it basically just comes down to whether your Ignition instance has access to the data it would need to come to a decision regarding increasing the count value.
I would just write a row into a table with the timestamp of each safety incident. Any UI can query for the last record and display the days/hours/minutes/whatever since that timestamp.
Make a new row for any new incident.
I've got tons of PLCs, but not anything that actually that has this data. I could just add a tag to random PLC that we have running in the factory and have it increase daily, and then have Ignition look at this tag and manually go in and reset it if/when there is a safety incident, but I was looking to see if Ignition could just... run a counter on its own that increased daily. I could also add a new plc just for this and put a key switch to reset the counter and do it that way. Was just hoping there was a simple way to build it out.
- Create a memory tag of data type DateTime.
- Create a Perspective view with a DateTime picker and a put a tag binding on the DateTime value property to your memory tag. Make it bidirectional so that the DateTime component can write to the tag. Set
pickerType : date
format : YYYY-MM-DD
(You should put some security on this page to restrict access to authorised users.) - Anywhere you want to report the number of days since the last incident create a label on a view and put an expression binding on the text property. Something like,
daysBetween({[default]LastIncident}, now(60000)
now(60000)
will cause the calculation to be run every 60 s.
I'll leave you to add some finesse to the expression to take care of partial days, etc.
Using a DateTime input rather than a Today button means you can enter a weekend day on Monday, etc.
This looks to be exactly what I needed. Now I'm going to make it even easier for me and figure out how to let someone else edit the start date so that EHS can enter a potential incident and it will update on its own.
Thanks so much.
Thanks for the feedback.
Have you set up an Ignition user source or hooked into your company's Active Directory (or whatever) so that they manage the authentication. That would be the recommendation.
I haven't done that yet and to be honest, we're only using ignition to display things at this time and no one is really interacting with it. I do have users set and am working on bringing in AD now. Ideally, I'd love for them to be able to use an email or some other type of notification to do the entry too, but not sure if thats possible, but I do know its something thats beyond my capabilities at this time.