diff --git a/spec/units.yaml b/spec/units.yaml index 1894da3a7..5289284b4 100644 --- a/spec/units.yaml +++ b/spec/units.yaml @@ -1,11 +1,30 @@ # This file defines units supported in the VSS standard catalog -# So far only two domains defined, ides is to have domains for all -# Criteria: Two units belongs to same domain if it is possible to convert +# Ambition: Two units belongs to same domain if it is possible to convert # between them, either with multiplier/denominator or by custom # (hard-coded) function # # (However, conversion may result in out of range if target unit/datatype cannot # represent the value) +# +# Ambition when defining domains: +# +# A domain shall have a default unit. +# Other units in the same name domain shall specify how to convert to default unit. +# Either by explicitly or implicitly stating multiplier/denominator +# or identifying that custom (hard-coded) conversion is needed +# multiplier: x (default: 1) +# denominator: Y (default: 1) +# custom-conversion: true | false (default: false) +# +# The default unit does not need to specify any of them (i.e. use default = 1:1 mapping) +# +# For backward compatibility reasons defining domains should for now be optional +# I.e. tooling shall not give an error if a domain has not been defined +# TODO: Agree on long term standpoint of whether domains shall be required +# Alt 1: Required for all VSS-based models, i.e. give warning today that it may become mandatory if not not defined +# Alt 2: Required only for standard catalog (i.e. this file), i.e for now give warning if using "--strict" mode +# Alt 3: Always keep it optional, potentially give info if using --strict mode + domains: distance: @@ -16,12 +35,16 @@ domains: speed: description: Change in distance per time unit default-unit: km/h - time: + point in time: description: Specific moment in time default-unit: iso8061 - duration: + time: description: Time between two events default-unit: s + pressure: + description: Force applied perpendicular to the surface of an object per unit area + default-unit: Pa + # More domains to be added in similar way. units: mm: description: Distance measured in millimeters @@ -49,18 +72,20 @@ units: inch: description: Distance measured in inches domain: distance - # Maybe support only integers for multiplier/denominator + # Maybe support only integers for multiplier/denominator, if we prefer that over 0.0254 multiplier: 254 denominator: 10000 allowed-datatypes: ['numeric'] km/h: description: Speed measured in kilometers per hours domain: speed + allowed-datatypes: ['numeric'] m/s: description: Speed measured in meters per second domain: speed multiplier: 36 denominator: 10 + allowed-datatypes: ['numeric'] m/s^2: description: Acceleration measured in meters per second squared domain: acceleration @@ -116,47 +141,72 @@ units: description: Electric charge measured in ampere hours domain: electric charge ms: - description: Duration measured in milliseconds - domain: duration + description: Time measured in milliseconds + domain: time denominator: 1000 + allowed-datatypes: ['numeric'] s: - description: Duration measured in seconds - domain: duration + description: Time measured in seconds + domain: time + allowed-datatypes: ['numeric'] min: - description: Duration measured in minutes - domain: duration + description: Time measured in minutes + domain: time multiplier: 60 + allowed-datatypes: ['numeric'] h: - description: Duration measured in hours - domain: duration + description: Time measured in hours + domain: time multiplier: 3600 + allowed-datatypes: ['numeric'] day: - description: Duration measured in days - domain: duration + description: Time measured in days + domain: time multiplier: 86400 + allowed-datatypes: ['numeric'] weeks: - description: Duration measured in weeks - domain: durtaion + description: Time measured in weeks + domain: time multiplier: 604800 + allowed-datatypes: ['numeric'] months: - description: Duration measured in months - domain: duration + description: Time measured in months + domain: time # Multiplier based on 30 day month multiplier: 2592000 + allowed-datatypes: ['numeric'] years: - description: Duration measured in years - domain: duration + description: Time measured in years + domain: time # Multiplier based on 365 day year multiplier: 31536000 + allowed-datatypes: ['numeric'] + iso8061: + description: Point in time expressed as string according to ISO 8601 + domain: point in time + allowed-datatypes: ['string'] + # Special conversion method 1so8601 -> timestamp needed + UNIX Timestamp: + description: Unix time is a system for describing a point in time. It is the number of seconds that have elapsed since the Unix epoch, excluding leap seconds. + domain: point in time + # Conversion custom , i.e this file does not specify how conversion to iso8061 happens + conversion: custom + allowed-datatypes: ['uint32','uint64','int64'] mbar: description: Pressure measured in millibars domain: pressure + multiplier: 100 Pa: description: Pressure measured in pascal domain: pressure kPa: description: Pressure measured in kilopascal domain: pressure + multiplier: 1000 + psi: + description: Pressure measured in pounds per square inch + domain: pressure + multiplier: 6894.7572931783 stars: description: Rating measured in stars domain: rating @@ -220,17 +270,3 @@ units: Wh/km: description: Energy consumption per distance measured in watt hours per kilometer domain: energy consumption per distance - psi: - description: Pressure measured in pounds per square inch - domain: pressure - iso8061: - description: Time expressed as string according to ISO 8601 - domain: time - allowed-datatypes: ['string'] - # Special conversion method 1so8601 -> timestamp needed - timestamp: - description: Unix time is a system for describing a point in time. It is the number of seconds that have elapsed since the Unix epoch, excluding leap seconds. - domain: time - # Conversion custom , i.e this file does not specify how conversion to iso8061 happens - conversion: custom - allowed-datatypes: ['uint32','uint64','int64']