# IEC 61850

> Connect IEC 61850 substation IEDs over MMS - object references, the functional-constraint suffix and the supported MMS value types.

**The IEC 61850 driver is not part of the current Ganter Lab download**, so a
station installed from that download cannot connect to an IED yet.

The **IEC 61850** driver talks to substation IEDs — protection relays, merging
units, bay controllers — over MMS, the client/server half of IEC 61850. You
address values by their object reference in the device's data model: logical
device, logical node, data object, data attribute. Add a device under the
IEC 61850 driver in the [Connector](connector); the panel shows only the
fields this protocol uses.

## Connection {#connection}

| Field | Meaning | Default |
| --- | --- | --- |
| **Host** | IP address or host name of the IED. | empty |
| **Port** | TCP port of the MMS connection. 0 uses 102, the ISO-on-TCP standard. | 0 |

The device header shows the assembled endpoint, for example
`iec61850://192.168.0.40:102`. There are no poll-interval fields for this
driver: its tags are read once per second.

## Addressing {#addressing}

An IEC 61850 tag is addressed by its MMS path in the tag's Source card:

| Field | Meaning | Accepted values | Default |
| --- | --- | --- | --- |
| **MMS path** | The object reference, optionally followed by a functional-constraint suffix in brackets. Required. | free text | empty |
| **Read length (bytes, blank = auto)** | Completes the tag's stored address form only; reads are typed MMS reads and ignore it. | 1 and up, blank | blank |

The object reference is the full path through the data model,
`LogicalDevice/LogicalNode.DataObject.DataAttribute`:

| MMS path | Reads |
| --- | --- |
| `LD0/MMXU1.TotW.mag.f` | total active power magnitude (a measurand, default `[MX]`) |
| `LD0/MMXU1.A.phsA.cVal.mag.f` | phase A current magnitude |
| `LD0/GGIO1.SPCSO1.stVal[ST]` | a single-point status value |
| `LD0/LLN0.Mod.stVal[ST]` | the logical device's mode |

The suffix names the **functional constraint** of the data attribute — the
same FC column the IED's ICD/SCL file shows. It is exactly two uppercase
letters in square brackets at the end of the path. Without a suffix, `MX`
(measurands) is assumed, which suits analog measurements; status values need
`[ST]`, setpoints `[SP]`, configuration values `[CF]`. Accepted tokens:

| FC | Meaning | FC | Meaning |
| --- | --- | --- | --- |
| `ST` | status information | `EX` | extended definition |
| `MX` | measurands (analog) | `CO` | control |
| `SP` | setpoint | `US` | unicast sampled values |
| `SV` | substitution | `MS` | multicast sampled values |
| `CF` | configuration | `RP` | unbuffered report |
| `DC` | description | `BR` | buffered report |
| `SG` | setting group | `LG` | log control blocks |
| `SE` | setting group editable | `SR` | service response / tracking |
| `OR` | operate received | `BL` | blocking |

A path whose FC does not match the attribute's actual constraint fails the
read, so when a value stays bad, compare the suffix against the SCL file
before doubting the path. The Source card's read-only **Source address
(wire)** line shows the assembled address as you edit.

## Data types {#data-types}

The **Data type** picker offers the four primitive MMS values the driver
marshals, each read with a typed MMS read:

| Data type | MMS value | Notes |
| --- | --- | --- |
| Float | floating point | the usual choice for `mag.f` measurands |
| Boolean | boolean | single-point status like `stVal` of an SPS |
| Int32 | integer | narrowed from the MMS integer; a value beyond 32 bits fails the read |
| String | visible string | names, vendor strings, `dU` descriptions |

Composite values are not readable as one tag: a whole data object, a quality
bit string or a timestamp does not fit the four primitives above. Address the
primitive leaf attribute you need, like the `mag.f` or `stVal` leaf itself.

## Writes {#writes}

Tags whose **Access** is Read and write or Write only can be written. A write
sends the typed MMS value to the same object reference and functional
constraint — suitable for setpoints (`[SP]`) and other writable attributes.
Writes are plain MMS writes: the driver does not run the IEC 61850 control
model, so commands to `Oper`/`SBO` controls of CO attributes are not what
this is for. A new tag starts as Read only.

## Discovery {#discovery}

IEC 61850 self-description is not wired to a scan in this driver, so the
Connector shows no Discover button. Take the object references from the IED's
SCL/ICD file and add the device and its tags by hand.

## Good to know {#good-to-know}

- Values are polled over MMS once per second; buffered and unbuffered
  reporting (RCBs), GOOSE and sampled values are not used.
- The MMS connection is unencrypted ISO-on-TCP; TLS is not part of this
  driver's build.
- An unreachable IED costs nothing at startup: the device keeps retrying in
  the background and its tags read as bad quality until the connection lands.
