Skip to main content

SELlib

Read and write the file formats an SEL protective relay project is made of — the ones AcSELerator QuickSet produces.

Nothing here talks to a relay, opens a socket, or knows what a web request is.

Renamed. This library was published as selfiles for 1.x. From 2.0.0 it is SELlib, and the import moved with it — import sellib, not import selfiles. Nothing else changed in 2.0.0; the major is the rename. The selfiles distribution has been removed from PyPI, so there is no version of it left to install: import selfiles does not resolve to anything, and a requirements file naming it will fail rather than quietly install something older.

import sellib
from sellib.rdb import process_upload
from sellib.dnp_map import parse, discover

sellib.configure(user_data_dir="~/.pacct/data", cache_dir="/var/cache/rdb")

info = process_upload(open("substation.rdb", "rb").read(), "substation.rdb")
for relay in info.relays:
    print(relay.name, relay.model, relay.ip)
module what it reads
sellib.rdb, .rdb_cache the RDB (an OLE compound database): relays, models, addresses, extracted into a content-addressed cache
sellib.settings SET_*.TXT relay settings
sellib.dnp_map SET_D<n>.TXT, the DNP3 point map
sellib.gle QuickSet logic diagrams — parse, and render a page to SVG
sellib.selogic SELOGIC equations: parse, compare by equivalence, normalise settings
sellib.models per-model registries: block conventions, and valid Relay Word names
sellib.scl what an SCL/SCD holds that is SEL's: the sAddr db: grammar, GOOSE health bits, the bit → MMS item tables. The standard half is py61850
sellib.match cross-match an RDB's relays against an SCD's IEDs
sellib.dnp_profile SEL DNP3 device profile bundles

The one contract to know about

sellib.dnp_map guarantees parse(b).serialize() == b, byte for byte, for every SET_D in the reference corpus. These bytes go back into a protection relay: a settings file that round-trips imperfectly is a relay that behaves in a way nobody asked for. The 0x1C field separator lives inside the line, before the CRLF, and is preserved literally, along with each model's own index padding (BI_1 on a 411L, BI_00 on a 751).

Writing a Compound File back out — needed whenever an edit grows a stream — is cfbwrite, a separate library.

What is not here

Reading an SCL file as an IEC 61850-6 object model — the document, the DataTypeTemplates pool, the Communication section, a per-IED tree of logical nodes, datasets, control blocks and ExtRefs — is py61850, which sellib depends on. None of that is SEL's, and a Siemens or GE file needs exactly the same reader.

What stayed here is what only SEL writes: the db: grammar inside the standard sAddr attribute, and the pubRxStatus health bit inside a <Private> block. Both are read off py61850 model nodes, so the two libraries never parse one file twice and cannot come to disagree about it.

Data

The per-model registries ship with the package. configure(user_data_dir=...) adds an overlay searched first, per model, so a host can add a relay model at runtime without shipping a new release and without repeating the rest.

Install

pip install sellib

Python 3.10+, and py61850 for the standard half of an SCL file. Extracted from PAC CT, where all of it is exercised against a real substation corpus.

Licence

AGPL-3.0-or-later — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sellib-3.0.0.tar.gz (301.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sellib-3.0.0-py3-none-any.whl (277.0 kB view details)

Uploaded Python 3

File details

Details for the file sellib-3.0.0.tar.gz.

File metadata

  • Download URL: sellib-3.0.0.tar.gz
  • Upload date:
  • Size: 301.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sellib-3.0.0.tar.gz
Algorithm Hash digest
SHA256 329a32b7283a2b0fcba7e3801f696faf31a6f816b88c21144eeeb935973a11f0
MD5 6da3d78177b3ea9c34e02035ca91ebdb
BLAKE2b-256 1c854a770ca927a79a31872bba6a342e29d976783211d5c95650e57d025825ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for sellib-3.0.0.tar.gz:

Publisher: release.yml on GuilhermeMarini/sellib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sellib-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: sellib-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 277.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sellib-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8fa87617df1e371fa185844c8f544ca88a4a7b9c99169fe54ef967fbc68bcb3
MD5 f8cd8410a924b538e835c9390e5e2204
BLAKE2b-256 bf54f79743b9127cf15f50314d86b1d92a173df44f9e3b495d437ac6c92bb985

See more details on using hashes here.

Provenance

The following attestation bundles were made for sellib-3.0.0-py3-none-any.whl:

Publisher: release.yml on GuilhermeMarini/sellib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

3.0.1

2 files

This release

3.0.0 This release

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page