Code Monkey home page Code Monkey logo

mcprotocol's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mcprotocol's Issues

NodeRed crash, when setting MC connection

I AM SORRY, I MADE MISTAKE. THIS WAS MENT FOR node-red-contrib-mcprotocol

BUT MAYBE YOU CAN CHECK THIS ISSUE, SINCE IT USES YOUR LIBRARY?

Every time I set connection parameters NodeRed crashes.
When I restart service, everything works as expected.

Some info for debugging - from start of node-red to crash, when I changed setting of connection node (PLC connection)
PLEASE NOTE I use port 6551, this is not a mistake or error.

`
27 Jan 16:36:49 - [mcprotocol] adding new connection to pool ~ mcprotocol: {host:'10.144.240.22', port: 6551}
[2021-01-27T15:36:49.833Z 793782 ] 'plcType' set is A
[2021-01-27T15:36:49.839Z 799843 10.144.240.22]
27 Jan 16:36:49 - [info] Started flows
27 Jan 16:36:49 - [mcprotocol] connected ~ mcprotocol: {host:'10.144.240.22', port: 6551}
27 Jan 16:36:51 - [warn] Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)
27 Jan 16:37:29 - [info] Stopping modified nodes
27 Jan 16:37:29 - [mcprotocol] closing connection ~ mcprotocol: {host:'10.144.240.22', port: 6551}
27 Jan 16:37:29 - [mcprotocol] deleting connection from pool ~ mcprotocol: {host:'10.144.240.22', port: 6551}
27 Jan 16:37:29 - [info] Stopped modified nodes
27 Jan 16:37:29 - [info] Starting modified nodes
27 Jan 16:37:29 - [mcprotocol] adding new connection to pool ~ mcprotocol: {host:'10.144.240.22', port: 6551}
[2021-01-27T15:37:29.569Z 529683 ] 'plcType' set is A
[2021-01-27T15:37:29.570Z 530977 10.144.240.22]
27 Jan 16:37:29 - [info] Started modified nodes
27 Jan 16:37:29 - [mcprotocol] error ~ mcprotocol: {host:'10.144.240.22', port: 6551}: Error: connect ECONNREFUSED 10.144.240.22:6551
Error: connect ECONNREFUSED 10.144.240.22:6551
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1138:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '10.144.240.22',
port: 6551
}
Error: connect ECONNREFUSED 10.144.240.22:6551
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1138:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '10.144.240.22',
port: 6551
}
[2021-01-27T15:37:29.591Z 551323 10.144.240.22] We Caught a connect error ECONNREFUSED
27 Jan 16:37:29 - [mcprotocol] connection closed ~ mcprotocol: {host:'10.144.240.22', port: 6551}
27 Jan 16:37:29 - [error] [MC Write:Zapiši v PLC] Error: Not connected!
27 Jan 16:37:30 - [error] [MC Write:Zapiši v PLC] Error: Not connected!
27 Jan 16:37:31 - [red] Uncaught Exception:
27 Jan 16:37:31 - Error: read ECONNRESET
at TCP.onStreamRead (node:internal/stream_base_commons:213:20)

`
Regards,
Jinx

The value of "offset" is out of range.

angeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 1. Received 2
at boundsError (internal/buffer.js:49:9)
at Uint8Array.readUInt8 (internal/buffer.js:213:5)
at processMBWriteItem (/home/pi/Downloads/mcprotocol-master/mcprotocol.js:1358:27)

Problem Resolved by changing at line 1358 in MCprotocol.js file:
1358: writeResponse = theData.readUInt8(1);

Please update node descriptions

I AM SORRY, I MADE MISTAKE. THIS WAS MENT FOR node-red-contrib-mcprotocol

Hi,
It would be nice if you can update node "How to use" description with some examples.
These are my recomendations.

### READING VALUES from PLC:

SETTING MC-READ node
use msg.topic as address

HOW TO READ VALUES:
Trigger function node with this settings to get values of X0 ... X15 inputs.
In this example X0 is the first address to read, 16 is length of data to receive
msg.topic="X0,16" msg.payload="" //To nima vpliva return msg;

### WRITING VALUES to PLC:

SETTING MC-WRITE node
use msg.topic as address
use msg.payload as values to write into PLC

HOW TO WRITE VALUES:
Trigger function node with settings like this
//1st option is using address with length --> define as many values as stated in address length (in my example 2 is length msg.topic="D552,2" msg.payload = [666,777] //2nd option is using address array and values array msg.topic=["D552","D558"] msg.payload = [666,777] //3rd option - setting only one value - address is string, value is number msg.topic="D552" msg.payload = 1234
Regards,
Jinx

Connection Timed out

Hey, I can set up the connection with the device on an specific ipadress and port (5556).
However,
I get an error mentioning 'Timed out' as can be seen from the screenshot

My code is displayed as well.

Let me know if this is an issue with the PLC configuration or improper addressing of the data.
Test.txt
Capture

Question about mcprotocol.js writing to X017

Hi

Firstly, thank you for developing this interface. It is very useful.

I have an FX3U-64M with an FX-ENET-ADP. I was testing the writing of X017 and based on the manual for FX-ENET-ADP the MC code should be:
00 FF 0A 00 11 00 00 00 20 58 01 00 10

However, mcprotocol.js seems to be writing the code:
00 FF 0A 00 0F 00 00 00 20 58 01 00 10

and it works. Can you let me know how does "X017" translate to the fifth hex character to be "0F" instead of "11"? "11" is the hex representation of 17.

Thanks!

type L

Hello,
I'm using your driver, I really appreciate it.
I did little implementation and I use a workaround because I suffer a small memory problem (I restart the process every minute, i'm continuosly reading a lot of values), but it suite my needs.

A question: I would like to use also L type (as Y,X and M that works), I've tried to implement by myself without results, do you have some hints?
thanks a lot for your job

Ale

Timeout should be number - my sollution

I AM SORRY, I MADE MISTAKE. THIS WAS MENT FOR node-red-contrib-mcprotocol

Hi,
when setting timeout in settings I get error when I deploy, that timeout should be number not string ie "1000".

Sollution (in my opinion):
in file connection.js I use function Number() to tell this variable is getting number, not string.
this.options.timeout = Number(config.timeout) || 1000;
Best regards,
Jinx

collaboration opportunity (node-red-contrib-mcprotocol)

Hello PLCPeople / Dana?

I emailed you a few days back - perhaps you didnt see it? I have instead raised an issue just in case.

I have used your mcprotocol code in my node-red node node-red-contrib-mcprotocol for quite some time. I have only recently published this node but I would like to say, it has been running successfully, talking to a range of Mitsi PLCs for about 1 year.

Initially, I embedded your code (complete with original licence and full credit in the readme) and over this last year I have made extensive changes to your original code.

Most of this development was all before I fully understood the whole github arena & thus it is has many many changes I couldn't possibly hope to offer as individual PRs.

In an effort to rectify this, I have created a fork of https://github.com/plcpeople/mcprotocol here --> https://github.com/Steve-Mcl/mcprotocol and added all my private changes with the major changes under the commit message...

  • mass update including UDP support, 3E, 4E and more ...
    • Add UDP support (million times more stable than mitsi TCP)
    • Add read() + write() functions for simple operations
    • Support A, QnA, Q and L series
    • add routing capability
    • add enumerations for device codes, ranges, limits etc
    • add debug levels

It is ultimately my intention to split the embedded mcprotocol code out of the node-red node & point it back to a separate mcprotocol library (be that my fork or your original works).

I wonder - rather than having 2 separate implementations, if it would be beneficial if this were a collaboration?

Are you intending on progressing the development of your implementation or should I simply continue to maintain my own fork? Please note, you are obviously welcome to take anything I have implemented back over to this original.

Let me know your thoughts, Steve.

Fx5-U Connection Issues

Hello,
I tried to connect FX-5U with mcprotocol. (With default ethernet configuration)
Connected but timeout occured. (Port 1280 used)
When I try to add SLMP and port 1281 connection refused.
What can I do for connection?
thank you.

--default configuration full output --
osboxes@osboxes:~/Desktop/plc$ node index.js
[13654,472511518] Initiate Called - Connecting to PLC with address and parameters:
[13654,474872590] { port: 1280, host: '192.168.11.253', ascii: false }
[13654,476336891] Connection cleanup is happening
[13654,476448689 192.168.11.253] Clearing read PacketTimeouts
[13654,476540692 192.168.11.253] Clearing write PacketTimeouts
[13654,477061769 192.168.11.253]
[13654,477157964 192.168.11.253] Attempting to connect to host...
[13654,479260801 192.168.11.253] TCP Connection Established to 192.168.11.253 on port 1280
[13654,479759896] Translation OK
[13654,479902438 192.168.11.253] Reading All Items (readAllItems was called)
[13654,480222241 192.168.11.253] Adding or Removing { arg: [ 'TEST1' ], action: 'add' }
[13654,480343069 192.168.11.253] Adding TEST1
[13654,481492403 192.168.11.253] Clearing read PacketTimeouts
[13654,481623624 192.168.11.253] Calling SRP from RAI
[13654,481789472 192.168.11.253] SendReadPacket called
[13654,481951201] We're Binary
[13654,482263745] The Returned MC Buffer is:
[13654,482325446] <Buffer 01 ff 0a 00 00 00 00 00 20 4d 01 00>
[13654,482583582] The returned buffer length is 12
[13654,482715223] The final send buffer is:
[13654,482768884] <Buffer 01 ff 0a 00 00 00 00 00 20 4d 01 00>
[13654,483404295] Sending Read Packet SEQ 2
[13658,989687579 192.168.11.253] PacketTimeout called with type read and seq 2
[13658,989849586 192.168.11.253] READ TIMEOUT on sequence number 2
[13658,990198258 192.168.11.253] ReadResponse called
[13658,990618274] Timeout error - zero length packet
[13658,990728828 192.168.11.253] Read Time is 4 seconds and 508.9 ms.
[13658,990995231 192.168.11.253] Every packet done sending
[13658,991520979] Logging a Bad Quality thePointer 0
[13658,991625825] Logging a Bad Quality thePointer 0
[13658,991704333] Logging a Bad Quality thePointer 0
[13658,991773858] Logging a Bad Quality thePointer 0
[13658,991837977] Logging a Bad Quality thePointer 0
[13658,991892822 192.168.11.253] Address M0,5 has value false,false,false,false,false and quality BAD 255,BAD 255,BAD 255,BAD 255,BAD 255
[13658,991984928 192.168.11.253] We are calling back our readDoneCallback.
SOMETHING WENT WRONG READING VALUES!!!!
{ TEST1: [ 'BAD 255', 'BAD 255', 'BAD 255', 'BAD 255', 'BAD 255' ] }
-- end output --

It works with FX PLC also

Hi,
I can confirm I was able to use this node also to communicate with FX3U PLC. I didn't do a stress test.
I use these settings:
-FRAME: 1E
-PROTOCOL: TCP
-PLC Type: A

These settings are not set (default)
-Network No
-PC No
-Dest Module
-Dest Module Stn No

Regards,
Jinx

Node-red can't reconnection PLC.

I want to assume a situation if the PLC goes off for 1 minute and it starts working again. Node-red can't reconnection PLC. Node-red still say "Error: Not connected!"

Not reading High Number of tags.

Hi there , I am trying to read 284 tag at a time . It is only responding only in case D all address, X comes Bad 255 ,Y comes Bad 255,
M comes Bad 255..
Later then made 8-8 tag array and read and removeItem() . But it makes slow my reading and also some are not readable now. Some shows Bad 255.
Please Help
Capture
.

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.