Configure the KPI service
This guide shows you how to configure the time-series you need for the KPI service. It does not suggest how to persist these values.
To learn how the KPI service works, read About KPI service. Example use cases include OEE and various performance metrics.
Prerequisites
Before you start, ensure you have the following:
- The KPI service installed
- An
equipmentHierarchy
is configured
Procedure
In short, to configure the KPI Service, the procedure works as follows:
- Persist machine state records to the
EquipmentState
table - Persist quantity records to the
QuantityLog
table - Persist job response data to the
JobOrderState
table - (Optional) Configure the calendar service to record planned downtime events and shift records to time series. Refer to Use work calendars
Record machine states
Every time an equipment changes state, it is persisted to the time-series table EquipmentState
.
EquipmentState
table schema
CREATE TABLE IF NOT EXISTS EquipmentState(
EquipmentId SYMBOL,
ISO22400State VARCHAR, -- ADOT, AUST, ADET, APT
time TIMESTAMP
) TIMESTAMP(time) PARTITION BY MONTH DEDUP UPSERT KEYS(time, EquipmentId);
This table shows a QuestDB specific schema. You may also add additional columns as required.
To use the service for another time-series DB, get in touch.
[
{
"EquipmentId": "Machine A",
"ISO22400State": "ADET",
"PackMLState": "Held",
"time": "2024-03-28T13:13:47.814086Z",
}
]
PackMLState
, to show that additional data can also be recorded.Record quantity records
You can persist two categories of quantity records:
- (Optional) Values generated by the machine.
- Final produced quantities (these should be categorised into
Good
,Scrap
, andRework
).
QuantityLog table schema
CREATE TABLE IF NOT EXISTS QuantityLog(
EquipmentId SYMBOL,
Origin SYMBOL, -- Machine, User
QtyType SYMBOL, -- Delta, RunningTotal (running total not currently supported)
ProductionType SYMBOL, -- Good, Scrap, Rework
Qty FLOAT,
time TIMESTAMP
) TIMESTAMP(time) PARTITION BY MONTH DEDUP UPSERT KEYS(time, EquipmentId, Origin, QtyType, ProductionType);
[
{
"EquipmentId": "Machine A",
"Origin": "Machine",
"QtyType": "Delta",
"ProductionType": "Unknown",
"Qty": 6,
"time": "2024-03-28T09:30:34.000325Z"
}
]
[
{
"EquipmentId": "Machine A",
"Origin": "User",
"QtyType": "Delta",
"ProductionType": "Good",
"Qty": 10,
"time": "2024-03-28T09:30:34.000325Z"
},
{
"EquipmentId": "Machine A",
"Origin": "User",
"QtyType": "Delta",
"ProductionType": "Scrap",
"Qty": 2,
"time": "2024-03-28T09:30:34.000325Z"
},
{
"EquipmentId": "Machine A",
"Origin": "User",
"QtyType": "Delta",
"ProductionType": "Rework",
"Qty": 1,
"time": "2024-03-28T09:30:34.000325Z"
}
]
Record job response records
Job response records persist to JobOrderState
and are used to identify the current planned cycle time of each part produced from the machine.
When an operation starts, a record is created setting the planned cycle time.
When the operation is finished, another record is created to reset the planned cycle time to 0.
JobOrderState table schema
CREATE TABLE IF NOT EXISTS JobOrderState(
EquipmentId SYMBOL,
JobOrderId SYMBOL,
PlanningCycleTime FLOAT, -- Number of seconds per produced part
time TIMESTAMP
) TIMESTAMP(time) PARTITION BY MONTH DEDUP UPSERT KEYS(time, EquipmentId, JobOrderId);
[
{
"EquipmentId": "Machine A",
"JobOrderId": "Order001",
"PlanningCycleTime": 100,
"time": "2024-04-02T14:32:21.947000Z"
}
]
[
{
"EquipmentId": "Machine A",
"JobOrderId": "Order001",
"PlanningCycleTime": 0,
"time": "2024-04-02T14:59:58.947000Z"
}
]