The trend history system has a master file
for each trend. This master file manages the trend history data
files. When a history file is filled, data will be written to
another trend data file (pointed to by the master file).
Master File structure
The master file has a header followed by an array of history
file information. The history files are ordered in a such a way
that the most recent one is at the top.
MASTERHDR
HISTFILE most recent
HISTFILE
HISTFILE
MASTERHDR structure
title
|
128
|
Title of the file
(ASCII). It contains information, such as file version, type, start
time and logging name.
|
ID
|
8
|
ID for Citect files. It
is set to "CITECT".
|
type
|
2
|
Type of the Citect
file. It is set to TREND.
|
version
|
2
|
Version number of the
trends.
|
alignment
|
4
|
alignment for 16
bytes
|
Mode
|
4
|
Indicates the mode of
the MASTER file. (For future use. Currently it is set to 0.)
|
History
|
2
|
Number of history files
created for the logging.
|
nFiles
|
2
|
Number of history files
created.
|
next
|
2
|
Next history file
number. Internal use only, users MUST NOT use this entry to get the
next history file.
|
AddOn
|
2
|
Shows the number of
history files added onto the system through user functions. User
can add old (backed up) history files to the system
temporarily.
|
alignment
|
20
|
alignment for 16
bytes
|
HISTFILE structure
Name
|
144
|
History file
name.
|
BinHdr
|
96
|
History file binary
header. See HISTBINHDR structure.
|
HISTBINHDR structure
ID
|
8
|
ID for Citect files. It
is set to "CITECT".
|
type
|
2
|
Type of the Citect
file. It is set to TREND.
|
version
|
2
|
Version number of the
trends.
|
StartEvNo
|
4
|
Starting Number for
events in this history file. (Event Trends only.)
|
LogName
|
32
|
Name of the trend
record hat owns the history file.
|
Mode
|
4
|
Indicates the mode of
the history file. (For future use. Currently it is set to
0.)
|
Area
|
2
|
The area that has
access to the acquired data.
|
Priv
|
2
|
The access rights
required to execute the command.
|
FileType
|
2
|
History file
type.
|
SamplePeriod
|
4
|
Sample period of
logging (in milliseconds) See NOTE 2
|
sEngUnits
|
8
|
Units of scales. (Set
to the units of the trend record.)
|
Format
|
4
|
Format of scales. (Set
to the format of the trend record.)
|
StartTime
|
4
|
History file creation
time.
|
EndTime
|
4
|
When the history file
is created EndTime is set to ZERO. When the file becomes full the
EndTime is set to the current time (to indicate that the file is no
longer active).
|
DataLength
|
4
|
Shows the number of
data items. DataLength = (File Size - HeaderSize) / 2
|
FilePointer
|
4
|
Points to the last data
in the file.
|
EndEvNo
|
4
|
the history file is
created EndEvNo is set to ZERO. When the file becomes full the
EndEvNo is set to the current event number (to indicate that the
file is no longer active). (Event trends only)
|
alignment
|
2
|
for 16 bytes
|
NOTE 1: You have to read the whole master file to determine the
sequence of history files.
NOTE 2: Compatibility of trend history files between version 4
and version 5 of Citect. When Citect version 5 reads a trend
history file created by version 4 it does not alter the
SamplePeriod (from second to millisecond) so that those files can
still be used with version 4. The files created by version 5 will
have millisecond SamplePeriod therefore cannot be used by version
4.
Trend Data File structure
HISTFILEHDR
data (2 bytes per data)
HISTFILEHDR structure
title
|
128
|
ASCII title of the
file. It contains information, such as, file version, type, start
time and logging name.
|
BinHdr
|
96
|
Binary header for
history files. See HISTBINHDR structure
|
Citect version 3.3 and 4.10 onward HISTFILEHDR structure has
been altered to cater for inserting the default scales into the
trend history files. The new HISTFILEHDR structure is as
follows:
New HISTFILEHDR structure
title
|
112
|
ASCII title of the
file. It contains information, such as, file version, type, start
time and logging name.
|
DefScale
|
16
|
default scales. See the
structure of DEFAULTSCALES below.
|
BinHdr
|
96
|
Binary header for
history files. See HISTBINHDR structure
|
DEFAULTSCALES structure
RawZero
|
4
|
(float)
|
RawFull
|
4
|
(float)
|
EngZero
|
4
|
(float)
|
EngFull
|
4
|
(float)
|
|