The TMs currently include modbus:type definitions like:
So far, I've found that integer, number, and integer types are used, which sounds like datatypes in JSON.
However, it's really not clear how exactly should these types be interpreted on the binary level. I found the Siemens manual for the relevant device, and there is a section on Siemens datatypes in Modbus, so I can figure it out manually. But, it's not possible to do that automatically.
This document uses instead XSD datatypes: https://w3c.github.io/wot-binding-templates/bindings/protocols/modbus/#payloaddatatype
Which honestly creates even more problems (e.g., "how is xsd:decimal encoded???") and does not answer the questions about binary encodings.
This document also uses XSD datatypes, but with completely different indentifiers: https://w3c.github.io/wot-binding-templates/bindings/protocols/modbus/ontology.html#payloaddatatype
I currently have implemented a workaround which guesses the binary layout and datatype based on the generic datatype given in the TM and its length in registers.
The TMs currently include
modbus:typedefinitions like:thingmodels/siemens/siemens/3nacom-fuse/v1.0.0-20240802121832-3b18ae135fbc.tm.json
Line 983 in 50ef5ff
So far, I've found that
integer,number, andintegertypes are used, which sounds like datatypes in JSON.However, it's really not clear how exactly should these types be interpreted on the binary level. I found the Siemens manual for the relevant device, and there is a section on Siemens datatypes in Modbus, so I can figure it out manually. But, it's not possible to do that automatically.
This document uses instead XSD datatypes: https://w3c.github.io/wot-binding-templates/bindings/protocols/modbus/#payloaddatatype
Which honestly creates even more problems (e.g., "how is xsd:decimal encoded???") and does not answer the questions about binary encodings.
This document also uses XSD datatypes, but with completely different indentifiers: https://w3c.github.io/wot-binding-templates/bindings/protocols/modbus/ontology.html#payloaddatatype
I currently have implemented a workaround which guesses the binary layout and datatype based on the generic datatype given in the TM and its length in registers.