- Driver.AbCip.Cli-003: SubscribeCommand prints the 'Subscribed' banner BEFORE wiring OnDataChange so the main thread can't interleave its write with the poll-thread handler. - Driver.AbCip.Cli-004: AbCipCommandBase.Timeout and SubscribeCommand validate TimeoutMs / IntervalMs and throw CommandException on non-positive values. - Driver.AbCip.Cli-005: every command now calls FlushLogging() in its finally block. - Driver.AbCip.Cli-006: Timeout init throws NotSupportedException with a pointer at TimeoutMs instead of silently swallowing assignments. - Driver.AbCip.Cli-007: added AbCipCommandBaseTests covering BuildOptions shape, probe / controller-browse / alarm toggles, host address, family selection, tag list passthrough. - Driver.AbCip.Cli-008: rewrote the opening paragraph in docs/Driver.AbCip.Cli.md to credit the six-CLI roster with a pointer at docs/DriverClis.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
85 lines
2.8 KiB
Markdown
85 lines
2.8 KiB
Markdown
# `otopcua-abcip-cli` — AB CIP test client
|
|
|
|
Ad-hoc probe / read / write / subscribe tool for ControlLogix / CompactLogix /
|
|
Micro800 / GuardLogix PLCs, talking to the **same** `AbCipDriver` the OtOpcUa
|
|
server uses (libplctag under the hood).
|
|
|
|
Second of six driver test-client CLIs (Modbus → AB CIP → AB Legacy → S7 →
|
|
TwinCAT → FOCAS). Shares `Driver.Cli.Common` with the others; see
|
|
[DriverClis.md](DriverClis.md) for the authoritative roster.
|
|
|
|
## Build + run
|
|
|
|
```powershell
|
|
dotnet run --project src/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Cli -- --help
|
|
```
|
|
|
|
## Common flags
|
|
|
|
| Flag | Default | Purpose |
|
|
|---|---|---|
|
|
| `-g` / `--gateway` | **required** | Canonical `ab://host[:port]/cip-path` |
|
|
| `-f` / `--family` | `ControlLogix` | ControlLogix / CompactLogix / Micro800 / GuardLogix |
|
|
| `--timeout-ms` | `5000` | Per-operation timeout |
|
|
| `--verbose` | off | Serilog debug output |
|
|
|
|
Family ↔ CIP-path cheat sheet:
|
|
- **ControlLogix / CompactLogix / GuardLogix** — `1,0` (slot 0 of chassis)
|
|
- **Micro800** — empty path, just `ab://host/`
|
|
- **Sub-slot Logix** (rare) — `1,3` for slot 3
|
|
|
|
## Commands
|
|
|
|
### `probe` — is the PLC up?
|
|
|
|
```powershell
|
|
# ControlLogix — read the canonical libplctag system tag
|
|
otopcua-abcip-cli probe -g ab://10.0.0.5/1,0 -t @raw_cpu_type --type DInt
|
|
|
|
# Micro800 — point at a user-supplied global
|
|
otopcua-abcip-cli probe -g ab://10.0.0.6/ -f Micro800 -t _SYSVA_CLOCK_HOUR --type DInt
|
|
```
|
|
|
|
### `read` — single Logix tag
|
|
|
|
```powershell
|
|
# Controller scope
|
|
otopcua-abcip-cli read -g ab://10.0.0.5/1,0 -t Motor01_Speed --type Real
|
|
|
|
# Program scope
|
|
otopcua-abcip-cli read -g ab://10.0.0.5/1,0 -t "Program:Main.Counter" --type DInt
|
|
|
|
# Array element
|
|
otopcua-abcip-cli read -g ab://10.0.0.5/1,0 -t "Recipe[3]" --type Real
|
|
|
|
# UDT member (dotted path)
|
|
otopcua-abcip-cli read -g ab://10.0.0.5/1,0 -t "Motor01.Speed" --type Real
|
|
```
|
|
|
|
### `write` — single Logix tag
|
|
|
|
Same shape as `read` plus `-v`. Values parse per `--type` using invariant
|
|
culture. Booleans accept `true`/`false`/`1`/`0`/`yes`/`no`/`on`/`off`.
|
|
Structure (UDT) writes need the member layout declared in a real driver config
|
|
and are refused by the CLI.
|
|
|
|
```powershell
|
|
otopcua-abcip-cli write -g ab://10.0.0.5/1,0 -t Motor01_Speed --type Real -v 3.14
|
|
otopcua-abcip-cli write -g ab://10.0.0.5/1,0 -t StartCommand --type Bool -v true
|
|
```
|
|
|
|
### `subscribe` — watch a tag until Ctrl+C
|
|
|
|
```powershell
|
|
otopcua-abcip-cli subscribe -g ab://10.0.0.5/1,0 -t Motor01_Speed --type Real -i 500
|
|
```
|
|
|
|
## Typical workflows
|
|
|
|
- **"Is the PLC reachable?"** → `probe`.
|
|
- **"Did my recipe write land?"** → `write` + `read` back.
|
|
- **"Why is tag X flipping?"** → `subscribe`.
|
|
- **"Is this GuardLogix safety tag writable from non-safety?"** → `write` and
|
|
read the status code — safety tags surface `BadNotWritable` / CIP errors,
|
|
non-safety tags surface `Good`.
|