jsonopc

1.0.0 • Public • Published

jsonopc

A sample library that implements a simple interface using JSON between NodeJS and PLCs using OPC.

Prerequisites

  1. OPC .NET API 2.00 Redistributables.msi.
  2. MatrikonOPC Server

Usage

var jsonopc = require('jsonopc').Opc;

var host   = 'localhost',
    server = 'Matrikon.OPC.Simulation.1';

jsonopc.connect(host, server, function (err, opc) {
    
    // Create tag value request
    var request = {
        plc1: {
            Int4: 'Random.Int4'
        },
        plc2: {
            Int5: 'Random.Int5'
        }
    };
    
    // Retrieve tag values
    opc.get(request, function (data) {
        
        console.dir(data);
        
        // Close connection to OPC server
        opc.end();
    });
});

Notes

Although possible, this library does not currently support setting PLC tag values, only retrieving.

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i jsonopc

    Weekly Downloads

    0

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    20.6 kB

    Total Files

    8

    Last publish

    Collaborators

    • vvvzhangshuo