User Tools

Site Tools


wiki:countnz

COUNTNZ() Function (Count Non-Zero)

The COUNTNZ() function can be used to get the number of minutes a value is greater than a threshold value

Usage:

COUNTNZ(variable, options, val,[start_hour],[end_hour])

variable - the variable name to check

options - see below

val - optional - the threshold value to be greater than (0 is the default)

start_hour - option for 'diff in range (option 5) when period is 1 day - start hour (0-23)

end_hour - option for 'diff in range (option 5) when period is 1 day - end hour (0-23) - set start and end to 0 to ignore this

Generic Variables (per device type)

COUNTNZ('genset_on',1)

Get the number of minutes that genset_on was greater than 0 for the current day

COUNTNZ('voltage',5,100)

Get the number of minutes the voltage was greater than 100v for the selected period

Device - Specific Variables

For device specific variables use a . to separate the device name:

COUNTNZ('My Device.My Value',1)

Option Parameters

The second parameter, [options] is a number and can be any of the following

1 DAY - Number of minutes non-zero today
2 WEEK - Number of minutes non-zero for the week
3 MONTH - Number of minutes non-zero for during the month
4 YEAR - Number of minutes non-zero for during the current year
5 PERIOD - Number of minutes non-zero for the selected range
6 SLICE - Number of minutes non-zero for variable changed during the slice in the range (i.e. in a graph segment)

Example

Get the uptime in percent based on voltage for the day (1440 minutes per day)

100*(COUNTNZ('voltage',1)/1440)

Possible return values: 0 - 100

Example2

Get the minutes the DG was running for between 6am and 6 pm (18)

(COUNTNZ('DG1_AC_Active_Power',5,0,6,18))

wiki/countnz.txt · Last modified: 2022/07/04 08:39 by admin