Schema advice for commercial solar monitoring

Trying to get an idea how to design the schema for a project. I anticipate logging measurements approximately every minute from a few Modbus connected devices (mostly solar inverters funneled through a proprietary communications gateway) which at present are then going through a Node-Red Inflxdb batch uploader to send data into InfluxDB and being dashboarded by Grafana. All of which is working great; seriously great, it’s so darn easy and cool!

But now it’s time to plan for the future where customers will be banging on it. As a means of providing data segregation from one customer to another primarily from within the Grafana interface, it seems each customer should have their own database.

I’m still having trouble planning what to call a Measurement vs a Tag or a Field. Queries seem to be the driving factor in schema design, but I can’t figure out what the best approach is. Our queries should be pretty straightforward, compare the performance of an inverter’s output to another across a given physical site. I’ve attached a hierarchy of potential field counts (which I suspect are trivial but I do anticipate scaling at the customer and site level) for relational reference.

It seems to me that gateway, inverter, string, and maybe sensor are all appropriate Tags. What’s not clear is where Measurements fit into this. Would a Measurement be something like a unit of measure? Such as fields which measure Power in Watts that get appropriate Tags for a Gateway vs an Inverter vs an Inverter’s String to differentiate them in the queries?

Looking closer at my potential queries, it seems things like status and even firmware versions should actually be tags rather than fields. Please let me know if you disagree.

I am having trouble filtering on tags which were provided by node-red’s uploader from variables.
tags:{ location:“warehouse”, serial: global.get(“invSerial”) }
This query works fine:
SELECT mean("power") FROM "autogen"."inverter" WHERE ("location" = 'warehouse')

Grafana has no trouble filtering on location=warehouse but chokes on serial=MIBB007236 even when the string is selected from Grafana’s drop down selector after choosing serial for the where. Grafana provides an error parsing query suggesting it expected identifier, string, number, bool instead of the actual string it provided in the drop down.
This query fails with the parsing error:
SELECT mean("power") FROM "autogen"."inverter" WHERE ("serial" = 'MIBB007236')

Pretty sure I’m doing something wrong with how I send the tag to the db, I just don’t know what it is.

Honing in on the tag system I think. If I want to display fields from all of the inverters at a location, those inverter measurements will have to be tagged with the location tag. I’ve updated my graphic to reflect tags that will be mostly static. Some of the tags such as “status” or “mode” will be limited to a total of around five options each and will seldom change more than twice a day. But I put them into tags so they’re indexed as it would be nice to do queries where status=3 or something.

Am I on the right track? Or have I gotten something wrong and need to head in a different direction?

Seems like you are doing it right to me. I usually name the measurement after the thing being monitored. From a query perspective they create a namespace that is useful for organization and since queries comparing fields across measurements is trickier I don’t add more than needed. I find a good indication when to use a different measurement is when the set of tags is different. Good candidates for tags are items that identify the object being monitored and don’t change frequently or have a finite set of values.

1 Like