Best approach to store actual values / nominal values in influxdb for usage in grafana

I’m looking for the best approach to handle following situation in influxdb for usgae in grafana:

Situation: I collect per minute 150 datapoints from a heating system. Some values are actual values like ambient-temperature without a nominal(target) value. Other values have an actual value and a nominal value.

Example:

The green line is the actual water temperature; the yellow line ist the nominal value (50 degrees).

In other cases the heating system does not provide settings. E.g. the system mode like Winter/Summer-Mode. Winter-Mode means heating and warm water preparation; Summer-Mode means only warm water preparation. This mode will be changed only twice a year.

By not getting this value from the json i have inject it manually, when the mode changes.

Question: Should I inject this mode every minute to the given datapoints or only when it changes? Or should I use a separate bucket for all the nominal values and save them when the state changes?

I would use one bucket.

Use actual and setpoint as tag values.

Something like this:

|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
 |> filter(fn: (r) => r["_measurement"] == "TemperatureData")
 |> filter(fn: (r) => r["MeasType"] == "actual" or r["MeasType"] == "setpoint")

You should ideally inject your data so that the set point and actual values are sent with the exact same timestamp. I use Node-RED to do this.

Thanks for your answer.

Coming from the good old IBM-DB2-Thinking, so the influxdb-approach is by now not so familiar for me - but it will going.

Is my understanding correct, that the non-frequently changing datapoints should be injected every minute? Can’t I use the “latest”-value?

I took am relatively new to InfluxDB as well and time series databases in general. If you plan on how you store your data (with fields and tags), then you can store billions and billions of data points that can be queried very fast. I can try to find a tutorial that I used in the beginning that taught me about fields and tags and the importance of organization.

I would recommend you inject an actual and setpoint value for a given temperature every 60 seconds. Doing this for 150 different temperatures should be fine every minute.

If you can inject the actual and setpoint with the same timestamp, then you will be able to have a pretty compact data structure. You can also do queries that allow you to set alerts on the difference between actual and setpoint (not sure if that is important or not, but thought I would mention it).

Edit: here is the link [Training] InfluxDB Performance Tuning and Schema Design - YouTube

2 Likes

Thanks for the link. Will take a look into it.

Short feedback:

Took a look at the mentioned video and by now things are much clearer.

From my perspective I will “design” as this:

bucket: homecontrol
measurement: heatingsystem
subsystem: Heatingcurcuit1, Warmwater1,Solarheat1,Weather,Weatherforecast

Subsystems and the actuals/setpoints are represented by tags. The individual actuals/nominals will be injected as fields. All points for one write to influxdb have the same timestamp (precision of second).

Example for roomtemperature:

Actual value:
bucket: homecontrol, measurement: heatingsystem, timestamp: 2022-12-04T23:10:00 Tag1:heatingcurcuit1,Tag2:actuals, Field: roomtemperature: 19.5

Nominal value:
bucket: homecontrol, measurement: heatingsystem, timestamp: 2022-12-04T23:10:00 Tag1:heatingcurcuit1,Tag2:nominal, Field: roomtemperature_set: 21.5

What do you think about this?

Hi @olkr

It’s a great start. My take is to create 5 measurements (Heatingcircuit1, Warmwater1, etc.), and use a Location tag as well as a MeasType tag. Besides temperature, are there any other parameters that you wish to measure (such as humidity), now or in the future?

Bucket HomeControl
Measurement Heatingcircuit1 Warmwater1 Solarheat1 Weather Weatherforecast
Tags: standardized descriptions of the data Location bedroom, kitchen, office, garage
MeasType nominal, setpoint
Fields: data to be measured temperature integer
humidity integer
rainfall integer
windspeed integer

Remember that each Measurement does not need to contain all of the fields shown (for example, humidity, rainfall and windspeed may not be used for any of the measurements except for Weather and Weatherforcast).

1 Like

Update: Created a “kind of repository”, where the 150 measurements are assigned to specific influxdb-measurements and tags(assignment not completed, just for testing how it works):


Next year, more systems to monitor will show up (photovoltaic, accu, car). I can create new repos with measurements e.g. photovoltaic and the specific fields.