ready for graphing
This commit is contained in:
parent
05de094429
commit
13f6c94fd0
1 changed files with 17 additions and 3 deletions
|
@ -26,8 +26,22 @@ FROM generate_series($__timeFrom(), $__timeTo(), '1 minute'::interval) AS ts
|
|||
LIMIT 1
|
||||
) AS gi_next ON true
|
||||
WHERE gi_prev.time IS NOT NULL and gi_next.time IS NOT NULL AND gi_next.time <> gi_prev.time
|
||||
)
|
||||
), collected AS (
|
||||
SELECT ts as time,
|
||||
public.ema(samp_value ::real, 0.33) over (order by ts asc) as smoothval,
|
||||
ema(samp_value ::real, 0.33) over (order by ts asc) as smoothval,
|
||||
samp_value as absvalue
|
||||
FROM coallated;
|
||||
FROM coallated), firstorder AS (
|
||||
SELECT time, smoothval, absvalue,
|
||||
smoothval - LAG (smoothval, 1) OVER (ORDER BY time ASC) as delta1st
|
||||
FROM collected), secondorder AS (
|
||||
SELECT
|
||||
time,
|
||||
smoothval,
|
||||
absvalue,
|
||||
delta1st,
|
||||
delta1st - LAG(delta1st, 1) OVER (ORDER BY time ASC) as delta2nd
|
||||
FROM firstorder)
|
||||
SELECT *,
|
||||
ema(delta1st, 0.25) OVER (ORDER BY time ASC) as smoothdelta1st,
|
||||
ema(delta2nd, 0.25) OVER (ORDER BY time ASC) as smoothdelta2nd
|
||||
FROM secondorder;
|
||||
|
|
Loading…
Add table
Reference in a new issue