RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • About ArchestrAnaut Blog
  • About Our Authors
  • Email Subscription
  •  

    Notes on Quality

    July 27th, 2011

    I have a couple notes on quality to share.  Not code quality or manufacturing quality, but OPC quality.  For a quick read & good background on how the OPC quality integer is constructed, read this.  I needed a couple SQL functions that mirror the IAS quality checking functions.  FYI, for those that don’t know, there are 5 of these functions:  IsGood, IsBad, IsUncertain, IsInitializing, & IsUsable.

    Here’s a somewhat abbreviated run down of how the OPC quality number is constructed.  An OPC quality is made up of 4 chucks: extended status (vendor specific; 1 byte), major status (good, bad, or uncertain; 2 bits), minor status (based on the major status; 4 bits), and limit status (is it clamped or not; 2 bits).  For each major status, there are 16 available minor statuses possible (0-15) though only the first 8 are defined.

    I ran a quick test to reverse engineer the IAS functions (see script at bottom of blog).  What I found was the following:

    Major Minor IsBad IsInitializing IsUncertain IsGood IsUsable
    0 0-7 True False False False False
    0 8-15 False True False False False
    1 0-7 False False True False True
    1 8-15 True False False False False
    2 0-7 True False False False False
    2 8-15 True False False False False
    3 0-7 False False False True True
    3 8-15 True False False False False

    To summarize the table, it looks like they appropriated part of the bad quality range (major = 0) for initializing which makes sense.  Though you could argue that there was already a status defined for this scenario (Not Connected:  Major = 0, Minor = 2).  Major status 2 isn’t used anywhere, so it got lumped into Bad, which also makes sense.  The minor statuses 0-7 for Good (Major = 3) and Uncertain (Major = 1) work as expected, but 8-15 got lumped into Bad.  I know they’re not defined, but they’re still part of the Good/Uncertain major status.  Glad I ran the test.  Maybe this is different in later versions (the tested version is 3.0 SP2).  The final observation is that IsUsable checks the quality for Good or Uncertain as well as checking the value is also a valid value (i.e. not NaN).

    The test script:
    (The one interesting note here is that you can write directly to the UDA.Quality attribute, which could be useful if you’re doing something fancy surrounding the data’s quality.)

    Dim i as Integer;

    Log header row
    LogMessage("Value,Quality,IsGood,IsBad,IsUncertain,IsInitializing,IsUsable");
    Iterate through all of the possible OPC qualities
    For i = 0 to 255
        ‘ Force the PV quality
       
    Me.PV.Quality = i;
       

        ‘ Log data row for the quality
        LogMessage(
           
    Me.PV.Value + "," +
           
    Me.PV.Quality + "," +
           
    IsGood(Me.PV) + "," +
            IsBad(
    Me.PV) + "," + 
           
    IsUncertain(Me.PV) + "," +
            IsInitializing(
    Me.PV) + "," +
            IsUsable(
    Me.PV));
    Next;

    ‘ Log message for end of test
    LogMessage("——————-");


    Bug in Alarm DB Purge/Archive Utility

    July 25th, 2011

    I found a “feature” in the Alarm DB Purge/Archive utility last week.  The password entry box will only accept 9 characters.  So, if the password for the account is longer than that, you’re out of luck.

    image


    Harder Than a Needle in a Haystack

    June 19th, 2011

    I spent last Friday & Saturday writing some SQL code for client to make finding historical data “outages” quicker and easier.  They wanted to know where all of the time spans where the quality wasn’t good.  I was thinking it was a little like a needle in a haystack problem, but it’s not.  It’s harder than that.  It’s more like measuring every piece of hay in the haystack.

    Read the rest of this entry »


    You ran a W.H.A.T.?!?

    June 8th, 2011

    We ran into a bootstrap issue on a live system this week.  This customer can’t lose data.  On the plus side, it’s a redundant setup & everything is running fine on one machine.  The problem is that we need to wipe the platform that isn’t running the objects (use Platform Killer).

    Read the rest of this entry »


    Watching a Horde of Objects

    May 16th, 2011

    Every now & then I run across a scenarios where I have to build a watch window for hundreds of objects.  If I built watch windows like they teach you in the training class (click & drag in ObjectViewer), I’d still be building them.  There’s a far easier way to build large watch windows.

    Read the rest of this entry »


    ArchestA Graphics Notes

    April 26th, 2011

    Just ran a quick test on ArchestrA graphics to verify when the OnShow & OnHide scripts execute.  I was also testing if AA graphic objects’ visibility properties are updated when the InTouch visibility was updated.  Nothing Earth-shattering here, but just a quick FYI.

    Read the rest of this entry »


    A How-To Link to with BindTo

    April 6th, 2011

    We’ve run across several scenarios where we want to link to an indeterminate or variable number of items during a script’s execution to do some kind of work with them.  Among other things, we have used this for iterating through a pair of parameter lists in a formula object to perform a compare between the field IO & the loaded formula.  Using IO extensions are too slow to update & read back within a single scan, but you can use the BindTo command with the Indirect type to do what you need!  The BindTo-Indirect combination works like a  pointer for IAS (this one, not this one).

    Read the rest of this entry »


    Interfacing to a SQL Database

    February 28th, 2011

    In our work we do a lot of interfacing with SQL databases (usually MS SQL Server).  Being able to interface with SQL from IAS is a big weapon in one’s arsenal.  You can retrieve data from a table or view, execute stored procedures and functions, and virtually anything else you can dream of doing with T-SQL.

    We’ve wrapped most of the code to do the SQL DB interfacing into a DLL for simplicity and error trapping.  However, this post is intended to give a basic example on executing a simple query from an IAS script using the .NET objects.

    Read the rest of this entry »


    WriteStatus Function in QuickScript Library

    February 8th, 2011

    I’m currently exploring ways of verifying a write has been completed or gets stuck.  I ran across the WriteStatus function that comes with the QuickScript function library.  I was trying to use it, but it always returned MxStatusOk even for items with bad quality.

    Read the rest of this entry »


    Coding Conventions in IAS

    January 21st, 2011

    We’ve been working on some design & coding conventions for the work we do, part of which is in IAS.  We’re still kicking around a lot of ideas trying to come up with good reasons for and against them.  I’d like to hear back if anyone has ideas or things that work for you.

    Read the rest of this entry »