iec61850

package module
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2026 License: GPL-3.0 Imports: 0 Imported by: 0

README

go-iec61850

A pure-Go implementation of the IEC 61850 protocol family:

  • MMS client and server (IEC 61850-8-1 over TPKT/COTP/Session/Presentation/ACSE)
  • GOOSE publisher and subscriber (raw Ethernet, Linux AF_PACKET)
  • Sampled Values (IEC 61850-9-2 / 9-2LE) publisher and subscriber
  • SCL (ICD/CID/SCD) parsing and runtime model instantiation

No cgo. GPLv3 licensed.

Quick start

Run the example server and explore it with the TUI client:

go run ./cmd/ied-server -scl testdata/simpleIO_direct_control.cid -addr :10102
go run ./cmd/iedx 127.0.0.1:10102        # or run with no address for a connect form

iedx is a full mouse-driven terminal client: a Browse tab (model tree, live read, type-aware write, auto-refresh, filter), plus Reports, Datasets, Controls, Setting Groups, Files and Logs tabs. Click tabs and rows, scroll with the wheel, ? for keys.

ied-server simulates live data (measurand drift, toggling status points with quality and timestamps) so configured reports fire, accepts controls, and can serve files with -files DIR. ied-client test exercises every feature the server exposes and prints a PASS/FAIL/SKIP report:

go run ./cmd/ied-server -scl testdata/simpleIO_direct_control.cid -addr :10102 -files /tmp/comtrade
go run ./cmd/ied-client -addr 127.0.0.1:10102 test

Read a value programmatically:

c, err := client.Dial(ctx, "192.168.10.5:102")
if err != nil { ... }
defer c.Close()

v, err := c.Read(ctx, "simpleIOGenericIO/GGIO1.AnIn1.mag.f", model.MX)

Documentation

  • docs/api.md — full API reference with examples for every package
  • docs/developer-guide.md — architecture and how to extend the stack
  • SKILL.md — task-oriented guide for building apps (agent-friendly)
  • examples/ — runnable programs: read, server, report-monitor, goose-subscribe, control
  • godoc: go doc github.com/dscsystems/go-iec61850/client (etc.)

Packages

Package Purpose
client High-level ACSI client (browse, read/write, datasets, reports, controls, files)
server High-level ACSI server driven by an SCL or programmatic model
goose, sv GOOSE and Sampled Values publish/subscribe over ethernet
scl SCL file parsing and model building
model IEC 61850 object model, functional constraints, Quality/Timestamp types
mms Low-level MMS (ISO 9506) values, codecs and client connection
asn1 Minimal BER runtime used by all codecs

Interop

Verified in both directions against libiec61850 1.6:

  • our client drives the C server_example_basic_io: browse, read, write, model retrieval, datasets, reporting (GI), control
  • the C client_example1 and control example drive our server: association, read/write, datasets, reporting (data-change and integrity reports), and control (direct-normal and direct-enhanced)

Run it with bash interop/run.sh (see interop/).

The interop tests are guarded by environment variables so CI without a C toolchain stays green:

# our client against a running C server on :10102
IEC61850_TEST_SERVER=127.0.0.1:10102 go test ./client/ ./mms/
# the C client against our in-process server
IEC61850_C_CLIENT=/path/to/client_example1 go test ./server/ -run CClient

Status

Initial-release; the API may change until v1. All packages build without cgo and cross-compile to Linux, Windows and macOS. GOOSE and SV raw-socket transport is Linux-only (AF_PACKET); other platforms need a capture backend.

Implemented: MMS client/server, browse/read/write, datasets, reporting (URCB and buffered BRCB with EntryID resync, GI/integrity/data-change), control (all four models: direct/SBO, normal/enhanced), setting groups (SGCB), file services (directory and streamed read), log queries (readJournal by time and after-entry), GOOSE and SV pub/sub, SCL parsing, TLS transport.

Documentation

Overview

Package iec61850 provides a pure-Go implementation of the IEC 61850 protocol family: MMS client/server (IEC 61850-8-1), GOOSE and Sampled Values publish/subscribe, and SCL configuration handling.

Most applications use the high-level subpackages:

  • client: ACSI client for talking to IEDs (browse, read, write, datasets, reporting, controls, file transfer)
  • server: ACSI server for building IEDs, simulators and gateways
  • goose, sv: layer-2 publish/subscribe
  • scl: SCL (ICD/CID/SCD) parsing and model instantiation
  • model: the IEC 61850 object model and common data types

The lower layers (mms, asn1, internal/osi) are exported where useful for tooling but are not needed for typical use.

Directories

Path Synopsis
Package asn1 implements the minimal BER (ISO 8825-1) runtime used by the MMS, ACSE, presentation, GOOSE and SV codecs in this module.
Package asn1 implements the minimal BER (ISO 8825-1) runtime used by the MMS, ACSE, presentation, GOOSE and SV codecs in this module.
Package client is the high-level IEC 61850 ACSI client.
Package client is the high-level IEC 61850 ACSI client.
cmd
goose-sniff command
Command goose-sniff is a passive GOOSE and Sampled Values monitor.
Command goose-sniff is a passive GOOSE and Sampled Values monitor.
ied-client command
Command ied-client is a small command-line IEC 61850 MMS client demonstrating the client package: browse, read, write and dataset access against a live IED.
Command ied-client is a small command-line IEC 61850 MMS client demonstrating the client package: browse, read, write and dataset access against a live IED.
ied-server command
Command ied-server is an example IEC 61850 server.
Command ied-server is an example IEC 61850 server.
iedx command
Command iedx is a full-featured terminal IEC 61850 client: browse the model, read and write data, monitor reports, operate controls, manage setting groups, transfer files and query logs — with mouse support.
Command iedx is a full-featured terminal IEC 61850 client: browse the model, read and write data, monitor reports, operate controls, manage setting groups, transfer files and query logs — with mouse support.
Package ethernet provides the raw layer-2 access used by the GOOSE and Sampled Values transports: an Interface abstraction over a network device, plus pure frame marshalling helpers that are testable without a socket.
Package ethernet provides the raw layer-2 access used by the GOOSE and Sampled Values transports: an Interface abstraction over a network device, plus pure frame marshalling helpers that are testable without a socket.
examples
control command
Example: operate a controllable point.
Example: operate a controllable point.
goose-subscribe command
Example: subscribe to GOOSE on a network interface (Linux, needs CAP_NET_RAW).
Example: subscribe to GOOSE on a network interface (Linux, needs CAP_NET_RAW).
read command
Example: connect to an IED, browse it and read a value.
Example: connect to an IED, browse it and read a value.
report-monitor command
Example: enable a report control block and print incoming reports.
Example: enable a report control block and print incoming reports.
server command
Example: serve a model from an SCL file and push live values.
Example: serve a model from an SCL file and push live values.
Package goose implements the IEC 61850-8-1 GOOSE mapping over raw Ethernet: the goosePdu codec, a publisher with the standard retransmission state machine, and a subscriber with anomaly detection.
Package goose implements the IEC 61850-8-1 GOOSE mapping over raw Ethernet: the goosePdu codec, a publisher with the standard retransmission state machine, and a subscriber with anomaly detection.
internal
osi/acse
Package acse implements the subset of ISO 8650 / X.227 ACSE used by MMS: the AARQ/AARE association-control APDUs that carry the MMS Initiate request/response as user information, plus the RLRQ/RLRE release APDUs.
Package acse implements the subset of ISO 8650 / X.227 ACSE used by MMS: the AARQ/AARE association-control APDUs that carry the MMS Initiate request/response as user information, plus the RLRQ/RLRE release APDUs.
osi/cotp
Package cotp implements the ISO 8073 / X.224 Connection-Oriented Transport Protocol class 0, as profiled by RFC 1006 for MMS.
Package cotp implements the ISO 8073 / X.224 Connection-Oriented Transport Protocol class 0, as profiled by RFC 1006 for MMS.
osi/presentation
Package presentation implements the subset of the ISO 8823 / X.226 connection-oriented presentation protocol used by MMS: the CP/CPA connection PDUs that negotiate the ACSE and MMS presentation contexts, and the fully-encoded-data wrapping applied to every data-phase PDU.
Package presentation implements the subset of the ISO 8823 / X.226 connection-oriented presentation protocol used by MMS: the CP/CPA connection PDUs that negotiate the ACSE and MMS presentation contexts, and the fully-encoded-data wrapping applied to every data-phase PDU.
osi/session
Package session implements the minimal subset of the ISO 8327-1 connection-oriented session protocol used by the MMS profile: the CONNECT/ACCEPT SPDUs for association setup and the GIVE-TOKENS + DATA-TRANSFER prefix used for every data message.
Package session implements the minimal subset of the ISO 8327-1 connection-oriented session protocol used by the MMS profile: the CONNECT/ACCEPT SPDUs for association setup and the GIVE-TOKENS + DATA-TRANSFER prefix used for every data message.
osi/tpkt
Package tpkt implements RFC 1006 (ISO transport service on top of TCP), the framing layer beneath COTP for MMS over TCP port 102.
Package tpkt implements RFC 1006 (ISO transport service on top of TCP), the framing layer beneath COTP for MMS over TCP port 102.
Package mms implements the subset of MMS (ISO 9506) required by IEC 61850-8-1: the Data value model, PDU codecs and a client connection with the confirmed/unconfirmed service set used by ACSI.
Package mms implements the subset of MMS (ISO 9506) required by IEC 61850-8-1: the Data value model, PDU codecs and a client connection with the confirmed/unconfirmed service set used by ACSI.
Package model implements the IEC 61850 object model: functional constraints, object references, the LD/LN/DO/DA node tree shared by the SCL loader, the server and client-side model retrieval, and the common bit-string types from IEC 61850-7-3 (Quality, Dbpos, trigger options).
Package model implements the IEC 61850 object model: functional constraints, object references, the LD/LN/DO/DA node tree shared by the SCL loader, the server and client-side model retrieval, and the common bit-string types from IEC 61850-7-3 (Quality, Dbpos, trigger options).
Package scl parses IEC 61850-6 SCL files (ICD, CID, SCD, IID) with the standard library XML decoder and instantiates the runtime object model of the model package.
Package scl parses IEC 61850-6 SCL files (ICD, CID, SCD, IID) with the standard library XML decoder and instantiates the runtime object model of the model package.
Package server is the high-level IEC 61850 ACSI server.
Package server is the high-level IEC 61850 ACSI server.
Package sv implements the IEC 61850-9-2 Sampled Values mapping over raw Ethernet: the savPdu/ASDU codec, a generic and a 9-2LE typed subscriber, and a 9-2LE publisher with a sample clock.
Package sv implements the IEC 61850-9-2 Sampled Values mapping over raw Ethernet: the savPdu/ASDU codec, a generic and a 9-2LE typed subscriber, and a 9-2LE publisher with a sample clock.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL