Closed reginbald closed 2 months ago
Yes, this is correct. In DTDL v2 semantic types are only supported at the telemetry or property level. We are exploring expanding the use of semantic types in future revisions of DTDL.
Can you provide some examples of where you would want to use units within a complex type?
Thanks for the quick reply :)
Let's say we have a component that represents a heat camera. When a product has been scanned and is detected to be too hot it will send out an alarm/telemetry with the picture, max temperature and min temperature of the product.
{
"@type": "Telemetry",
"name": "overheating",
"schema": {
"@type": "Object",
"fields": [
{
"name": "image",
"schema": "string"
},
{
"name": "minTemp",
"schema": "double"
},
{
"name": "maxTemp",
"schema": "double"
}
]
}
},
or
Let's say we have a machine that may have two or more sensors for temperature readings in a room. We'd like to describe it using an array with temperature values and sensor ids.
{
"@type": "Telemetry",
"name": "roomTemp",
"schema": {
"@type": "Array",
"elementSchema": {
"@type": "Object",
"fields": [
{
"name": "id",
"schema": "string"
},
{
"name": "temperature",
"schema": "double"
}
]
}
}
}
These are great examples--thanks for adding these. We're not quite ready to have the next set of design discussions on this topic, but I want to leave this issue open so that we can come back to it because I think it will be important to address sooner rather than later.
Hi @reginbald
We have published the DTDL v3 preview. This version supports units in Fields as described here https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/Docs/en-US/DTDL.quantitativeTypes.v1.md#semantic-types-and-units
If this satisfies your requirements, can you close this issue?
Hi @reginbald
We have published the DTDL v3 preview. This version supports units in Fields as described here https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/Docs/en-US/DTDL.quantitativeTypes.v1.md#semantic-types-and-units
If this satisfies your requirements, can you close this issue?
The above link gives a 404
apologies, we've been refactoring the folder structure.
This link should work: https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v3/DTDL.quantitativeTypes.v1.md#semantic-types-and-units
Hi @reginbald
Wondering if this update to DTDL satisfies your requirements. If so, can you close this issue?
In DTDL v1 every level in a DCM could have a displayUnit property. In DTDL v2 this property is removed. Display units in v2 are derived from the unit property. The unit property can only be present when a semantic type is defined. A semantic type is only valid on telemetry or a property that has a numeric schema (integer, long, float, double). This means that it’s not possible to define a unit for fields of an object. So if you want to have units as part of the definition you cannot use complex types in a DCM (object, map, array).
Is this true?