Skip to content

Latest commit

 

History

History
188 lines (166 loc) · 12.5 KB

DTDL.quantitativeTypes.v1.md

File metadata and controls

188 lines (166 loc) · 12.5 KB

QuantitativeTypes extension

Version 1

Usable in DTDL version 3

The QuantitativeTypes extension provides a set of standard semantic types that can be applied to CommandRequests, CommandResponses, Fields, MapValues, Properties, and Telemetries. If a service supports the QuantitativeTypes extension, and if the QuantitativeTypes context is specified, the service recognizes and understands the semantic types, unit types, and units itemized below, as well as the unit property on each of the semantic types.

QuantitativeTypes context

The context specifier for version 1 of the QuantitativeTypes extension is "dtmi:dtdl:extension:quantitativeTypes;1".

Semantic types and units

The semantic types itemized below can co-type a CommandRequest, a CommandResponse, a Field, a MapValue, a Property, or a Telemetry in DTDL version 3. When a CommandRequest, CommandResponse, Field, MapValue, Property, or Telemetry is co-typed with one of these semantic types, the value of the unit property must be an instance of the corresponding unit type, and the value of the schema property must be a numeric type.

Note that although most semantic types have matching unit types, there is not a strict one-to-one correspondence between semantic types and unit types. For example, Humidity is expressed using DensityUnit, and Luminosity is expressed using PowerUnit.

The chart below itemizes semantic types, corresponding unit types, and available units for each unit type.

Note: The TimeSpan semantic type should not be confused with the duration schema type. The duration schema is in ISO 8601 format; it is intended for calendar durations; and it does not play well with SI units. The semantic unit for TimeSpan is TimeUnit, which gives temporal semantics to a numeric schema type.

Semantic type Unit type Unit
Acceleration AccelerationUnit centimetrePerSecondSquared
gForce
metrePerSecondSquared
Angle AngleUnit degreeOfArc
minuteOfArc
radian
secondOfArc
turn
AngularAcceleration AngularAccelerationUnit radianPerSecondSquared
AngularVelocity AngularVelocityUnit degreePerSecond
radianPerSecond
revolutionPerMinute
revolutionPerSecond
ApparentEnergy ApparentEnergyUnit gigavoltAmpereHour
kilovoltAmpereHour
megavoltAmpereHour
voltAmpereHour
ApparentPower ApparentPowerUnit gigavoltAmpere
kilovoltAmpere
megavoltAmpere
millivoltAmpere
voltAmpere
Area AreaUnit acre
hectare
squareCentimetre
squareFoot
squareInch
squareKilometre
squareMetre
squareMillimetre
Capacitance CapacitanceUnit farad
microfarad
millifarad
nanofarad
picofarad
Concentration Unitless partsPerBillion
partsPerMillion
partsPerQuadrillion
partsPerTrillion
percent
unity
Current CurrentUnit ampere
kiloampere
microampere
milliampere
DataRate DataRateUnit bitPerSecond
bytePerSecond
exbibitPerSecond
exbibytePerSecond
gibibitPerSecond
gibibytePerSecond
kibibitPerSecond
kibibytePerSecond
mebibitPerSecond
mebibytePerSecond
tebibitPerSecond
tebibytePerSecond
yobibitPerSecond
yobibytePerSecond
zebibitPerSecond
zebibytePerSecond
DataSize DataSizeUnit bit
byte
exbibit
exbibyte
gibibit
gibibyte
kibibit
kibibyte
mebibit
mebibyte
tebibit
tebibyte
yobibit
yobibyte
zebibit
zebibyte
Density DensityUnit gramPerCubicMetre
kilogramPerCubicMetre
microgramPerCubicMetre
milligramPerCubicMetre
Distance LengthUnit astronomicalUnit
centimetre
foot
inch
kilometre
metre
micrometre
mile
millimetre
nanometre
nauticalMile
ElectricCharge ChargeUnit ampereHour
coulomb
milliampereHour
Energy EnergyUnit britishThermalUnit
electronvolt
gigajoule
gigawattHour
joule
kiloBritishThermalUnit
kilojoule
kilowattHour
megaelectronvolt
megajoule
megawattHour
milliwattHour
terawattHour
wattHour
EnergyRate PowerUnit britishThermalUnitPerHour
gigajoulePerHour
gigawatt
horsepower
joulePerHour
joulePerSecond
kiloBritishThermalUnitPerHour
kilojoulePerHour
kilojoulePerSecond
kilowatt
kilowattHourPerYear
megajoulePerHour
megawatt
microwatt
milliwatt
tonOfRefrigeration
watt
Force ForceUnit newton
ounce
pound
ton
Frequency FrequencyUnit gigahertz
hertz
kilohertz
megahertz
millihertz
Humidity DensityUnit gramPerCubicMetre
kilogramPerCubicMetre
microgramPerCubicMetre
milligramPerCubicMetre
Illuminance IlluminanceUnit footcandle
lux
Inductance InductanceUnit henry
microhenry
millihenry
IonizingRadiationDose IonizingRadiationDoseUnit gray
microgray
microsievert
milligray
millisievert
sievert
Irradiance IrradianceUnit wattPerSquareMetre
Latitude AngleUnit degreeOfArc
minuteOfArc
radian
secondOfArc
turn
Length LengthUnit astronomicalUnit
centimetre
foot
inch
kilometre
metre
micrometre
mile
millimetre
nanometre
nauticalMile
Longitude AngleUnit degreeOfArc
minuteOfArc
radian
secondOfArc
turn
Luminance LuminanceUnit candelaPerSquareMetre
Luminosity PowerUnit britishThermalUnitPerHour
gigajoulePerHour
gigawatt
horsepower
joulePerHour
joulePerSecond
kiloBritishThermalUnitPerHour
kilojoulePerHour
kilojoulePerSecond
kilowatt
kilowattHourPerYear
megajoulePerHour
megawatt
microwatt
milliwatt
tonOfRefrigeration
watt
LuminousFlux LuminousFluxUnit lumen
LuminousIntensity LuminousIntensityUnit candela
MagneticFlux MagneticFluxUnit maxwell
weber
MagneticInduction MagneticInductionUnit gauss
tesla
Mass MassUnit gram
kilogram
massPound
microgram
milligram
slug
tonne
MassFlowRate MassFlowRateUnit gramPerHour
gramPerSecond
kilogramPerHour
kilogramPerSecond
massPoundPerHour
Power PowerUnit britishThermalUnitPerHour
gigajoulePerHour
gigawatt
horsepower
joulePerHour
joulePerSecond
kiloBritishThermalUnitPerHour
kilojoulePerHour
kilojoulePerSecond
kilowatt
kilowattHourPerYear
megajoulePerHour
megawatt
microwatt
milliwatt
tonOfRefrigeration
watt
Pressure PressureUnit bar
decapascal
hectopascal
inchesOfMercury
inchesOfWater
kilopascal
millibar
millimetresOfMercury
pascal
poundPerSquareInch
Radioactivity RadioactivityUnit becquerel
gigabecquerel
kilobecquerel
megabecquerel
ReactiveEnergy ReactiveEnergyUnit gigavoltAmpereReactiveHour
kilovoltAmpereReactiveHour
megavoltAmpereReactiveHour
voltAmpereReactiveHour
ReactivePower ReactivePowerUnit gigavoltAmpereReactive
kilovoltAmpereReactive
megavoltAmpereReactive
millivoltAmpereReactive
voltAmpereReactive
RelativeDensity Unitless partsPerBillion
partsPerMillion
partsPerQuadrillion
partsPerTrillion
percent
unity
RelativeHumidity Unitless partsPerBillion
partsPerMillion
partsPerQuadrillion
partsPerTrillion
percent
unity
Resistance ResistanceUnit kiloohm
megaohm
milliohm
ohm
SoundPressure SoundPressureUnit bel
decibel
Temperature TemperatureUnit degreeCelsius
degreeFahrenheit
kelvin
Thrust ForceUnit newton
ounce
pound
ton
TimeSpan TimeUnit day
hour
microsecond
millisecond
minute
nanosecond
second
year
Torque TorqueUnit newtonMetre
Velocity VelocityUnit centimetrePerSecond
kilometrePerHour
kilometrePerSecond
knot
metrePerHour
metrePerSecond
milePerHour
milePerSecond
Voltage VoltageUnit kilovolt
megavolt
microvolt
millivolt
volt
Volume VolumeUnit cubicCentimetre
cubicFoot
cubicInch
cubicMetre
fluidOunce
gallon
litre
millilitre
VolumeFlowRate VolumeFlowRateUnit cubicFootPerMinute
cubicMetrePerHour
cubicMetrePerMinute
cubicMetrePerSecond
gallonPerHour
gallonPerMinute
litrePerHour
litrePerMinute
litrePerSecond
millilitrePerHour
millilitrePerMinute
millilitrePerSecond

Semantic type and unit examples

The following example shows an Interface with four contents elements that are all of type Telemetry.

  • The element named "thermometer" has co-type Temperature and unit degreeCelsius.
  • The element named "barometer" has co-type Pressure and unit millibar.
  • The element named "humidityMeter" has co-type RelativeHumidity and unit percent.
  • The element named "anemometer" has co-type Velocity and unit metrePerSecond.

One Telemetry has a schema value of integer, and the other three have schema values of double, all of which are valid since both integer and double are numeric schemas.

{
  "@context": [
      "dtmi:dtdl:context;3",
      "dtmi:dtdl:extension:quantitativeTypes;1"
  ],
  "@id": "dtmi:com:example:Sensor;1",
  "@type": "Interface",
  "contents": [
    {
      "@type": [ "Telemetry", "Temperature" ],
      "name": "thermometer",
      "schema": "double",
      "unit": "degreeCelsius"
    },
    {
      "@type": [ "Telemetry", "Pressure" ],
      "name": "barometer",
      "schema": "double",
      "unit": "millibar"
    },
    {
      "@type": [ "Telemetry", "RelativeHumidity" ],
      "name": "humidityMeter",
      "schema": "integer",
      "unit": "percent"
    },
    {
      "@type": [ "Telemetry", "Velocity" ],
      "name": "anemometer",
      "schema": "double",
      "unit": "metrePerSecond"
    }
  ]
}

The following example reformulates the above Interface to have a single Telemetry whose schema is an Object with four Fields. Each field has a name, co-type, and unit that matches one of the separate Telemetries above.

{
  "@context": [
      "dtmi:dtdl:context;3",
      "dtmi:dtdl:extension:quantitativeTypes;1"
  ],
  "@id": "dtmi:com:example:Sensor;1",
  "@type": "Interface",
  "contents": [
    {
      "@type": "Telemetry",
      "name": "multimeter",
      "schema": {
        "@type": "Object",
        "fields": [
          {
            "@type": [ "Field", "Temperature" ],
            "name": "thermometer",
            "schema": "double",
            "unit": "degreeCelsius"
          },
          {
            "@type": [ "Field", "Pressure" ],
            "name": "barometer",
            "schema": "double",
            "unit": "millibar"
          },
          {
            "@type": [ "Field", "RelativeHumidity" ],
            "name": "humidityMeter",
            "schema": "integer",
            "unit": "percent"
          },
          {
            "@type": [ "Field", "Velocity" ],
            "name": "anemometer",
            "schema": "double",
            "unit": "metrePerSecond"
          }
        ]
      }
    }
  ]
}

Feature versions

The chart below lists the versions of the QuantitativeTypes extension that are currently available.

Extension Context DTDL versions
QuantitativeTypes v1 dtmi:dtdl:extension:quantitativeTypes;1 3