How to have a point that is the sum of time of binary point is on..
-
i mean i have a modbus source that is binary on or off
i want to create a metadatapoint the sums the accumulate hours of that binary is 1....i don't know what to put on the script part of the metadata point for achieving this
what i need is to have a counter of working hours a day of a engine..
thanks for the help..
-
This is from the documentation on Meta Data Points (click on the ? icon)
The StartsAndRuntimeList object is returned by Binary and Multistate points. It contains the following properties:
realStart: (integer) the actual start time used for calculations (in case the start time precedes the point's first known value)
end: (integer) the end time used for calculations
data: (array) the list of individual StartAndRuntime objects.
Each StartAndRuntime object has the following properties:
value: (boolean for Binary, integer for Multistate) the point state to which the remaining properties apply
starts: (integer) the number of times the state was entered over the period
runtime: (integer) the amount of time in milliseconds the point was in the state over the period
proportion: (float) the proportion of the period the point was in the state (runtime / real duration)
percentage: (float) proportion * 100To access a specific StartAndRuntime object in the list, use the get() function. For example, the following returns the proportion of time that 'b' was in state 'false' over the previous 2 months.
return b.past(MONTH, 2).get(false).proportion;
you could do
return 24*(b.past(HOUR, 24).get(true).proportion);
I think this will take the % of time it was true for the 24 hour period and then convert that to how many hours.
-
Hi and thanks for the help, what i need is not the last 24hours but by day i mean some thing like return (b.past**(TODAY).**get(true).proportion);
[quote=
return 24*(b.past(HOUR, 24).get(true).proportion);
I think this will take the % of time it was true for the 24 hour period and then convert that to how many hours.[/quote]
-
I you set the update to start of day and use this it will work: return 24*(b.past(DAY).get(true).proportion);