How can I do this? I want to get max values of a saw wave, 1 result per max

I am logging(every 1minute) the charging of an battery, and want to get a table of results where each result is just the max of each charging cycle. Is this possible with influxdb? If so can you give me some guidance?
Thanks.

i.e.
6/10/2019 11:52:52 52Kw Added
6/09/2019 11:52:52 12Kw Added
6/08/2019 11:52:52 25Kw Added

I am logging(every 1minute) the charging of an battery, and want to get a
table of results where each result is just the max of each charging cycle.

Do you mean max, or do you mean sum?

In other words, are you looking for the maximum value of the measurement at
any point in the cycle, or do yu want to add up all the measurements during
one cycle?

Is this possible with influxdb?

Yes, I would think so.

If so can you give me some guidance?

How about select max(measurement) from datasource group by time(interval)

Replace “measurement” with whatever the field in your data source is named
Replace “datasource” with whatever the table containing the data is named
Replace “interval” with whatever the length of your charging cycle is (eg:
“1d”, judging from your example below)

i.e.
6/10/2019 11:52:52 52Kw Added
6/09/2019 11:52:52 12Kw Added
6/08/2019 11:52:52 25Kw Added

Regards,

Antony.

Yes I would like the max. That mostly works, but could be better since the charge cycle is not regular. Here is an example of the current data:See that for a few times the times are the same so that is still the same saw wave data. So maybe there is a way to use a something like the difference between the points to determine to select or something?

select max(charge_energy_added) from charge_state group by time(12h) limit 100
name: charge_state
time max


2019-06-07T00:00:00Z 1.88
2019-06-07T12:00:00Z 11.09
2019-06-08T00:00:00Z 11.51
2019-06-08T12:00:00Z 11.51
2019-06-09T00:00:00Z 11.51
2019-06-09T12:00:00Z 11.51
2019-06-10T00:00:00Z
2019-06-10T12:00:00Z 1.15
2019-06-11T00:00:00Z 9.1
2019-06-11T12:00:00Z

Yes I would like the max. That mostly works, but could be better since the
charge cycle is not regular.

If the charge cycle is not regular, I can’t think of any way to express that
in an Influx query.

Here is an example of the current data:

select max(charge_energy_added) from charge_state group by time(12h)
limit 100 name: charge_state
time max


2019-06-07T00:00:00Z 1.88
2019-06-07T12:00:00Z 11.09
2019-06-08T00:00:00Z 11.51
2019-06-08T12:00:00Z 11.51
2019-06-09T00:00:00Z 11.51
2019-06-09T12:00:00Z 11.51
2019-06-10T00:00:00Z
2019-06-10T12:00:00Z 1.15
2019-06-11T00:00:00Z 9.1
2019-06-11T12:00:00Z

See that for a few times the times are the same so that is still the same
saw wave data. So maybe there is a way to use a something like the difference
between the points to determine to select or something?

I cannot think of a way to do that - but maybe someone else here can.

Antony.