Appearance
Writing data to a machine (Kaynan Fusion flows)
Kaynan Nexus only reads machines, and nothing in the portal can write to one. This page is for Kaynan Fusion's own Node-RED flows on the box, for example a robot cell passing a job or program number to the machine it tends.
Data only. Job numbers, program numbers, counts, recipe numbers. Never safety signals: cycle start, door, chuck, emergency stop and interlocks stay on hardwired I/O.
The safe write function
The example flow kealink-safe-write (in Import, Examples, node-red-contrib-kealink, 0.4.3 or later) has a function that sits in front of the machine's write node. It sends a value only when:
- the key is on its
ALLOWlist, - the value is a number within that key's
minandmax(a whole number where the entry saysinteger: true), ortrueorfalsewhere it saystype: "bool", - the value fits the place it is written to, such as a 16-bit register,
- the same key was not written in the last second (
MIN_INTERVAL_MS).
If any value in a message fails, nothing is sent. The reasons go to the function's second output and to the debug panel as a warning, and the status under the function shows the first one. When the values go through, the status shows sent N at HH:MM.
Send it either several values at once or one per message:
js
msg.payload = { job_number: 1234, program: 130 };js
msg.topic = "job_number";
msg.payload = 1234;Set up
- Import
kealink-safe-write. - In the function, set
PROTOCOLand list each key inALLOWwith itsmin,maxandtarget. The function has an example for each protocol. - Replace the Write node goes here debug node with the machine's write node:
| PROTOCOL | Write node | Its settings |
|---|---|---|
modbus | Modbus Flex Write (node-red-contrib-modbus) | The client node set to the device. target: fc 6 or 16 for a holding register, 5 for a coil, and the address (40001 in a manual is 0) |
opcua | OpcUa-Client (node-red-contrib-opcua) | Action WRITE, endpoint set to the machine. target: nodeId and datatype |
allen-bradley | eth-ip out (node-red-contrib-cip-ethernet-ip) | It writes one tag, chosen in the node: put a switch on msg.topic first, with one eth-ip out per tag. target: tag |
omron | FINS Write (node-red-contrib-omron-fins) | Address msg.topic, Data msg.payload. target: address, such as D100, or W0.01 for a bit |
mitsubishi | slmp-write (@fa_yoshinobu/node-red-contrib-plc-comm-slmp) | Updates left empty. target: address with its type, such as D100:U or M100:BIT |
- Deploy, and send a test value the machine can safely take.
Fanuc: use the fanuc-focas-write node instead. It has its own allow list and reads every value back.
Check the value arrived
The function only knows what it sent. Where the machine allows it, read the value back with that machine's read node and compare.