Hi Forum,
Given two tags tag1, tag2, and a workorder.
On the production floor, when a process is running (indicated by a running tag).
Every time tag1 value change, ignition needs to write both tag1 and tag2 values onto a database table including workorder.
Such that, user could query these data per workorder and display on xy chart.
I wonder which is best:
- Record the start and end time of the process, and use it to query tag history?
- Use a gateway tag change script, run a write query?
- Can SQL Bridge even do this requirement?
I would use a transaction group to do this, with the trigger condition being the tag1 changing value
1 Like
As Jasmine mentioned, this is where a transaction group (SQL Bridge) would work well, especially if you haven't done this type of thing before.
Is it a good practice to only log Tag Values with Good Quality?
Should I log the value with quality along with it?
I would suggest that a tag with bad quality is junk data and should be left out of the database.
If you're not already using transaction groups, I'm not sure this use case justifies adding an extra module. If you need to use this pattern for a lot of tags, then maybe, and even then with a properly constructed tag hierarchy, transaction groups are not that helpful..
You can just use a gateway tag change event, monitoring tag 1, and insert both tags values when the event is triggered.
Add some validation and filtering logic if needed, and you got yourself a simple script that does exactly what you need.
The only thing that's unclear to me is where you find the workorder.
I agree with you, since I know python and writing query, I find that transaction group also do the same thing under the hood. And it give me more flexibility using python.
I will also take this opportunity to look at transaction group, I forgot about what is this all about.
Is also a tag with string data type.
I come to conclude that, using transaction group will provide many benefits.
I need help though.
I watch all the videos, but still confuse how to configure transaction group according to client requirement:
Below are the items:
- isRunning tag
- distance tag (int)
- workorder tag (string)
- val_1
- val_2
The Logic:
if Running tag is True.
Every time distance tag change
then log item 2 to item 5 to database.
I am confuse particularly on Execution Timer.
I watched that, Execution Timer will take precedence:
What if Execution timer is slower than distance tag increment?
How do I set this up in Transaction group.
Try this (I Haven’t tested it):
This video and the next one are the ones you want.
Set your execution time to the same rate as what you are polling the distance tag.
Thanks, i will try.
I got confused on "Run Always Expression and Trigger Expression" vs the trigger tab.
I guess just a matter of getting familiar.
Edit:
I now got clear on my confusion.
On item table: Run Always and Trigger refers to the expression being executed always or once when triggered. And not referring to the Running or triggering the group to log.