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
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
| Item | Description | |
|---|---|---|
| Master | TotalSentCnt | Total frames sent |
| TotalRecvCnt | Total frames received | |
| TimeoutCnt | Frame receive timeout count | |
| DiscardPDOCnt | Process data receive discard count | |
| NetDelay | Network propagation delay time | |
| CRCErrCnt | CRC error frames received | |
| Slave | Result | Acquisition result |
| NodeAdr | Node address | |
| PortNum | Number of ports | |
| ErrCnt[0] - [3] | Error counter per port |
What Is a BI Tool?
Software that analyzes and visualizes various kinds of data
| Paid / free | Product name | Vendor |
|---|---|---|
| Partly paid | Microsoft PowerBI Desktop | MicroSoft |
| Google Data Studio | ||
| 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
| PLC | OMRON NJ/NX series with database connection, CPU unit Ver. 1.64 or later Sysmac Studio Ver. 1.56 or later |
| DataBase | SQLServer |
| BI tools | Microsoft 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 | Column name | Data type |
|---|---|---|
| MasterStat | RecDT | datetime |
| TotalSentCnt | numeric(10,0) | |
| TotalRecvCnt | numeric(10,0) | |
| TimeoutCnt | numeric(10,0) | |
| DiscardPDOCnt | numeric(10,0) | |
| NetDelay | numeric(10,0) | |
| CRCErrCnt | numeric(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 | Column name | Data type |
|---|---|---|
| SlaveStat | RecDT | datetime |
| Result | numeric(10,0) | |
| NodeAdr | numeric(5,0) | |
| PortNum | numeric(3,0) | |
| ErrCnt0 | numeric(3,0) | |
| ErrCnt1 | numeric(3,0) | |
| ErrCnt2 | numeric(3,0) | |
| ErrCnt3 | numeric(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
| Master | EC_GetMasterStatistics |
| Slave | EC_GetSlaveStatistics |
Processing
EC_GetMasterStatistics and EC_GetSlaveStatistics are executed periodically and the results are inserted into the database with a date/time

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