Documentation
¶
Overview ¶
Package obis is the Object Identification System of IEC 62056-6-1:2023 (EN IEC 62056-6-1:2024 is the same text) as a model: it validates an OBIS code, says which range each value group is in (standard, manufacturer, utility, consortia, country, reserved), describes what a standard code identifies, and derives a point name for it. The tables are data (obis.yaml) with clause and table references; the wording is ours.
SigmaM2M's DLMS adapter names configured objects with it, and its IEC 62056-21 and Wireless M-Bus adapters name readout addresses (reduced ID codes, annex A.1) and data records with it.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrReserved = errors.New("reserved OBIS code")
ErrReserved is returned by Validate for codes in reserved ranges.
Functions ¶
Types ¶
type Code ¶
type Code [6]byte
Code is an OBIS code, value groups A to F.
func Parse ¶
Parse reads a six-group code: "1.0.1.8.0.255", or the delimited form of annex A.1 with all groups ("1-0:1.8.0*255", "1-0:1.8.0.255"). Reduced codes with groups left out are read by ParseReduced.
type Counts ¶
type Counts struct {
Media int // allocated A values (Table 3)
Countries int // Table 7 rows
Consortia int // Table 6 rows
ElectricityC int // quantity C values (Table 13)
ElectricityD int // D values (Table 14)
Harmonics int // E values of Table 16 other than 0
AngleCodes int // E values of Table 17
LossCodes int // E values of Table 18
DipClasses int // E values of Table 19
ObjectRows int // rows of Tables 8 to 12 and 20 to 24, 6-2 clause 6 and EN 13757-1 clause 11.3
MediaC int // quantity C codes of media 4 to 9 (EN 13757-1:2021), per A
MediaD int // D codes of the EN 13757-1:2021 D tables
}
Counts is the size of the model, for tests and the report.
type Info ¶
type Info struct {
Code Code
Kind Kind
// Medium (A), Channel (B), Quantity (C), Processing (D), Class (E) and
// Period (F) say what each value group means, in our words; empty when
// the group carries no meaning of its own.
Medium, Channel, Quantity, Processing, Class, Period string
// Owner is the country or consortium of a country or consortia code.
Owner string
// Name is the derived point name; empty when the code has no standard
// meaning (manufacturer, utility, consortia, country, context codes and
// reserved ones).
Name string
// Classes are the interface classes IEC 62056-6-2:2023 clause 6 gives
// the object (class_id), in the order the standard lists them; empty
// when it gives none.
Classes []uint16
// Ref is the clause and table the meaning comes from.
Ref string
// Problem says why a reserved code is reserved.
Problem string
}
Info describes a code.
func Describe ¶
Describe classifies and describes a code, taking the first matching row where rows of several classes share it.
Example ¶
What OBIS codes mean, and the point names derived from them.
package main
import (
"fmt"
"github.com/cB-Sigma/dlms/obis"
)
func main() {
for _, s := range []string{"1.0.1.8.0.255", "1.0.32.7.0.255", "1.0.1.8.0.3", "7.0.13.2.0.255"} {
i := obis.Describe(obis.MustParse(s))
fmt.Println(s, i.Kind, i.Name)
}
// A reduced code as an IEC 62056-21 readout writes it.
c, _ := obis.ParseAny("1.8.0")
fmt.Println(obis.Name(c))
}
Output: 1.0.1.8.0.255 standard activeEnergyImport 1.0.32.7.0.255 standard voltageL1 1.0.1.8.0.3 standard activeEnergyImport_b03 7.0.13.2.0.255 standard gasConverterVolumeFwdBase activeEnergyImport
func DescribeClass ¶
DescribeClass is Describe for an object of a known interface class.
type Kind ¶
type Kind string
Kind is the range a code falls in (clause 4, Table 2).
const ( Standard Kind = "standard" // a meaning this document defines Media Kind = "media" // A = 4-9: defined for those media elsewhere (clause 1, EN 13757-1) Manufacturer Kind = "manufacturer" // 4.2, Tables 2, 8, 20 Utility Kind = "utility" // 5.2, B = 65-127 Consortia Kind = "consortia" // 5.4.2, C = 93 Country Kind = "country" // 5.4.3, C = 94, or reserved for one country in a table Inactive Kind = "inactive" // A = 0, C = 127 (Table 5) Reserved Kind = "reserved" // 4.3: not allocated )
Kinds.
type Reduced ¶
type Reduced struct {
A, B, C, D, E, F int
// Manual is set when "&" rather than "*" comes before F: the reset
// was made by hand (A.1).
Manual bool
}
Reduced is an ID code in the presentation of annex A.1, "A-B:C.D.E*F", as IEC 62056-21 readouts and displays use it: C and D are mandatory; A, B, E and F may be left out (-1 here); every group is 0 to 99, and C and D may be the letters C, F, L, P for 96 to 99 (A.2 Table A.1).
func ParseReduced ¶
ParseReduced reads a reduced ID code: "1.8.0", "1.8.0*03", "C.1.0", "F.F", "1-0:1.8.0&12", "1-0:1.8.0". A trailing ".255" or "*255" (F not used, 5.6.1) is accepted and read as F left out.
func (Reduced) Code ¶
Code completes a reduced code (finding F-264, A.1 does not say what groups left out mean): A left out is 0 (abstract) when C is 96 to 99, the letters C, F, L, P, and 1 (electricity) otherwise, as electricity meter readouts print them; B left out is 0 (no channel, 5.2); E left out is 0 (the only or total object, 4.5); F left out is 255 (not used, 5.6.1).