Skip to main content

Crate iec61850_kit

Crate iec61850_kit 

Source
Expand description

IEC 61850 for the substation process bus and the station bus.

GOOSE and Sampled Values carry protection signals and measurements over Ethernet. The MMS client and server provide station-bus services over TCP or an application-owned stream. The server loads its data model from SCL.

§The shape of it

Every protocol core in proto is sans-IO: it owns no socket, spawns no thread and never reads a clock. It takes inputs with the caller’s notion of “now”, yields outputs, and says when it wants to be called again.

let mut sub = Subscriber::new(SubscriberConfig::new(SubscriptionKey {
    dst: MacAddr::parse("01-0C-CD-01-00-05")?,
    appid: 0x0005,
    gocb_ref: "IED1LD0/LLN0$GO$gcbTrip".into(),
}));

for event in sub.feed(now, frame) {
    match event {
        // The publisher's data changed.
        SubscriberEvent::NewState { st_num, values, .. } => { /* act on `values` */ }
        // Nothing arrived within `timeAllowedtoLive`: the inputs are no longer valid.
        SubscriberEvent::Expired => { /* fail safe */ }
        _ => {}
    }
}
sub.on_timeout(now);
let wake_at = sub.next_timeout();

The same code therefore runs under an async runtime, on a bare-metal timer, or inside a deterministic simulation with no I/O at all — and builds no_std on an allocator alone.

§Modules

ModuleWhat it holds
commonThe types every layer shares: UtcTime, Quality, ObjectReference, Fc, MacAddr, Edition, Limits, and the IEC 61850-7-2 modelling types TrgOps, OptFlds, ReasonCode, ControlModel and ServiceType
berA panic-free BER codec for the subset IEC 61850 uses
protoThe protocol cores: Ethernet framing, MMS Data, GOOSE, Sampled Values
proto::sv::SampleLayoutWhat the octets of a sampled-value ASDU mean, read out of the engineering file
proto::osiThe OSI stack under MMS: TPKT and its stream reader, COTP class 0 and TSDU reassembly, session, presentation, ACSE (feature mms)
proto::mmsThe MMS PDUs IEC 61850-8-1 uses, sharing their value codec with GOOSE (feature mms)
proto::mms::associationThe association state machine over those six layers, for both roles (feature mms)
proto::mms::reportWhat an IEC 61850 report is on the wire, and what OptFlds decides (feature mms)
proto::mms::controlOper, SBOw, Cancel, LastApplError and AddCause (feature mms)
proto::mms::fileFileName, FileAttributes and DirectoryEntry — the MMS file services (feature mms)
proto::mms::journalWhat a log entry is on the wire, and the ranges QueryLogByTime/QueryLogAfterEntry map onto (feature mms)
proto::mms::typespecTypeSpecification — what GetVariableAccessAttributes answers with (feature mms)
clientA blocking MMS client: browse, read, write, reporting, control, files, logs, setting groups (feature client)
serverA blocking MMS server: the SCL file is the namespace, with a report engine, the four control models, setting groups, service tracking, a sandboxed file store and logs (feature server)
modelThe IED model a publisher takes its addresses and data sets from
sclReading that model out of an ICD, CID or SCD, resolving what an IED subscribes to, and checking the engineering the schema does not (feature scl)
pcapClassic capture files, for replaying traffic and recording what was built (feature pcap)

§Safety and limits

#![forbid(unsafe_code)] throughout, and unwrap, expect, panic and slice indexing are denied by lint: a malformed frame becomes an Error carrying a reason and a byte offset, never a panic. Decoders enforce Limits — nesting depth, data-set members, primitive length, ASDUs per frame — before allocating, and the event queues every core hands its output through are bounded and count what they drop.

Allocation tests cover GOOSE retransmissions and steady-state Sampled Values publishing and reception. A GOOSE subscriber allocates owned values on a state change.

§Status

Minor releases can change the API before 1.0. See the verification guide for tested peers, capture results and conformance limits.

§Reading the comments

Claims about a standard in this crate’s documentation carry a tag saying how they were checked: ✅ against a freely available text (an ITU-T recommendation, an RFC, Wireshark’s ASN.1 module, a public IEC preview); 🌐 against a public source such as libiec61850 or Wireshark’s dissector; ⚠ engineering judgement, not checked against the paywalled IEC text.

Re-exports§

pub use common::Clock;
pub use common::DecodeReason;
pub use common::Edition;
pub use common::Error;
pub use common::Fc;
pub use common::Instant;
pub use common::Limits;
pub use common::MacAddr;
pub use common::ObjectReference;
pub use common::Quality;
pub use common::Result;
pub use common::TimeQuality;
pub use common::UtcTime;
pub use common::Validity;

Modules§

ber
A panic-free BER (ITU-T X.690) codec for the subset IEC 61850 uses.
clientclient
A blocking IEC 61850 client over MMS — the ten-line path.
common
Types every layer shares: time, quality, object references, MAC addresses, editions, the IEC 61850-7-2 packed option types (TrgOps, OptFlds, ReasonCode), the service tracking enumerations, errors and limits, the Clock trait the application supplies, and the EventQueue every core hands its events through.
model
The IED model descriptor: what an SCL file says about an IED, in the shape the server, the publishers and the subscribers consume.
netnet
GOOSE and Sampled Values on a live interface (feature net).
pcappcap
Reading and writing classic pcap files.
protogoose or mms or sv
Sans-IO protocol cores: codecs and state machines that own no socket, thread or clock.
sclscl
IEC 61850-6 SCL: loading a model, resolving subscriptions, checking engineering, editing.
serverserver
An IEC 61850 server: the SCL file is the model, and the model is the namespace.