History, saving data in a database

The Solution must be switched to Full mode.

In an already created project set the database (Mervis DB) server address, user name, and password (ask your Mervis DB administrator for the credentials), and communication interval in the PLC configuration. The URL for Mervis DB is to be entered as


and the communication with Mervis DB must be enabled:

Another important parameter is the Runtime ID, a string which shall be unique for every PLC to write in a database. It may be the project name and PLC identification, such as “Tesco025_Boilers”.

The Communication period is not the sampling interval (which is set up in the History, see below). If e.g. the sampling interval is 1 min and the Communication period is 1 hour, every communication with the database saves data of the last 60 minutes, i.e. 60 samples for every data point.

Save, or upload, the configuration to PLC in the next step.

Create a new history definition by right-click to the History item, and select Add New History.


  • Save period - data storage interval setting
  • Enable Variable Name - enable/disable saving
  • Trigger Variable Name - Action for trigger


  • Enable Variable Name - enable/disable saving
  • Trigger Variable Name - Action for trigger
  • Timestamp Variable Name - Variable with timestamp for save to database

Insert variables you want to be sampled. In the Variable browser tab select one or more variables, right-click one of them, and select Add to History. Choose one of the predefined history definitions.

Check if the “History Runtime Identification” in the PLC properties for history has been entered.

If the project has history blocks defined, the recorded history data can be saved in a computer.

Right-click the selected histories, and select “Download history”.

In the opened window, set the target file to save history, required time range, time format, and PLC to download the data from.

The history will be saved in a .csv file. The record can be opened in a text viewer or table processor (MS Excel). The first row contains column headers, time stamp and variable names. The values are separated by semicolons.

The storage capacity for different controller types is below. After the memory is full, the oldest records are deleted and replaced by new ones.

PLC Memory reserved for historyMin. number of records
mark220, mark320, markMX 2000kB 37000
wPLC750-8101, wPLC750-8102 2000kB 37000
mark220LX, mark320LX, markMX.2, markMX.3, markMXL, mark520, IMIO105.2, IMIO110.2, ICIO205.2, mark130.22000kB 37000

The specified number of records is the minimum guaranteed that the platform has reserved for histories. It depends on the size of the data types of variables that are stored in history. The actual number of stored records may be notably larger.

  • © Energocentrum Plus, s.r.o. 2017 - 2024