5. Database Communication
After enabling database communication and turning on the automatic data collection task for the target machine/group (see the Bivrost Gateway Manual 5.3.1.2. Task Settings, and 5.4.1.2. Group Task Settings), the gateway will automatically write the data collection task results to the specified database. Currently supported database types include InfluxDB v2.x, MySQL, SQL Server, PostgreSQL, and others. Refer to the Bivrost Gateway Manual 5.6.4. Database Configuration for instructions on configuring the database service.
Database table names take the form [table prefix][data class], where the table prefix is set on the gateway’s communication configuration page (see the Bivrost Gateway Manual 5.6.4. Database Configuration); the table name is the same as the type of the data class used in MQTT communication (see 1.2. Data Description). The table below shows the names of each database table (using a MySQL database with no table prefix set and log storage mode as an example):
| Table Name | Data Class |
|---|---|
| alarmhistory | AlarmHistory |
| alarmlog | AlarmLog |
| cncstatus | CNCStatus |
| count | Count |
| currenttoolnumber | CurrentToolNumber |
| cycle | Cycle |
| energyconsum | EnergyConsum |
| feedandspindle | FeedAndSpindle |
| groupcount | GroupCount |
| groupcumulativetime | GroupCumulativeTime |
| groupoee | GroupOEE |
| load | Load |
| loghistory | LogHistory |
| machine | — (Machine information table) |
| oee | OEE |
| offset | Offset |
| plc | PLC |
| position | Position |
| programblock | ProgramBlock |
| programinfo | ProgramInfo |
| timedata | TimeData |
| toollife | ToolLife |
The fields in each database table are the same as the tags and fields of the corresponding data class type (see 1.2. Data Description). The table below shows the fields of the cncStatus table (using a MySQL database with no table prefix set and log storage mode as an example):
| # | Name | Data Type | Length/Decimal Point |
|---|---|---|---|
| 1 | id | BIGINT | 20 |
| 2 | cncStatus | TEXT | |
| 3 | adjustedStatus | TEXT | |
| 4 | alarmStatus | TEXT | |
| 5 | alarmLevel | TEXT | |
| 6 | offTime | BIGINT | 20 |
| 7 | waitTime | BIGINT | 20 |
| 8 | emergencyTime | BIGINT | 20 |
| 9 | autoRunTime | BIGINT | 20 |
| 10 | manualTime | BIGINT | 20 |
| 11 | channel | VARCHAR | 128 |
| 12 | machineID | VARCHAR | 128 |
| 13 | time | DATETIME | 3 |
| 14 | uid | VARCHAR | 128 |
