5.6.4.4 Mapping of UN/CEFACT to EUInformation

This clause specifies how to apply the Codes for Units of Measurement published by the “United Nations Centre for Trade Facilitation and Electronic Business” (see UNECE). This recommendation establishes a single list of code elements to represent units of the International System of Units (SI Units) like units of measure for length, mass (weight), volume and other quantities and in addition covers administration, commerce, transport, science, technology, industry etc. It provides a fixed code that can be used for automated evaluation.

Table 25 contains a small excerpt of the relevant columns in the UNECE recommendation:

Table 25 – Examples from the UNECE Recommendation
Excerpt from Recommendation N°. 20, Annex 1
Common CodeNameSymbol
C81radianrad
C25milliradianmrad
MMTmillimetremm
HMThectometrehm
KMTkilometrekm
KMQkilogram per cubic metrekg/m3
FAHdegree Fahrenheit°F

The UNECE recommendation in several cases defines multiple instances of the same unit (same name and symbol) for different quantities. Therefore, the relevant information for EUInformation.unitId, EUInformation.displayName, and EUInformation.description has been extracted by eliminating duplicates. This extract is available here:

https://reference.opcfoundation.org/files/UNECE_to_OPCUA.csv?u=http://opcfoundation.org/UA/

This mapping has been generated as follows:

		Int32 unitId = 0;		Int32 c;		for (i=0; i<=3;i++)		{
			c = CommonCode[i];		if (c == 0) break;		// end of Common Code		unitId = unitId << 8;		unitId = unitId | c;	}