@fa_yoshinobu/node-red-contrib-plc-comm-slmp 0.2.12

Node-RED nodes for Mitsubishi PLC communication over SLMP binary 3E/4E frames.

npm install @fa_yoshinobu/node-red-contrib-plc-comm-slmp

CI npm version npm downloads Node-RED version Node.js version SLMP frame Transport License

Node-RED SLMP Nodes for Mitsubishi PLCs

Node-RED SLMP hero

Node-RED nodes for Mitsubishi PLC communication over SLMP binary 3E/4E frames.

This package uses the same named-device foundation as the SLMP libraries, extended here with Node-RED-friendly count and string forms:

  • D100
  • D100,10
  • D200:F
  • D200:F,4
  • D300:L
  • D50.3
  • M1000
  • M1000,8
  • D100:STR,10
  • DSTR100,10

This package is documented for the high-level Node-RED workflow only:

  • slmp-connection
  • slmp-read
  • slmp-write

Quick Start

  1. Install the package into your Node-RED user directory and restart Node-RED.
  2. Add one slmp-connection config node and set host, port, transport, and PLC type.
  3. Add slmp-read for the first smoke test, using a safe address such as D300, D300,4, or DSTR320,10.
  4. When read works, add slmp-write and use known-safe test devices before moving to production addresses.

If you are working from this repository, import one of the ready-to-run flows under examples/flows first. The safest first choices are:

Start with D word devices for the first smoke test. Do not start with slmp-device-matrix.json.

Release Information

Install from npm:

cd ~/.node-red
npm install @fa_yoshinobu/node-red-contrib-plc-comm-slmp

Install from this repository:

cd ~/.node-red
npm install /path/to/node-red-contrib-plc-comm-slmp

Optional local editor smoke test from the repository root:

npm run smoke:editor

This command installs the local package into an isolated temporary userDir, starts a temporary Node-RED runtime, imports slmp-basic-read-write.json, verifies the flow starts, and then shuts the runtime down again.

Legacy note:

  • the original unscoped [email protected] remains on npm, but new releases move to the scoped package name above

Changes Since Flow Library 0.2.3

The Node-RED Flow Library currently shows 0.2.3 as the published baseline for this scoped package. Check these changes before updating an existing flow:

  • slmp-connection now uses one PLC type selector. Older PLC series and frame type fields from Flow Library 0.2.3 flows must be reselected after import.
  • X/Y string addresses are PLC-type-specific: iQ-F uses octal X/Y, while the other supported PLC types use hexadecimal X/Y.
  • LTS, LTC, LSTS, LSTC, LCS, LCC, and LZ are now in the high-level surface where the selected PLC type supports them.
  • Device codes unsupported by the selected PLC type are errors by default. The slmp-device-matrix.json sample can instead log them as SKIPPED records when it sends slmpSkipUnsupported.

Supported PLC Registers

Start with these register/device families first:

  • word devices: D, SD, R, ZR, TN, CN
  • bit devices: M, X, Y, SM, B
  • typed forms: D100:S, D100:I, D200:F, D300:L
  • special Node-RED forms: D100,10, M1000,8, D100:STR,10, DSTR100,10
  • bit-in-word form: D50.3

See the full public table in Supported PLC Registers.

Documentation

Maintainer-only notes and retained evidence live under internal_docs/.

What You Can Do

  • Binary 3E and 4E frames
  • TCP and UDP transport
  • reusable slmp-connection
  • high-level reads and writes through slmp-read and slmp-write
  • typed source selection for literal / msg / flow / global / env
  • per-request routing via msg.target or configured route sources
  • read output selection for object / array / single value
  • metadata emission selection for msg.slmp
  • configurable error handling with throw / msg.error / second output
  • connection control via connect / disconnect / reinitialize messages

Set one explicit PLC type for each connection. The node stores it as plcFamily internally and derives frameType, access profile, and X/Y string-address rules from that selection.

Supported canonical PLC type values:

  • iq-f
  • iq-r
  • iq-l
  • mx-f
  • mx-r
  • qcpu
  • lcpu
  • qnu
  • qnudv

Underlying JS Helper

The package also exports the underlying SLMP helper library for the same read/write model used by the Node-RED nodes:

const { SlmpClient, readNamed } = require("@fa_yoshinobu/node-red-contrib-plc-comm-slmp/lib/slmp");

async function main() {
  const client = new SlmpClient({
    host: "192.168.250.100",
    port: 1025,
    plcFamily: "qnu",
  });
  const values = await readNamed(client, ["D300", "D300,4"]);
  console.log(values);
}

The helper validates address format, protocol constraints, and device-code support for the selected plcFamily, but does not pre-check PLC model-specific device ranges or upper bounds. If an address is outside the connected PLC's actual range, the PLC response is returned as the runtime error.

Current Public Register Scope

  • bit devices: SM, X, Y, M, L, F, V, B, TS, TC, LTS, LTC, STS, STC, LSTS, LSTC, CS, CC, LCS, LCC, SB, DX, DY
  • word devices: SD, D, W, TN, LTN, STN, LSTN, CN, LCN, SW, Z, LZ, R, ZR, RD
  • typed views: :S, :I (alias of :S), :D, :L, :F
  • string/count views: ,count, :STR, DSTR
  • word-bit view: .bit

Public device-code support by plcFamily:

PLC type Public device codes accepted by the high-level API and Node-RED editor
iq-r, iq-l, mx-f, mx-r SM, SD, X, Y, M, L, F, V, B, D, W, TS, TC, TN, LTS, LTC, LTN, STS, STC, STN, LSTS, LSTC, LSTN, CS, CC, CN, LCS, LCC, LCN, SB, SW, DX, DY, Z, LZ, R, ZR, RD
iq-f SM, SD, X, Y, M, L, F, B, D, W, TS, TC, TN, STS, STC, STN, CS, CC, CN, LCS, LCC, LCN, SB, SW, Z, LZ, R
qcpu SM, SD, X, Y, M, L, F, V, B, D, W, TS, TC, TN, STS, STC, STN, CS, CC, CN, SB, SW, DX, DY, Z, R, ZR
lcpu, qnu, qnudv SM, SD, X, Y, M, L, F, V, B, D, W, TS, TC, TN, STS, STC, STN, CS, CC, CN, SB, SW, DX, DY, Z, R, ZR

Validated public hardware summary:

  • FX5UC-32MT/D
  • Q06UDVCPU
  • R08CPU

Example Flows

The device-matrix flow records plcFamily in each JSONL result, keeps one outstanding request at a time, and summarizes OK, SKIPPED, NG, mismatch, timeout, and pending counts.

Known Limitations

  • the high-level Node-RED surface requires explicit PLC type selection
  • .bit,count is not supported
  • a single client connection keeps requests serialized by default
  • the read and write nodes keep the caller-visible logical request shape and do not silently retry with a different fallback split semantics
  • G and HG are not part of the current public high-level register table

Development

Run the local test suite:

cmd /c npm.cmd test

Notes

  • .bit notation is only valid for word devices such as D50.3
  • direct bit devices should be addressed directly as M1000, X1F, Y20
  • LTN, LSTN, LCN, and LZ default to 32-bit :D access in high-level helpers; iQ-F LZ samples should use LZ0 or LZ1
  • LCN current-value reads and writes use random dword access in the high-level helpers
  • LTS, LTC, LSTS, and LSTC state reads use the long timer 4-word decode helpers
  • LCS and LCC state reads use direct bit read; high-level state writes use random bit write (0x1402)
  • low-level direct bit writes are guarded for LTS/LTC/LSTS/LSTC/LCS/LCC
  • X/Y string addresses require explicit PLC type selection
  • iq-f interprets X/Y string addresses in octal, while other supported families use hexadecimal X/Y
  • random read batching follows the Python helper layer for batchable word devices

Node Info

Version: 0.2.12
Updated 1 week ago
License: MIT
Rating: 5.0 2

Categories

Actions

Rate:

Downloads

18 in the last week

Nodes

  • slmp-connection
  • slmp-read
  • slmp-write

Keywords

  • node-red
  • node-red-contrib
  • node-red-flow
  • slmp
  • mitsubishi
  • melsec
  • plc

Maintainers