Data records

Updated:

A data record is a set of values that belong together for one workpiece or work step, for example serial number, batch, torque, test pressure and result. The PLC provides it in a data block, PlantBeat fetches it, stores it permanently, and only then reports back to the PLC that it has it. This way no record gets lost.

Afterwards, you find every data record again on the "Records" page by serial number, batch or time range.

Note

For now, the "Records" page is only available for Siemens. With Beckhoff, reading with enable flag and done flag per group works, but the "Records" page is not available there yet.

How the PLC and PlantBeat coordinate

PlantBeat supports three methods, called "Protocol" in the wizard:

Protocol How it works When
A (single record with record number) The PLC provides a record with a record number and sets the Enable flag. PlantBeat reads, stores and sets the Done flag. The PLC then provides the next record. One record per cycle, recommended
B (ring buffer) The PLC writes records into an array with fixed slots. The enable flag is the write index, the done flag is the read index. PlantBeat fetches several records at once. Fast cycles, many records
Fallback (without record number) like A, but without a record number When the PLC does not deliver a record number. Records read twice after a crash then cannot be detected.

If the connection is set to "Read only", PlantBeat does not send a done flag. Record fetches with a done flag are then blocked.

Set up in the connection wizard

As an administrator, you set up data records in the connection wizard.

  1. Step 2 – Variables: In the data block, check the fields of the record, plus the variables for the enable flag and the done flag.
  2. Step 3 – Selected variables: The data block appears in the list as "Record fetch for a data block". Click it.
  3. In the Handshake tab, under Enable flag, choose the variable that tells PlantBeat a record is ready, and the value, for example "true". Under Done flag, choose the variable and the value that PlantBeat writes back.
  4. For a ring buffer, choose the array under Ring buffer (optional): Use as ring buffer (… slots). The enable flag and done flag are then called "Enable flag (write index)" and "Done flag (read index)".
  5. Click Save & continue.
  6. Open the connection again with Edit, click the data block, and in the Records tab set the Source name, Protocol and Fields. For protocol A you also enter the Record number path (optional). For a ring buffer, protocol B is already selected.
  7. Click Save & continue.
  8. Open the connection once more with Edit, click the data block, click Switch to records… in the Records tab and confirm.

PlantBeat only records complete data records after the switch-over. A configured ring buffer also only takes effect after that; with a ring buffer, the values are not read until then. Enable flag and done flag without a ring buffer already take effect before the switch-over. The list shows this as "Ring buffer set up – takes effect only after the switch-over".

You can also switch over and revert on the "Records" page with Switch over… and Revert….

Fields as key and time series

In the "Records" tab you see the fields of the source:

  • Key: you use this field later to search by serial number or batch. You set the key in the "Models" menu item (below).
  • Time series: the value also goes into the history and feeds the operations report and drift. This costs additional space.

More fields for the ring buffer

If the protocol is set to "B (ring buffer)", the Records tab also shows:

Field Meaning
Buffer path (e.g. DB1.puffer) the array with the slots of the ring buffer
Buffer depth number of slots in the ring
Records per cycle the maximum number of records PlantBeat fetches at once. The value must be smaller than the buffer depth.
Startup counter path (optional) a variable that the PLC increments at every startup. This lets PlantBeat reliably detect a PLC restart, even if PlantBeat was not connected for a long time.
Buffer size path (optional) the actual array length from the PLC. If it differs from the buffer depth, PlantBeat reports this instead of calculating with a wrong number.
Record number field (optional) a field in the record with a sequential number. This lets PlantBeat detect when the PLC overwrites unread slots.
Overtake protection an additional check per read cycle, see below

Overtake protection

With the Overtake protection checkbox, PlantBeat reads the write index a second time after reading the records. If the PLC overwrote slots during reading that PlantBeat had not yet stored, PlantBeat stores nothing from this cycle, sets no done flag, and reads the cycle again. The "Records" page then shows "Buffer overflow" for the source.

  • By default, overtake protection is off. It costs one additional read access to the PLC per cycle.
  • If the PLC never writes to slots that PlantBeat has not yet released via the read index, overtake protection never triggers. It checks this agreement, it does not replace it.
  • Turn it on if you do not fully trust a new PLC program yet or if the cycles are very fast.

Buffer/burst read for a fast variable

Some values change faster than PlantBeat can read them one by one, for example a speed in the millisecond range. In that case, the PLC collects the measurements in an array, and PlantBeat fetches the whole array at once. The values arrive as measurements of a single variable, not as data records.

Warning

This method is deprecated and remains available only for existing setups. PlantBeat sets the done flag as soon as it has taken over the values, before they are stored permanently, and even when the array is empty. In a crash or power failure, values can therefore be lost or arrive twice without you noticing. Set up new fetches as a ring buffer (protocol B).

Set it up in the connection wizard, step 3, click the data block, Handshake tab:

  1. Under Enable flag and Done flag, choose the variables as for any record fetch.
  2. Expand the Advanced section and check Buffer/burst read (fast variable).
  3. Fill in the fields, see the table below.
  4. Click Save & continue.
  5. For the target variable, turn on "Record statistics" in the Statistics tab and choose the recording mode "On change".
Field Meaning
Target variable (e.g. DB10.Drehzahl) the variable under which the measurements arrive. It must be one of the connection's selected variables. Otherwise PlantBeat does not read the array and sets no done flag.
Values array (e.g. DB10.werte) the array with the collected measurements
Count path (e.g. DB10.anzahl) how many entries in the array are currently valid
Time array (optional, e.g. DB10.zeit_ms) an array with the timestamp of each measurement
Time mode how PlantBeat creates the timestamps, see below

The header of the section then also shows "· buffer/burst read".

This is how a cycle works: when the enable flag is set, PlantBeat reads the count, then that many entries from the values array and, if specified, from the time array, takes them over and sets the done flag. If the count is 0, PlantBeat still sets the done flag so the PLC can continue. PlantBeat fetches at most 1,000 entries per cycle.

The values taken over go through the statistics of the target variable:

  • Without "Record statistics", PlantBeat stores none of these values. Values that PlantBeat reads via enable flag and done flag have statistics off by default.
  • With "Cyclic — average" or "Cyclic — instantaneous value", only one value per interval remains. The fine resolution you read the array for is then lost.
  • With "On change", PlantBeat stores every value that differs from the last stored one. Identical consecutive values are dropped.

See Statistics per value.

Time mode Timestamp
Read time All values of a cycle get the time of reading. The time spacing between the values is lost. This is the default.
DINT_ms The time array contains sequential milliseconds from the PLC. The last value gets the time of reading, the others their offset before it.
DTL The time array contains the PLC's date and time. If PlantBeat cannot read it as a timestamp, the read time applies.

Note

For complete data records with several fields, the ring buffer (protocol B) is the standard method. In the Records tab, this older method is listed under Buffer mode as "Single variable (deprecated)". Existing setups keep running.

"Records" page

Operators and administrators can open the page ("PLC production data records – recording and search"). Only administrators can switch over and revert.

Recording

At the top, the measured status is shown for each source: Today, Last record, Buffer (fill level of a ring buffer) and further columns. Where nothing has been measured, the reason is shown instead of a number.

Not acknowledged counts the data records that PlantBeat has already stored but not yet reported back to the PLC with the done flag.

Latest recording messages lists events such as a loss of records. With Loss seen you acknowledge a message as seen. The entry stays in the event history.

  1. Enter the search term in Serial number or batch.
  2. Choose the Match: Exact, Starts with or Contains.
  3. If needed, narrow down by key, source, model and time range (From, To).
  4. Click Search. Reset clears the search.

Clicking a result opens the "Data record" page with all fields, unit and quality. Linked data records lists other data records with the same key value, for example the same workpiece at other stations. Open in search searches for this key value.

Models: one product across several stations

A product often passes through several stations, each with its own data block. A model joins these data records through a common key, for example the serial number. Only administrators can open the "Models" menu ("One product across several stations – joined by a key").

  • New key: the name of the key, for example "Serial", and how it is displayed. For the normalization you choose "Remove separators" or "Keep separators".
  • New model: a wizard with five steps guides you through choosing the sources, the key field per source and the lead station, up to saving with Save without trial run. The trial run itself follows in a later version.
  • Retention on this unit (days): retention period for all data records of the model. It then applies instead of the period of the individual source.
  • Retire: retired models are kept, because recorded data records refer to them. With Put back into service you bring a model back.

In the search, a model serves as a filter.

Retention

By default, data records are kept for 730 days. You set the period under "Settings" › "Data" › "Data retention", per source in the "Records" tab, or per model. See Retention and storage.

Warning

If the disk is full, PlantBeat stores no more data records and sets no done flag. The machine then waits. Keep an eye on the storage headroom on the "Data storage" page.

Practice without a machine

The practice machine (address demo) has two data blocks for practicing:

  • DB3 handshake: one record per enable with SatzNr, Serial, Charge, Drehmoment, Pruefdruck and Ergebnis_OK. Enable flag canRead = true, done flag readFinished = true. After each done flag, the next record is ready 2 seconds later.
  • DB4 ring buffer: 128 slots, one record per second. Enable flag (write index) schreibIndex, done flag (read index) leseIndex. When the ring is full, the PLC waits and Wartet_s increases.

Step-by-step exercise

  1. In the connection wizard, create a connection with manufacturer Siemens S7, IP address demo, CPU type S7-1500 and mode "Symbolic".

  2. In step 2, check the fields of DB3 and DB4, plus the variables for the enable flag and the done flag.

  3. In step 3, click DB3, Handshake tab:

    • Enable flag: DB3.canRead
    • Done flag: DB3.readFinished
  4. Click DB4, Handshake tab:

    • Ring buffer (optional): choose the array DB4.puffer, Use as ring buffer (128 slots)
    • Enable flag (write index): DB4.schreibIndex
    • Done flag (read index): DB4.leseIndex

    The list then shows "Ring buffer set up – takes effect only after the switch-over".

  5. Click Save & continue.

  6. Open the connection with Edit. For DB3, in the Records tab, enter a Source name, choose the Protocol "A (single record with record number)", enter DB3.SatzNr under Record number path (optional) and choose the Fields.

  7. For DB4, in the Records tab, enter a Source name. The protocol "B (ring buffer)" is already selected. Choose the Fields.

  8. Click Save & continue.

  9. Open the connection once more with Edit, and for both DB3 and DB4 click Switch to records… in the Records tab and confirm.

New records from both sources then keep appearing on the "Records" page.

The demo line comes with ready-made data records with serial number and batch across five stations. There, a part with rework shows six instead of five linked data records.

Next steps