plcpeople / mcprotocol

node.js implementation of the MC (MELSEC communication) protocol to exchange data with Mitsubishi FX programmable controllers.
MIT License
99 stars 40 forks source link

type L #1

Open kevino83 opened 6 years ago

kevino83 commented 6 years ago

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

kevino83 commented 6 years ago

I searched with no results in java and net driver, they address type like 0x9C,0x90 (or 0x92 for L type), I didn't find anything similar in mcprotocol. I also added case "L": theItem.areaMCCode = 0x4c20; in stringToMCAddr with no consistent results, I lack a lot of knowledge

plcpeople commented 6 years ago

Sorry, I have been travelling for work. I will have a look later today or this weekend.

kevino83 commented 6 years ago

Really thanks for your reply and your help, I would like to reciprocate

plcpeople commented 6 years ago

I looked at the MC protocol reference manuals I have (for the Q series and the FX3U series) and those PLCs don't seem to support reading L type directly, which is why it is not in the code already. What type of PLC are you using? Are these the latch relays?

IF you are using a type that does support reading the L type directly, and if 0x4c20 is the correct type, you'd have to add it in a few spots:

Please try that and let us know how it works, or what error you receive if it does not. If it does work, I would like to include in the documentation what type of PLC it has been tested with and would welcome a pull request. I think it's only these 3 spots that need changing but there may be more, if this doesn't work I will take a closer look.

kevino83 commented 6 years ago

Hello and thanks, I'm using a Q series, with the old activeX driver we also use the L type (latch relays). The implementation that you suggest is the same I used. I'm not 100% sure about 0x4c20 but i think it's correct (like 0x4d20 for M type).

I encounter error in both reading and writing :( During read the error is that the second byte is not 0x00 (processMBPacket())

I have to admint that studing your driver I don't undersant it completly

Ale

plcpeople commented 6 years ago

I did a bit more reading on this. According to the MC protocol manual for the Q series (http://dl.mitsubishielectric.com/dl/fa/document/manual/plc/sh080008/sh080008x.pdf), it looks like latch relays can't be read as "L" using the A compatible 1E frames that are used with this driver. If the other driver is using 0x92 as a type code, that is likely the QnA compatible 3E/4E/5E frames which is basically a different communication protocol and would involve a full rewrite of this project in order to support that. But on page 398 of the link it does say that you may be able to access L relays as M relays using this driver, so to access "L100" you would use the driver to request "M100" and that may work.

If not, I don't think this driver will be ever able to read latch relays directly.

Also - I am curious what memory problems you had?

kevino83 commented 6 years ago

1) thanks, really. I will try the Mxxx way tomorrow and let you know

2) after 20/30 minutes I have to kill the process and restart it because memory start to increase, I use a child process only for plc connection.

kevino83 commented 6 years ago

I 've tried with no results, pointing to L as M it returns M results. The range of type M in Q series is 0-8191 and L 0-2k, they overlap. I also tried to call M8192 (thinking that differents type can queue in M call) but got BAD 255.

Maybe I will implement 4E in node or golang (not soon)

Thanks for your support and patience Alessandro

ChiuYuanJiun commented 5 years ago

Can you modify this node program for me. Let it can be used on Node-RED . If you are convinent please contact me . my email : n7336@ms29.hinet.net

plcpeople commented 5 years ago

We did not write any of the DLLs or C++ code mentioned in any of the documentation so that is not something that we can really help with, sorry. The FX3U-ENET-ADP manual (http://dl.mitsubishielectric.com/dl/fa/document/manual/plc_fx/jy997d45801/jy997d45801f.pdf) lists some basic VS code samples for the MC protocol that are probably a good starting point but that's the best we can do.