Logging and Trending Data
Logging and Trending Data
Citect Pty. Limited makes no representations or warranties with respect to this manual and, to the
maximum extent permitted by law, expressly limits its liability for breach of any warranty that may be
implied to the replacement of this manual with another. Further, Citect Pty. Limited reserves the
right to revise this publication at any time without incurring an obligation to notify any person of the
revision.
COPYRIGHT
TRADEMARKS
Citect Pty Limited has made every effort to supply trademark information about company names,
products and services mentioned in this manual. Trademarks shown below were derived from
various sources.
IBM, IBM PC and IBM PC AT are registered trademerks of Internatrional Business Machine
Corporation.
MS-DOS, Windows, Windows 98, Windows 2000, Windows XP and Excel are trademarks of
Microsoft Corporation.
General Notice:
Some product names used in this manual are used for identification purposes only and may be
trademarks of their respective companies.
The trend system can provide a better understanding of the performance of your plant and
equipment. It can be used for dynamic visual analysis (trend and SPC graphs), production records,
or for regularly recording the status of equipment for efficiency and preventive maintenance.
Using Trend Tags, you can specify exactly what information you want to collect from your I/O
Device variables. This information can be logged at regular intervals (periodic trend), or only when
an event occurs (event trend). Event trends are used for trending data that is not time-based, for
example, for a product as it comes off an assembly line. Trend data is usually saved on disk for
analysis or displayed on a trend graph.
The trend system is based on real time samples. The trend system expects a return of one data
point each time it samples the data. Although gaps in the data can be filled, you should ensure that
your field device can return data values at the rate you specify (especially if you are using sample
periods of less than 100 ms).
CitectHMI/SCADA can collect and store any amount of data. The only restriction on the amount of
data that you can store is the size of the hard disk on your computer. (CitectHMI/SCADA uses an
efficient data storage method - ensuring that space on your computer's hard disk is maximised.)
For long term storage, you can archive the data to disk or tape (without disrupting your runtime
system). For efficient storage, you should store trend files on a compressed volume.
NOTE: If you are trending data across a network (distributed processing), it is recommended that
you enable time synchronisation using the Computer Setup Wizard.
You might also consider staggering your trend sample requests using the
[Trend]StaggerRequestSubgroups parameter.
Expression LT131
Logs the Variable Tag LT131
Comment
The value of the process variable LT131 is logged. Variable LT131 must be defined as a
variable tag.
You can also log any Cicode expression or function, for example:
Expression LT131/COUNTER
Logs Variable Tag LT131 divided
Comment by the Variable Tag COUNTER
NOTE: When a variable tag is used in the expression field of a trend tag property, the 'Eng Zero
Scale' and 'Eng Full Scale' fields of that variable tag must be set appropriately, or data
will be lost because the trend logs negative values as invalid.
Trigger LT131<50
In this example, logging occurs when the value of the variable tag (LT131) falls below 50.
For a periodic trend, data is logged only while the value of the trigger is TRUE. (The trend
graph will still scroll, but will display <GATED> where the trigger is FALSE.) In the above
example, data is logged continuously while the value of LT131 remains less than 50. Logging
ceases when the value rises to (or above) 50. Logging does not occur again until the value of
LT131 falls below 50.
You do not have to specify a trigger for a periodic trend. If you do not specify a trigger for a
periodic trend, logging occurs continuously.
For an event trend, data is logged once when the value of the trigger changes from FALSE to
TRUE. In the above example, one sample is logged when the value of LT131 first becomes
less than 50. Another sample is not logged until the value of LT131 rises to (or above 50) and
again falls below 50.
Sample Period 30
Logs data every 30 seconds
Comment
NOTE: The following fields are implemented with extended forms (press F2).
NOTE: 1) With CitectHMI/SCADA Versions 5.xx, it is not possible to store trend files in the
Bin, Runtime, Backup or User directories; or any subdirectories of these. If you have
existing Version 3.xx or 4.xx projects that use these directories to store trend files, the
path for these will have to be changed to the Data directory.
2) The trend system will buffer the acquired data before saving it to a file. The
[Trend]CacheSize parameters determine the buffer sizes for returned data.
The File Name property is optional. If you do not specify a file name, the file name defaults to
\CITECT\DATA\<Name> on the hard disk where you installed CitectHMI/SCADA. <Name> is
the Trend Tag Name. If you do use this property, you should ensure that no other trend tags
have the same name, otherwise the data may be lost.
NOTE: 1) Do not use a file extension when specifying a file name. If you edit this property
(change the file name or path) in an existing project, all existing SPC data is ignored.
2) This file name must be different to your SPC tag file names.
Storage Method
Select either Scaled or Floating Point as the storage method for the trend. The key difference
between these two options is that Scaled is a two-byte data storage method, whereas Floating
Point uses eight bytes.
Floating Point storage has a dramatically expanded data range in comparison to Scaled
storage, allowing values to have far greater resolution. However, you need to consider that it
also uses a lot more disk space. Scaled should be used where compatibility with pre-V5.31
trend history files is required.
If you do not specify a storage method, it is set to Scaled by default.
A trend graph is a visual representation of past and current activity. It provides an effective way of
displaying plant-floor data. It builds a picture over time of how a variable (such as product output,
level, temperature, etc.) is changing or how a device or process is performing. You can monitor
current activity as it happens and scroll back through time to view the trend history.
As the values of variables change over time, or as events happen, the graph moves across the
page. The latest values are always displayed. You can scroll back through historical data to
display past values of the variable (or process).
You can trend any single variable or Cicode expression. You can display any number of trends on
the screen simultaneously, even if they have different sample periods. You can also display up to
eight trend tags (pens) in any trend window.
Historical data collection continues even when the display is not active. You can switch between
pages without affecting trend graphs. Trend data acquisition and storage of data (in trend history
files) continues even when the display is not active.
NOTE: Variable tags can also be visually trended using an SPC Control Chart. Statistical
Process Control (SPC) is a facility that enables you to control the quality of materials,
manufactured products, services, etc. This quality control is achieved by collecting,
arranging, analysing, and testing sampled data in a manner that detects lack of uniformity
or quality.
Trend interpolation is used to define the appearance of a trend graph when the incoming samples
fall out of sync with the display period or when samples are missed.
For example, a particular trend may be sampled five times between each update of the trend graph.
As only one value can be displayed for each update, a single value must be used that best
represents the five samples; and that could be the highest value, the lowest value, or an average.
To define how CitectHMI/SCADA calculates the value to use, you have to set a particular Trend
Interpolator Display Method.
The following table shows the available interpolator display methods, grouped into condense
methods (where the display period is longer than the sample period) and stretch methods (where
the display period is less than or equal to the sample period).
The interpolation display method is set via TrnSetDisplayMode() function. You can also use the
[Trend]GapFillMode parameter, but it will interpolate values within the actual trend file as well as on
the trend graph.
- or -
1. From the File menu select New
2. Select Type: Page
3. Choose the Resolution (size) of the trend page.
4. Choose a trend Template for the trend page:
Singletrend One trend on the page
Doubletrend Two trends on the page
Eventtrend One event trend on the page
Zoomtrend Two trends on the page (one window for zooming)
Poptrend A single trend on the page (for display in a pop-up window)
5. Click on the OK button.
Function Purpose
The standard trend templates have buttons that call these functions to print data - .
When you print using the TrnPrint function, the Plot Setup form will display. This form allows you to:
Specify the title of the trend.
Add a comment which is displayed beneath the title.
Specify whether the trend is going to print in black and white, or in colour. The selection that
you make here will become the setting for the [General]PrinterColourMode parameter.
Define your printer setup. The printer that you select here will be set as the default printer at
the [General]TrnPrinter parameter.
Specify whether or not the form displays the next time the function is used. This check box
sets the [General]DisablePlotSetupForm parameter.
Exporting Trend Data
You can export trend data to reports and databases with the following functions:
Function Purpose
The standard trend templates have buttons that call these functions to export data.
NOTE: You can also select part of your trend graph (click and drag) and copy the underlying
values to the Windows clipboard. You can then paste them into an Excel spreadsheet. (If
you are pasting millisecond values, you will need to create a custom format for the TIME
column to display these values correctly. To do this, select the column and select Format |
Cells. In the Number tab, select Custom for Category, and type h:mm:ss.000 AM/PM.)
When CitectHMI/SCADA starts up for the first time, it creates all the trend files required by each
trend tag in the runtime system. (You can change this default using the [Trend}AllFiles parameter.)
CitectHMI/SCADA uses a system of rotational history files to store the trend data. Data is stored in
several files rather than in a single large file.
By default, CitectHMI/SCADA uses 2 files (for each trend tag). You can change the default by
specifying the number of files to use, for example:
No. Files 10
Use ten files for the data, as in the
Comment following diagram:
Tag Tag
name name
1. When Citect begins logging,
.010 .001 data is written to the first file
Tag Tag 2. At midnight the
name name following Sunday,
.009 .002 Citect writes to the
second file
4. After week 10 the
Tag first file is overwritten Tag 3. At midnight the
name name
.008
with new data following Sunday,
.003
Citect writes to the
third file and so on
Tag Tag
name name
.007 .004
Tag Tag
name name
.006 .005
The maximum number of files you can specify per trend tag is 270.
You can also specify the period between files, i.e. when a new history file is used, for example:
Period 1:00:00
Use a new file each hour
Comment
Period 6:00:00
Use a new file every six hours
Comment
Period 72:00:00
Use a new file every three days
Comment
Period Monday
Use a new file each week beginning on
Comment Monday
You can also specify the time of day to synchronise the start of the history file, for example:
Time 6:00:00
Synchronise the file at 6:00 am
Comment
Time 12:00:00
Synchronise the file at 12:00 midday
Comment
Time 18:30:00
Synchronise the file at 6:30 pm
Comment
Storage method
CitectHMI/SCADA allows you to select which storage method you want to use for Trend tags and
SPC tags. You are given a choice of either Scaled or Floating Point, the key difference being that
Scaled represents a two-byte data storage method, whereas Floating Point uses eight bytes,
delivering far greater precision.
Floating Point storage has a dramatically expanded data range in comparison to Scaled storage,
allowing values to be more precise. However, you need to consider that it also uses a lot more disk
space. Scaled should be used where compatibility with pre-V5.31 trend history files is required.
You can set the required storage method via the Trend Tag or SPC Tag properties form (press the
F2 key to view the extended form). The storage method is set to Scaled by default.
The following equations allow you to calculate the total disk space required to store a trend across a
specified period of time.
Note that the storage method used for a trend (Scaled or Floating Point) affects the number of bytes
required for each sample, so it is important to base your calculations on the appropriate formula.
To find out which storage method a particular trend is using, refer to the extended Trend Tag
Properties dialog. (By default, the Scaled storage method is used.)
Scaled
Each data sample requires two bytes of storage. You can therefore calculate the total disk storage
required for each trend by using the following formula:
For example, if a trend record produces one sample every ten seconds for one week, and you are
using five data files (five weeks), the number of bytes required is:
( )
(7 x 24 x 60 x 60) x 5 x 2
Bytes required = 464 x 5 + 176 +
10
= 607296 bytes
Floating Point
Each data sample requires eight bytes of storage. This alters the equation to:
( )
Period (secs) x (No.Files) x 8
Bytes reqd = 704 x No. Files + 160 +
for each Sam ple Period
trend ( )
( )
(7 x 24 x 60 x 60) x 5 x 8
Bytes required = 704 x 5 + 160 +
10
= 2422976 bytes
Note that the calculations above do not take into account the space required to store the history file
for each trend. This is because these files remain at a set size and therefore do not significantly
impact the amount of disk space required.
NOTE: For efficient trends storage, you can use Windows NT file compression. Customers have
reported getting files down to 10% of their original size using this method, though the
actual amount of compression varies depending on the rate of change of the data.
If you change the configuration of your trend history files (in an existing project), or you change the
configuration of a trend tag that affects the number, time, or period of the trend files, you must delete
all the existing trend files - before you run the new system.
If you change the path of your trend history files (in an existing project), all existing trend data is
ignored.
NOTE: You must not delete history files (that CitectHMI/SCADA creates) from your hard disk -
while your system is running.
Instead of specifying the full path to data files in your system, you can use path substitution.
With path substitution, you define a name that is a substitution for the full directory path. You can
then use the substitution name in the following format:
For example, if you decide to store a trend data file called MYFILE in a directory called
C:\CITECT\DATA\MYTRENDS, you can specify the full path to the file, for example:
or define a path substitution (for example MYDATA) and specify the path as:
Path substitution provides greater control of data storage. You can change the location of all data
files by changing the definition of the data path - instead of locating and changing each occurrence
of the data path.
Default Path Definitions