sunspec / models

SunSpec Model Definitions
Apache License 2.0
84 stars 52 forks source link

[Model 64020] Json swaps ProbeTmp and MainTmp fields compared to XML #240

Open nielsbasjes opened 1 year ago

nielsbasjes commented 1 year ago

The smdx_64020.xml (Mersen GreenString) XML says (note the ordering of the fields and the offsets):

      <point id="ProbeTmp" offset="6" type="int16" units="C" mandatory="true" />
      <point id="MainTmp" offset="5" type="int16" units="C" mandatory="true" />

and the json says:

            {
                "label": "Probe Temperature",
                "mandatory": "M",
                "name": "ProbeTmp",
                "size": 1,
                "type": "int16",
                "units": "C"
            },
            {
                "label": "Main Temperature",
                "mandatory": "M",
                "name": "MainTmp",
                "size": 1,
                "type": "int16",
                "units": "C"
            },

Because in the Json variant the offsets are implicitly calculated from the ordering (without and explicit offset field) this effectively means these two fields have been swapped in the migration from XML to json.

nielsbasjes commented 1 year ago

@shelcrow / @bobfox : Which is correct? The json or the xml?

bobfox commented 1 year ago

I think there are a couple of issues here.

I think some tools did not use the offset attribute as it was somewhat redundant if there are no gaps between points in the model definitions. I suspect if you read that model with pysunspec2 using the SMDX model definition, it would order it based on the point order not the offset attribute.

This is a vendor defined model that is published by SunSpec but controlled by the manufacturer. SunSpec converted these models to the json encoding for convenience but you could argue that is not ideal as SunSpec does not control the model definition. Also, I don't believe this model definition is actually being used by anyone but am not sure.

Ideally, it would be good to work through the manufacturer to clarify the correct solution but I suspect that may be difficult.

nielsbasjes commented 1 year ago

I did some googling and your assessment of "may be difficult" seems very correct.

I have found only very small number of sites mentioning "Mersen Greenstring" which show a device, but that was not on any mersen related website.

The websites https://www.mersen.com/ and https://ep-us.mersen.com/ both return 0 results on terms like greenstring, sunspec and even modbus. Searching for helioprotection results in some entries but nothing to do with monitoring (mostly fuses).

So I conclude it is a device that was for sale in 2016 and right now they have wiped all references to it.

So at this point it seems you're correct in that no one is actually using it.

Given your remark about pysunspec2 I propose to simply swap the offset values in the (deprecated) XML. This makes both "the same" (which may be wrong) and changes nothing for any existing users.