Sml.Units (SmlEx v0.1.0)

Copy Markdown View Source

DLMS/COSEM unit codes (IEC 62056-62) as used in the unit field of SML list entries.

The most common ones for electricity meters are 27 (W), 30 (Wh), 33 (A), 35 (V) and 44 (Hz).

iex> Sml.Units.name(30)
:wh

iex> Sml.Units.symbol(27)
"W"

iex> Sml.Units.code(:wh)
30

Summary

Functions

Returns the unit code for a unit name, or nil if it is unknown.

Returns the unit name for a unit code, or nil if it is unknown.

Returns the unit symbol for a unit code, or nil if it is unknown.

Types

code()

@type code() :: 0..255

Functions

code(name)

@spec code(atom()) :: code() | nil

Returns the unit code for a unit name, or nil if it is unknown.

name(code)

@spec name(code() | nil) :: atom() | nil

Returns the unit name for a unit code, or nil if it is unknown.

symbol(code)

@spec symbol(code() | nil) :: String.t() | nil

Returns the unit symbol for a unit code, or nil if it is unknown.