eclipse-sparkplug / sparkplug

Sparkplug
Eclipse Public License 2.0
109 stars 39 forks source link

Add Engineering Units metadata field for metrics #104

Open matthewGEA opened 3 years ago

matthewGEA commented 3 years ago

Add a metadata field specifically for Engineering Units. Use a unique identifier for units (such as "Codes for Units of Measurement"). Maybe allow a field for human readable description, too?

Reference the implementation from OPC-UA: https://reference.opcfoundation.org/v104/Core/docs/Part8/5.6.3/

lothar7 commented 2 years ago

Great suggestion.

I-Campbell commented 2 years ago

This should be a Metric.Property Metric.Metadata seems only for file transfer purposes

wz2b commented 2 years ago

OPC/UA seems to be UNECE codes which are an international standard above and beyond just OPC/UA. Based on that, I approve of the idea of using the UNECE "Common Code" field if that's what we wish. That would make the Property be of type String.

I still think we need to decide what to name this property on the Sparkplug side, and I think there should be provisions for both the common code and a label as two different things, and maybe also consider euName:

but my main question here is: even if we do not REQUIRE that you use these property names in the spec, is it okay to encourage it?

One thing about using a standard system like this is it gives the ability to programmatically convert things. The UNECE database gives some conversion info but it's unfortunately in a text field. Still ... I looked at a bunch of other implements including PINT (python) and javax.measure (java), and I think both of those would also be an okay place to start that doesn't carry as much weight (ha ha!) as using a U.N. international standard.

So in summary I give this request a thumbs up, adding that I'd like to see some kind of "best practices" document, separate document, appendix, something that makes it so that whenever possible when I get a sparkplug message from some machine it gives me the associated units so I know if it's S.I., Imperial units, or something the vendor made up.

I think if we're having this discussion we ought to think about standard recommendations for scale and offset too.....