日本語 English

EtherCAT diagnostics and statistics with BI tools

Overview

We periodically read EtherCAT diagnostic and statistical information and visualize it with BI tools

The goal is to show the error count of each port and its history for each node
Power BI screen showing EtherCAT port error history

Flow from reading EtherCAT diagnostic and statistical information to displaying it in a BI tool

What Is EtherCAT Diagnostic and Statistical Information?

The diagnostic and statistical information held by the EtherCAT master and slaves contains the following

Benefits of monitoring EtherCAT diagnostic information

  • Long-term monitoring of communication quality
  • Early detection of noise and poor contacts
  • Detecting signs before equipment stops
  • Use as maintenance data
EtherCAT diagnostic and statistical information
ItemDescription
MasterTotalSentCntTotal frames sent
TotalRecvCntTotal frames received
TimeoutCntFrame receive timeout count
DiscardPDOCntProcess data receive discard count
NetDelayNetwork propagation delay time
CRCErrCntCRC error frames received
SlaveResultAcquisition result
NodeAdrNode address
PortNumNumber of ports
ErrCnt[0] - [3]Error counter per port

What Is a BI Tool?

Software that analyzes and visualizes various kinds of data

BI tools
Paid / freeProduct nameVendor
Partly paid Microsoft PowerBI Desktop MicroSoft
Google Data Studio Google
Qlick Sense Desktop Qlik
Zoho Analytics SOHO Japan Co., Ltd.
Open source
(free)
Pentaho Pentaho / Hitachi
Grafana Grafana Labs
Metabase Metabase project
Kibana Elastic
Graylog Graylog
Redash Redash
Apache Superset Airbnb

Used here

Configuration

The ECAT diagnostic and statistical information acquired by the PLC is inserted into a DB and analyzed on a PC with a BI tool
EtherCAT diagnostic information collection system configuration diagram

PLCOMRON NJ/NX series with database connection, CPU unit Ver. 1.64 or later
Sysmac Studio Ver. 1.56 or later
DataBaseSQLServer
BI toolsMicrosoft Power BI Desktop
or Metabase

Create the DB tables

Create the following two tables

Table for EtherCAT master diagnostic and statistical information

A date/time field is added to the diagnostic and statistical data acquired by the PLC before saving

Table name = MasterStat
Table nameColumn nameData type
MasterStatRecDTdatetime
TotalSentCntnumeric(10,0)
TotalRecvCntnumeric(10,0)
TimeoutCntnumeric(10,0)
DiscardPDOCntnumeric(10,0)
NetDelaynumeric(10,0)
CRCErrCntnumeric(10,0)

SQL to create the table

-- SQLServer Query Create Table
create table MasterStat(
RecDT datetime NOT NULL,
TotalSentCnt numeric(10, 0) NULL,
TotalRecvCnt numeric(10, 0) NULL,
TimeoutCnt numeric(10, 0) NULL,
DiscardPDOCnt numeric(10, 0) NULL,
NetDelay numeric(10, 0) NULL,
CRCErrCnt numeric(10, 0) NULL,

CONSTRAINT PK_MasterStat_1 PRIMARY KEY CLUSTERED(RecDT)
);
	

Table for EtherCAT slave diagnostic and statistical information

A date/time field is added to the diagnostic and statistical data acquired by the PLC before saving

Table name = SlaveStat
Table nameColumn nameData type
SlaveStatRecDTdatetime
Resultnumeric(10,0)
NodeAdrnumeric(5,0)
PortNumnumeric(3,0)
ErrCnt0numeric(3,0)
ErrCnt1numeric(3,0)
ErrCnt2numeric(3,0)
ErrCnt3numeric(3,0)

SQL to create the table

-- SQLServer Query Create Table
create table SlaveStat(
RecDT datetime NOT NULL,
Result numeric(10, 0) NULL,
NodeAdr numeric(5, 0) NOT NULL,
PortNum numeric(3, 0) NULL,
ErrCnt0 numeric(3, 0) NULL,
ErrCnt1 numeric(3, 0) NULL,
ErrCnt2 numeric(3, 0) NULL,
ErrCnt3 numeric(3, 0) NULL,

CONSTRAINT PK_SlaveStat_1 PRIMARY KEY CLUSTERED(RecDT, NodeAdr)
);
	

PLC processing

Getting EtherCAT diagnostic and statistical information

EtherCAT diagnostic and statistical information is acquired with the following instructions

Table name = SlaveStat
MasterEC_GetMasterStatistics
SlaveEC_GetSlaveStatistics

Processing

EC_GetMasterStatistics and EC_GetSlaveStatistics are executed periodically and the results are inserted into the database with a date/time

Ladder program for EC_GetMasterStatistics and DB insert processing
(this ladder contains no error handling)

Explanation

Table name = SlaveStat

By block
BlockDescription
0While LogEnable is ON, LogRec turns ON every minute
1Executes EC_GetMasterStatistics and EC_GetSlaveStatistics to get EtherCAT diagnostic and statistical information
2Creates the database-processing flag
3Database connection processing
4Creates a record to add from the EtherCAT master diagnostic and statistical information with date/time data attached
5Maps the MasterStat table to the record to add (MasterStatTbl)
6Executes Insert
7Creates records to add from the EtherCAT slave diagnostic and statistical information with date/time data attached
Line 3Repeats until a node address of 0 appears in the read SlaveStat
Lines 6-13Creates a new record from the read information with date/time attached
Line 17Stores it in prevSlaveStat as the previous value
8Maps the SlaveStat table to the records to add (SlaveStatTbl)
9Executes BatchInsert
10Gets the connection status (ConnectionStatus) for debugging
11Disconnects from the database on normal completion of BatchInsert

BI Tool Settings

For Power BI Desktop

For Metabase

Download

If you found this site helpful, your support would be greatly appreciated

Comments