Pure Elixir implementation of the IEC 61850 protocol stack.
This top-level module provides ergonomic entrypoints for the most common client,
server, control, and model-parsing workflows while delegating to the full
layered protocol stack under ExIEC61850.*.
Quick Start
# Start an IED server from an SCL (.icd/.cid/.scd) or .cfg file, or an %IedModel{}
{:ok, server} = ExIEC61850.start_server("tools/model_generator/sample_model.icd", port: 10102)
# Connect a client (with optional :tls, :password, :name, :closed_handler)
{:ok, conn} = ExIEC61850.connect("127.0.0.1", 10102)
{:ok, lds} = ExIEC61850.logical_devices(conn)
{:ok, val} = ExIEC61850.read(conn, "simpleIOGenericIO/GGIO1.AnIn1.mag.f", :mx)
:ok = ExIEC61850.disconnect(conn)
:ok = ExIEC61850.stop_server(server)
Summary
Functions
Creates and connects an IEC 61850 client to host:port.
Closes an active client connection.
Lists Logical Devices exposed by the connected IED server.
Executes a direct or SBOw Operate command on a controllable DataObject (e.g. LD/XCBR1.Pos).
Parses a .cfg model file into an %IedModel{}.
Parses an SCL (.icd/.cid/.scd) file into an %IedModel{}.
Reads an IEC 61850 object/attribute reference with the given Functional Constraint.
Creates an %IedServerConfig{} struct.
Starts a supervisor-friendly auto-reconnecting client worker (ReconnectWorker).
Starts an IEC 61850 server from an %IedModel{} or an SCL (.icd/.cid/.scd) / .cfg file path.
Stops a running IEC 61850 server.
Updates a server attribute value using a native Elixir value or %MmsValue{}.
Returns the current ExIEC61850 package version string.
Writes a native Elixir value or %MmsValue{} to an IEC 61850 attribute reference.
Functions
@spec connect(String.t(), :inet.port_number(), keyword()) :: {:ok, pid()} | {:error, term()}
Creates and connects an IEC 61850 client to host:port.
Options
:tls- Erlang:sslclient options list (enables TLS):password- ACSE password string for authentication:name- OptionalGenServerprocess registration name:closed_handler-fn reason -> ... endinvoked on passive disconnect
@spec disconnect(GenServer.server()) :: :ok
Closes an active client connection.
@spec logical_devices(GenServer.server()) :: {:ok, [String.t()]} | {:error, term()}
Lists Logical Devices exposed by the connected IED server.
@spec operate(GenServer.server(), String.t(), term()) :: :ok | {:error, term()}
Executes a direct or SBOw Operate command on a controllable DataObject (e.g. LD/XCBR1.Pos).
@spec parse_cfg(Path.t()) :: {:ok, ExIEC61850.IEC61850.Server.Model.IedModel.t()} | {:error, term()}
Parses a .cfg model file into an %IedModel{}.
@spec parse_scl(Path.t()) :: {:ok, ExIEC61850.IEC61850.Server.Model.IedModel.t()} | {:error, term()}
Parses an SCL (.icd/.cid/.scd) file into an %IedModel{}.
@spec read(GenServer.server(), String.t(), atom()) :: {:ok, ExIEC61850.Mms.IsoMms.Common.MmsValue.t()} | {:error, term()}
Reads an IEC 61850 object/attribute reference with the given Functional Constraint.
@spec server_config(keyword()) :: ExIEC61850.IEC61850.Server.Impl.IedServerConfig.t()
Creates an %IedServerConfig{} struct.
@spec start_reconnect_client(keyword()) :: GenServer.on_start()
Starts a supervisor-friendly auto-reconnecting client worker (ReconnectWorker).
@spec start_server( ExIEC61850.IEC61850.Server.Model.IedModel.t() | Path.t(), keyword() ) :: {:ok, pid()} | {:error, term()}
Starts an IEC 61850 server from an %IedModel{} or an SCL (.icd/.cid/.scd) / .cfg file path.
Options
:port- TCP/TLS listening port (default102):config- Optional%IedServerConfig{}struct:tls/:tls_options- Erlang:sslserver options list:authenticator-fn password -> boolean() endor{mod, fun, args}:file_root- Root directory for MMS file service:name- OptionalGenServerprocess registration name
@spec stop_server(GenServer.server()) :: :ok
Stops a running IEC 61850 server.
@spec update_value(GenServer.server(), String.t(), term()) :: :ok
Updates a server attribute value using a native Elixir value or %MmsValue{}.
@spec version() :: String.t()
Returns the current ExIEC61850 package version string.
@spec write(GenServer.server(), String.t(), atom(), term()) :: :ok | {:error, term()}
Writes a native Elixir value or %MmsValue{} to an IEC 61850 attribute reference.