|
Documentation
OpenRDA for Intellution Fix/Dynamics
Overview
The historical and real-time data in the FIX DMACS database is exposed through NODE, TAG, TAGVALUE and ARCHIVE tables. The NODE table exposes a list of nodes accessible from the FIX node where
the OpenRDA Server is running. It is used to get a list of all the nodes that are on the FIX network. The TAG table exposes the tags, the block types, description and other information
about each of the tags. It is used to look up tags by tag name, block type, description or node. The TAGVALUE table is used to find out the current field values for all the
tags. The ARCHIVE table is used to access historical data for specified tags. Use of SQL allows these tables to be searched using wildcard or numeric expressions.
You can experiment accessing data from any of the tables by using tools like Microsoft Access and Microsoft Excel or by using the Interactive SQL tool supplied with the OpenRDA ODBC Driver.
Refer to step 6 of chapter 3 for details on accessing the FIX data from Microsoft Excel. The OpenRDA Server for FIX does not authenticate based on user name or password so you can enter any
values you want for the user name and password in the login box.
Accessing Node Directory
The list of nodes that are currently active is obtained by querying a single column table NODE. To get a list of all nodes, use:
select * from NODE
Accessing Tag Directory
The tag directory table TAG contains a list of all tags on all nodes accessible from the selected server. It contains information about each of the NODE:TAG pairs. The type of information
exposed includes the description of the tag, engineering units and the block type.
| Table 4‑2: TAG Table |
|
Column
|
Type
|
Description
|
|
NODE
|
CHAR(32)
|
Node name
|
|
TAG
|
CHAR (32)
|
Tag name for the block
|
|
BLOCKTYPE
|
CHAR(2)
|
Block Type
|
|
EGU
|
CHAR(4)
|
Engineering units
|
|
DESCRIPTION
|
CHAR (40)
|
Description of the block
|
To get a list of all tags on all nodes that are contained in the database: select * from TAG
To get a list of tags on a specific node: select * from TAG where NODE=’DEMO’
To get a list of tags where the description contains the word 'temperature':
select * from TAG where DESCRIPTION like '%temperature%'
Accessing Tag Values
The real-time table TAGVALUE allows access to current field values for the specified NODE and TAG. This can be used to read any number of tags and their associated field values. For each
tag, the associated field values are returned as columns.
| Table 4‑3: TAGVALUE Table
|
|
Column
|
Type
|
Description
|
Valid Entries
|
|
NODE
|
CHAR(32)
|
Node name
|
|
|
TAG
|
CHAR (32)
|
Tag name
|
|
|
ADI
|
CHAR(9)
|
Alarm areas assigned to this block.
|
A - P, All, None
|
|
AUTO
|
CHAR(32)
|
Automatic or manual status of the block.
|
Automatic, Manual
|
|
CHALM
|
CHAR(32)
|
Alarm status of this block's chain.
|
Display Only
|
|
CLOSE_A
|
CHAR(7)
|
Text description entered in the Close (Tag) field.
|
Text (up to 7 characters)
|
|
CUALM
|
CHAR(32)
|
Current alarm status.
|
Display Only
|
|
CV
|
DOUBLE
|
Current value.
|
Numeric Value
|
|
ACV
|
CHAR(80)
|
ASCII representation of current value.
|
ASCII value
|
|
DBAND
|
CHAR(32)
|
Dead band range for alarms entered in the Dead Band field.
|
Numeric Value (in EGU range)
|
|
DESCRIPTION
|
CHAR(40)
|
Text entered in the Description field.
|
Text (up to 40 characters)
|
|
EHI
|
CHAR(32)
|
Contains the high scale engineering units measurement displayed to operators entered in the High Limit field.
|
Numeric Value
|
|
ELO
|
CHAR(32)
|
Contains the low scale engineering units measurement displayed to operators value entered in the Low Limits field.
|
Numeric Value
|
|
ENAB
|
CHAR(32)
|
Alarm status. Displays Yes if the alarms are enabled or No if the alarms are disabled.
|
Yes or No
|
|
ETAG
|
CHAR(4)
|
Engineering units tag entered in the Units field.
|
Text (4 characters)
|
|
EVENT
|
CHAR(32)
|
Event messaging status. Displays Enable if event messaging is enabled or Disable if event messaging is disabled.
|
ENABLE, DISABLE
|
|
IAM
|
CHAR(32)
|
Specifies an initial mode of either Automatic or Manual.
|
Automatic, Manual
|
|
IENAB
|
CHAR(32)
|
Initial alarm status entered in the Enable Alarms field.
|
ENABLE, DISABLE
|
|
INV
|
CHAR(32)
|
Status of whether this block outputs the inverse of the input. Displays a Yes or No.
|
Yes, No
|
|
IOAD
|
CHAR(32)
|
I/O address entered in the I/O Address field.
|
See your I/O Driver Manual for the valid entry.
|
|
IODV
|
CHAR(32)
|
I/O driver entered in the Device field.
|
See your I/O Driver Manual for the valid entry.
|
|
IOHT
|
CHAR(32)
|
I/O hardware type entered in the Hardware Options field.
|
See your I/O Driver Manual for the valid entry.
|
|
IOSC
|
CHAR(32)
|
Type of I/O signal conditioning entered in the Signal Condition field.
|
See your I/O Driver Manual for the valid entry.
|
|
ISCAN
|
CHAR(32)
|
Specifies whether the block is initially placed on or off scan when the system starts. Status is entered in the Start Block on Scan field. Displays On or Off.
|
On, Off
|
|
LAALM
|
CHAR(32)
|
Highest severity unacknowledged alarm.
|
Display Only
|
|
NALM
|
CHAR(32)
|
Unacknowledged alarm status. Displays a Yes if there are any unacknowledged alarms for this block, or a No if all alarms are acknowledged.
|
Yes, No
|
|
NAME
|
CHAR(32)
|
Block type name (for example, AI).
|
Block Type
|
|
NEXT
|
CHAR(32)
|
The tag name of the next block to receive output from this block. The tag name is entered in the Next Block field.
|
Display Only
|
|
OPEN_A
|
CHAR(7)
|
Text description entered in the Open (Tag) field.
|
Text (up to 7 characters)
|
|
PREV
|
CHAR(32)
|
The tag name of the upstream block.
|
Display Only
|
|
PRI
|
CHAR(32)
|
Alarm priority entered in the Priority field. Displays Low, Medium or High.
|
Low, Medium, High
|
|
PRIM
|
CHAR(32)
|
Block's tag name
|
Display Only
|
|
SCAN
|
CHAR(32)
|
Scan status. Displays either On or Off.
|
On, Off
|
|
SCANT
|
CHAR(32)
|
Scan time setting entered in the Scan Time field.
|
Numeric Value (1 to 255 seconds)
|
|
SA[1-3]
|
CHAR(32)
|
Names of the security areas in the Security Areas 1 to 3 fields.
|
Up to three security area names, as defined in the Security Configuration program
|
To access the field values of tag DEMO:RAMP, use the query:
select * from TAGVALUE where node=’DEMO’ and tag=’RAMP’;
Updating Tag Values
The real-time table TAGVALUE allows updates to the current field values for the specified NODE and TAG. This can be used to write applications that can automatically update a set of set
points. Only tags that are in manual mode can be updated. You can update a tag value by either specifying the CV field value or the ACV field value. For TX types blocks you must
update the ACV field. The update feature is only available if the OpenRDA Server for FIX has been configured to allow it and if the user has logged in with the required password.
Examples:
update tagvalue set ACV='2.0' where tag='HUMIDITY';
You can also use a special feature to update multiple tags with a single query. This is done using a special INSERT syntax provided by the OpenRDA Server for FIX. The syntax is as follows:
insert into tagvalue (NODE, TAG, ACV) values ( ('Node1','Tag1','20.0'), …, ('Node1','Tag20','50.0'));
The above statement will update the values of all the specified NODE:TAG pairs as part of the VALUES clause to the specified values. You must use the exact syntax specified above. Each
SQL statement can at most update 2048 tags and the size of the SQL statement must not exceed 8192. If you exceed this limit then you will have to break your update up into multiple statements.
Accessing Historical Data
The historical data table ARCHIVE allows access to data collected from the FIX Historical Collect program or from a Lab data file converted to FIX format. Data is accessed by specifying the NODE, TAG
and time range. This table is used to get time history for one or more tags and to find out what tags exist in the history files. If you want to access data from history files that are located
in a different location than the path configured by FIX, you can specify value for the DATASET column to either select a pre-configured path or any other path containing the historical data
files. This allows each user to access any history files that are accessible by the OpenRDA Server for FIX. Details on how to set up and access different sets of historical datasets are given
in section Specifying the location of the History Files.
| Table 4‑4: ARCHIVE Table |
|
Column
|
Type
|
Description
|
|
NODE
|
CHAR (32)
|
Node name
|
|
TAG
|
CHAR (32)
|
Tag name and optionally can include the field name in format TAG.FIELD
|
|
TIME
|
TIMESTAMP
|
Time that you want the historical data values for. It is used as the start time when used in conjunction with DURATION field. You can specify a BETWEEN condition on the TIME field to specify both the
start time and end time (and avoid having to specify the DURATION). As an output this column represents the time of the sample. You can perform queries relative to current time by omitting condition
on this column (see description of the DURATION field).
The format of the time string is ‘YYYY-MM-DD HH:MM:SS’. Note that the year value should contain the century too. Year 97 does not imply 1997.
|
|
VALUE
|
DOUBLE
|
Floating point value
|
|
STATUS
|
INTEGER
|
The Status code. 0 indicates data is valid. Otherwise data is NOT valid. Data may be marked invalid if the specified NTF was not archived for the specified time range or if the historian was shutdown.
|
|
ALARM
|
CHAR(256)
|
The Alarm code. See Table 4‑6 for possible values.
|
|
DURATION
|
CHAR(32)
|
Used in conjunction with the TIME field to specify the time range. If a value for TIME is also specified, then data will be retrieved from time starting from the specified TIME to time ending
with TIME + DURATION. Specify the DURATION only and no value for TIME if you want to access data for specified past time. Format for the duration string is DD:HH:MM:SS. The default duration is 60 seconds.
|
|
SAMPLE_INTERVAL
|
TIMESTAMP
|
Interpolation between values. The format for the sample_interval time string is HH:MM:SS. This allows for an sample_interval of up to 23:59:59. The times are entered in 24-hour format. The default
sample_interval is 60 seconds.
|
|
MODE
|
CHAR(32)
|
Mode of retrieval of NTF. Supported Modes are SAMPLE, AVERAGE, HIGH, LOW & RAW. Default mode is SAMPLE for HTR points and RAW for Lab Data points.
§ Sample Mode - the last value found, up to and including the start of the sample_interval, is returned. Only valid for HTR points.
§ Average Mode - the average of all valid data found during the sample_interval is returned. Only valid for HTR points.
§ High Mode - the highest valid data point found during the sample_interval is returned. Only valid for HTR points.
§ Low Mode - the lowest valid data point found during the sample_interval is returned. Only valid for HTR points.
§ Raw Mode - the raw data points from LABDATA files are returned. Only valid for Lab Data points.
|
|
DATASET
|
CHAR(256)
|
- P or empty - to access history files at the path pointed to by the PRIMARY setting in the server configuration or the default Historical Data
path setting in the FIX SCU configuration
- S - to access history files pointed to by the SECONDARY setting in the server configuration. You can use this path to point to the historical
data files on your file server.
- Any UNC path - path to the history files
Please refer to section Specifying the location of the History Files for details on PRIMARY and SECONDARY data path settings in the server
configuration. All paths should point to the root HTRDATA path, not an individual node directory.
|
Finding out what tags are in the history files
You can find out what all tags are currently being archived by querying this table without any time range. For example,
select * from ARCHIVE
will print out all points that are currently being archived. The server assumes default TIME value of one minute before current time, a DURATION of one minute, and an SAMPLE_INTERVAL of one
minute.
To find out what points are in the history files at a specified time:
select * from ARCHIVE where NODE=’DEMO’ and TIME = ’1992-09-25 08:00:00'
or
select * from ARCHIVE where NODE=’DEMO’ and TIME = {ts ’1992-09-25 08:00:00'}
Accessing data by specifying a time range
To access data for tag DEMO:OILRM1.F_CV over a time range:
select * from ARCHIVE where (NODE=’DEMO’ and TAG=’OILRM1.F_CV’) and TIME between '1992-09-25 08:00:00' and '1992-09-25 12:00:00’;
or
select * from ARCHIVE where (NODE=’DEMO’ and TAG=’OILRM1.F_CV’) and TIME = '1992-09-25 08:00:00' and duration ='4:00:00’;
To access multiple tags from the same node over the same time range:
select * from ARCHIVE where NODE=’DEMO’ and (TAG=’OILPIPE1’ or TAG=’OILPIPE2’) and TIME = '1992-09-25 08:00:00' and duration ='4:00:00’;
Accessing data by specifying start time relative to current time
In many cases you may want to build and save queries to return results for a past time duration without having to specify a different start time and end time each time you want to run the
query. Building a query that contains a specification for the DURATION but no specification for the TIME can do this. The query below will report data for the last 24 hours each time it
is run:
select * from ARCHIVE where TAG=’OILLEVEL1’ and duration=’1:00:00:00’ and sample_interval=’1:00:00’ and mode=’HIGH’
This feature allows you to embed these queries in reports and have the reports generated with past specified amount of data each time they are run.
Using the MODE options
The MODE setting controls what value is returned for a sample over a given sample_interval. For any sample_interval, there may be zero or more points that were collected. The mode
settings determine how a sample value for that sample_interval is determined.
To access 1-hr averages for tag DEMO:OILLEVEL1:
select * from ARCHIVE where TAG=’OILLEVEL1’ and time='1992-09-25 08:00:00' and duration=’1:00:00:00’ and sample_interval=’1:00:00’ and mode=’AVERAGE’
To access the highest valid data point for tag DEMO:OILLEVEL1 during a 24-hr sample_interval and for a duration of 4 days:
select * from ARCHIVE where TAG=’OILLEVEL1’ and time='1992-09-25 08:00:00' and duration=’4:00:00:00’ and sample_interval=’23:59:59’ and mode=’HIGH’
Using SQL set functions - MIN, MAX, AVG
The SQL language defines many useful functions that can be applied over a resulting set. For example, you can use the function MIN on the VALUE column to get the minimum value of that parameter
over a time range. The query below will report the minimum value tag 'XYZ' took over last 24 hours:
select min(value) from archive where node = 'DEMO' and tag='XYZ' and duration='1:00:00:00';
The following query will print out the minimum, maximum and average over the last 24 hours:
select min(value), max(value), avg(value) from archive where node = 'DEMO' and tag='XYZ' and duration='1:00:00:00';
The following query will report the maximum value and the time at which the value was at its maximum using a nested query feature of SQL. Multiple times will be returned depending on how long
that maximum existed and what you have specified as your sample_interval.
select time, value from archive where node='DEMO' and tag='XYZ' and duration = '1:00:00:00' and sample_interval='1:00:00' and value = (select min(value) from archive where node='DEMO' and tag='XYZ'
and duration = '1:00:00:00' and sample_interval='1:00:00' )
Accessing multiple tags and getting the values in a tabular format
The following query shows how the data for OILLEVEL1 and OILTEMP can be retrieved where the first column is the time and the second and third columns are values for the two variables. This is the way
you will want to retrieve the data to easily plot one or more variables against time. The SQL language requires the use of JOINs between the ARCHIVE table to achieve this.
SELECT ARCHIVE_1.TIME, ARCHIVE_1.VALUE AS OILLEVEL1, ARCHIVE_2.VALUE AS OILTEMP
From ARCHIVE ARCHIVE_1, ARCHIVE ARCHIVE_2
Where (ARCHIVE_1.NODE=’DEMO’ and ARCHIVE_1.TAG=’OILLEVEL1’ and ARCHIVE_1.TIME = {ts '1992-09-25 08:00:00'} and ARCHIVE_1.duration ='8:00:00’ and sample_interval=’1:00:00’) and (ARCHIVE_2.NODE=’DEMO’
and ARCHIVE_2.TAG=’OILTEMP’) and ARCHIVE_2.TIME= ARCHIVE_1.TIME;
The above query was formulated using the MS Query tool that is bundled with Microsoft Excel for external data access and generated the following result table:
|
TIME
|
OILELEVEL1
|
OILTEMP
|
|
1992-09-25 08:00:00
|
0.000000
|
0.000000
|
|
1992-09-25 09:00:00
|
0.000000
|
0.000000
|
|
1992-09-25 10:00:00
|
0.000000
|
0.000000
|
|
1992-09-25 11:00:00
|
526.436279
|
42.000000
|
|
1992-09-25 12:00:00
|
151.522095
|
44.000000
|
|
1992-09-25 13:00:00
|
151.522095
|
44.000000
|
|
1992-09-25 14:00:00
|
151.522095
|
44.000000
|
|
1992-09-25 15:00:00
|
151.522095
|
44.000000
|
Interval Literal
Interval literal strings can be used in SQL query to manipulate Date/Time/Timestamp values. Interval literal strings can be used in date-time expression to:
- add an interval to a datetime (or add a datetime to an interval)
- subtract an interval from a datetime
The interval literal string can be in one of these formats:
{INTERVAL [+|-] interval-string interval-qualifier}
INTERVAL [+|-] interval-string interval-qualifier
The two types of intervals cannot be mixed in expressions. You can only use one of them in any expression.
Interval-string: The interval-string value is specified in quotes in one of the two formats:
- year-month interval: interval in terms of years and an integral number of months
- day-time interval: interval in terms of days, hours, minutes, seconds.
Each of the fields in the interval-string needs to be separated by specific separator characters. Between year and month is a hyphen separator. Between day and hour is a space separator, between hour
and minute is a colon separator, between minute and second is colon separator, between second and fractional second is period separator. Date-time interval operations are supported only on
dates older than Jan 1, 1970. Year-month interval operations are supported on any date.
Interval-qualifier: The interval qualifier specifies the class of the interval (type of interval) and precision of the fields.
Table 4‑5: Example Interval Literals
|
Format
|
Description
|
|
{INTERVAL '5' YEAR}
|
interval of 5 years
|
|
{INTERVAL '5' YEAR(2)}
|
interval of 5 years. The interval leading precision is 2.
|
|
{INTERVAL '20' MONTH}
|
interval of 20 months
|
|
{INTERVAL '5-20' YEAR To MONTH} -
|
interval of 2 years and 20 months
|
|
{INTERVAL '2' DAY}
|
interval of 2 days
|
|
{INTERVAL '2 10' DAY To HOUR}
|
interval of 2 days and 10 hours
|
|
{INTERVAL '2 10:20' DAY To MINUTE} -
|
interval of 2 days, 10 hours and 20 minutes
|
|
{INTERVAL '2 10:20:5' DAY To SECOND}
|
interval of 2 days, 10 hours, 20 minutes, 5 seconds
|
|
{INTERVAL '2 10:20:5.123' DAY To SECOND} -
|
interval of 2 days, 10 hours, 20 minutes, 5.123 seconds
|
Example queries of date-time expressions with Interval literals:
To access data for tag DEMO:OILRM1.F_CV for last 24 hours and at a sample interval of 1 hr each.
select * from archive where time between now() - {INTERVAL '1' DAY} and now() and SAMPLE_INTERVAL = '01:00:00';
Note: The current version does not support Interval Data Type.
Specifying the Location of the History Files
By default, all queries to the ARCHIVE table access the history files pointed to by the FIX path settings. You can query different history files by either specifying a path or using a
pre-configured path on the server. All paths should point to the root HTRDATA path, not an individual node directory. On the server side you can configure both the primary and secondary path for the
history files by setting the PRIMARY and SECONDARY settings in the [FIX] section of the OPENRDA.INI file. This allows any client to request access to these history files by simply setting the
value of DATASET to ‘P or 'S'. If paths for PRIMARY and SECONDARY are empty, they will default to the Historical Data path setting in the FIX SCU configuration. For example, the query:
select * from archive where dataset='S'
will list all points being archived in the history files at the location defined by the SECONDARY.
Alternatively, the client can specify a path in the query. This allows the greatest flexibility but requires each query to include the path. For example, the query:
select * from archive where dataset='//mynode/history'
will list all points being archived in the history files at the location //mynode/history.
To set up the server for primary and secondary historical data paths:
1. Make sure the OpenRDA Sever for FIX is not running. If it is, stop it by closing the Window.
2. Open the OPENRDA.INI file by running the OpenRDA Config File from the OpenRDA ODBC for FIX program group. This will open OPENRDA.INI for editing.
3. Go to the section [FIX]
4. Under this section, set the settings for:
PRIMARY = UNC path
SECONDARY = UNC path
where path is location of the history files ( i.e. PRIMARY = C:\FIX\HDT). Note that these paths can refer to location on your file server or any other NODE in the FIX environment.
5. Save the file
6. Start OpenRDA Server from the OpenRDA ODBC for FIX program group
7. From the client you can now execute queries where the DATASET contains the value "S".
Accessing lab data
FIX stores lab data in files with L24 extension. These may be in the same directories as the HXX files or in separate directories. If they are in separate directories then the node name
that is returned is the sub-directory they are in. For example, if you have a node DEMO, then you will have a DEMO directory under the HTRDATA directory. This directory will contain
historical data files with H04, H08 or H24 extensions. If lab data is placed in this directory, then accessing the ARCHIVE table with NODE='DEMO' will return data from both lab data files and
the history data files. In some installations the lab data files are in separate directories under the HTRDATA directory. If one of these directories is called LABDATA, then the ARCHIVE
table will report the node name as LABDATA. You can retrieve just the lab data by specifying NODE = 'LABDATA' in the query.
Accessing Alarms
The FIX historian saves the alarm status along with the tag value. You can access the ALARM status by retrieving the ALARM column from the ARCHIVE table. This allows you to easily monitor
the alarm by archiving that value. For example, you can obtain all alarms over the last 24 hours by using the following query:
select * from archive where duration='1:00:00:00' and ALARM is not like 'AS_OK%' and alarm is not like 'AS_DSAB%' and sample_interval='30:00';
Table xx below lists all the different values that are returned for the ALARM value. You can use the LIKE feature of SQL to not have to type in the exact string.
Table 4‑6 : Alarm Values
|
AS_OK: No alarm - OK,
|
|
AS_LOLO: Low low alarm,
|
|
AS_LO: Low alarm
|
|
AS_HI: High alarm
|
|
AS_HIHI: High high alarm
|
|
AS_RATE: Rate of change
|
|
AS_COS: Change of state
|
|
AS_CFN: Change from normal
|
|
AS_DEV: Deviation
|
|
AS_FLT: Floating point error
|
|
AS_MANL: Special code for MANL/MAINT (for inputs)
|
|
AS_DSAB: Alarms disabled
|
|
AS_ERROR: General block error
|
|
AS_ANY: Any block alarm
|
|
AS_NEW: New block alarm
|
|
AS_TIME: Timeout alarm
|
|
AS_SQL_LOG: Not connected to database
|
|
AS_SQL_CMD: SQL Cmd not found or invalid
|
|
AS_DATA_MATCH: SQL cmd doesn't match data list
|
|
AS_FIELD_READ: Error reading tag values
|
|
AS_FIELD_WRITE: Error writing tag values
|
|
AS_IOF: General I/O failure
|
|
AS_OCD: Open circuit
|
|
AS_URNG: Under range (clamped at 0)
|
|
AS_ORNG: Over range (clamped at MAX)
|
|
AS_RANG: Out of range (value unknown)
|
|
AS_COMM: Comm link failure.
|
|
AS_DEVICE: Device failure.
|
|
AS_STATION: Station Failure",
|
|
AS_ACCESS: Access denied (privledge)
|
|
AS_NODATA: On poll but no data yet
|
|
AS_NOXDATA: Exception item but no data yet
|
|