David Edelman Posted February 19 Share Posted February 19 We have string-type signals that show the current operating mode. On the historian, these signals have a compression setting of 8 hours, meaning a new value is written no later than 8 hours after the previous value was written. So during any 12 hour period, there will be 1 or 2 values written to the historian even if nothing has changed. We are trying to count the number of changes to the string signal during a 12 hour period. For numeric signals, we can use $signal.remove($signal.runningdelta() == 0) .aggregate(count(), $capsule, durationkey()) This makes sure that if the numeric signal (also with a compression setting of 8 hrs max) does not actually change during the 12 hour period, that data point will not count. Is there an equivalent way for doing this with string signals? Thanks, David Link to comment Share on other sites More sharing options...
Seeq Team Joe Reckamp Posted February 19 Seeq Team Share Posted February 19 Hi David, You could do the following to create a capsule per each change in signal value (regardless of string or numeric): $signal.tocondition() And then you could count the capsules that are created. Link to comment Share on other sites More sharing options...
David Edelman Posted February 19 Author Share Posted February 19 Thanks Joe - unfortunately this still gives a count of 1 even when there are no changes. Intervention - Mode Chg = $mode.toCondition() .aggregate(count(), $s, durationkey()) Thanks, David Link to comment Share on other sites More sharing options...
Seeq Team Solution Joe Reckamp Posted February 19 Seeq Team Solution Share Posted February 19 Hi David, You could either: (1) subtract 1 from the count as it will always have the starting value as a capsule, meaning the value will always be number of changes + 1 or (2) use $signal.tocondition().starts(), which will make the capsule only appear at the start (or specifically the time when a change is made) Link to comment Share on other sites More sharing options...
David Edelman Posted February 19 Author Share Posted February 19 13 minutes ago, Joe Reckamp said: (2) use $signal.tocondition().starts(), which will make the capsule only appear at the start (or specifically the time when a change is made) This seems to work in our case. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now