Collect information for boolean points

Collect information for boolean points

The second functionality of the FIN Watcher is to collect information regarding the boolean points.

This means that 2 new properties need to be enabled for boolean points that have the history option enabled:

  • runTime: will specify the period of time for which the point was On (in hours) from the last reset
  • runStarts: will specify the number of times the point has been turned On from Off  from the last reset
To enable the tags simply select the check boxes named runStarts and runTime for any boolean point that has the history option enabled as well,
To modify the frequency on which the function will collect data, the user can search for the watcher, by typing inside Folio-> Axon: finWatcherFreq and edit this by adding a new tag called finBoolStatsFreq (number).
  • finBoolStatsFreq - Tune how often the FinWatcher computes boolean 'runStarts' and 'runTime'. If not configured it defaults to 1 hr. The value must be greater than 5 seconds.

It computes the value based on the history of the point - so you can verify the correctness by matching it with the history data.
The values are calculated by computing them based on the historic changes since last time the watcher ran. So if there was no change there is no history so the value should stay the same.

In the edit window the user will add a new tag called: finBoolStatsFreq (numeric type) and set it to whatever value it's desired.

Hit apply, and then for the new changes to take effect, the user will need to disable and re-enable the FIN Watcher resource in the Settings app.

After the amount of time specified in the finBoolStatsFreq, the user can start noticing that the runStarts and runTime start collecting data. (runTime will always default to hour based units, the computing in the background is still based on finBoolStatsFreq).

To reset the values stored in the runStarts and runTime, simply press the reset button next to it.

Reset

The user can also reset the moment when the collecting information for boolean points starts in 2 ways:

  1. Call finResetStatsStartTime() and it will add the statsResetTs to bool points with the current time 
  2. Call finResetStatsStartTime(null, now() - xhr) for a different statsResetTs. In this example it is set to now-xhours. The time can't be later then 24 hours before.
    You can also call finResetStatsStartTime(rec, ts), see pod docs for more.

All stats that have been collected can be reset by calling finResetBoolStats().

Finwatcher doesn't calculate those stats over periods longer than 1 day.
However, you can get those values by querying the historian:
// duration on each day for True value, runTime
read(point and his and kind == "Bool").hisRead(lastWeek).hisRollup(durTrue, 1day).foldCol("v0",sum)
// count number of change of states. runStarts
read(point and his and kind == "Bool").hisRead(lastWeek).hisRollup(count, 1day).foldCol("v0",sum)