Skip to content

fingerskier/plc_logger

Repository files navigation

plc_logger

Logs PLC data

This tool requires

  • Node.js: It is free and used widely in a variety of industries.
  • honcho: Also free, library for connecting to Profinet devices (S7, ABB, Mit, etc.).

Three files are required in addition to installing Node.js: plc_logger.js | Do not edit this file!!! log.cmd | The shell script. *.json | Configuration settings - edit this file.

NOTE: the three log.* files can be named anything, as long as the file-names begin the same. e.g. flarn.cmd, flarn.json, flarn.pts

The *.cmd file: You should only edit the 3rd line of this script: node plc_logger.js log > log_%mydate%_%mytime%.dat Change 'log' to whatever your project name is. This name should match the three file-names (as stated above).

Edit the log.cmd file (or copy it) with the following format:

node index.js <project-name> <IP_address> > <output_file>

Look in log.cmd for an example. You can run this directly from the command-line as well. You can also create a separate batch file for multiple groups of points and run them in separate command-line windows.

The *.json file: This is the main configuration. Edit the values herein accordingly.

Note that _honcho_ relies on other packages dependent on the type of controller:
	Siemens - [nodes7](https://github.com/plcpeople/nodeS7)
	Allen Bradley - [nodepccc](https://github.com/plcpeople/nodepccc)
	Mitsubishi - [mcprotocol](https://github.com/plcpeople/mcprotocol)

Examples of valid point addresses: TEST1=M32.2 // Bit at M32.2 TEST3=M20.0 // Bit at M20.0 TEST4=DB1,REAL0.20 // Array of 20 values in DB1 TEST5=DB1,REAL4 // Single real value TEST6=DB1,REAL8 // Another single real value TEST7=DB1,INT12.2

Every point address must have a corresponding entry in the mappings files.

Examples of valid point mappings:
```
{
	"TEST1": { "tagsets":["status"] },
	"TEST3": { "tagsets":["status"] },
	"TEST4": { "tagsets":["status"] },
	"TEST5": { "tagsets":["status"] },
	"TEST6": { "tagsets":["status"] },
	"TEST7": { "tagsets":["status"] }
}
```

Multiple Logs: This project does not implement the 'tagset' feature. To get logs of different groups of tags simply create copies of the three files, edit them accordingly, and run in a separate process.

TEST1=M32.2 // Bit at M32.2

TEST3=M20.0 // Bit at M20.0

TEST4=DB1,REAL0.20 // Array of 20 values in DB1

TEST5=DB1,REAL4 // Single real value

TEST6=DB1,REAL8 // Another single real value

TEST7=DB1,INT12.2

Every point address must have a corresponding entry in the mappings files.

Examples of valid point mappings:

{

"TEST1": { "tagsets":["status"] },

"TEST3": { "tagsets":["status"] },

"TEST4": { "tagsets":["status"] },

"TEST5": { "tagsets":["status"] },

"TEST6": { "tagsets":["status"] },

"TEST7": { "tagsets":["status"] }

}