MES Integration Series · Part 2
Machine Data Mapping and MES Database Structure
How do PLC tags become fields in the MES database?
A PLC tag called Cycle_Time becomes a field called cycle_time_sec in the MES, with a unit, a data type and a rule for what is a valid value. This page lets you map and check a record yourself, shows a simple MES database and the SQL behind it, and answers questions from sample data. The example tags and values are not from a real plant.
The PLC or controller collects the machine data. The edge gateway maps it to the MES fields and checks it. The MES stores it in a database for live tracking, quality and traceability.
| PLC tag | Meaning | PLC type | MES field | Example |
|---|
Change the raw PLC values on the left. The gateway converts units and names, then the MES rules decide whether the record is accepted. The rules are the ones in the case: data type, value range, mandatory fields, timestamp order, duplicates, allowed values and completeness.
The tables follow the case: machines, production orders, production data, quality data and alarm events. Production data is the centre: each row belongs to one machine and one order, and quality and alarm rows point back to it. Pick a table to see its fields and the SQL that creates it. The design is an example; yours will depend on your MES.
The sample data below is generated for the demo (60 parts from two machines). The query runs on it as the MES would on its tables. Change the question to see the SQL and the answer.
| Time | Serial number | Result | Cycle time (s) |
|---|
The tiles and the table are computed from the same sample records as the query above. Change the machine to filter.
| Stage | Tools shown in the case | What they do here |
|---|
The tools are examples, not recommendations. Choose by what your team owns and what your machines and PLCs support.
The database is a simplified example. Design the real schema with the MES supplier or your database team, and keep units, data types and time zones consistent.