This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Trends average by Schedule (month,year)
#1
Hi,

Is there anyway to trend data excluding some hour of the day?

For example, if in a day I don´t write data in the object at night, I don´t want to include on daily, monthly, yearly... average

In this average, I only want to include data from 7:00 to 20:00.

Thanks
Reply
#2
Create a virtual object with the same data type as the object you want to log. Then attach an event script to the source object that will write the real value between 7:00 and 19:59, and 0 otherwise. Trend log must be attached to the virtual object.

Event script, change virtual object address (32/1/1) as needed:
Code:
hour = os.date('*t').hour
if hour >= 7 and hour < 20 then
  value = event.getvalue()
else
  value = 0
end

grp.checkupdate('32/1/1', value)
Reply


Forum Jump: