[foxboro] OAJ - A Problem Solved

  • From: <terry.lloyd@xxxxxxxxxxxxxx>
  • To: <foxboro@xxxxxxxxxxxxx>
  • Date: Thu, 11 Jan 2007 17:39:47 -0000

I've resolved a problem with the extraction of messages from the
Operator Action Journal.  I don't know if anyone else has this problem
but thought it would be useful to share this solution.

For some time I've noticed an occasional problem with the data extracted
from the Operator Action Journal.  It appeared to be some sort of
corruption that was truncating and merging lines of text together, e.g.

01-11-07 13:51:10 32WP01 PLC1_1800_CO:1800_MCOUT  .IN_9   Set     to
Reset
01-11-07 13:51:11 32WP02 W949_01     :P275V2      .OUT    548.00  to
524.00
01-11-07 13:51:14 32WP01 PLC1_1800_CO:1800_MCOUT  .IN_6   Set     to
Reset
01-11-07 13:51:41 31WP0201-11-0713:51:5131WP02W806_01:A203W.UNACKUnack
to Ack
01-11-07 13:51:51 31WP02 W954_01     :P427U3      .UNACK  Unack   to Ack
01-11-07 13:51:51 31WP02 W210_03     :XA101U      .UNACK  Unack   to Ack

The 4th line above starts with a timestamp and station name then
continues with another complete line without any spaces.

The oajgen script that is used to extract messages from the historian,
calls the sacego Ace Reporter program with the appropriate params.  One
of these params is a file oaj.arc that is a complied version of oaj.ace.
This file contains the report layout and sql commands to extract and
format the data.
This text file oaj.ace has some code in it to handle different action
type of messages, e.g.
        E - change environment
        A - application
        S - script
        M - manual change
        O - compound on/off

But it doesn't cater for any other types of messages.  Some time ago we
enabled the Horn Mute button on the CAD (enabled under controlled
conditions - but that's another story).  I've discovered that each time
the Operators use this button another message type of H is written to
the historian OAJ table.  The code inside oaj.ace can't handle this
extra message type and results in printing the truncated and merged
line.

I've edited and recompiled this file and the output produced is now...

01-11-07 13:51:10 32WP01 PLC1_1800_CO:1800_MCOUT  .IN_9   Set     to
Reset
01-11-07 13:51:11 32WP02 W949_01     :P275V2      .OUT    548.00  to
524.00
01-11-07 13:51:14 32WP01 PLC1_1800_CO:1800_MCOUT  .IN_6   Set     to
Reset
01-11-07 13:51:41 31WP02 OTHER  Horn Unmute All
01-11-07 13:51:51 31WP02 W806_01     :A203W       .UNACK  Unack   to Ack
01-11-07 13:51:51 31WP02 W954_01     :P427U3      .UNACK  Unack   to Ack
01-11-07 13:51:51 31WP02 W210_03     :XA101U      .UNACK  Unack   to Ack


Here are the paths to the relevant files on our system...
/usr/foxbin/oajgen
/usr/foxbin/oaj.arc
/usr/fox/acescripts/oaj.ace
/opt/informix/bin/sacego
/opt/informix/bin/saceprep (used to compiled oaj.ace to oaj.arc - see
B0193BL)


Here's the text file oaj.ace with my edits...

{ @(#)oajin.ace 20.1 11/15/89
  This is a compilable script to generate an Operator Action Journal
report.

  Five positional command-line arguments MUST specify:
    station (letterbug)
    compound
    block
    start time
    end time

  These may be preceded by -d "historian name"

Initial version developed 23-May-89 - 18-Jul-89 NEC
Revs:
    30-Aug-89 NEC    don't use time and date builtins -- wrong TZ
    26 Feb 1998 DRM  use 4-digit years in start and end times
    01 Dec 1998 DRM  expand mintime and maxtime from 14 to 16 characters
    10 Jan 2007 TJL  add an extra ELSE at the end to handle the HORN
                     message type in particular and any others.
                     TJLloyd  - Dow Corning Barry.
                =20
}

database
    hs3101
end

define
    param[1] sname char(6)      {letterbug of workstation       }
    param[2] cname char(12)     {compound name                  }
    param[3] bname char(12)     {block name                     }
    param[4] mintime char(16)   {start yyyy-mm-dd hh:mm         }
    param[5] maxtime char(16)   {end   yyyy-mm-dd hh:mm         }
end

output
    left margin 0
    bottom margin 0
    right margin 80
end

select *
    from opraction
    where
        station matches $sname
            and
        compound matches $cname
            and
        block matches $bname
            and
        time_tag[1,16] >=3D $mintime    {time_tag is yyyy-mm-dd
hh:mm:ss}
            and
        time_tag[1,16] <=3D $maxtime
    order by time_tag                   {file is circular, so sort
result}
end

format
    page header=20
        print 15 spaces, "Operator Action Journal Report"
        {print 10 spaces, date, 2 spaces, time, "  Page ", pageno}
        print 22 spaces, "  Page ", pageno
        skip 1 line
    on every row
        print
            column 1, time_tag[6,10] clipped,   {mm-dd          }
            column 6, "-",
            column 7, time_tag[3,4] clipped,    {yy             }
            column 10, time_tag[12,19] clipped, {hh:mm:ss       }
            column 19, station clipped;
        if act_type  =3D "M" then                       {Modify }
            begin
                print
                    column 26, compound clipped,
                    column 38, ":",
                    column 39, block clipped,
                    column 51, ".",
                    column 52, parm clipped,
                    column 59, description clipped
            end
        else if act_type  =3D "O" then          {On/Off }
            begin
                print
                    column 26, compound clipped,
                    column 39, "STATE",
                    column 59, description clipped
            end
        else if act_type  =3D "A" then          {Applic }
            begin
                print
                    column 26, "APPLIC",
                    column 33, description clipped
            end
        else if act_type  =3D "S" then          {Script }
            begin
                print
                    column 26, "SCRIPT",
                    column 33, description clipped
            end
        else if act_type  =3D "E" then          {ChgEnv }
            begin
                print
                    column 26, "ChgEnv",
                    column 33, description clipped
            end
        else   {extra code added to cope with other message types}
            begin
                print
                    column 26, "OTHER",
                    column 33, description clipped
            end
end




 Regards =20
     Terry=20

Terry Lloyd, Systems Engineer
____________________________________________________________
Building W601,  Mail BA111C     Voice:     +44 (0)1446 723501
Dow Corning Ltd                 Fax:       +44 (0)1446 723674
Cardiff Road                    E-Mail:   terry.lloyd@xxxxxxxxxxxxxx
Barry
Vale of Glamorgan,  CF63 2YL
____________________________________________________________



 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

Other related posts:

  • » [foxboro] OAJ - A Problem Solved