frangoteam / FUXA

Web-based Process Visualization (SCADA/HMI/Dashboard) software
https://frangoteam.org
MIT License
2.49k stars 741 forks source link

[FEATURE] New Ethernet/IP client - testers wanted #1213

Open greg9504 opened 1 month ago

greg9504 commented 1 month ago

@AlexCastro-Prog @cjmccoy2 @ZhuNathan

Describe the feature I've integrated the ST-ethernet-ip node library into FUXA. This library supports Ethernet/IP IO implicit messaging, generic explicit messages and proprietary Rockwell symbolic tags (tags by name). See here for a description at a high level: https://library.automationdirect.com/ethernetip-implicit-vs-explicit-messaging/

Why? The current Ethernet/IP plug-in is not really Ethernet/IP, it is the PCCC protocol (AB) which uses Ethernet/IP as the transport layer. There are so many more devices which use generic Ethernet/IP. This plugin allows access to them, as well as having support for Rockwell proprietary symbolic tags.

Additional context How to use it: Add a new device, and select GenericEthernetIP as the type: image

Then click on the browse/search button. This will search the local network for Ethernet/IP clients.

image

image

This waits for 6 seconds for responses, any found devices will be in the dropdown list. In this case two were found, a Banner Engineering safety controller and a Rockwell Micro850 PLC (simulator) image

Select the device you want to connect to. image

Consult the device manuals. If the device supports implicit messaging (sometimes referred to as IO Messages), you configure those here. Later you'll configure tags that reference these messages.

If the device supports IO messages, click the plus button to add a message. A device can support multiple messages. So you can define more than one. When you click the add button (or edit one you've previously added), the following dialog will appear: image

All this information will be found in the device manuals. It is important that all sizes be entered in BYTES! Note most devices will use 2 byte words, so if the size is given in words, multiply by 2.

IO messages are sent over UDP at a predefined rate. That is the Request Packet Interval (RPI). This is independent of the Polling rate defined in the device setup tab. It is the rate specific for this IO message. Most devices will support RPI less than 100ms, however remember that FUXA is a client/server application. Setting this very low will most likely not have the affect you were hoping for.

After entering the IO modules, enable the device in the device setup panel and then close the setup panel. If you have configured IO messages, the pluin will start to exchange those messages with the device. Otherwise the plugin will poll the device for it's ID information.

If you are using Wireshark, use this filter: ip.addr==192.168.1.160&&(tcp.port==44818||udp.port==2222)

Replace the ip address with the ip address of your device. This filter will show all Ethernet/IP TCP (port 44818) and IO messages (udp port 2222).

If running debug in Visual Studio Code, the debug console for the server will look like:

2024-06-01T22:44:13.740Z [INF]  'FUXA' start
2024-06-01T22:44:13.746Z [INF]  'XS26CP' created
2024-06-01T22:44:13.750Z [INF]  'XS26CP' start
2024-06-01T22:44:13.752Z [DBG]      'XS26CP' try to connect 192.168.1.160:44818
2024-06-01T22:44:13.752Z [DBG]      XS26CP disconnectAll!!!!!!
2024-06-01T22:44:13.761Z [INF]  'FUXA' restored 0/0 values
2024-06-01T22:44:13.764Z [INF]  'XS26CP' restored 0/0 values
2024-06-01T22:44:13.800Z [DBG]      XS26CP ethernet/ip explicit/symbolic conn is now connected!!!!
2024-06-01T22:44:13.801Z [DBG]      XS26CP Make IO Connections
2024-06-01T22:44:13.802Z [DBG]      XS26CP globalIOScanner undefined, creating new and binding to UDP socket
Bind successful
server listening 0.0.0.0:2222
2024-06-01T22:44:13.805Z [DBG]      XS26CP globalIOScanner bind successful
2024-06-01T22:44:13.847Z [DBG]      XS26CP in waitingForIOConnections, numberOfIOScannersWaitingToConnect: 1, connectionAttempts: 20
2024-06-01T22:44:14.361Z [DBG]      XS26CP in waitingForIOConnections, numberOfIOScannersWaitingToConnect: 1, connectionAttempts: 19
2024-06-01T22:44:14.864Z [DBG]      XS26CP in waitingForIOConnections, numberOfIOScannersWaitingToConnect: 1, connectionAttempts: 18
2024-06-01T22:44:15.369Z [DBG]      XS26CP in waitingForIOConnections, numberOfIOScannersWaitingToConnect: 1, connectionAttempts: 17
2024-06-01T22:44:15.877Z [DBG]      XS26CP in waitingForIOConnections, numberOfIOScannersWaitingToConnect: 0, connectionAttempts: 16
2024-06-01T22:44:15.878Z [DBG]      XS26CP io connections finished connecting
2024-06-01T22:44:15.878Z [DBG]      'XS26CP' connected!

Setting up tags There are 3 types of tags: IO implicit tags - These point to data within IO messages Explicit message tags - These use Ethernet/IP explicit messages to exchange data with the device Rockwell Symbolic tags - Browse a Rockwell PLCs or type in the tag name to exchange data with a Rockwell PLC.

Add a new tag the usual way. The dialog that comes up will look like: image

In the case above Symbolic tags are not supported, you'll see a message to indicate this. If we try a device that does support symbolic tags, the device must be "enabled" in the device setup tab. If it is not, you will see this message telling you to enable the device: image

Here is an example of a device that supports symbolic tags and is enabled: image

The list of tags is a tree view. There will always be a "Global Tags" view, this represents the global variables tags on the Rockwell PLC. Additional program tags will be shown, a branch for each program.

NOTE: For Micro800 devices, only Global variable tags are supported (this is a device limitation, for both real and simulator). As I've only an Micro800 simulator to test with, I have not tested program tags. Please report back.. In some cases not all global tags will be returned by the device (this may or may not be a limitation of the simulator). You can always manually enter the tag name in the Address field.

When you select a tag from the list, the Address and Type field are filed in. If you do not see the tag in the list, enter the name manually in the Address field and set the Type.

This is what the tags look like in the Rockwell Connected Components Workbench:

image

Here are some examples of Symbolic tags created from the above PLC: (digital output 2) image

(global variable named "Greg" of type string) image

(global variable named "GregArray", index 3 array indexes are 1 based!, array of unsiged bytes) image

In CCW this looks like: image

continued in reply

greg9504 commented 1 month ago

And here are the values: image

How to define tag that references an IO message Select Tag Type as Assembly I/O image

When you do, there will be a drop down list of IO messages/tables to select from. Select one that you configured on the device setup panel previously.

You then need to define if this is a single bit or a 16bit word value that you want to read from the IO message and the offset of that bit/word. The offsets are 0 based. A bit value will have both a byte offset and a bit offset into the byte (0..7).

You then specify if tag will be used to read or write the value.

Explicit Messages You can send Ethernet Explicit messages - message defined by Class/Instance/Attribute using getAttributeSingle/setAttributeSingle Ethernet/IP messages - to get and set values on the device. image

Refer to your device manuals for explicit message Class/Instance/Attribute values. Enter the values, then chose whether this tag will be used for getting (getAttributeSingle) and setting the value or setting only (setAttributeSingle). There is a text field where you can enter HEX formatted (2 character, no 0x, spaces OK) string of bytes that should be appended to the message. This is useful if your device requires additional information beyond the Class/Instance/Attribute, otherwise leave this blank.

That covers using the plugin.

Notes: I have tested with: Banner Engineering XS26 Safety Controller (IO and Explicit get messages) SEW MDX61B VFD (IO and Explicit get/set messages) Rockwell Micro850 Simulator using Connected Components Workbench version 22.00 (Symbolic tags)

Looking for people to test with other devices. Hopefully someone with a Rockwell PLC.

If you know how to build from source you can find it here: https://github.com/greg9504/FUXA/tree/ethernetipfull