Hi team,
I need to record a list of tags every hour at times like 1:30, 2:30, 3:30, etc. During a shift, there will be 8 records.
For example:
Tag
:ProductionStartDateTime
- 30-05-2024 11:30 (expression tag)ProductionEndDateTime
- current time
I want to record the tag values via a transaction group and then reset the tag. The trigger for this transaction is a boolean tag, which will be enabled when the time crosses every hour, e.g., 30-05-2024 12:30.
Initially, I set the expression tag as follows
if ({[~]Global Tags/Current Minute} = 30 && {[~]Global Tags/Current Second} = 0, 1, 0)
However, some recorded tag values were null because they were reset after the hour. I then modified the expression to:
if ({[~]Global Tags/Current Minute} = 29 && {[~]Global Tags/Current Second} > 50, 1, 0)
But the same issue occurred. Finally, I changed it to:
if ({[~]Global Tags/Current Minute} = 29 && {[~]Global Tags/Current Second} > 45, 1, 0)
This worked fine, but the recorded times are not exactly one hour apart. For example:
ProductionStartDateTime
- 30-05-2024 11:30:00ProductionEndDateTime
- 30-05-2024 12:29:47
The runtime is not exactly one hour, and when I check the total runtime for the shift, it is 478 minutes instead of 480 minutes because of this issue.
Any ideas on how to overcome this?