Applies To:
  • CitectSCADA 1.00 1.01 1.10 1.11 1.20 2.00 2.01

Summary:
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 Ttitle 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.

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.
alignment 4 Alignment for 16 bytes
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.
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 EnTime 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.
alignment 6 alignment for 16 bytes

NOTE: You have to read the whole master file to determine the sequence of history files.

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
 

Solution:
 

Keywords:
 

Attachments