Open patbou74 opened 5 years ago
Realise this issue was opened nearly 2 years ago. If I understand your problem correctly, your issue is that you have 2 clients accessing the same PLC via FINS and data is not ending up at the right place. I think this can be resolved by each node using a different SA1 number in the header, see lib/constants.js. This is what I do for different IP address accessing the same PLC
From the Omron manual: SA1 Source node number. Specify within the following ranges. 01 to 7E: Node number in SYSMAC NET network (1 to 126 decimal) 01 to 3E: Node number in SYSMAC LINK network (1 to 62 decimal) FF: Broadcast transmission
I don't think this is possible.. The 2 nodes which query at the same time are on the same computer (multiple parallel requests). But the problem is with Omron. On the other hand, the nodes do not validate the SID to which they receive the information, after having emitted their requests. This is the point I wish to underline. If they validated it, I would never have been able to see the problem.
I have read the following article. It goes in the same direction. https://github.com/ptrks/node-omron-fins/issues/12
I faced this exact same issue today: I have two different applications running on the same computer and accessing the same PLC, but just seconds after running they crashed with the message Unexpected SID 'XX' received. That was happening because one application was eventually receiving data that was meant to the other application, and the PLC was messing up the Dst Ports.
After following @CharlieMarshall 's suggestion and changing the SA1 parameter to 3 on one app and to 2 on the other app, the problem was solved, and data started going to the right place.
This is a problem of not validate the SID when returning information. In my example, 2 nodes (10.20.100.254) have two query to the controller (Omron CJ2M) at the same time (frame 281, 282). For a reason (bug of the manufacturer) that I do not know, the two answers will come to the second node, because the PLC replaced the Dst Port (frame 283). Since it does not validate the SID ... it is that it causes bad data on the node.
Frame 281. Src Port 51123, Dst Port 9600, SID 0xbc, Query 50 Data, Sent by node 1 Frame 282. Src Port 33667, Dst Port 9600, SID 0Xbd, Query 10 Data, Sent by node 2 Frame 283. Src Port 9600, Dst Port 33667, SID 0Xbc, Answer 50 Data, Why PLC change Dst Port ??????????? I dont know ! But the node 2 was listening on this port Frame 284. Src Port 9600, Dst Port 33667, SID 0Xbd, Answer 10 Data, OK !, Receive by node 2
The plc should not change the port, but ... node-omron-fins not valide de Service ID (SID)
Originally posted by @patbou74 in https://github.com/patrick--/node-omron-fins/issues/12#issuecomment-442228733