Fun and Games with the I/A Series Historian

Here are some routines that may be helpful working with your historian





  • DCS Stuff Home

  • Scripts & tools

  • Historian

  • Helpful Hints

  • Process control at this gold mill

  • Links to other resources




  • Questions & Suggestions
    LINE


    Please note: I am currently using I/A version 6.1 on 51B and 51B1 machines (Sun Sparcstation 5 and 4). Some of the following information (especially file locations) is different on other versions and platforms.


    While I find the normal historian configurator easy to use for making changes to a point or two, it is awkward and time consuming for making large scale changes to the historian's database. I/A provides a bulk configuration tool called cfgpts to make bulk configuration easier. The following examples use cfgpts and other Foxboro and Unix programs to make maintaining your historian's database easier.

    Using cfgpts to get configuration information from your historian

    You can find the cfgpts and in /opt/fox/hstorian/bin/ on the 51 series AP or AW. Documentation for this tool is in the same directory in cfgpts.doc. To get a list of configured points in your historian:

    # cd /opt/fox/hstorian/bin
    # cfgpts -Rv hist01
    ID=ANALOG1:TT405.PNT, PD=KILN 3 TEMP, DB=0.100000, SR=10, RC=216;
    ID=ANALOG1:TIC405.SPT, PD=KILN 3 TEMP CONTROLLER, DB=1.000000, SR=10, RC=216;
    ID=ANALOG1:TIC405.PNT, PD=KILN 3 TEMP CONTROLLER, DB=0.100000, SR=10, RC=216;
    ID=AVALOG1:TIC405.OUT, PD=KILN 3 TEMP CONTROLLER, DB=0.100000, SR=10, RC=216;
    etc....
    The R option gets the points from the historian hist01 which have not been marked as deleted, and the v option (for verbose) displays full configuration information for each point. The output is in the form:
    ID (Point ID), PD (Point description), DB (Dead-band), SR (Sample rate), RC (Sample file size in blocks of 100 samples);
    Fields are separated with a comma and records are separated with a semi-colon.

    To get a summary of the data in the historian:

    # cfgpts -sq
    {
    Total Collection Points = 1000
    Total Sample Files = 999
    Total File space (apx.) = 657 MBytes (if AP20 database),
    Total File space (apx.) = 785 MBytes (if AP50 database),
    Combined Sample Rate = 13637 Samples/minute.
    }
    The s option is for statistics, and the q option suppresses display of the configuration records.


    Extracting the historian data points

    To get a list of just the configured points, you can use grep to select only those lines that start with "ID" (avoiding error messages and statistics), and nawk to print only the point name:

    # cfgpts -Rv hist01 | grep "^ID" | nawk -F"[=,]" '{print $2}'
    ANALOG1:TT405.PNT
    ANALOG1:TIC405.SPT
    ANALOG1:TIC405.PNT
    AVALOG1:TIC405.OUT
    etc...
    Dissecting this:
    cfgpts -Rv hist01 generates a list of non-deleted points in the historian which is piped to grep:
    | grep "^ID" filters for those lines starting with ID, the output of which is piped to nawk:
    | nawk -F"[=,]" '{print $2}' define the field separators for this command as "=" and "," and print the second field.
    Modifying the command to save the results to a file gives:
    # cfgpts -Rv hist01 | grep "^ID" | nawk -F"[=,]" '{print $2}' > hist01.txt


    Validate the historian data points

    To validate the collection points in the historian we can use the file (histpoints.txt) from the above example and Foxboro's omget tool (/opt/fox/bin/tools/omget) which returns the current value of a point if it is valid, or returns an error message if the point is invalid. Please note, with a large list of points this can take quite some time to run, especially if there are a large number of bad points. From the command line in the C shell:

    # foreach item ( `cat hist01.txt` )
    ? /opt/fox/bin/tools/omget $item
    ? sleep 1
    ? end
    ANALOG1:TT405.PNT (f): 878
    ANALOG1:TIC405.SPT (f): 880
    /opt/fox/bin/tools/omget: object [ANALOG1:TIC405.PNT] OM error [ -60 ].
    /opt/fox/bin/tools/omg: object [AVALOG1:TIC405.OUT] does not exist.
    etc...
    In the above example, the OM error 60 is the result of an bad parameter type for the valid block (no PNT parameter in a PID block), and the "does not exist" error is the result of a compound:block that can't be located. We can refine this to take the bad points and save them to a file:
    # rm hist01.bad
    # foreach item ( `cat hist01.txt` )
    ? /opt/fox/bin/tools/omget $item | grep "object" | nawk -F"[\\[\\]]" '{print $2}' >> hist01.bad
    ? sleep 1
    ? end
    #
    In the examples above, note the back-quotes rather than quotes in ( `cat hist01.txt` ) which executes the enclosed command. The grep on "object" just selects the error lines. The nawk command sets the field separators to "[" and "]" for this command to enable us to print just the object between the brackets. The list of bad points is then appended to hist01.bad. Because we are appending a line at a time to the file hist01.bad, we delete any previous copies prior to starting the verification. The "sleep 1" reduces the load on the nodebus.


    Dealing with the bad points

    There are a number of causes for bad points in the historian database. The ones I see most include spelling mistakes in compound and block names, use of an improper parameter type, and the moving or deletion of the original block. If your verification of the historian's database turns up just a few bad points it is probably easiest to fix or delete them through the normal collection point configurator. If you have lots of bad points I find it is easiest to delete them all with cfgpts and add back the correct ones as I figure out what they should have been. Deleting the points we have determined to be bad is quite simple.

    WARNING -- Caution should be taken when using the cfgpts to add and delete points!!! Using the file hist01.bad generated in the last example we need to build a list of points to remove in the format recognized by cfgpts, which means "ID=" before the point name and a ";" at the end of each line. We can use sed to make these edits (without overwriting the original file) and send the result to cfgpts. The listing of points removed can be displayed or alternately sent to a file. The historian should be turned off before adding or deleting points. Also, it is good practice to get a backup listing of the historian's database:

    # histonoff hist01 OFF
    # cfgpts -Rv hist01 > hist01.backup
    # sed 's/^.*$/ID=&;/' hist01.bad | cfgpts -Dv hist01 > hist01.removed
    # histonoff hist01 ON
    #
    Check the file hist01.removed for errors encountered during the deletion. If all went smoothly, you will have a list of the points deleted. To reverse this action in the event of an error (ie. CP was off while you were generating bad points list), you can undo the deletion by:
    # histonoff hist01 OFF
    # cfgpts -Av hist01 <hist01.removed >hist01.added
    # histonoff hist01 ON
    #


    Building a list of points for addition

    Sometimes there is a need to add a large group of points to the historian. If the information to be added can be expressed easily such as "MEAS, SPT and OUT parameters on all PIDX blocks in 36CP03 at a scan rate of 10 seconds and a dead-band of 0.5% of scale retaining 60 hours of data" then it is easy to build an input file for cfgpts to add the points. To do exactly this, we can use the iccprt tool to extract the information and format it for cfgpts with awk and sed.

    First the use iccprt to extract the parameter level information from a station:
    # cd /opt/fox/ciocfg/api
    # iccprt -p -o 36CP03.txt 36CP03
    #
    The "-p" tells iccprt to extract parameters, "-o 36CP03.txt" says output to a file named 36CP03.txt, and the final 36CP03 is the station letterbug. This generates a file that can be used to build an addition file for cfgpts. First, sed can be used to change the "END" after each block in the text file to something that can be used as a record separator:
    sed 's/^END//' 36CP03.txt
    Next, the parameter identifier tags can be stripped out and replaced with a space:
    sed 's/^.*= / /'
    Next, awk (or nawk in this case to handle longer records) can be used to list just the fields we want. For the PIDX block, field 1 is the compound and block, 2 is the type (PIDX), 3 is the description, 8 is HSCI1, 9 is LSCI1, 21 is HSCO1 and 22 is LSCO1:
    nawk 'BEGIN {FS="\n"; RS=""} {print $1, $2, $3, $8, $9, $21, $22}'
    Finally grep can be used to list only the PIDX records:
    grep PIDX
    Putting it all together, on a command line:
    # sed 's/^END//' 36CP03.txt | sed 's/^.*= / /' | nawk 'BEGIN {FS="\n"; RS=""} {print $1, $2, $3, $8, $9, $21, $22}' | grep PIDX
    ANALOG2:TIC3601 PIDX REACTOR 1 JACKET TEMP CONTROLLER 200.0 0.0 100.0 0.0
    ANALOG2:TIC3601 PIDX REACTOR 2 JACKET TEMP CONTROLLER 200.0 0.0 100.0 0.0
    ANALOG2:TIC3601 PIDX REACTOR 1 CORE TEMP CONTROLLER 500.0 0.0 100.0 0.0
    ANALOG2:TIC3601 PIDX REACTOR 2 CORE TEMP CONTROLLER 500.0 0.0 100.0 0.0
    #
    This gives a list in the format NAME TYPE DESCRIPTION HSCI1 LSCI1 HSCO1 LSCO1 which is useful as a reference but can't be used as an input to cfgpts yet. The nawk portion of the command can also be used for formatting the output, and then sed can be used to strip extra information:
    # sed 's/^END//' 36CP03.txt | sed 's/^.*= / /' | nawk 'BEGIN {FS="\n"; RS=""} {print $2 "ID="$1".MEAS, PD="$3", DB="($8-$9)*0.005", SR=10, RC=216;"}' | grep PIDX | sed 's/^ PIDX//' | sed 's/= /=/g'
    ID=ANALOG2:TIC3601, PD=REACTOR 1 JACKET TEMP CONTROLLER, DB=1, SR=10, RC=216;
    ID=ANALOG2:TIC3601, PD=REACTOR 2 JACKET TEMP CONTROLLER, DB=1, SR=10, RC=216;
    ID=ANALOG2:TIC3601, PD=REACTOR 1 CORE TEMP CONTROLLER, DB=1, SR=10, RC=216;
    ID=ANALOG2:TIC3601, PD=REACTOR 2 CORE TEMP CONTROLLER, DB=1, SR=10, RC=216;
    #
    This gives a properly formatted list for cfgpts, but only for the MEAS parameter. The print portion of the nawk statement can be expanded to add the SPT and OUT parameters. The output can be directed to a file and then used with cfgpts to add the points to the historian:
    # sed 's/^END//' 36CP03.txt | sed 's/^.*= / /' | nawk 'BEGIN {FS="\n"; RS=""} {print $2 "ID="$1".MEAS, PD="$3", DB="($8-$9)*0.005", SR=10, RC=216;"; print $2 "ID="$1".SPT, PD="$3", DB="($8-$9)*0.005", SR=10, RC=216;"; print $2 "ID="$1".OUT, PD="$3", DB="($21-$22)*0.005", SR=10, RC=216;"; }' | grep PIDX | sed 's/^ PIDX//' | sed 's/= /=/g'
    > 36CP03.histadd
    # cp 36CP03.histadd /opt/fox/hstorian/bin/
    # cd /opt/fox/hstorian/bin
    # histonoff hist01 OFF
    # cfgpts -Av < CP03.histadd >hist01.add
    # histonoff hist01 ON
    #


    Foxboro and I/A Series are registered trademarks of The Foxboro Company.

    Counter


    This page hosted by GeoCities Get your own Free Home Page


    1