Code Monkey home page Code Monkey logo

node-omron-fins's People

Contributors

adam8810 avatar awenchen avatar ceremcem avatar charliemarshall avatar danibjor avatar ptrks avatar

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

Watchers

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

node-omron-fins's Issues

Valide SID, Query / Answer

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)

image

image

image

image

Originally posted by @patbou74 in https://github.com/patrick--/node-omron-fins/issues/12#issuecomment-442228733

Bitwise read/write

As of now, there is no bitwise (bit by bit) read/write functions available.

Reading a bit is not so important because we can read a word and use desired bit inside the word, that might be handled in the application.

But writing a bit is a more complex operation (like database transactions) so it should be included/exposed by the library, possibly with a "dot notation" format:

client.write "C100.01", true/false

Reading other than memory area D

I tried to read data from memory area HR.

Googled around a bit and found HR to be 0x80.
I've updated the constants.js file to include HR area like this:

module.exports.MemoryAreas = {
    'H' : 0x80,
    'D' : 0x82
};

I've added a console.log(temp) to fins_client.js' _translateMemoryAddress function just to verify that MemoryArea is in fact set to 0x80.

I do a simple .read('H00300', 24) and do a console.log(msg) in the 'reply' event method:

{
  remotehost: '10.0.0.233',
  sid: 9,
  command: '0101',
  response: '0000',
  values: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] 
}

In Omron Sysmac Studio, we inspect the H3xx memory area and it dones not look like this. Values should be like [big integer, 0, 2, ...]

Any ideas?

Patch to read and write to return the sid

To be able to track multiple parallel requests, I simply added:
return self.header.SID;
to FinsClient.prototype.read and FinsClient.prototype.write.

It is possible to have this patch in the code?

Thank you.
GT

read from Memory

Hi guys
I have a question ?
I was able to connect to the PLC using this library, but I don't know how to read the information from the PLC and I get all zero.
The PLC is Omron NX1P2.
The photo below is the information inside the PLC on the software.
Please guide.
Thanks .
ScreenShot

mps problem if I use the electron library

Using the electron library when I run the application it gives me the following error:

(node:5664) UnhandledPromiseRejectionWarning: TypeError: Cannot set properties of undefined (setting 'mps')
(Use electron --trace-warnings ... to show where the warning was created)
(node:5664) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

The solution with which I solved this problem was to modify line 35 in the FinsSequenceManager.js file from
self.mpsCounter = this.mps = 0;
to
self.mpsCounter = 0;

Error: Not running when calling .read multiple times

var fins = require('omron-fins');
var port = 9600, ip = '192.168.250.1', options = {timeout: 10000};
var client = fins.FinsClient(port, ip);

// This does not read correctly
setTimeout(function(){
    client.read('D6029', 1);
}, 11000);

Results in this error:

/* The cases that do not read correctly give the following error
Missing error handler on `socket`.
Error: Not running
    at Socket._healthCheck (dgram.js:420:11)
    at Socket.send (dgram.js:272:8)
    at FinsClient.run (/var/lib/cloud9/MPFTraceServer/node_modules/omron-fins/lib/fins_client.js:324:17)
    at Socket.objCurrCycleTraceData.objProductionQty.SID (/var/lib/cloud9/MPFTraceServer/app_cycle.js:42:16)
    at Socket.emit (events.js:95:17)
    at Socket.onevent (/var/lib/cloud9/MPFTraceServer/node_modules/socket.io/lib/socket.js:330:8)
    at Socket.onpacket (/var/lib/cloud9/MPFTraceServer/node_modules/socket.io/lib/socket.js:290:12)
    at Client.ondecoded (/var/lib/cloud9/MPFTraceServer/node_modules/socket.io/lib/client.js:193:14)
    at Decoder.Emitter.emit (/var/lib/cloud9/MPFTraceServer/node_modules/socket.io/node_modules/socket.io-parser/node_modules/component-emitter/index.js:134:20)
    at Decoder.add (/var/lib/cloud9/MPFTraceServer/node_modules/socket.io/node_modules/socket.io-parser/index.js:247:12)
*/

How to write chars?

Hi,

thanks for sharing your work.
May I ask if and how is possible to write chars in a DM? What's the correct approach?
I know that I can store 2 chars per each DM, one in the MSB and one in the LSB.

Thanks

License for the project?

Noticed you haven't assigned a license for the project yet, from my experience it definitely gets more complicated over time as you have more contributors/copyright holders. Also, some people may not be able to contribute because of employer IP agreements if a license isn't assigned (I'm in this boat).

If you are going for open-source, Github's licensing site has good advice: https://opensource.guide/legal/, https://choosealicense.com/

Looking forward to contributing to the project!

express API implementation

I'm not sure if this is the rigth place for a question...
can anyone help me with using this wonderful library in a express api


const express = require('express');
const router = express.Router();
var fins = require('../lib/index');

var client = fins.FinsClient(9600, '172.16.103.125');//plc address

router.get('/', (req, res) => {
res.send('data from PLC');//here I'd like to send back to the client the values from the PLC
});

omron-fins use with node-red

I'm also not sure if this is the rigth place for my question...
I'm a newbie with Raspberry pi and node red.
Please can anyone help me using this wonderful library in node-red?

Multiple address read?

Is it possible to read on multiple address?
For example:
.read(['D00000', 'D12345', 'D32145']);

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.