Solved

Grafana: Flow to volume per day / week


Userlevel 1

Hi! I’m curious what is the best practice to do this basic thing and visualize on Grafana ( ideally without code): 

  1. With a flow transmitter, summarize the total volume per day or week. 
  2. Correct the above against a threshold or a running signal. Ie. I now when the flow should be 0

Here’s how I do nr 1, it feels a bit like a hack. Nr2 I am solving with Functions in CDF, however it would be nice if there’s a quick way of doing it without code, 

 

The query looks like this: 

24*ts{externalId="arba:one:s=0:PLC_03!Vc_S07_200_FT01_PV", alignment=1653386400000}

-Should the alignment be at the middle of the day, 12:00, or at midnight 00:00? When we get back to wintertime, it will be off by one hour.. 

 

icon

Best answer by karanrajagopalan 2 June 2022, 14:23

View original

4 replies

For your 2nd question, I understand that if the flow is below certain threshold you want to consider that as 0. With this assumption, I propose this solution attached. The 1st query in the pic below is

 

on_error((ts{externalId="xxx-xxxx",alignment=1653386400000}*

round(ts{externalId="xxx-xxxx",alignment=1653386400000}/540,0))/

round(ts{externalId="xxx-xxxx",alignment=1653386400000}/540,0),0)

I want to make any value 0 that is below 270Kg. I need to use 2*270 since I'm using round function here. 

 

 

I hope this helps.

 

Cheers

Karan.

@Håvard Knappskog  - Was the answer helpful? And for your 1st question. I believe that the queries should automatically fetch the data from right time range regardless of timezone. Grafana by default takes the browser timezone. The pic below shows the default setting when the time window  was set to last 168 hours.

 

Userlevel 1

Hi! 

Thanks, the replies was really helpful! 

Do you know what is the best resource/docs to explore the functionality I can use with the custom query of Grafana? 

Regards,

@Håvard Knappskog  - Here it is https://docs.cognite.com/cdf/dashboards/guides/grafana/timeseries#custom-queries

Reply