Giter Club home page Giter Club logo

node-red-contrib-pccc's Introduction

node-red-contrib-pccc

A Node-RED node to interact with some Allen-Bradley PLCs using PCCC protocol. Based on the awesome work of plcpeople/nodepccc.

Installing

You can install this node directly from the "Manage Palette" menu in the Node-RED interface. There are no external dependencies or compilation steps.

Alternatively, run the following command in your Node-RED user directory - typically ~/.node-red on Linux or %HOMEPATH%\.nodered on Windows

    npm install node-red-contrib-pccc

Usage

Just drop a pccc in node to read and watch addresses of the PLC, or a pccc out node to write values to the PLC. Both of them need a pccc endpoint, where you can configure the address of the PLC (IP Address, port, and routing), the cycle time and timeout values, and the list of addresses available on the PLC.

Addressing

The addresses follow the same syntax of what would be used on RSLogix, so for example B3:0/0 addresses the bit 0 of byte 0 in the file B3, and F8:1 points to the float 1 at the file F8.

About routing

The configuration of routing follows a very special syntax for now

0x01,0x00,0x01,0x00
  |    |    |    |
  |    |    |    +-- 0: The slot of the PLC
  |    |    +------- 1: Route over the backplane
  |    +------------ Reserved, always zero
  +----------------- 1: Number of words (1 = 2 bytes) of the routing section

You most likely just want to change the last number to the slot of the PLC when connecting to ControlLogix/CompactLogix controllers

Wishlist

  • Validate addresses
  • Improve routing configuration

Bugs and enhancements

Please share your ideas and experiences on the Node-RED forum, or open an issue on the page of the project on GitHub

License

Copyright: (c) 2016-2021, ST-One Ltda.

GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

node-red-contrib-pccc's People

Contributors

gfcittolin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

swipswaps

node-red-contrib-pccc's Issues

Trouble connecting to SLC / 05

newbie to PCCC and node red. Just trying to connect Node Red to an existing AB SLC5 /05 to create a simple HMI-
PLC address is 192.168.1.120.
WhoActive

PCCC set -up...
PCCC set-up

Getting this error
pcccError

I am able to connect through RSLogix500 and Android App - "Suppanel" using "192.168.120:44818"

Any help or advice would be appreciated.

PLC5 Unable to Read/Write Data

I have been working with my PLC 5/80 and its Ethernet sidecar recently. 1785-L80B/E rev. C01 and 1785-ENET/A rev. E01 respectively.

When I address a single element of the datafile B12 or N7 (e.g. B12:0/0-15) I get a verbose return of "No response from PLC, restarting the communication" or (e.g. N7:0) "Failure (Bad Values)" with either read or write operations.

I have also experimented with the routing to no avail. I have attempted both the default and an older port, link routing scheme of 0x01,0x00,0x01,0x01 given that the sidecar is technically in slot 1.

I know that CIP protocol works for this particular setup. I have a Micro820 that can read and write the same datafiles over TCP 44818 with impunity. (Micro820 was disabled for testing purposes.)

Thoughts? I'd like to use this PLC5 with Node-RED if possible. If need be I will make my studio machine and PLC5 remotely available to whomever needs it to aid in development.

Different IP Address

I have many many different types of machines and the LAN is associated with to type of machine. For example, one type of machine has IP of 192.168.1.101 and another type has 192.168.2.105. Currently, I am using this node to read all the PLCs, but I am having issues with my dashboard loading. I believe it's due to the different LAN. When I delete one type of IP node, then the dashboard loads. Is there a solution to this?

Node Status - Failure

If the PLC is offline for a long time, the node goes to failure error and doesn't report this so it becomes an uncatchable error.
Is it possible to make this catchable or in other words be readable by the error/status node?

Allen Bradley Micrologix 1400 PLC Error "Failure (Bad values)"

I'm connected to the MicroLogix-1400, working just fine, until errors.
192.168.254.220 Port 44818
Routing <--- ?? what's that ?
Cycle Time Adjusted it from 500 -700, No differences noted
Timeout, Adjusted it from 1500 - 3500, No differences noted

Node-RED program is simple.
I havepccc-node-red-failure
pccc-node-red-failure
Input - 500 ms delay - json true =1; json false =2; on output 1>> Set msg.payload = 0
on output 2>> Set msg.payload = 1.

This is a simple 50% duty cycle at 500ms. It works perfectly... Until
"Failure (Bad values)" erupts on the debug pane. Usually it works for about 5 minutes. and crashes.

I tried an alternate test with a word vs. bit modification. It lasted about a half hour when left to run by itself. When I returned to my PC and started working on email or internet, it failed with the same problem.

Kind Regards,
kzy

pccc flex out

I would like to make some updates to your "node-red-contrib-pccc" to be able to pass the tag in the message such as:

msg.variable = "N160.1";
msg.payload = 1864
return msg;

or

msg.payload = {
     variable = "N160.1",
     val= 1884
}

I don't want to manage this long term. If I was update the code would you be in accepting a pull request? I need this to work in the next 2 days so if you could please respond ASAP. I would like to start working on it today.

Controllogix L71_V33 Failure (Bad values)

I've have setup a simple flow with the 'PCC in' node without reading the register from the PLC and it appears a connection is established, however a "No response from PLC, restarting the communication" message keeps periodically popping up i.e. a green online icon comes up in the node. the controller is on Slot 0 and the Ethernet module is in Slot 2.

Below is the screenshot from the node-red verbose output:

[26419,81502679] Initiate Called - Connecting to PLC with address and parameters:
[26419,81693188] {
host: '172.17.227.246',
port: '44818',
routing: <Buffer 01 00 02 00>
}
[26419,84009126] Connection cleanup is happening
[26419,84146735 172.17.227.246] Clearing read PacketTimeouts
[26419,84277394 172.17.227.246] Clearing write PacketTimeouts
[26419,84896419 172.17.227.246]
[26419,84971326 172.17.227.246] Attempting to connect to host...
[26419,86562721 172.17.227.246] TCP Connection Established to 172.17.227.246 on port 44818 - Will attempt EIP Connection
[26419,91187291 172.17.227.246] EIP Register Session Response Received - connection confirmed
[26419,91418567 172.17.227.246] Session Handle is 0x1002F40C
[26419,91848530] Translation OK
[26420,93842130 172.17.227.246] Reading All Items (readAllItems was called)
[26420,94964908 172.17.227.246] Adding or Removing { arg: [], action: 'add' }
[26420,95464571 172.17.227.246] Adding
[26420,96428245 172.17.227.246] Calling SRP from RAI
[26420,97129472 172.17.227.246] SendReadPacket called
12 Jan 14:55:14 - [warn] [pccc endpoint:b56461294fe29b50] No response from PLC, restarting the communication
[26431,110633343 172.17.227.246] We Caught a read/write error ECONNRESET - resetting connection
[26431,110951250 172.17.227.246] ConnectionReset has been called to set the reset as pending
[26431,111094495] Scheduling the reset for 4.5 seconds later.
[26431,111493376 172.17.227.246] ConnectionReset has been called to set the reset as pending

Following this test, I've setup the node to read address F8:0 from the PLC and I get the following verbose output:

[26570,191288417] Initiate Called - Connecting to PLC with address and parameters:
[26570,191364828] {
host: '172.17.227.246',
port: '44818',
routing: <Buffer 01 00 02 00>
}
[26570,191773570] Connection cleanup is happening
[26570,191827122 172.17.227.246] Clearing read PacketTimeouts
[26570,191873113 172.17.227.246] Clearing write PacketTimeouts
[26570,192070301 172.17.227.246]
[26570,192117080 172.17.227.246] Attempting to connect to host...
[26570,193360497 172.17.227.246] TCP Connection Established to 172.17.227.246 on port 44818 - Will attempt EIP Connection
[26570,197457274 172.17.227.246] EIP Register Session Response Received - connection confirmed
[26570,197609094 172.17.227.246] Session Handle is 0x1002F70C
[26570,197947009] Translation OK
[26571,199684901 172.17.227.246] Reading All Items (readAllItems was called)
[26571,200436919 172.17.227.246] Adding or Removing { arg: [ 'Test' ], action: 'add' }
[26571,200585498 172.17.227.246] Adding Test
[26571,203008222 172.17.227.246] Clearing read PacketTimeouts
[26571,203283537 172.17.227.246] Calling SRP from RAI
[26571,203361933 172.17.227.246] SendReadPacket called
[26571,204138978] The A2 Returned Buffer is:
[26571,204208918] <Buffer a2 04 08 8a 00 00>
[26571,204392305] The returned buffer length is 6
[26571,204470792] The PCCC Encapsulation Header is:
[26571,204525731] <Buffer 4b 02 20 67 24 01 07 00 00 01 02 03 04 0f 00 12 34>
[26571,204674882] The Returned buffer is:
[26571,204726357] <Buffer a2 04 08 8a 00 00>
[26571,205011467] Sending Read Packet SEQ 2
[26571,208623026] <Buffer 6f 00 18 00 0c f7 02 10 00 00 00 00 00 00 00 01 00 28 1e 4d 00 00 00 00 00 00 00 00 0a 00 02 00 00 00 00 00 b2 00 08 00 d2 00 01 01 15 03 01 00>
[26571,208935797] onResponse called with length 48
[26571,209198522] Valid EIP Data Response Received
[26571,209318325] Invalid response or response code in bytes 40-43.
[26571,209420503] Service not supported maybe? Bad path?
[26571,209530060] This can occur on power-up reconnection or missing PLC-ENI link using ENI.
[26571,209657916] <Buffer 6f 00 18 00 0c f7 02 10 00 00 00 00 00 00 00 01 00 28 1e 4d 00 00 00 00 00 00 00 00 0a 00 02 00 00 00 00 00 b2 00 08 00 d2 00 01 01 15 03 01 00>
[26574,205523050 172.17.227.246] PacketTimeout called with type read and seq 2
[26574,205903813 172.17.227.246] READ TIMEOUT on sequence number 2
[26574,206102363 172.17.227.246] ConnectionReset from read packet timeout.
[26574,206310317 172.17.227.246] ConnectionReset has been called to set the reset as pending
[26574,207315392 172.17.227.246] ReadResponse called
[26574,208449456 172.17.227.246] Timeout error - zero length packet
[26574,208663552 172.17.227.246] Read Time is 3 seconds and 5.2 ms.
[26574,208924102 172.17.227.246] Every packet done sending
[26574,210013098 172.17.227.246] Address F8:0 has value 0 and quality BAD 255
[26574,210342311 172.17.227.246] Calling reset from readResponse as there is one pending
[26574,210809652 172.17.227.246] ResetNOW is happening
[26574,210955447] Connection cleanup is happening
[26574,211147257 172.17.227.246] Clearing read PacketTimeouts
[26574,211286411 172.17.227.246] Clearing write PacketTimeouts
[26574,211696707 172.17.227.246]
[26574,211825185 172.17.227.246] Attempting to connect to host...
[26574,211937182 172.17.227.246] We are calling back our readDoneCallback.
[26574,212235856 172.17.227.246] Reading All Items (readAllItems was called)
[26574,212362971 172.17.227.246] Unable to read when not connected. Return bad values.
[26574,212484247 172.17.227.246] Calling SRP from RAI
[26574,212602324 172.17.227.246] SendReadPacket called
[26574,213013342] The A2 Returned Buffer is:
[26574,213126448] <Buffer a2 04 08 8a 00 00>
[26574,213402711] The returned buffer length is 6
[26574,213647874] The PCCC Encapsulation Header is:
[26574,213752284] <Buffer 4b 02 20 67 24 01 07 00 00 01 02 03 04 0f 00 12 34>
[26574,213912318] The Returned buffer is:
[26574,214003666] <Buffer a2 04 08 8a 00 00>
[26574,214182878 172.17.227.246] Not Sending Read Packet because we are not connected - ISO CS is 1
[26574,214286465 172.17.227.246] Requesting PacketTimeout Due to ISO CS NOT 4 - READ SN 2
12 Jan 14:57:37 - [error] [pccc endpoint:b56461294fe29b50] Failure (Bad values)
[26574,216275178 172.17.227.246] PacketTimeout called with type read and seq 2
[26574,216401959 172.17.227.246] READ TIMEOUT on sequence number 2
[26574,216505385 172.17.227.246] ReadResponse called
[26574,216721676 172.17.227.246] Timeout error - zero length packet
[26574,216874096 172.17.227.246] Read Time is 0 seconds and 4.1 ms.
[26574,217020192 172.17.227.246] Every packet done sending
[26574,217218557 172.17.227.246] Address F8:0 has value 0 and quality BAD 255
[26574,217336649 172.17.227.246] We are calling back our readDoneCallback.
12 Jan 14:57:37 - [error] [pccc endpoint:b56461294fe29b50] Failure (Bad values)
[26574,218059634 172.17.227.246] TCP Connection Established to 172.17.227.246 on port 44818 - Will attempt EIP Connection
[26574,221653357 172.17.227.246] EIP Register Session Response Received - connection confirmed
[26574,221810016 172.17.227.246] Session Handle is 0x1002F80C
[26574,683854072 172.17.227.246] Timed reset has happened. Ideally this would never be called as reset should be completed when done r/w.
[26574,685509906 172.17.227.246] ResetNOW is happening
[26574,685803112 172.17.227.246] Clearing an earlier scheduled reset
[26575,201483335 172.17.227.246] Reading All Items (readAllItems was called)
[26575,201737941 172.17.227.246] Calling SRP from RAI
[26575,201840294 172.17.227.246] SendReadPacket called
[26575,202115983] The A2 Returned Buffer is:
[26575,202201884] <Buffer a2 04 08 8a 00 00>
[26575,202349361] The returned buffer length is 6
[26575,202432484] The PCCC Encapsulation Header is:
[26575,202498921] <Buffer 4b 02 20 67 24 01 07 00 00 01 02 03 04 0f 00 12 34>
[26575,202607815] The Returned buffer is:
[26575,202674838] <Buffer a2 04 08 8a 00 00>
[26575,202977175] Sending Read Packet SEQ 2
[26575,205971536] <Buffer 6f 00 18 00 0c f8 02 10 00 00 00 00 00 00 00 01 00 28 1e 4d 00 00 00 00 00 00 00 00 0a 00 02 00 00 00 00 00 b2 00 08 00 d2 00 01 01 15 03 01 00>
[26575,206225774] onResponse called with length 48
[26575,206336942] Valid EIP Data Response Received
[26575,206430601] Invalid response or response code in bytes 40-43.
[26575,206511195] Service not supported maybe? Bad path?
[26575,206587452] This can occur on power-up reconnection or missing PLC-ENI link using ENI.
[26575,206673206] <Buffer 6f 00 18 00 0c f8 02 10 00 00 00 00 00 00 00 01 00 28 1e 4d 00 00 00 00 00 00 00 00 0a 00 02 00 00 00 00 00 b2 00 08 00 d2 00 01 01 15 03 01 00>
[26578,204096094 172.17.227.246] PacketTimeout called with type read and seq 2
[26578,204382012 172.17.227.246] READ TIMEOUT on sequence number 2
[26578,204610791 172.17.227.246] ConnectionReset from read packet timeout.
[26578,204977930 172.17.227.246] ConnectionReset has been called to set the reset as pending
[26578,205201750 172.17.227.246] ReadResponse called
[26578,205700297 172.17.227.246] Timeout error - zero length packet
[26578,205887231 172.17.227.246] Read Time is 3 seconds and 4 ms.
[26578,206148446 172.17.227.246] Every packet done sending
[26578,206372374 172.17.227.246] Address F8:0 has value 0 and quality BAD 255
[26578,206498634 172.17.227.246] Calling reset from readResponse as there is one pending
[26578,206928885 172.17.227.246] ResetNOW is happening
[26578,207046983] Connection cleanup is happening
[26578,207242039 172.17.227.246] Clearing read PacketTimeouts
[26578,207395734 172.17.227.246] Clearing write PacketTimeouts
[26578,207885487 172.17.227.246]
[26578,208001864 172.17.227.246] Attempting to connect to host...
[26578,208140278 172.17.227.246] We are calling back our readDoneCallback.
[26578,208288551 172.17.227.246] Reading All Items (readAllItems was called)
[26578,208429230 172.17.227.246] Unable to read when not connected. Return bad values.
[26578,208575969 172.17.227.246] Calling SRP from RAI
[26578,208697762 172.17.227.246] SendReadPacket called
[26578,209063738] The A2 Returned Buffer is:
[26578,209177299] <Buffer a2 04 08 8a 00 00>
[26578,209401771] The returned buffer length is 6
[26578,209603612] The PCCC Encapsulation Header is:
[26578,209725341] <Buffer 4b 02 20 67 24 01 07 00 00 01 02 03 04 0f 00 12 34>
[26578,209922435] The Returned buffer is:
[26578,210056940] <Buffer a2 04 08 8a 00 00>
[26578,210289477 172.17.227.246] Not Sending Read Packet because we are not connected - ISO CS is 1
[26578,210416491 172.17.227.246] Requesting PacketTimeout Due to ISO CS NOT 4 - READ SN 2
12 Jan 14:57:41 - [error] [pccc endpoint:b56461294fe29b50] Failure (Bad values)
[26578,212804848 172.17.227.246] TCP Connection Established to 172.17.227.246 on port 44818 - Will attempt EIP Connection
[26578,213362095 172.17.227.246] PacketTimeout called with type read and seq 2
[26578,213514487 172.17.227.246] READ TIMEOUT on sequence number 2
[26578,213686715 172.17.227.246] ReadResponse called
[26578,213812563 172.17.227.246] Timeout error - zero length packet
[26578,213860585 172.17.227.246] Read Time is 0 seconds and 5 ms.
[26578,213932182 172.17.227.246] Every packet done sending
[26578,213999710 172.17.227.246] Address F8:0 has value 0 and quality BAD 255
[26578,214057907 172.17.227.246] We are calling back our readDoneCallback.
[26578,214121547 172.17.227.246] Reading All Items (readAllItems was called)
[26578,214176437 172.17.227.246] Unable to read when not connected. Return bad values.
[26578,214235381 172.17.227.246] Calling SRP from RAI
[26578,214290757 172.17.227.246] SendReadPacket called
[26578,214425778] The A2 Returned Buffer is:
[26578,214470812] <Buffer a2 04 08 8a 00 00>
[26578,214564288] The returned buffer length is 6
[26578,214626461] The PCCC Encapsulation Header is:
[26578,214682322] <Buffer 4b 02 20 67 24 01 07 00 00 01 02 03 04 0f 00 12 34>
[26578,214770945] The Returned buffer is:
[26578,214821245] <Buffer a2 04 08 8a 00 00>
[26578,214912159 172.17.227.246] Not Sending Read Packet because we are not connected - ISO CS is 2
[26578,214967813 172.17.227.246] Requesting PacketTimeout Due to ISO CS NOT 4 - READ SN 2
12 Jan 14:57:41 - [error] [pccc endpoint:b56461294fe29b50] Failure (Bad values)
[26578,216477236 172.17.227.246] PacketTimeout called with type read and seq 2
[26578,216582583 172.17.227.246] READ TIMEOUT on sequence number 2
[26578,216654495 172.17.227.246] ReadResponse called
[26578,216792170 172.17.227.246] Timeout error - zero length packet
[26578,216849172 172.17.227.246] Read Time is 0 seconds and 2.5 ms.
[26578,216939174 172.17.227.246] Every packet done sending
[26578,217046932 172.17.227.246] Address F8:0 has value 0 and quality BAD 255
[26578,217098611 172.17.227.246] We are calling back our readDoneCallback.
12 Jan 14:57:41 - [error] [pccc endpoint:b56461294fe29b50] Failure (Bad values)
[26578,217501946 172.17.227.246] EIP Register Session Response Received - connection confirmed
[26578,217590086 172.17.227.246] Session Handle is 0x1002F90C
[26579,212890883 172.17.227.246] Reading All Items (readAllItems was called)
[26579,213229698 172.17.227.246] Calling SRP from RAI
[26579,213501217 172.17.227.246] SendReadPacket called
[26579,214119642] The A2 Returned Buffer is:
[26579,214300328] <Buffer a2 04 08 8a 00 00>
[26579,214707688] The returned buffer length is 6
[26579,214982217] The PCCC Encapsulation Header is:
[26579,215139477] <Buffer 4b 02 20 67 24 01 07 00 00 01 02 03 04 0f 00 12 34>
[26579,215360318] The Returned buffer is:
[26579,215486213] <Buffer a2 04 08 8a 00 00>
[26579,215936951] Sending Read Packet SEQ 2
[26579,218885154] <Buffer 6f 00 18 00 0c f9 02 10 00 00 00 00 00 00 00 01 00 28 1e 4d 00 00 00 00 00 00 00 00 0a 00 02 00 00 00 00 00 b2 00 08 00 d2 00 01 01 15 03 01 00>
[26579,219153022] onResponse called with length 48
[26579,219361157] Valid EIP Data Response Received
[26579,219557929] Invalid response or response code in bytes 40-43.
[26579,219708324] Service not supported maybe? Bad path?
[26579,219843821] This can occur on power-up reconnection or missing PLC-ENI link using ENI.
[26579,220003282] <Buffer 6f 00 18 00 0c f9 02 10 00 00 00 00 00 00 00 01 00 28 1e 4d 00 00 00 00 00 00 00 00 0a 00 02 00 00 00 00 00 b2 00 08 00 d2 00 01 01 15 03 01 00>
^C12 Jan 14:57:45 - [info] Stopping flows
[26581,554149927 172.17.227.246] We Caught a read/write error ECONNRESET - resetting connection
[26581,554388341 172.17.227.246] ConnectionReset has been called to set the reset as pending
[26581,554699252 172.17.227.246] ConnectionReset has been called to set the reset as pending

I've trolled through the internet to try and find a solution, however, I was unable to get it to work correctly.

Anyone out there have any suggestions?

Read Micro850

Can this node read tags from Micro850? I tried using it and it shows the PLC online as a node status, but it doesn't read the tag. As the Micrologix 1100 are getting discontinued in March 2022, we are trying to migrate to Micro800s.

Allen Bradley PowerFlex750 Drive

Hi,

I'm working with the "pccc-node" using a PowerFlex 755 Drive.

Reading all parameters are just fine, when I write to the timeout parameter (N42:3) it's working well but if I try to write to N45:X the "pccc out" node is sending the "bad values" error message, also if I try to set N150:X or N201:X the node status show "failure".

Does anyone know if the data must be in a specific format or there is a configuration on the VSD that must set for allowing the data to be written?

Cannot select a variable in single variable for pccc in node

This is regarding to AB micrologix 1400. I'm having problem with selecting a variable in single variable mode for in-node. Every time I selected a variable (B3:0/0 or N7:0/0...) and closed the configuration window, the selections reset. Even though, the name showed on the node. When I opened the configuration window again, it showed no variable were selected. I can read the input of the whole word just find (B3/0 or N7/0).

Out node also having problems. Connection to PLC ok. it kept showing "TypeError: Cannot read property 'split' of undefined". I cannot output word, bit, bool, or number.

Thanks for any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.