Event recording using RTES

RTES has been used often to capture data in disk resident files. The data encompasses an adjustable period of time prior to and after an event occurring, so that it may be analyzed graphically or in a spread sheet. A RTES task is used to perform this function. The task records the values of any variables that might be relevant to a disk file, say every second. But the file rolls over say every 3 minutes. A variable is used to indicate to the task that something significant occurred - this is just a rule that OR's all possible events (a pump starts up or shuts down, a circuit trips, etc.). At that point, the task that already has the last 3 minutes captured, continues recording for another say 3 minutes and archives the whole thing under a filename chosen automatically according to the date/time. This method has been implemented on several sites, including two nuclear plants, several pipeline pump stations and two co-generation plants.

The data is recorded in 32-bit floating point format. In this example, capturing the values of 32 variables, each record contains 34 numbers. The first number is a time stamp, then come the 32 values recorded and the last number is a date stamp. This format is compatible with the trend display feature of WinRTES. It uses a 'header' file that provides the quantity of variables in each record, a descriptor for each of the variables and a range to be used for automatic scaling when the data is displayed. An example of this file is EVENT.TRH

Variables

R0006  MONTH$
R0007  DAY$
R0008  YEAR$
R0009  HOUR$
R0010  MINUTE$
R0011  SECOND$

R0017  EVENT          R        EVENT.BIN
R0018  EVERR                   ERROR REPORT FOR EVENT TASK
R0019  EVHPOS                  CURRENT POSITION IN HEAD
R0020  EVTIME         R        INTERVAL BETWEEN RECORDINGS (SEC)
R0021  EVHSIZ         R        NUMBER OF RECORDS BEFORE EVENT
R0022  EVHEAD         R        NUMBER OF MINUTES BEFORE EVENT
R0023  EVTAIL         R        NUMBER OF MINUTES AFTER EVENT
R0024  EVTSIZ         R        NUMBER OF RECORDS AFTER EVENT
R0025  EVSTART                 AN EVENT OCCURRED
R0026  EVFNAME        R        10080047.TRD
R0027  EVTCTR                  COUNTER FOR RECORDS IN TAIL
R0028  EVROL                   SET WHEN HEAD ROLLED OVER
R0029  EVXPOS                  COUNTER IN HEAD WHEN DATA COPIED
R0030
R0031
R0032  EVTRACE                 TASK TRACE

R0049  TIME           R        TIME STAMP
R0050  V1                      DATA TO BE RECORDED
R0051  V2
R0052  V3
R0053  V4
R0054  V5
R0055  V6
R0056  V7
R0057  V8
R0058  V9
R0059  V10
R0060  V11
R0061  V12
R0062  V13
R0063  V14
R0064  V15
R0065  V16
R0066  V17
R0067  V18
R0068  V19
R0069  V20
R0070  V21
R0071  V22
R0072  V23
R0073  V24
R0074  V25
R0075  V26
R0076  V27
R0077  V28
R0078  V29
R0079  V30
R0080  V31
R0081  V32
R0082  DATE           R        DATE STAMP

R0097  TEMP1                   SPACE FOR READ/WRITE
R0098  TEMP2
R0099
R0100
R0101
R0102
R0103
R0104
R0105
R0106
R0107
R0108
R0109
R0110
R0111
R0112
R0113
R0114
R0115
R0116
R0117
R0118
R0119
R0120
R0121
R0122
R0123
R0124
R0125
R0126
R0127
R0128
R0129  TEMP33
R0130  TEMP34                  END OF SPACE FOR READ/WRITE

Rules
RULE EVENT=0.00
RULE EVTIME=3.00
RULE EVHSIZ=m(EVHEAD*60.00/EVTIME)
RULE EVHEAD=5.00
RULE EVTAIL=5.00
RULE EVTSIZ=m(EVTAIL*60.00/EVTIME)
RULE EVFNAME=0.00
RULE TIME=MINUTE$+SECOND$/100.00
RULE DATE=MONTH$+DAY$/100.00
Task
EVENT
001 TRACE EVTRACE
002 ERROR EVERR
003 STOP EVROL
004 X DEL @EVENT
005 EOPEN   1 EVENT  34
006 LET EVHPOS=0.00
007 WRITE   1 TIME
008 GPOS   1 EVHPOS
009 IF [EVSTART] 014
010 WAIT EVTIME
011 IF [EVHPOS<EVHSIZ] 007
012 START EVROL
013 GOTO 005
014 REM GET THE EVENT FILE NAME
015 X CTEXT EVFNAME EVFNAME.FMT
016 EOPEN   2 EVFNAME  34
017 LET EVTCTR=EVTSIZ
018 POS   2 EVHSIZ
019 IF [EVROL] 021
020 POS   2 EVHPOS
021 WAIT EVTIME
022 WRITE   2 TIME
023 LET EVTCTR=EVTCTR-1.00
024 IF [EVTCTR>0.00] 021
025 EOPEN   2 EVFNAME  34
026 LET EVXPOS=EVHPOS*(EVROL')+EVHSIZ*EVROL
027 IF [EVXPOS=0.00] 034
028 POS   1 EVHPOS
029 READ   1 TEMP1
030 IF [EVERR>0.00] 036
031 WRITE   2 TEMP1
032 LET EVXPOS=EVXPOS-1.00
033 IF [EVXPOS>0.00] 029
034 IF [EVSTART] 034
035 GOTO 001
036 EOPEN   1 EVENT  34
037 GOTO 029

Notes

1. The task EVENT must be running. This is done by placing in the task AUTOEXEC, the statement
X RUN EVENT
2. Line 15 of the task expects a file called EVFNAME.FMT to exist and contain a 'format' for the name to be used for the new file. We often use a file name that reflects the date and time of the event. So, EVFNAME.FMT contains:
@@MONTH$ LZI 2@@@DAY$ LZI 2@@@HOUR$ LZI 2@@@MINUTE$ LZI 2@.TRD