Hello everyone,
So I have an AOI that historizes data for the last 30 days, months and years. It worked fine for about a month, then I realized that the last day had about 82 hours of data, which is impossible (we are on earth, not mercury).
For what follows, note that Lo_DATE_DAY is local to the AOI and In_DATE_DAY is the actual date of the PLC. See the attached file for a screenshot of the rung.
To detect a day change, I have a NEQ(Lo_DATE_DAY, In_DATE_DAY). When this condition is true, I send an ONS to MOV(In_DATE_DAY, Lo_DATE_DAY) and lock a data change request.
So, the next time I scan, In_DATE_DAY will be equal to Lo_DATE_DAY.
The problem I have today is that the ONS remains active. Lo_DATE_DAY != In_DATE_DAY even though the ONS was supposed to execute the Lo_DATE_DAY = In_DATE_DAY. But now because the condition before the ONS did not change from true to false, the storage bit of the ONS remains set and does not allow execution.
My question is: Why did the MOV(In_DATE_DAY, Lo_DATE_DAY) operation not occur on the first execution of the ONS and how can I fix this problem so it does not happen again?
Again, this logic worked correctly for a few months. There is no other way to write to Lo_DATE_DAY and the ONS storage bit is only used on this ONS.
Thank you.
So I have an AOI that historizes data for the last 30 days, months and years. It worked fine for about a month, then I realized that the last day had about 82 hours of data, which is impossible (we are on earth, not mercury).
For what follows, note that Lo_DATE_DAY is local to the AOI and In_DATE_DAY is the actual date of the PLC. See the attached file for a screenshot of the rung.
To detect a day change, I have a NEQ(Lo_DATE_DAY, In_DATE_DAY). When this condition is true, I send an ONS to MOV(In_DATE_DAY, Lo_DATE_DAY) and lock a data change request.
So, the next time I scan, In_DATE_DAY will be equal to Lo_DATE_DAY.
The problem I have today is that the ONS remains active. Lo_DATE_DAY != In_DATE_DAY even though the ONS was supposed to execute the Lo_DATE_DAY = In_DATE_DAY. But now because the condition before the ONS did not change from true to false, the storage bit of the ONS remains set and does not allow execution.
My question is: Why did the MOV(In_DATE_DAY, Lo_DATE_DAY) operation not occur on the first execution of the ONS and how can I fix this problem so it does not happen again?
Again, this logic worked correctly for a few months. There is no other way to write to Lo_DATE_DAY and the ONS storage bit is only used on this ONS.
Thank you.