Storage Format
There are two implementations of the interface IDataStorage
available: ASCIIDataStorage
and BinaryDataStorage
.
In both formats the first variable which is stored is the reserved variable ___xCompressTags
of type BOOL
. Its value determines if the instance paths are stored compressed. If an integrity object is written, then it is written as the last variable named ___Integrity
of type BOOL
with value TRUE
. All persistent variables except these reserved variables are stored in order and sorted by their full instance path. It does not matter if the instance paths compressed or not.
Tip
If the data are modified by the user, he has to make sure that the right sort order will be maintained.
ASCII format
ASCIIDataStorage
writes each instance path of the persistent variables (possibly in compressed format), the data type and the value as a string into the file. The name and the date are separated by a tab character (can be changed by parameter codbySeparator
). When the archive is read, a conversion will be executed. Therefore the file can be modified externally. Lines must be separated by "\r\n" (Windows convention). Lines which starts with a semicolon will be ignored on reading - this line will not be added when the archive is written.
Format of an ASCII file:
{timestamp}\r\n {instance path}{bySeparator}{Typ}:{value}\r\n … {instance path}{bySeparator}{Typ}:{value}\r\n
The time stamp determines the time when the storage was triggered. It is written as DATE_AND_TIME literal (example:
)DT#2012-01-11-15:11:09

Treatment of REAL
and LREAL
variables:
The values of variables are written as ST literals. REAL
and LREAL
values are treated differently, because the implementation of the conversion into and from decimal fractions without loss of accuracy. However to avoid any loss of accuracy and to maintain the readability and the possibility to modify the ASCII file, these values are stored in a hexadecimal format. The (inexact) decimal fraction is added behind the hexadecimal value as a comment. While reading the file, the hexadecimal format as well as the ST decimal format are supported. This allows the user to modify the decimal fraction.
The hexadecimal format is defined as follows:
F16#{Mantissa}H{Exp} | F16#NaN | F16#+Inf | F16#-Inf {Mantissa} ::= {HexNumeral} {Exp} ::= {HexNumeral} {HexNumeral} ::= [+-]?[1-9A-F][0-9A-F]*
If m
is the value of the mantissa and e
the value of the exponent than the value of the number is m * 16^e
.
lr1 LREAL:F16#F0H-3 0.05859375
Binary format
BinaryDataStorage
saves the data in a binary format. The time stamp follows that (type DATE_AND_TIME
). After that the variables are listed.
Compressed archives
The variable values are stored with path and name (in the path there is neither the application nor the device name) in a compact spelling to save resources and time.
In any case (compressed or not) the instance paths must be sorted in order of the full instance path. This sort order is alphabetically, whereby array indices are sorted numerically.
Objects | Compressed Format |
---|---|
|
|
|
|
|
|
|
|