Skip to content

OpenEnergyTools/iec61850-cli-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# iec61850-cli-client

A command-line IEC 61850 client for reading data values, browsing server
directories, managing report control blocks, subscribing to reports, and
issuing control commands.

## Build

```bash
cargo build --release
```

The binary is produced at `target/release/iec61850-cli-client`.

## General flags

| Flag | Default | Description |
|---|---|---|
| `--host <HOST>` | `localhost` | Server hostname or IP address |
| `-p, --port <PORT>` | `102` | MMS TCP port |
| `-r, --request <REQUEST>` | `get_data_values` | Service to execute (see below) |

Enable debug logging by setting the environment variable:
```bash
RUST_LOG=debug ./iec61850-cli-client ...
```

---

## Requests

### `get_data_values`

Read one or more data attribute values. References follow the pattern
`LogicalDevice/LogicalNode.DataObject.DataAttribute[FC]`.  
The functional constraint (FC) defaults to `ST` when omitted.

```bash
# Read a single value (FC defaults to ST)
./iec61850-cli-client --host 192.168.1.10 -r get_data_values \
    IEDLD/MMXU1.TotW.mag.f

# Read multiple values with explicit FC
./iec61850-cli-client --host 192.168.1.10 -r get_data_values \
    "IEDLD/MMXU1.TotW.mag.f[MX]" \
    "IEDLD/MMXU1.TotV.mag.f[MX]"
```

---

### `get_server_directory`

List all logical devices exposed by the server.

```bash
./iec61850-cli-client --host 192.168.1.10 -r get_server_directory
```

---

### `get_logical_device_directory`

List all logical nodes inside a logical device.

```bash
./iec61850-cli-client --host 192.168.1.10 -r get_logical_device_directory IEDLD
```

---

### `get_data_definition`

Retrieve the data definition (structure) of a data object or attribute.

```bash
./iec61850-cli-client --host 192.168.1.10 -r get_data_definition \
    "IEDLD/MMXU1.TotW"
```

---

### `get_brcb_values`

Read all attributes of a Buffered Report Control Block (BRCB).

```bash
./iec61850-cli-client --host 192.168.1.10 -r get_brcb_values \
    --brcb-ref "IED1LD/LLN0.brcb1"
```

---

### `get_urcb_values`

Read all attributes of an Unbuffered Report Control Block (URCB).

```bash
./iec61850-cli-client --host 192.168.1.10 -r get_urcb_values \
    --urcb-ref "IED1LD/LLN0.urcb1"
```

---

### `set_brcb_values`

Write one or more attributes to a BRCB. After writing, the connection is kept
open for 10 seconds to allow observation of incoming reports.

| Flag | Description |
|---|---|
| `--brcb-ref <REF>` | BRCB reference (required) |
| `--rpt-id <ID>` | Report identifier (RptID) |
| `--rpt-ena <true\|false>` | Enable/disable reporting |
| `--dat-set <REF>` | Dataset reference |
| `--buf-tm <MS>` | Buffer time in milliseconds |
| `--intg-pd <MS>` | Integrity period in milliseconds |
| `--gi <true\|false>` | Trigger general interrogation |
| `--purge-buf <true\|false>` | Purge the buffer |
| `--resv-tms <S>` | Reservation time in seconds |

```bash
# Enable reporting and trigger a general interrogation
./iec61850-cli-client --host 192.168.1.10 -r set_brcb_values \
    --brcb-ref "IED1LD/LLN0.brcb1" \
    --rpt-ena true \
    --gi true
```

---

### `set_urcb_values`

Write one or more attributes to a URCB. After writing, the connection is kept
open for 10 seconds to allow observation of incoming reports.

All BRCB flags above are also available, plus:

| Flag | Description |
|---|---|
| `--urcb-ref <REF>` | URCB reference (required) |
| `--resv <true\|false>` | Reserve the URCB for exclusive use |
| `--opt-seq-num <true\|false>` | OptFlds: sequence number |
| `--opt-time-stamp <true\|false>` | OptFlds: report timestamp |
| `--opt-reason <true\|false>` | OptFlds: reason for inclusion |
| `--opt-dat-set-name <true\|false>` | OptFlds: dataset name |
| `--opt-data-ref <true\|false>` | OptFlds: data reference |
| `--opt-conf-rev <true\|false>` | OptFlds: configuration revision |
| `--opt-segmentation <true\|false>` | OptFlds: segmentation |

```bash
# Reserve the URCB and enable timestamp + reason in reports
./iec61850-cli-client --host 192.168.1.10 -r set_urcb_values \
    --urcb-ref "IED1LD/LLN0.urcb1" \
    --resv true \
    --rpt-ena true \
    --opt-time-stamp true \
    --opt-reason true
```

---

### `subscribe_report`

Enable reporting on a control block and print incoming reports for 10 seconds.

| Flag | Description |
|---|---|
| `--cb-ref <REF>` | Control block reference (required) |
| `--report-type <TYPE>` | `buffered` or `unbuffered` (required) |

```bash
# Subscribe to a buffered report control block
./iec61850-cli-client --host 192.168.1.10 -r subscribe_report \
    --cb-ref "IED1LD/LLN0.brcb1" \
    --report-type buffered

# Subscribe to an unbuffered report control block
./iec61850-cli-client --host 192.168.1.10 -r subscribe_report \
    --cb-ref "IED1LD/LLN0.urcb1" \
    --report-type unbuffered
```

---

### `control`

Issue a control command using one of the four IEC 61850 control models.

| Flag | Description |
|---|---|
| `--co-ref <REF>` | Control object reference, e.g. `IED1LD/CSWI1.Pos` (required) |
| `--control-model <MODEL>` | One of the four models below (required) |
| `--ctl-val <VALUE>` | Control value (required, see formats below) |
| `--oper-timeout <S>` | Seconds to wait for CommandTermination (enhanced-security models, default: 10) |

**Control models**

| Value | Description |
|---|---|
| `direct_with_normal_security` | Single operate, no select, no termination |
| `direct_with_enhanced_security` | Single operate, waits for CommandTermination |
| `sbo_with_normal_security` | Select then operate |
| `sbo_with_enhanced_security` | Select-with-value then operate, waits for CommandTermination |

**Control value formats (`--ctl-val`)**

| Format | Data type | Example |
|---|---|---|
| `true` / `false` | SPC / DPC (Boolean) | `--ctl-val true` |
| integer | INC / ENC / ISC (INT32) | `--ctl-val 2` |
| float | APC with float analogue value | `--ctl-val 1.5` |
| `i:<integer>` | APC with integer analogue value | `--ctl-val i:42` |
| `stop` / `lower` / `higher` / `reserved` | BSC / BAC (BinaryStep) | `--ctl-val lower` |

```bash
# Direct control (normal security) — open a switch
./iec61850-cli-client --host 192.168.1.10 -r control \
    --co-ref "IED1LD/CSWI1.Pos" \
    --control-model direct_with_normal_security \
    --ctl-val true

# SBO with enhanced security — close a switch, wait up to 15 s for termination
./iec61850-cli-client --host 192.168.1.10 -r control \
    --co-ref "IED1LD/CSWI1.Pos" \
    --control-model sbo_with_enhanced_security \
    --ctl-val false \
    --oper-timeout 15

# Step control — raise a tap changer
./iec61850-cli-client --host 192.168.1.10 -r control \
    --co-ref "IED1LD/ATCC1.TapPos" \
    --control-model direct_with_normal_security \
    --ctl-val higher
```

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages