SerafinTech / ST-node-ethernet-ip

Connect to PLC controllers with Node and Ethernet/ip
MIT License
37 stars 20 forks source link

Ethernet/IP Scanner Function #5

Closed Venomz101 closed 3 years ago

Venomz101 commented 3 years ago

Hello creator and good work with this repository!!

I have a few questions and I am unsure where to bring them up other than here, so excuse me if this is the wrong forum.

I was thrilled to see that this repository had I/O Scanner as I am currently trying to establish communication to a Fanuc Robot Controller R-30iB Mate. The robot controller works as Ethernet/IP Adapter and writes its inputs to Instance number e.g 101 and outputs to Instance number e.g 151.

The way I would like to achieve communication is through explicit message (tcp) to be able to read both I/Os and register acyclically, cyclic is not important so implicit message (udp) might be good to have for future case.

I am currently looking to try to implement this to Node-RED where configuration can simply be made what instances are to be read and written by specifying:

Reading the instance numbers e.g 101 and 151 is priority and will get me on the way for what I am currently working on, but having the flexibility to specifiy what to read and write will give me almost complete data exchange with any Ethernet/IP adapter.

Now to the questions,

Attached is a .pdf file for the EIP for the Fanuc Robot Controller, especially interesting is page 92-142, page 139 is good for what I want to achieve foremost.

R-30iB_EIP_operatormanual[MAROC77EN01101E_Rev.G].pdf

SerafinTech commented 3 years ago

USE AT YOUR OWN RISK DO NOT USE TO SECURE SAFETY OF PEOPLE OR PROPERTY

To answer your questions.

So your request to be able to read/write any instance you wanted - I have created a fork with that ability.

cip-functions

Example

const { Controller } = require("ST-ethernet-ip")

const controller = new Controller();

// Third parameter is for custom path to controller for devices that are not Allen Bradley PLCs.
// Usually an empty buffer
controller.connect('192.168.86.40', 0, Buffer.alloc(0) ).then(async () => {

  // 0x04 - Assembly Class
  // 101 - Instance
  // 3 - Attribute
  const data = await controller.cipGetAttributeSingle(0x04, 101, 3)

  console.log(data)

}).catch(e => {
  //Error Handling
  console.log(e)
})

USE AT YOUR OWN RISK DO NOT USE TO SECURE SAFETY OF PEOPLE OR PROPERTY

Venomz101 commented 3 years ago

This is great! Thank you.

I will test these functions towards the Fanuc R-30iB Mate controller when the opportunity arises and get test results back to you.

SerafinTech commented 3 years ago

Closed