Skip to content

bakerface/ll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ladder Logic Compiler

This node.js package provides methods for compiling and decompiling ladder logic programs.

Table of Contents

Installation

To install this application using the node.js package manager, issue the following commands:

npm install ladder-logic

ll.compile

Below is an example of how to use the compiler.

var ll = require("ladder-logic");

var program = ll.compile(
    "!! this is an example of a latch with an emergency stop !!\n" +
    "||--[/ESTOP]----[/STOP]----+--[START]--+------(RUN)-----||\n" +
    "||                         |           |                ||\n" +
    "||                         +---[RUN]---+                ||\n" +
    "||                                                      ||\n" +
    "||--[RUN]-------------------------------------(MOTOR)---||");

console.log(program);

/*
[ [ 'in', 'ESTOP' ],
  [ 'not' ],
  [ 'in', 'STOP' ],
  [ 'not' ],
  [ 'and' ],
  [ 'in', 'START' ],
  [ 'in', 'RUN' ],
  [ 'or' ],
  [ 'and' ],
  [ 'out', 'RUN' ],
  [ 'in', 'RUN' ],
  [ 'out', 'MOTOR' ] ]
*/

ll.decompile

Below is an example of how to use the decompiler.

var ll = require("ladder-logic");

var program = [
    [ 'in', 'ESTOP' ],
    [ 'not' ],
    [ 'in', 'STOP' ],
    [ 'not' ],
    [ 'and' ],
    [ 'in', 'START' ],
    [ 'in', 'RUN' ],
    [ 'or' ],
    [ 'and' ],
    [ 'out', 'RUN' ],
    [ 'in', 'RUN' ],
    [ 'out', 'MOTOR' ]
];

console.log(ll.decompile(program));

/*
||                                                 ||
||--[/ESTOP]----[/STOP]----+--[START]--+----(RUN)--||
||                         |           |           ||
||                         +--[RUN]----+           ||
||                                                 ||
||--[RUN]----(MOTOR)-------------------------------||
||                                                 ||
*/

About

Ladder Logic Compiler for node.js and the web

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published