Skip to content
IEC 60870-5-102

IEC 60870-5-102

Reading integrated totals, the energy values of electricity meters, from meters and data concentrators over serial lines and modems; in Spain the basis of fiscal metering.

Transport
FT 1.2 on a serial line or modem; or a terminal server that passes the line through
Link
Unbalanced: the controlling station polls, the meter only answers
Profile
Spanish REE profile: sessions with an access key, clock setting, tariffs
Library
go-iec60870-5 (iec102)
CLI
iec102ctl
Interop
iec60870-5-interop v0.5.0

IEC 60870-5-102 (IEC 102) is the companion standard for the transmission of integrated totals: the energy counters of electricity meters, read per integration period. A controlling station (a metering front end or data collector) reads an integrated total station (a meter or a data concentrator) over a serial line or a modem, on the same FT 1.2 frames and link procedures as IEC 101.

It has an application layer of its own. A request names a record address (the hourly load profile, daily values, the billing period, a list of events), a range of counters and a time window; the meter confirms the request, sends one ASDU per integration period with a common time tag, and terminates it. IEC 102 has no spontaneous data: a meter only answers what it is asked. Its time formats are its own too, time a for the period and time b for the meter’s clock.

IEC 102 is best known in Spain, where Red Eléctrica (REE) built its fiscal metering on it and added a profile with sessions and an access key, clock setting, tariff information and contracted powers. Nearly every open IEC 102 implementation is an REE controlling station.

Where you meet it

  • Spanish fiscal metering of generation, transmission and large consumers, under the REE profile
  • Energy meters and data concentrators in substations and power plants, read by a metering front end over serial lines or modems
  • Meter data collection for billing and settlement, where readings must come with their integration period and quality

Quickstart

From the command line

Install iec102ctl with curl -fsSL https://get.otfabric.io/iec102ctl | sh, or on Windows irm https://get.otfabric.io/iec102ctl.ps1 | iex (all install options). No meter at hand? Start a simulated one:

Terminal window
iec102ctl server start

and read it from another terminal:

Terminal window
# Who is it, and what time does it have?
iec102ctl client info --url tcp://127.0.0.1:2401
iec102ctl client time --url tcp://127.0.0.1:2401
# The hourly load profile of one day, in an REE session
iec102ctl client totals --url tcp://127.0.0.1:2401 --record 11 \
--from 2026-01-01T01:00 --to 2026-01-02T00:00 --access-key 7
# The same as increments, as a table
iec102ctl client totals --url tcp://127.0.0.1:2401 --kind incremental \
--from 2026-01-01 --to 2026-01-02 --format table

From Go

Terminal window
go get github.com/otfabric/go-iec60870-5

Read one day of the hourly load profile from a meter of the REE profile:

main.go
package main
import (
"context"
"fmt"
"log"
"net"
"time"
"github.com/otfabric/go-iec60870-5/iec102"
"github.com/otfabric/go-iec60870-5/iec102/client"
"github.com/otfabric/go-iec60870-5/iec102/ree"
)
func main() {
// A terminal server in front of the meter's serial port.
conn, err := net.DialTimeout("tcp", "10.0.0.20:2401", 5*time.Second)
if err != nil {
log.Fatal(err)
}
p := iec102.Params{Profile: ree.Profile} // decode REE bodies
c, err := client.New(conn, client.Config{LinkAddr: 1, CommonAddr: 1, Params: p})
if err != nil {
log.Fatal(err)
}
defer c.Close()
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
if err := ree.Login(ctx, c, 7); err != nil { // the meter's access key
log.Fatal(err)
}
day := time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC)
periods, err := c.ReadTotals(ctx, ree.RecordLoadProfile, iec102.Read{
T: iec102.C_CI_NU_2, First: ree.AddrActiveImport, Last: ree.AddrActiveImport,
From: iec102.TimeAOf(day.Add(time.Hour), nil), To: iec102.TimeAOf(day.Add(24*time.Hour), nil),
})
if err != nil {
log.Fatal(err)
}
for _, period := range periods {
fmt.Printf("%v %d kWh\n", period.Time, period.Totals[0].Value)
}
if err := ree.Logout(ctx, c); err != nil {
log.Fatal(err)
}
}

What go-iec60870-5 and iec102ctl support

Roles Controlling station (client) and integrated total station (server) with a store of records
Reads Every read command for integrated totals (C_CI_NA_2 to C_CI_NU_2): absolute or incremental, operational or accounting, by time window, period or oldest record; single-point events; product information; the meter clock
REE profile Sessions with an access key, clock setting, tariff information (current and stored), contracted powers and special days, in the opt-in package iec102/ree
Data Time a and time b with summer time, quality bits, refusals with their cause (no record, no period, unknown address)
CLI info, time, totals, events, a raw request, the REE commands, and a simulated meter from YAML
Not yet Spontaneous or class 1 data, signature checks, one client polling several meters on a shared line
Dependencies Go standard library only

Interoperability

IEC 102 is the thinnest corner of the family. There is no open, licensed implementation of a meter (the controlled station), and every open controlling station implements the REE profile. iec60870-5-interop runs the one usable stack, gisce/iec870ree, an REE controlling station in Python, and go-iec60870-5’s meter passes its checks. The go-iec60870-5 client has no independent peer, so it is tested against its own server and recorded meter traffic only. That is a fact about the open ecosystem, and why a simulated meter in iec102ctl is useful to anyone building a metering front end.

OT Fabric projects for IEC 60870-5-102

go-iec60870-5

The IEC 60870-5 telecontrol family in one module: IEC 101 on serial lines, IEC 102 for meter readings, IEC 103 for protection relays and IEC 104 over TCP/IP, each as controlling and controlled station, on shared FT 1.2, link-layer and time-tag packages. IEC 104 keeps TLS, IEC 62351-5, file transfer and redundancy groups. Pure Go, standard library only.

go get github.com/otfabric/go-iec60870-5
  • IEC 101
  • IEC 102
  • IEC 103
  • IEC 104
GitHub

iec102ctl

Read electricity meters and data concentrators over IEC 102: product information, the clock, integrated totals by period window, events, and the requests of the Spanish REE profile, or simulate a meter for a metering front end. Part of iec60870ctl.

iec60870-5-interop

Independent IEC 60870-5 implementations in containers behind one contract, per companion standard: IEC 101 (lib60870-C, cB-Sigma, digitalpetri), IEC 102 (gisce/iec870ree, REE profile), IEC 103 (vitusdong, ARIEC103, Open103, go-iecp5 cs103) and IEC 104 (lib60870-C, OpenMUC j60870, wendy512, cB-Sigma, part5). OT Fabric's own go-iec60870-5 stack is published behind the same contract, one image per standard, for testing your stack against.

  • IEC 101
  • IEC 102
  • IEC 103
  • IEC 104
GitHub

Who is behind IEC 60870-5-102

The organizations that publish, test, certify or host open-source work for IEC 60870-5-102. Listed for reference, not as partners. Compare membership and fees.