iec61850ctl
iec61850ctl is a command-line tool for IEC 61850. It is built on go-iec61850 and go-mms and ships as a static Go binary with no CGO and no libiec61850 at runtime. Over MMS it browses and reads IEDs, subscribes to reports, operates controls, writes scalar settings, transfers files and reads journals. On the station bus it sniffs, subscribes to and publishes GOOSE and Sampled Values, and reads and writes their control blocks. It also parses SCL offline, runs a local MMS server from SCL, and can expose a small read-only HTTP/JSON API.
This page follows v0.13.2, built on go-iec61850 v1.19.4 and go-mms v1.9.2.
Install
Section titled “Install”curl -fsSL https://get.otfabric.io/iec61850ctl | shirm https://get.otfabric.io/iec61850ctl.ps1 | iexcurl -fsSL https://get.otfabric.io/iec61850ctl | env OTF_UNMANAGED_INSTALL=/usr/local/bin shgo install github.com/otfabric/iec61850ctl@latestBinaries for Linux (x86-64, ARM64, ARMv7), macOS (Intel, Apple silicon) and Windows (x86-64, ARM64). The installer checks the release's SHA-256 checksum, installs per user without sudo (~/.local/bin, on Windows %LOCALAPPDATA%\OTFabric\bin) and upgrades in place when you run it again. Pin a version with OTF_VERSION; the CI line installs into a fixed directory without touching PATH or shell profiles. All installer options, release archives for offline machines. Check the install with iec61850ctl version.
Connecting
Section titled “Connecting”Most client commands need --host. Host, port and IED name can also come from the environment; flags win.
| Flag | Environment | Default | Meaning |
|---|---|---|---|
--host |
IEC61850_HOST |
none (required) | IED address |
--port |
IEC61850_PORT |
102 |
MMS port |
--ied-name |
IEC61850_IED_NAME |
empty | IED name used as the MMS domain prefix; also selects the IED for server start |
--connect-timeout |
10s |
Bound on each connect attempt: TCP, COTP and MMS association | |
--timeout |
10s |
Bound on each MMS request | |
--retry |
0 |
Connect retries with exponential backoff and jitter | |
--retry-max-delay |
5s |
Cap on the delay between connect retries | |
--log-level |
warn |
Structured logs on stderr: debug, info, warn, error, off |
|
--log-format |
text |
text or json |
|
--debug |
off | Shorthand for --log-level debug |
|
--local-tsel, --remote-tsel |
0001 |
Calling and called COTP T-selector, hex, at most 4 octets | |
--ssel, --psel |
0001, 00000001 |
Called session and presentation selector, hex | |
--ap-title, --ae-qualifier |
1.1.1.999.1, 12 |
Called ACSE AP-title and AE-qualifier | |
--tpdu-size |
1024 |
Proposed COTP TPDU size, 128 to 65531 |
The ISO addressing defaults match libiec61850 (since v0.8.0) and suit most IEDs without any flag. An IED that refuses the connection with COTP address unknown (reason 3) needs the values from its SCL ConnectedAP (OSI-TSEL, OSI-SSEL, OSI-PSEL, OSI-AP-Title, OSI-AE-Qualifier), for example --remote-tsel 00000001 --ap-title 1,3,9999,23 --ae-qualifier 23. Selectors take an even number of hex digits; an empty value (--remote-tsel=) omits the parameter, and an invalid one exits 2.
Retries apply only to establishing the connection. Invalid input, authentication failures and interrupts are never retried, and logs never go to stdout.
Set --ied-name when the server names its domains <IED><LD>, as IEC 61850-8-1 requires and libiec61850, IEC61850bean and iec61850ctl server start do, so LD names appear bare. Against server start from v0.9.0 that is --ied-name InteropIED for the interop fixtures, whose domain is InteropIEDInteropLD; before v0.9.0 the self-server used bare LD instance names (InteropLD), and its --instance-domain-names flag brings them back.
Each command opens one association, writes Connecting to host:port to stderr, and on exit closes with a bounded Conclude (about 2 s) followed by Abort if that fails.
Command tree
Section titled “Command tree”iec61850ctl├── discover / scan Scan a subnet or IP range for MMS (port 102) responders├── list lds | lns | dos | das | dss | reports | journals | files├── get object | ds | report | journal | file├── tree Full or scoped model tree (--flatten / --serialize)├── find path | bulk├── subscribe report Subscribe to a URCB or BRCB├── control inspect | operate├── set object Write a scalar attribute (rejects FC=CO)├── scl parse | convert├── server start | generate-config├── goose list | sniff | subscribe | publish | gocb get|set├── sv list | sniff | subscribe | publish | svcb get|set├── http Read-only REST API for one device├── version└── completion bash | zsh | fish | powershellDiscover and browse
Section titled “Discover and browse”# Find MMS responders; --host is a CIDR or range hereiec61850ctl discover --host 192.0.2.0/24
export IEC61850_HOST=192.0.2.10iec61850ctl list lds --detailed --format tableiec61850ctl list lns --ld MNSREF615LD0 --detailediec61850ctl list dos --ld MNSREF615LD0 --ln FMMXU1iec61850ctl list das --ld MNSREF615LD0 --ln FMMXU1 --do Hz --detailed
# Walk part of the model as flat pathsiec61850ctl tree --flatten --path MNSREF615LD0/FMMXU1
# Find paths: --ln is a regex, --path an exact DO or DO.DAiec61850ctl find path --ln MMXU --path A.phsA --include-das --detaileddiscover --resolve-mac reads the ARP cache and needs root.
iec61850ctl get object --object MNSREF615LD0/FMMXU1.Hz.mag.f --fc MX --detailediec61850ctl get ds --ld MNSREF615LD0 --ln LLN0 --name MeasFlt --detailedget object takes the reference without the FC and the FC separately in --fc (default MX). Use ST for status, CF for configuration, DC for descriptions.
Reports
Section titled “Reports”-
List the report control blocks. Instance names on the device can differ from the SCL (
urcb01versusurcb0101), so always discover first.Terminal window iec61850ctl list reports --ld MNSREF615LD0 --ln LLN0iec61850ctl get report --ld MNSREF615LD0 --ln LLN0 --report rcbMeasFlt01 -
Subscribe.
--type BRfor buffered,--type RPfor unbuffered.--interrogationtriggers a general interrogation after enable;--syncreads the dataset once as a baseline.Terminal window iec61850ctl subscribe report \--ld MNSREF615LD0 --ln LLN0 --report rcbMeasFlt01 --type BR \--show-values --interrogation --sync --duration 30s -
For a BRCB, purge the buffer or resume from an EntryID (hex). These are written before
RptEna.Terminal window iec61850ctl subscribe report \--ld MNSREF615LD0 --ln LLN0 --report rcbMeasFlt01 --type BR \--purge-buf --interrogation --max-reports 1 --format jsonl --yes--purge-bufempties the device’s buffer, so it needs--yessince v0.10.0.
subscribe report registers its handler before it enables the RCB, so the buffered entries a BRCB sends right after RptEna are not lost. --purge-buf, --entry-id and --resv-tms are only valid with --type BR. The subscription disables the RCB cleanly on exit (Ctrl+C, --duration or --max-reports). --keepalive (default 5s, 0 disables) re-reads the RCB periodically, so a dropped association ends the subscription with exit code 4 instead of waiting silently.
Control and scalar writes
Section titled “Control and scalar writes”# Read ctlModel and whether a select is needediec61850ctl control inspect --object InteropLD/GGIO1.SPCSO2 --format json
# Select (if required) and operate on one association, then confirmiec61850ctl control operate \ --object InteropLD/GGIO1.SPCSO2 \ --value true --type bool --mode auto \ --confirm-ref 'InteropLD/GGIO1.SPCSO2.stVal[ST]' \ --format json --yes
# Scalar setting write with read-back verificationiec61850ctl set object \ --object InteropLD/GGIO1.SetInt1.setVal --fc SP \ --value 5 --type int --verify --format json --yesThe safety model:
- Controls only through
control.set objectrejects--fc CObefore it dials. Usecontrol operatefor controllable objects. - Atomic journeys.
control operatereadsctlModeland runs select and operate on one association.--modeisauto(recommended),direct,sboorsbow; a mode that does not match the device fails. A selection cannot survive between CLI processes, and there is no standalonecontrol select. - Explicit types.
--typeis required (bool,int,uint,float,enum,string). Values are never inferred. - Confirmation is opt-in. Only
--confirm-reftriggers a read-back.--verifydoes the same forset object. - Cleanup is not rollback. If select succeeds but operate does not complete, the tool sends a best-effort Cancel. It does not undo an operate.
- HTTP is read-only.
iec61850ctl httpserves browse, read and find only.
There is no documented dry-run flag.
control operate --format json reports a status: planned, operated, confirmed, operated-unconfirmed, confirmation-mismatch or failed. The last three exit non-zero. With --test or --no-confirm the status is operated.
Files and journals
Section titled “Files and journals”iec61850ctl list files --detailediec61850ctl get file --name conf.xml.gz --output ./conf.xml.gz --detailed
iec61850ctl list journals --ld MNSREF615LD0iec61850ctl get journal --domain MNSREF615LD0 --journal LLN0\$EventLog \ --from 2024-10-30T12:00:00Z --to 2024-10-30T13:00:00Z--from and --to accept RFC 3339, space-separated UTC or Unix milliseconds. Omit --to to read everything after --from.
GOOSE runs on raw Ethernet, so these commands take an interface instead of a host. On Linux grant the capability once instead of running as root; on macOS and the BSDs you need access to /dev/bpf*. Windows exits with code 8.
sudo setcap cap_net_raw+ep "$(command -v iec61850ctl)"
# The GOOSE control blocks of an SCL file, with address and dataset (no network)iec61850ctl goose list --scl station.scd
# Decode every GOOSE frame on the wire, optionally filterediec61850ctl goose sniff --iface eth0 --appid 0x1001 --count 10 --format jsonl
# A supervised subscription to one GoCB, validated against SCLiec61850ctl goose subscribe --iface eth0 --scl station.scd --gocb IED1/LD0/gcb1 --duration 30s
# Read or disable a GoCB on an IED over MMSiec61850ctl goose gocb get --host 192.0.2.10 --ld LD0 --gocb gcb1iec61850ctl goose gocb set --host 192.0.2.10 --ld LD0 --gocb gcb1 --disable --yesgoose subscribe checks confRev, datSet, goID and the member types, and supervises the stream the way an LGOS node does: timeouts, stNum and sqNum gaps, duplicates and restarts, with a summary per stream at the end. With --count it exits 5 if the count is not reached within --duration. --gocb takes the GSEControl name, LD/name, IED/LD/name or the gocbRef. Publishers whose MMS domain is the bare LD instance, such as go-iec61850 servers and iec61850ctl server start, need --bare-domain.
Sampled Values
Section titled “Sampled Values”# The SV control blocks of an SCL file: address, svID, rate, noASDU, profile and sample layoutiec61850ctl sv list --scl merging-unit.cid
# Decode SV ASDUs, with the 9-2LE layout, one sample per secondiec61850ctl sv sniff --iface eth0 --appid 0x4000 --layout 9-2LE --sample-every 4000
# A supervised subscription with live statisticsiec61850ctl sv subscribe --iface eth0 --scl merging-unit.cid --svcb MSVCB01 \ --sample-every 4000 --duration 30s
# Read or disable an MSVCB over MMSiec61850ctl sv svcb get --host 192.0.2.10 --ld LD0 --svcb MSVCB01iec61850ctl sv svcb set --host 192.0.2.10 --ld LD0 --svcb MSVCB01 --disable --yessv subscribe validates confRev, datSet, smpRate, smpMod and the sample size, and supervises smpCnt per stream. Every --stats-interval it prints the rate, ASDUs, lost, duplicate and out-of-order samples, timeouts, the smpCnt wrap, smpSynch and confRev. --sample-every prints every Nth sample, with 9-2LE channels in amperes and volts.
Publishing on the station bus
Section titled “Publishing on the station bus”# Three GOOSE state changes, one second apart, as test framesiec61850ctl goose publish --iface eth0 --scl device.cid --gocb gcb1 \ --value 0=true --changes 3 --interval 1s --yes
# Ten seconds of a 9-2LE stream with three-phase sine currents, as simulation framesiec61850ctl sv publish --iface eth0 --scl merging-unit.cid --svcb MSVCB01 --yes --duration 10s \ --waveform IA=100 --waveform IB=100,50,-120 --waveform IC=100,50,120 --waveform VA=325The guard rails are the same for both: an explicit --iface and --yes, and every frame carries the GOOSE test flag or the SV simulation bit unless you combine --test=false or --simulation=false with --live. A refused publish exits 2. sv publish sets sample values by index, member reference or 9-2LE channel (IA to VN, with qualities qIA to qVN), and --waveform CHANNEL=PEAK[,HZ[,PHASE]] injects a sine computed from the sample index, so it stays exact under scheduling jitter. The summary reports samples, frames, late and skipped samples and send errors.
gocb set and svcb set write the enable attribute last, and with --enable or --disable they read it back. Since v0.10.0 they need --yes, and a publish refused by a guard rail exits 13 (it was 2); a missing --iface is still a usage error, 2. Nothing is sent in either case.
SCL offline
Section titled “SCL offline”iec61850ctl scl parse --input device.cid --flattenscl parse and scl convert (SCL to CSV) need no device. go-iec61850 also ships a separate SCL tool, sclparse, with summary, validate, detect, inspect, dump-json and list-* subcommands. It installs like iec61850ctl, with curl -fsSL https://get.otfabric.io/sclparse | sh (Windows: irm https://get.otfabric.io/sclparse.ps1 | iex); its version is the go-iec61850 version. go-iec61850 also ships sclgen, which generates Go types from SCL schema bundles, at https://get.otfabric.io/sclgen.
sclparse summary station.scdsclparse validate --strict station.scdsclparse list-reports --json station.scdSince go-iec61850 v1.8.0 sclparse exits with the organisation’s codes: 0 success, 1 when validate finds errors, 2 usage error, 3 when the SCL file cannot be read or parsed, 10 when the output cannot be written, 130 when interrupted. Before, usage errors were 1, parse failures 2 and validation errors 3. The binaries of v1.8.1 carry the scl changes of v1.5.0 to v1.8.0; v1.8.0 and older ones were built on v1.4.5.
Server mode
Section titled “Server mode”server start runs a pure-Go MMS server from an ICD, CID or SCD file. It is the safest target for trying controls and reports.
# First IED in the file, or pick one with --ied-nameiec61850ctl server start --scl device.cid --host 0.0.0.0 --port 102
# Seed values captured from a live deviceiec61850ctl tree --host 192.0.2.10 --serialize --include all --output device.jsoniec61850ctl server start --scl device.cid --values device.json --port 102| Flag | Meaning |
|---|---|
--scl |
SCL file (required) |
--ied-name |
IED in the SCL (default: first) |
--values |
Serialized JSON from tree --serialize to seed leaf values |
--host / --port |
Bind address (default 0.0.0.0:102) |
--ready-json |
Print one readiness JSON line on stdout after bind |
--fixture-id |
Fixture revision included in the readiness line |
--files-dir |
Serve a directory read-only through the MMS file services |
--allow-readonly-fc-writes |
Accept client writes to status and measured values (FC ST, MX, SG, SR, OR, EX), for simulators and test fixtures only. Off by default since v0.7.0: IEC 61850-7-2 makes them read-only, and such a write is answered object-access-denied |
--max-connections |
Reserved; not enforced |
The server follows the SCL as IEC 61850-6 describes it. A ReportControl is indexed unless it says indexed="false", so <ReportControl name="urcb"> is served as urcb01 (and one already named urcb01 as urcb0101). Journals are named after their Log (LLN0$EventLog). Reports leave as soon as a trigger fires, and an RCB’s BufTm holds a report for that time to collect further changes. Operate t and LActTm carry the TimeQuality “clock not synchronised”, as the client’s control T does, because the host clock’s synchronisation is unknown.
Binding port 102 may need elevated privileges; use --port 1102 for testing, or --port 0 for an ephemeral port that the readiness line reports. Every server registers handlers for InteropLD/GGIO1.SPCSO1 (direct), SPCSO2 (SBO) and SPCSO3 (SBOw), which update the matching stVal; for other models they are inert. server generate-config exports a libiec61850 .cfg from serialized JSON for external C tooling; iec61850ctl does not run .cfg files.
Output and exit codes
Section titled “Output and exit codes”| Commands | --format |
|---|---|
list lds, list lns, list dos, list das |
text, json, csv, table, yaml |
list dss, list reports, get object, get ds, get report |
text, json |
control inspect, control operate, set object |
text, json |
subscribe report, goose sniff, goose subscribe, goose publish |
text, jsonl |
sv sniff, sv subscribe, sv publish |
text, jsonl |
goose list, goose gocb get, goose gocb set, sv list, sv svcb get, sv svcb set |
text, json |
Results go to stdout; connection status, warnings and diagnostics go to stderr. Every JSON command prints exactly one document. An unknown format exits non-zero.
{"object":"InteropLD/MMXU1.TotW.mag.f","fc":"MX","type":"float","value":1234.5}subscribe report --format jsonl emits baseline, report and a final summary event, one per line. Report events carry rpt_id, sequence_number, hex entry_id for BRCBs, values (with --show-values) and reasons (gi, dchg, qchg, dupd, integrity).
Booleans, integers, floats and strings have a stable JSON encoding. Timestamps, bit strings, octet strings, arrays and structures do not yet; do not script against their current form.
Exit codes are stable, so scripts can tell failures apart:
| Code | Meaning |
|---|---|
0 |
Success |
2 |
Usage error: invalid flag, argument or value, a missing --iface, or a command that changes device state (control operate, set object, gocb set, svcb set, subscribe report --purge-buf) without --yes |
3 |
Invalid reference, configuration or SCL |
4 |
Connection failed or lost, including a dropped report subscription |
5 |
Timeout (connect or request), or --count not reached before --duration |
6 |
Rejected by the server, including failed select or operate, an MMS access-denied result and a refused GoCB or MSVCB write |
8 |
Service not supported by the server or platform, such as raw Ethernet on Windows |
9 |
Permission: authentication failed, a service the server refuses as not permitted, or a raw-socket permission error |
10 |
Failure (unclassified) |
11 |
Not found: object, file, dataset, IED, RCB, journal, control block, network interface, including an MMS object-non-existent answer |
12 |
Write verification (--verify), control confirmation (--confirm-ref) or control block enable read-back mismatch |
13 |
Refused for safety: goose publish or sv publish without --yes, or with the test marker off (--test=false, --simulation=false) without --live (since v0.10.0; it was 2) |
130 |
Interrupted (SIGINT or SIGTERM) |
The codes follow the OT Fabric CLI exit-code table since v0.5.0. IEC61850CTL_FORMAT (or IEC61850CTL_OUTPUT_FORMAT) sets the default of --format on the commands that have it.
With --format json, control operate and set object still print their JSON document when they fail after reaching execution, and the exit code follows status or write_ok. The full machine contract per command is in docs/AUTOMATION.md.
Not supported: standalone or cross-process select, time-activated controls, complex (structured) MMS writes, writes or controls over HTTP, R-GOOSE and R-SV, and GOOSE or SV on Windows. The HTTP API has no authentication or TLS; bind it to loopback or put a reverse proxy in front.