Storing data into a history log

This guide will demonstrate how to use history logs for short-term, memory-constrained data storage from Unipi controllers using the Mervis IDE.

Axon
Neuron
Unipi 1.1

Prerequisites:

  1. Unipi controller running the Mervis OS
  2. 24V power supply

For this tutorial, we have:

  1. switched the Mervis IDE to Full mode

If you have everything from the Prerequisite list, your workspace should look like this:

Start by selecting the PLC in the left panel. In the Properties menu, you need to change History Runtime Identification attribute, which is used as identification of the PLC's history. If the PLC will be connected to the Mervis DB service the identification will be also used in the Mervis DB viewer visualisation tool. Enter a descriptive name, such as the PLC's location or its function.

The next step is to define a History log containing all variables saved in the history. In the left panel right-click on History and in the context menu choose Add New History.

A new History log will appear under History in the left panel. Select it and head to the Properties panel.

Change History log properties to the following:

  • History saved on PLC: set to true to enable data logging.
  • Type: set to Synchronous, for logging in intervals
  • Save Period: determines the save period for variables included in the History log.

Alternatively, you can enable event-based logging:

  • Type:Asynchronous enables logging based on an event triggered by a selected variable

History log is now defined and we can add variables into it. On the main panel you should see the main workspace. Simply right-click on office_Temperature global variables and in the context menu click on Add to History.

Using a similar method you can add variables into history also from the Variable browser.

Add to history window will appear. Choose the correct history log and confirm by clicking on OK.

Repeat the process for all remaining variables. When finished, double-click on the history log in the left panel to display a complete list of variables assigned to the given history log on the main panel.

Deploy Solution. The PLC is now ready to store variable history locally. You can check the history log's configuration and other related info in the Output tab in the bottom panel after clicking on the Deploy solution. Here in the text logs look for history statistics.

This statistic also displays the period for which the history log will be stored in the PLC before being overwritten by new logs. The value is influenced by logging intervals and the number and data type of logged variables. To maximize the storage period we recommend optimizing these parameters. If you want, for example, to log an outdoor temperature value, most applications should be able to make away with a 1-hour interval. Another option is to create a program (block) that compares temperature values to the most current logged ones, and triggers logging in asynchronous mode when the difference is greater than 1°C.