Skip to content

A Lightweight Ethernet/IP API written to interface with Rockwell ControlLogix/CompactLogix Controllers.

License

Notifications You must be signed in to change notification settings

NodeRich/node-ethernet-ip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node Ethernet/IP

A simple-lightweight node based API for interfacing with Rockwell Control/CompactLogix PLCs.

Prerequisites

latest version of NodeJS

Getting Started

Install with npm

npm install ethernet-ip --save

The API

Detailed Documentation Coming Soon...

Demos

  • Simple Demo

Simple Demo

const { Controller, Tag, EthernetIP } = require("ethernet-ip");

const { SINT, INT, DINT, REAL, BOOL } = EthernetIP.CIP.DataTypes.Types;

// Intantiate Controller
const PLC = new Controller();

// Instantiate some Tag Instances
const tag1 = new Tag("TEST_TAG"); // Controller Scoped
const tag2 = new Tag("TEST", "Prog"); // Locally Scoped in Program "Prog"
const tag3 = new Tag("TEST_REAL", "Prog");
const tag4 = new Tag("TEST_BOOL", "Prog");

// build tag array
const group = [tag1, tag2, tag3, tag4];

// Connect to PLC at IP, SLOT
PLC.connect("10.1.60.205", 5).then(() => {
    const { name } = PLC.properties;

    // Log Connected to Console
    console.log("\n\nConnected to PLC", `${name}`.green.bold, "...\n");

    // Read Each Tag in group every 50ms
    const interval = setInterval(async () => {
        for (let tag of group) {
            await PLC.readTag(tag);
        }
    }, 50);
});

// Subscribe to each tag's "Changed" Event
for (let tag of group) {
    tag.on("Changed", (tag, lastValue) => {
        console.log(`${tag.name} changed from ${lastValue} -> ${tag.value}`);
    });
}

Built With

Contributers

License

This project is licensed under the MIT License - see the LICENCE file for details

About

A Lightweight Ethernet/IP API written to interface with Rockwell ControlLogix/CompactLogix Controllers.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%