bilingual

Units for PnPSA

In extension to the USB HID standard, following is defined.

Goals for the extension

Extension Proposal

Units with square and cubic roots

The low nibble of Unit() should support:
  1. SI linear, half exponents
  2. SI rotation, half exponents
  3. Imperial linear, half exponents
  4. Imperial rotation, half exponents
  5. SI linear, 1/3 exponents
  6. SI rotation, 1/3 exponents
  7. Imperial linear, 1/3 exponents
  8. Imperial rotation, 1/3 exponents
The highmost nibble of Unit() should encode exponents of mol.

Examples

See table for development of nV/√Hz:
Unit code (hex)Unit Exponent (hex)RepresentationNotes
00F0D1217VThe usual unit code
00E0A2457VThis is a possible but forbidden unit code, all exponents are even
00E0B2457V/√Hz (= V√s)one exponent (for s) is odd
00E0B245EnV/√Hz10-9 multiplied

Non-decimal unit multiples

The available bytes of Unit Exponent() should be used as follows:
0 (LSB)10x, -8 ≤ x ≤ 7unchanged
12x, -8 ≤ x ≤ 7new
23x, -8 ≤ x ≤ 7
3 (MSB)5x, -8 ≤ x ≤ 7
Beneath adding support for low prime numbers, this extension enables for decimal factors more than 10-8 to 107. Now the range is 10-16 to 1014.

Note that USB HID documentation is not clear for negative numbers! (Nibbles or bytes are used?)

Examples

See this table for development of m³/h
Unit code (hex)Unit Exponent (hex)RepresentationNote
F0310cm³/sbase unit
F0316m³/s106 multiplied
F03100FEFE04m³/h3600 divided

Human-readable units

Those units are only needed to be sent by the device if there are non-standard. The client software should always decode usual units by itself. See appendix for a list that are mantadory for the client.

Units are stored as String Descriptor in Unicode. The device should deliver different versions of the unit in one string for some different usages! Unit strings must not contain delimiting characters.

The reference to a unit descriptor is done with a new global or local item. (To be defined!)

prefix charactertypeusagemantadory?
noneUnicode representationsaving into unicode-text files, visual representationyes
U+1plain ASCIIsaving into non-unicode-text filesyes if Unicode representation contains character codes ≥ U+80
U+2Unicode with HTMLvisual representationno
U+3Unicode with RTF
U+4Unicode with TeX

Units should not be language specific. But it's free for the firmware to use LCIDs for picking a culture-specific unit.

Examples

How units are saved into local-codepage text files

Local codepages often support some Unicode characters, e.g. ² or ³. In this case, writing Nm³/h in its ASCII representation Nm^3/h doesn't lead to be a good solution.

The client application first converts the Unicode representation using WideCharToMultiByte(CP_ACP) or similar, and checks for conversion errors. If so, the application uses the ANSI representation, otherwise, it uses the conversion result.

The usual case for Western code pages is the sign which is then saved as Ohm. For greek and far-east users, is available and used for writing.

Appendix

Mantadory known units for any client

Unit code (hex)Unit Exponent (hex)Representation
10010s
00F0D1217V
To be continued!