Exaquantum API Reference Manual
Exaquantum API Reference Manual
Manual
IM 36J04A14-01E
IM 36J04A14-01E
Yokogawa December 28 2005
7th Edition Issue 1
Exaquantum API Reference Manual i
All rights are reserved in this document, which is the property of Yokogawa Electric
Corporation. Information contained herein is the property of Yokogawa Electric
Corporation.
Unless agreed in writing by Yokogawa Electric Corporation, the licensee shall not remove,
release, disclose, reveal, copy, extract all or part of the documentation.
Trademark Acknowledgements
Microsoft, Windows, Windows 2000, Windows XP, Windows Server 2003, Microsoft
Word, Microsoft Excel, Microsoft Office 97, Microsoft Office 2000, Microsoft Office XP,
Microsoft Office 2003 Visual Basic, Visual C++, SQL Server, ActiveX and .NET are either
registered trademarks or trademarks of Microsoft Corporation in the United States and/or
other countries.
Exaquantum uses Microsoft SQL Server as part of an Integrated Value Added Solution.
Adobe and Acrobat are registered trademarks of Adobe Systems Incorporated, and registered
within particular jurisdictions.
Basic Scripting Engine provided by Cypress Software Inc., Copyright 1993 2000, all rights
reserved.
All other company and product names mentioned in this manual are trademarks or registered
trademarks of their respective companies.
Highlights
The Highlights section gives details of the changes made since the previous issue of this
document.
Summary of Changes
Detail of Changes
Chapter/Section/Page Change
14.2 Added and section numbers are changed.
15.1 Added and section numbers are changed.
Chapter 17 Newly added and Chapter numbers of later chapters are
changed.
23.2 Added description
23.8 Added and section numbers are changed.
Chapter 24 Newly added.
24.5 Signatures and parameters in DeleteTag Method and
DeleteFolder Method changed.
Table of Contents
Chapter 1 Introduction
This document serves as a reference document describing the Exaquantum Application
Programming Interfaces (APIs).
Two types of Interface are provided, COM interface and .NET interface. The Summary
section below describes what is available for each type.
The COM Interfaces are standard COM Automation Interfaces and are available to Windows
developers who develop applications in languages such as Microsoft Visual Basic (VB) and
Microsoft Visual C++ (VC++).
The .NET Interfaces are available to any .NET language, such as Microsoft C# and
Microsoft VB .NET.
The definitions of the COM APIs given in this document are in a VB style, but the APIs are
available to other languages including VC++.
This document is arranged in two broad sections, a section giving examples of each of the
data exchanges available via the APIs and a reference section giving details of the APIs.
1.1 Summary
APIs are available for the following:
COM APIs:
Reading the latest RTDB Item values in both a synchronous and asynchronous way
Reading the history of RTDB Item values in both a synchronous and asynchronous way
Reading the history of Alarm and Event data in both a synchronous and asynchronous
way.
Reading and writing item values through RBNS (Role Based Namespace)
Tag Browsing
NET APIs:
Access to the APIs is via the QuantumAutomation 1.0 Type Library installed as
'\Yokogawa\Exaquantum PIMS\System\QuantumAutomation.dll. In VB first make a
reference to this type library in your project before trying to use the API functions.
Note: This type library exposes more functionality than is described in this document.
These additional functions are not supported for this release of Exaquantum.
Table 3-1
It is good programming practice for each client to obtain a single Session object, and keep
hold of this for the entire time that access to Exaquantum API functions is required. This
will help clients respond to the various events available on Session, such as NetworkError; .
' Give the Session Pointer to the Alarm & Event Access object.
objAEAccess.SetSession objSession
It is good programming practice for each client to obtain a single Session2 object for each
Exaquantum server, and retain these for the entire time that access to Exaquantum API
functions is required. This will help clients respond to the various events available on
Session2, such as QuantumShutdown and QuantumAvailable.
An Item Id can be obtained from an Item Path by using the Browser PathToMetaData
method as follows:
Dim sItemsArray(1) As String
Dim lNumItems As Long
Dim Count As Long
Dim vItemID As Variant
Dim rsBrowseResults As ADODB.Recordset
' Run through the Recordset returned from Browse and add check which
' is valid.
For Count = 1 To lNumItems
vItemID = rsBrowseResults!ItemID
If Not IsNull(vItemID) Then
' Do something with the Item ID..
Else
MsgBox "Path is invalid:" & sItemsArray(Count - 1)
End If
rsBrowseResults.MoveNext
Next Count
rsRBNSBrowseResults.MoveNext
Wend
' Get the OPCAEPumpHistId (first row only for this example)
vAEId = objRecordset!OPCAEPumpHistId
Else
MsgBox "OPCAEPumpHistId is Null"
Exit Sub
End If
' Run through the Recordset returned from Browse and add the Item Ids
' to the DataAccess collection.
For Count = 1 To lNumItems
vItemID = rsBrowseResults!ItemID
If Not IsNull(vItemID) Then
' Add the item to the DataAccess collection
objDataAccess.Add vItemID
rsBrowseResults.MoveNext
Else
MsgBox "Path is invalid:" & sItemsArray(Count - 1)
Exit Sub
End If
Next Count
' Get VTQ from the Variant Array for each Item
The order is not necessarily the order in which
they were added in.
vValue1 = vData(1, 0)(0, 0) Value
lQuality1 = vData(1, 0)(1, 0) Quality
Note: For this type of read, the Data Access object must be defined 'With Events' as follows:
Dim WithEvents objDataAccess As QUANTUMAUTOMATIONLib.QDataAccess
This example is kept updated with the current value for two items. The first piece of code
registers the items and the second piece of code defines an event routine that will receive the
data:
Dim rsBrowseResults As ADODB.Recordset
Dim sItemsArray(1) As String
Dim lNumItems As Long
Dim Count As Long
Dim vItemID As Variant
' Run through the Recordset returned from Browse and add the Item Ids
' to the DataAccess collection.
For Count = 1 To lNumItems
vItemID = rsBrowseResults!ItemID
If Not IsNull(vItemID) Then
' Add the item to the DataAccess collection
objDataAccess.Add vItemID
rsBrowseResults.MoveNext
Else
MsgBox "Path is invalid:" & sItemsArray(Count - 1)
Exit Sub
End If
Next Count
This piece of code shows how to define an event routine that will receive the data. This will
be called once for each Item registered with the initial value then again on an item by item
basis as an item changes:
Private Sub objDataAccess_OnData(ByVal ItemID As Variant, ByVal
DataReturnType As QUANTUMAUTOMATIONLib.qdaDataReturnType, ByVal Data As
Variant)
Dim vValue As Variant
' Get VTQ from the Variant Array for this Item.
vValue = Data(0, 0) Value
lQuality = Data(1, 0) Quality
dTimeStamp = Data(2, 0) Timestamp
End Sub
This example reads the values for an item from History for the last 5 minutes:
Dim rsBrowseResults As ADODB.Recordset
Dim sItem As String
Dim lNumItems As Long
Dim Count As Long
Dim vItemID As Variant
Dim vData As Variant
Dim vValue As Variant
Dim lQuality As Long
Dim dTimeStamp As Date
Dim dQueryTime As Date
' Using the Recordset returned from Browse add the Item Id
' to the DataAccess collection.
vItemID = rsBrowseResults!ItemID
If Not IsNull(vItemID) Then
' Add the item to the DataAccess collection
objDataAccess.Add vItemID
Else
MsgBox "Path is invalid:" & sItem
Exit Sub
End If
' Loop through all the VTQs returned and store them
If Not IsNull(vData) Then
' Loop through the entire array and store the data
' NB: In this sample only the last data in the Array is stored when we
are out of the loop
For Count = 0 To UBound(vData(1, 0), 2)
vValue = vData(1, 0)(0, Count) Value
lQuality = vData(1, 0)(1, Count) Quality
dTimeStamp = vData(1, 0)(2, Count) Timestamp
Next Count
End If
Note: For this type of read, the Data Access object must be defined 'With Events' as follows:
Dim WithEvents objDataAccess As QUANTUMAUTOMATIONLib.QDataAccess
This example receives values for an item from history for the past 5 minutes. The first piece
of code registers the items and the second piece of code defines an event routine that will
receive the data:
Dim rsBrowseResults As ADODB.Recordset
Dim sItem As String
Dim lNumItems As Long
Dim vItemID As Variant
Dim dQueryTime As Date
' Using the Recordset returned from Browse add the Item Id
' to the DataAccess collection.
vItemID = rsBrowseResults!ItemID
If Not IsNull(vItemID) Then
' Add the item to the DataAccess collection
objDataAccess.Add vItemID
Else
MsgBox "Path is invalid:" & sItem
Exit Sub
End If
This piece of code shows how to define an event routine that will receive the data. This will
be called for multiple times until DataReturnType is qdaEnd for each Item registered:
Private Sub objDataAccess_OnData(ByVal ItemID As Variant, ByVal
DataReturnType As QUANTUMAUTOMATIONLib.qdaDataReturnType, ByVal Data As
Variant)
Dim vValue As Variant
Dim lQuality As Long
Dim dTimeStamp As Date
Dim vItemID As Variant
Dim Count As Long
' Loop through the entire array and store the data
' NB: In this sample only the last data in the Array is stored
' when we are out of the loop
If Not IsNull(Data) Then ' Ignore notification if Data is NULL
For Count = 0 To UBound(Data, 2)
vValue = Data(0, Count) Value
lQuality = Data(1, Count) Quality
dTimeStamp = Data(2, Count) Timestamp
Next Count
End If
Resolution filtering algorithm - Splitting the overall time period into smaller individual
periods for which minimum and maximum values will be returned.
This method is defined on both the IQDataAccess and IQDataAccessMulti interfaces. Refer
to section 18.12 SetFilterParameters Method for more details.
1 A query is issued covering the duration between the two input parameters; Start time of
data and the End time of data.
2 The data returned by the query is time-sliced into periods. The number of periods being
determined by the Number of periods input parameter.
3 For each period, the points with the Maximum and Minimum values are extracted. These
points will be sent to the client application. The Timestamps sent will be those associated
with the Maximum and Minimum values in that period.
4 If a bounding value is requested, an extra period is created whose boundary time is the
start time of the query. The only point contained within this extra period is the bounding
value.
NOTES
1. If there is only one point within a period, then this point is sent to the client.
2. If there are no points within a period, then no data is sent to the client for this period.
4. For any period, if there is a point with quality bad or uncertain shutdown, and whose
value is either:
then this point is returned in addition to the max and /or min points having good
quality. This means up to four points can be returned from one period, two with good
quality, and two with bad or uncertain shutdown quality.
5. Data having a secondary quality of deleted, irrespective of the primary quality, will
be deleted by the filtering. A client receiving raw data never gets these points.
Table 7-1
Aggregation types
This section describes the method used to calculate each types of aggregation.
Mean
The calculation of the Mean is based on the difference between the timestamp of the current
input notification and the equivalent timestamp form the previous input notification as
follows:
Where:
Ttotal Is the accumulating time for the input being valid i.e. its data quality was either
GOOD or Uncertain.
Where:
Ttotal Is the request time for the input being valid i.e. its data quality was either
GOOD or Uncertain.
Minimum
Determines the minimum value within the required period data. The timestamp indicates
when the minimum value was recorded
Maximum
Determines the maximum value within the required period data. The timestamp indicates
when the maximum value was recorded.
Standard deviation
The standard deviation builds upon the Mean calculation shown above:
Summation
There are two ways used to calculate the Summation that depend on the TimeFactor
configured for the aggregation calculation:
The time difference between the timestamp of the current input notification from the
timestamp of the previous input notification is used to calculate the contribution towards the
summation.
Where:
Tn-1 Is the timestamp of the input at the final requirement time or the timestamp
of the start of the current aggregation period if no notifications have been received
during the current period. T is measured in units of 100 nanoseconds.
At the beginning of the aggregation period the internal summation is reset to zero. As each
input notification arrives, it is added to the summation. The summation result is the
accumulated summation at the end of the aggregation period.
Spot value
By default, the value of the input at the end of the aggregation period. The value at the
beginning of the period may be selected by setting registry value
HKLM\Software\Quantum\Server\AggSpotValueAtPeriodStart to 1.
Count
Within the aggregation period under consideration, this represents the number of times the
input notification value changes from a value not equal to the On State value, to a value
equal to the On State value.
On Time
The number of seconds the input value has been equal to the On State value within the
aggregation period.
' Items are requested by using Intrinsic Namespace Access strings, i.e.
Root.???
sItem = "Root.Tag1.Value"
lNumItems = 1
' Using the Recordset returned from Browse add the Item Id
' to the DataAccess collection.
vItemID = rsBrowseResults!ItemID
If Not IsNull(vItemID) Then
' Add the item to the DataAccess collection
objDataAccess.Add vItemID
Else
MsgBox "Path is invalid:" & sItem
Exit Sub
End If
'If the Item Id is NULL, then the defined item does not exist
If IsNull(vItemID) Then
MsgBox "Invalid Path: " & sItem
Exit Sub
End If
Accessing Exaquantum data through RBNS also provides a high security by way of the
RBNS configuration. For example one user can read an item but another user may not be
able to read the same item.
QDataAccessMulti is built on top of QDataAccess and Session2 objects, and the same
principle applies to QDataAccessMulti object as to these two. One difference is that
QDataAccessMulti methods use path names and not item identifiers to identify items.
item1 = MyNamespace.Tag1.Value
item2 = MyNamespace.Folder1.Tag1.Value
item1 = MyNamespace.Tag1.Value
item2 = MyNamespace.Folder1.Tag1.Value
This example reads the Alarm and Events for a particular OPC Gateway from History:
Dim ConnectStr As String
Dim objConnection As ADODB.Connection
Dim objRecordset As ADODB.Recordset
Dim Count As Long
Dim i As Long
Dim vAEId As Variant
Dim Events As Variant
Dim vOPCAEPumpHistID As Variant
Dim sSource As String
Dim sMessage As String
Dim dTimeStamp As Date
Dim lSequenceNo As Long
Dim lEventCategory As Long
Dim lSeverity As Long
Dim sConditionName As String
Dim lNoOfAttributes As Long
Dim vEventAttributesArray As Variant
Dim vEventAttribute As Variant
Dim dQueryTime As Date
' Get the OPCAEPumpHistId (first row only for this example)
vAEId = objRecordset!OPCAEPumpHistId
Next Count
End If
Note: For this type of read, the AEAccess object must be defined 'With Events' as follows:
Dim WithEvents objAEAccess As QUANTUMAUTOMATIONLib.QAEAccess
This example receives the Alarm and Events for a particular OPC Gateway from History.
The first piece of code registers the Alarm and Event HistID, and the second piece of code
defines an event routine that will receive the data:
Dim vAEId As Variant
Dim vData As Variant
Dim vAEData As Variant
Dim lQuality As Long
Dim dTimeStamp As Date
Dim ConnectStr As String
Dim objConnection As ADODB.Connection
Dim objRecordset As ADODB.Recordset
Dim dQueryTime As Date
' Get the OPCAEPumpHistId (first row only for this example)
vAEId = objRecordset!OPCAEPumpHistId
End If
This piece of code shows how to define an event routine that will receive the data. This will
be called multiple times until EventReturnType is qdaEnd:
Private Sub objAEAccess_OnAE(ByVal EventReturnType As
QUANTUMAUTOMATIONLib.qeaEventReturnType, ByVal Events As Variant)
Dim vOPCAEPumpHistID As Variant
Dim sSource As String
Dim sMessage As String
Dim dTimeStamp As Date
Dim lSequenceNo As Long
Dim lEventCategory As Long
Dim lSeverity As Long
Dim sConditionName As String
Dim lNoOfAttributes As Long
Dim vEventAttributesArray As Variant
Dim vEventAttribute As Variant
Dim Count As Long
Dim i As Long
Next Count
End If
End Sub
1 To update raw data with an existing data write mechanism, e.g. Data Write API
For each job the user must specify a unique name and a set of input Items these are the
Items for which updated data has been previously written to the Exaquantum Historian.
The user may also optionally de-select one or more dependent items to be excluded from the
recalculation.
Recalculation can only be requested for dependent aggregations after having changed
the aggregation result items on which they depend. [See Note 1]
All dependent aggregations will be recalculated the user cannot deselect any items.
All result items set in a scripted aggregation will be recalculated, but only those that
are aggregation result items will have their dependent aggregations recalculated.
Number of aggregation result items must be small, e.g. a few. Also the time span to
recalculate should be short, e.g. a few hours. [See Note 2]
Note 1: Future release of Exaquantum will allow specifying raw data that will affect
referencing calculated tags as well as base and dependent aggregations.
Note 2: There is no hard figure, the actual number depends on the system work load. But
keep it to a minimum.
When requesting recalculation for an aggregation result item, the PercentTimeGood item
may not be selected this will be updated automatically when other aggregation results are
recalculated.
If an aggregation result uses the Changed property of the PercentTimeGood item (as shown
below) then it not be recalculated. This is because the PercentTimeGood value is calculated
internally and should not be written to explicitly.
if [Root.Tag1.Aggregations.Hour.PercentTimeGood.Value].Changed then
[Result.Aggregations.Hour.Mean.Value] = <n>
[Result.Aggregations.Hour.PercentTimeGood.Value] = <n>
end if
A period that lies within an archive. - If the start time is within an archive period and
the end time is valid then the data within the valid online period will be recalculated.
The Systems Events Viewer will report a failed recalculation.
A period before the time that an item was created. - If the start time is before the
creation of the item and the end time is valid then the data within the valid online
period will be recalculated. The Systems Events Viewer will report a failed
recalculation.
Determining the input and output dependencies of Items requested for recalculation
Starting up all Item, Aggregation and Calculation objects required for the
recalculation
Commit of a recalculation is synchronous. The method does not return to the user until all
updated data has been written into history and any updates to live aggregations have been
made to the RTDB.
Call the SetRecalcInputItemIds method to specify the Items whose data will be changed.
Call Recalc to request recalculation a Recordset of data values that will be written is
returned for review.
User either calls Commit to save the recalculated data to Exaquantum Historian or calls
Cancel to abandon the recalculation.
A recalculation is active from the beginning of a call on the Recalc() method until the end
of a call on the Commit() or Cancel() methods. Only one recalculation may be active at one
time. If a user releases a RecalcJob object that they have called the Recalc() method on
without calling Commit() or Cancel(), the recalculation will be automatically cancelled.
Users may still configure other recalculation job definitions while a recalculation is active.
Only one user may access a given job definition at one time.
If the user writes an aggregation result item at a timestamp which is not on the aggregation
period boundary for any result other than a Minimum or Maximum, the point will be
ignored.
Table 11-1
objRecalcJob.SetRecalcInputItems("Root.Tag1.Aggregations.Hour.Mean.Value")
.
' Commit the recalculation results to history
objRecalcJob.Commit lRecalcSessionID
Example of item values recordset showing points that may be affected:
Table 11-2
The plan is to change the same hourly aggregation result item for more than one hour within
a day.
Table 11-3
Table 11-4
User changes two hourly aggregation result items that feed a scripted aggregation
( Result.Aggregations.Hour.Mean.Value =
Root.Tag3.Aggregations.Hour.Mean.Value +
Root.Tag4.Aggregations.Hour.Mean.Value )
Table 11-5
Table 11-6
Table 11-7
Table 11-8
Returns a NamespaceBuilder object used for setting Tags and Function Blocks Offline and
Online. This object can only be obtained if the client is a member of QAdministratorGroup.
This method is called back on the client when the network connection fails between client
and server.
Clients cannot recover the connection to Exaquantum after this failure without first closing
the connection and re-establishing it by destroying and recreating the Session object.
Signature
Event NetworkError()
This method is called back on the client when the Exaquantum Server processes are shut
down.
Clients cannot recover the connection to Exaquantum after this failure without first closing
the connection and reestablishing it by destroying and recreating the Session object.
Signature
Event QuantumShutdown(bErrored As Boolean)
Parameters
bErrored is False if the Exaquantum processes shutdown normally (by stopping the
Service) or True if the processes shutdown abnormally.
ServerName is a string property allowing the client to specify the machine name of the
Exaquantum server to connect to. This property must be set before calling any other method
on the Session2 object. If not set, it will default to using the DesignatedServer in the same
way as the Session object.
ServerName may only be set once an attempt to reset it, or to set it after calling any other
method, will raise an error.
This method may be used to determine whether the Exaquantum server that the Session2
object is set to connect to is available. It returns True if the Exaquantum server is running or
False if the server is shutdown or the network is unavailable.
Signature
Public Function IsConnected() As Boolean
This method is called back on the client when the Exaquantum server that the Session2
object is set to connect to has been unavailable but is now connected.
Signature
Event QuantumAvailable()
Parameters
The connection state is an enumeration:
Table 15-1
Return a Recordset of metadata information for the contents of a single leaf in the
namespace.
Signature
Public Function Browse(Path As String, _
Optional Filter As String = "*", _
Optional Fields As brFields = brSummary) As ADODB.Recordset
Return Value
A Recordset will be returned populated with metadata information for the selected Path. The
information will be returned in alphabetic order based on the Name column. The columns
returned will be defined by the Fields parameter.
Parameters
Filter specifies a text filter to apply to the names of the leaves. This allows the client to
reduce the number of rows returned. The filter allows wildcards specified with *. Filter will
be ignored for browsing below a tag.
Fields allows the fields returned to be selected by the enumeration brFields as described
below.
ClassName nvarchar(32) The class name from the column Name in table
Class.
Id int The id for this leaf. This is typically the column ExtId
from table namespace. See below for details.
ClassName nvarchar(32) The class name from the column Name in table Class.
ItemDataTypeId tinyint For Items this returns the data type from the column
DataTypeId in table Item.
ItemId binary(8) For Items this returns the Item ID which is required
when using the DataAccess object.
NamespaceId int The id for this leaf from the Namespace table.
Id returned in Recordset
The Id returned depends on the class of the leaf and whether it exists above or below a tag in
the hierarchy as described below:
Table 16-3
Signature
Public Function PathToMetadata(Paths() As String, _
NumPaths As Long, _
Optional Fields As brFields = brSummary) As ADODB.Recordset
Return Value
A Recordset will be returned populated with metadata information for the selected Paths.
The information will be returned in the same order as the entries in the Paths array.
Fields allows the fields returned to be selected by the enumeration brFields as described in
section 16.1
Parameters
Fields allows the fields returned to be selected by the enumeration brFields as described
above.
Return a Recordset of paths for Items in the namespace hierarchy as defined by a list of one
or more Ids.
If more than one path exists due to a shortcut then return just one of the possible paths.
Signature
Public Function ItemIdToPath(Ids() As Long, _
NumIds As Long) As ADODB.Recordset
Return Value
A Recordset will be returned populated with a single column Path for the selected Ids. The
information will be returned in the same order as the entries in the Ids array.
Recordset shape:
Table 16-4
Parameters
Ids specifies a set of Ids as defined by the Id column of the Item Table.
A VARIANT, containing an array of 8 byte item ids, will be returned for the selected
NamespaceId, RemainingPaths, HiRange and LowRange. The information will be
returned in the same order as the entries in the RemainingPaths array.
Parameters
NamespaceId Specifies the id in the namespace to start parsing the path from.
RemainingPaths Specifies the leaf of the namespace to use below the specified
NamespaceId e.g. Folder1.Folder2.
Various filters may be specified to allow the client to reduce the number of rows returned.
Filters allow wildcards specified with *. Each filter has an associated flag to specify
whether the filter is additive (only matching leaves are returned) or subtractive (all matching
leaves are excluded)
FBTagFilter Specifies a text filter to apply to the names of Tags within Function Blocks.
TagFilter Specifies a text filter to apply to the names of Tags outside Function Blocks.
Parameters
Table 16-5
Parameter Description
RemainingPaths Specifies the leaf of the namespace to use below the specified
NamespaceID. For example; Folder1.Folder2.
Errors
E_INVALIDARG
Either:
The specified number of IDs does not concur with the size of either of the input arrays.
Return a Recordset of metadata information for the contents of a single leaf in the
namespace.
Signature
Public Function Browse(Path As String, _
Optional Filter As String = "*", _
Optional Fields As brFields = brSummary) As ADODB.Recordset
Return Value
A Recordset will be returned populated with metadata information for the selected Path. The
information will be returned in alphabetic order based on the Name column. The columns
returned will be defined by the Fields parameter.
Parameters
Filter specifies a text filter to apply to the names of the leaves. This allows the client to
reduce the number of rows returned. The filter allows wildcards specified with *. Filter will
be ignored for browsing below a tag.
Fields allows the fields returned to be selected by the enumeration brFields as described
below.
ClassName nvarchar(32) The class name from the column Name in table
Class.
ClassName nvarchar(32) The class name from the column Name in table Class.
ItemDataTypeId Tinyint For Items this returns the data type from the column
DataTypeId in table Item.
Id returned in Recordset
The Id returned depends on the class of the leaf and whether it exists above or below a tag in
the hierarchy as described below:
Table 17-3
Signature
Public Function PathToMetadata(Paths() As String, _
NumPaths As Long, _
Optional Fields As brFields = brSummary) As ADODB.Recordset
Return Value
A Recordset will be returned populated with metadata information for the selected Paths.
The information will be returned in the same order as the entries in the Paths array.
Fields allows the fields returned to be selected by the enumeration brFields as described in
section 17.1
Parameters
Fields allows the fields returned to be selected by the enumeration brFields as described
above.
Items of interests are specified by Item Ids, these can be resolved from the Item Path using
the Browser object. Before an Item can be read its Id must first be added to a collection
maintained by QDataAccess. After filling the collection, clients select the function they
require either for the whole collection (typical) or for individual items in the collection.
Add an Item Id to the collection of Items of interest. On add, if a request for data is current,
data for the new ItemID will be fetched automatically.
Signature
Sub Add (ItemID As Variant)
Parameters
ItemId - specifies the Item of interest. This should be an 8 byte array as returned by the
browser.
Signature
Sub Cancel ()
Signature
Property Count () As Long
Starts the asynchronous acquiring of data using the current time and processing options set
for the QDataAccess Object.
Signature
Sub Execute (Optional WithChanges As Boolean = True, _
Optional ReturnDataAsReady As Boolean = True )
Parameters
WithChanges - When requesting latest data, if set FALSE then only a single event will be
fired to the client for each Item. The default is to notify the client whenever the value of any
Item in the collection changes.
ReturnDataAsReady - When requesting historical data, if set FALSE then all the values for
each Item will be returned in a single event. The default is to send data as soon as it is
available to allow a more responsive user interface.
Signature
Function Item (Index As Variant) as Variant
Parameters
Return Value
This method is called back on the client for asynchronous events initiated by Execute().
Signature
Event OnData (ItemId As Variant, _
DataReturnType As qdaDataReturnType, _
Data As Variant)
Parameters
qdaNew=0 This is new data for this item. This is always the type for the first
notification for an item after Execute(), and for live data.
qdaEnd=2 For historical data, this is the final data for this Item.
where live data has only one row and historical data has one row for each time point.
Note: Data may be NULL and clients should check for this. This indicates that no data is
returned for this firing of the event.
This method is called back on the client for asynchronous requests if an error occurs.
Signature
Event OnError(Number As Long, _
Description As String, _
Source As String, _
HelpFile As String, _
HelpContext As Long)
Parameters
HelpFile - is the name of the HelpFile containing further information on the error.
Perform a synchronous read for values of items using the current time and processing
options set for the QDataAccess Object.
Data may be read for all items in the QDataAccess collection or for one specific item.
Data is always fetched for the whole collection and stored in the local cache. Subsequent
calls to ReadValue retrieve data from the cache. If the query times are not set, updating live
data is fetched so that the value in the cache is always up to date.
Signature
Function ReadValue (Optional ItemID As Variant) As Variant
Parameters
ItemID -An Item internal ID as an 8-byte array. If not supplied then defaults to fetch data
for all items in the collection.
Return Value
one row for each Item, where ItemID is the Item Id and VQT is a 2-dimensional Variant
array with the format:
Note: The Return Value may be NULL and clients should check for this. This indicates
that no data is returned for this query.
Signature
Sub Remove (ItemID As Variant)
Parameters
ItemId - specifies the Item of interest. This should be an 8 byte array as returned by the
browser.
Signature
Sub SetProcessOptions(Optional UpdateRate As Variant, _
Optional InterpMethod As qdaInterpMethod, _
Optional EdgeValueOptions As qdaEdgeValueOptions, _
Optional TimeIncrement As Variant, _
Optional ResampleInterval As Variant, _
Optional bUTC As Boolean = False)
Parameters
UpdateRate - specifies the maximum rate at which the client is to be notified of data
changes. If not specified the default is 5 seconds (must be specified as DATE.) The DATE
is converted to an interval by subtracting the earliest date that can be represented by the
DATE data type, i.e. midnight on 30th December 1899. This allows VB assignments such as
#00:00:05# for 5 seconds, or #00:02:00# for 2 minutes.
InterpMethod - determines how the raw historised data should be processed. If not
specified then defaults to qdaPreviousForward.
qdaLinear=3 Linear interpolation between the previous and next values. (Not
supported)
EdgeValueOption - determines how data matching the start and end times of a historical
query should be processed. If not specified then defaults to qdaIncludeEdge.
qdaIncludeEdge=0 Include values at specified start and end times by using the
propagating data using the selected interpolation method.
TimeIncrement - If this is specified, a timed request for history data will be made at the
UpdateRate, incrementing the SpotTime or StartTime by this amount. If latest data is
requested, polling is simulated by firing the latest value to the Client at the UpdateRate
(must be specified as DATE). See UpdateRate for details of how the DATE type is
interpreted as an interval.
ResampleInterval - If this is specified, history data will be resampled to provide exactly one
point per ResampleInterval (Must be specified as DATE.). See UpdateRate for details of
how the DATE type is interpreted as an interval.
Timestamps for all items except Minimum and Maximum Aggregation result items are
returned as the fixed ResampleInterval time. If an Aggregation result item is resampled at
its aggregation period, Exaquantum shutdown points within a period are automatically
screened out.
Minimum and Maximum Aggregation result items show the timestamp of the actual
minimum or maximum value within the ResampleInterval. Any Minimum or Maximum
Aggregation result item data with Deleted secondary quality is screened out.
bUTC If specified as True the timestamps returned will be in UTC. The timestamp that is
specified in SetQueryTime(), WriteValue(), should be in UTC as well. The default is False.
Allows the period or point in time to be specified for the items of interest.
Signature
Sub SetQueryTimes(Optional SpotTime As Variant, _
Optional StartTime As Variant, _
Optional EndTime As Variant)
Parameters
SpotTime - if specified, return data at this time otherwise return live data (must be specified
as a DATE).
StartTime & EndTime - If only StartTime is specified then return data from this time to the
latest data. If both StartTime and EndTime are specified then return data over this period
(must be specified as DATE).
Note 2: If the period of time specified by StartTime and EndTime falls wholly or partially in
the future (with respect to the Exaquantum Server clock), then additional data points
will be introduced in the data returned by DataAccess with a data quality of
Bad/Not Available. The points will be introduced for all times greater than the
Exaquantum Server clock.
Description
This method may be called before performing a read of history data to specify a filter to pre-
process the data. Any current query is cancelled.
Signature
Sub SetFilterParameters( Optional FilterParameters As Variant )
Parameters
Parameters Definition
Table 18-1
Array parameters
Array parameters
Array parameters
This method may be called by a client to allow the QDataAccess object to share its Session
connection. This is the recommended way to use QDataAccess.
If this method is not called before a request to fetch data, the QDataAccess object will create
its own Session object.
Signature
Sub SetSession(pSession As Object)
Parameters
Signature
Sub WriteValue (Value As Variant, _
Optional Item As Variant, _
Optional Quality As Variant, _
Optional TimeStamp As Variant)
Parameters
Item - The ItemId of the Item as an 8-byte array. This need not be specified if there is only a
single item in the collection.
Quality - The quality of the new value to be written to the Item. This defaults to GOOD if
not specified. If specified, it must be long integer.
If the primary quality Assumed is written to an Item that is not Offline, the Item quality will
remain unchanged. If a new value is written to an Offline Item, its secondary quality will
always be set to Replaced.
Timestamp - The timestamp of the new value to be written to the Item. This defaults to the
current time if not specified. If specified, it must be DATE.
This method may be called by a client to write Values into the history of an Item. The
method blocks until the write to history is complete. The new value is written directly to
history even if the timestamp is more recent than the latest timestamp in the Item.
Signature
Sub WriteHistoryValue(Value As Variant, _
Item As Variant, _
Quality As Long, _
TimeStamp As Date, _
Optional WaitTimeout As Long)
Parameters
Quality - The quality of the new value to be written to the Item as a long integer.
Timestamp - The timestamp of the new value to be written to the Item as a DATE.
WaitTimeout - The time in milliseconds to block before timing out. Default is 5 minutes.
Note: If a value less than or equal to zero is specified, the default is used.
It provides access to Exaquantum Item data distributed across multiple servers. Only
synchronous access is provided.
Only the methods detailed in this section are supported on this interface, all other methods
should not be used.
In addition to the specific errors listed, any method may return the standard system errors
E_INVALIDARG (for a parameter of incorrect type) or E_OUTOFMEMORY.
The client adds paths to item data that it is interested in. Data is fetched for the entire
collection when ReadValue() is called.
Internally QDataAccessMulti calls the RBNSBrowse object which browses the Role-Based
Namespace to fetch the ServerID, ServerName and ItemID for each Item path
Signature
Sub Add(ItemPath as String)
Parameters
ItemPath - A full path to an Item from the Role-Based Namespace for this user
Errors
Cancels any current data request, removes all added paths and clears all internally allocated
resources.
Signature
Sub Clear()
Cancels any current read data request but maintains list of added Items.
Signature
Sub Cancel ()
Reads the values of all added items using the current time and processing options set for the
QDataAccessMulti Object.
If no query is currently active, internally it creates a Session2 object for each group of Items
and sets the ServerName for that group. It also creates a QDataAccess object for each group
and passes in the Session2 object. It then calls SetQueryTimes and SetProcessOptions
passing on its own settings to each QDataAccess object and finally calls Execute() on each
QDataAccess object to obtain the data asynchronously. Subsequent calls to ReadValue()
retrieve data from the QDataAccess cache. If the query times are not set, updating live data
is fetched so that the value in the cache is always up to date.
Signature
Function ReadValue() As Variant
Parameters
One row for each Item, where ItemPath is the added Item Path and VQT is a 2-dimensional
VARIANT array with the format:
N.B. Item Paths are returned in the same order in which they were added.
If an Exaquantum server is unavailable, Item data for that server will appear with quality
BAD/NOTAVAILABLE when the server is restarted live and updating history data will
automatically be recovered.
Errors
Allows the period or point in time to be specified for the items of interest.
If times are specified as type string or string by reference, internally QDataAccessMulti calls
QTimeHelper::ParseTimes() to validate the time formats.
Signature
Sub SetQueryTimes( _
Optional SpotTime as Variant, _
Optional StartTime as Variant, _
Optional EndTime as Variant)
Parameters
SpotTime - If specified, return data at this time otherwise return the latest data.
If latest data is requested, the client will be notified when the data changes. (Must be
specified in one of the formats described below.)
StartTime & EndTime - If only StartTime is specified then return data from this time to the
latest data.
If both StartTime and EndTime are specified then return data over this period. (Must be
specified in one of the formats described below.)
Errors
Signature
Sub SetReportTimes ( _
Optional ReportStart as Variant, _
Optional ReportEnd as Variant, _
Optional SpotTime as Variant)
Parameters
Errors
<ABSOLUTEDATE> ::= System date format including time always taken as client local
machine time unless the bUTC flag is set in SetProcessOptions()
<NOW> ::= Current server time (taken from the Designated Server)
<TIMELBL> ::= (S... | M... | H... | D...) abbreviations for Seconds, Minutes, Hours, Days
< PRODCALPERIOD >::= A valid Production Calendar Period name (as configured on the
Designated Server)
<RANGE> ::= Where the StartTime is specified using the Production Calendar, RANGE
may be used to specify the EndTime as the end of the specified Production Calendar Period.
Signature
Sub SetProcessOptions( _
Optional UpdateRate As Variant, _
Optional InterpMethod As qdaInterpMethod = 0, _
Optional EdgeValueOptions As qdaEdgeValueOptions = 0, _
Optional TimeIncrement as Variant, _
Optional ResampleInterval as Variant, _
Optional bUTC As Boolean, _
Optional TZIndex As Long = -1)
Parameters
UpdateRate - Specifies the maximum rate at which the client is to be notified of data
changes. The default is 5 seconds. (Must be specified as DATE.)
InterpMethod - Currently only qdaPreviousForward is supported. See appendix for the use
of interpolation.
TimeIncrement - If this is specified, a timed request for history data will be made at the
UpdateRate, incrementing the SpotTime or StartTime by this amount. If latest data is
requested, polling is simulated by firing the latest value to the Client at the UpdateRate.
(Must be specified as DATE.)
ResampleInterval - If this is specified, history data will be resampled to provide exactly one
point per ResampleInterval (see figures 3 and 4). (Must be specified as DATE.)
BUTC - If set TRUE, timestamps specified in SetQueryTimes are interpreted as UTC and
timestamps are returned in UTC. Defaults to FALSE where times are specified and returned
as local time.
TZIndex - A long integer uniquely identifying the client Time Zone. If specified, time
conversions to and from UTC will be performed using the specified Time Zone rather than
the current Time Zone.
This allows conversions between UTC and local time to be performed on the server when the
server and client are running in different time zones.
If the UTC flag is set TRUE, the value of TZIndex will be ignored and no local time
conversions will be performed.
Note : Bounding values are returned when the requested times do not exactly lie on points
stored in history. They are the first point before the start time and the last point after
the end time. If Bounding Values are requested, data is returned directly from
QHistorian and may in some circumstances comprise only one data point.
This method may be called before performing a read of history data to specify a filter to pre-
process the data. Any current query is cancelled. For full details see section 18.12
SetFilterParameters Method
Writes the specified value, quality and timestamp to the specified Item.
Internally QDataAccessMulti queries the RBNSBrowse object which browses the Role
Based Namespace to obtain ServerID, ServerName and ItemID. It groups Items according to
Server.
Signature
Sub AddWrite (ItemPath as String, _
Value As Variant, _
Optional Quality As Variant, _
Optional Timestamp as Variant)
Parameters
ItemPath - A fully specified path to the Item through the Role-Based Namespace.
Quality - The quality of the new value to be written to the Item. Defaults to GOOD. If
specified, must be long integer.
Timestamp - The timestamp of the new value to be written to the Item. Defaults to the
current time. If specified, must be DATE.
Errors
E_Q_INVALIDPATH - The specified path does not exist or the user does not have access
rights to view the namespace
E_Q_NOWRITEACCESS - The user does not have write access to the Item
Internally creates a QItemWriter object for each Server group of Items and calls Add one or
more times, and Execute on each. The returned status arrays are amalgamated for return to
the client.
Signature
Function ExecuteWrite(Optional Reason As String = ) As Variant
Parameters
Reason - An optional string describing why the data is being written. Must be specified for
CFR Part 11 compliance.
The Variant returned contains a 2-dimensional array of ItemPath/Status Code where the
StatusCode is the worst return code for any value written to the item, i.e.
S_FALSE = at least one value not written to real-time database for this item,
Errors
Clears any Item data entered by the AddWrite() method before Execute() has been called.
Signature
Sub CancelWrite ()
This method removes paths to specified items added using the Add() method.
Signature
Sub Remove (ItemPath As String)
Parameters
ItemPath - A full path to an Item from the Role-Based Namespace for this user
Errors
Starts acquiring data asynchronously using current time and processing options set for the
QDataAccessMulti object.
Signature
Parameters
WithChanges - When requesting latest data, if set FALSE then only a single event will be
fired to the client for each Item. The default is to notify the client whenever the value of any
Item in the collection changes.
ReturnDataAsReady - When requesting historical data, if set FALSE then all the values for
each Item will be returned in a single event. The default is to send data as soon as it is
available to allow a more responsive user interface.
Errors
IQDataAccess::Add()
IQDataAccess::Execute()
This method is called back on the client for asynchronous events initiated by Execute().
Signature
Event OnData (ItemPath As String, _
DataReturnType As qdaDataReturnType, _
Data As Variant)
Parameters
ItemPath is the full path to an Item from the Role-Based Namespace for this user.
qdaNew=0 This is new data for this item. This is always the type for the first
notification for an item after Execute(), and for latest data.
qdaMoreRows=1 For trend data, this is additional data to append to previously received
data.
qdaEnd=2 For historical data, this is the final data for this Item.
where spot data has only one row and trend data has one row for each time point.
Note: Data may be NULL and clients should check for this. This indicates that no data is
returned for this firing of the event.
This method is called back on the client for asynchronous requests if an error occurs.
Signature
Event OnError(Number As Long, _
Description As String, _
Source As String, _
HelpFile As String, _
HelpContext As Long)
Parameters
HelpFile - is the name of the HelpFile containing further information on the error.
OPC Gateways of interest are specified by OPCAEPump Ids, these can be resolved the OPC
Gateway name by retrieving the column OPCAEPumpHistId from the table OPCServer in
the QConfig SQL Server database. Before Alarm and Event history can be read for a
specific OPC Gateway, its OPCAEPumpHistId must first be added to a collection
maintained by QAEAccess. After filling the collection, clients select the function they
require either for the whole collection (typical) or for individual items in the collection.
Signature
Sub Add (AEPumpID As Variant)
Parameters
AEPumpId - specifies the OPC Gateway of interest. This should be an 8 element byte array
as returned from column OPCAEPumpHistId from the table OPCServer.
Signature
Sub Cancel ()
Signature
Sub ClearFilterOptions ()
Read the number of OPC Gateways in the collection of OPC Gateways of interest.
Signature
Property Count () As Long
Starts the asynchronous acquiring of data using the current time, filter and processing
options set for the QAEAccess Object.
Note: If the user calls the Execute Method before the previous Execute operation is
complete/canceled, it returns an error.
Signature
Sub Execute(Optional ReturnEventsAsReady As Boolean = True)
Parameters
ReturnEventsAsReady - When requesting historical data, if set FALSE then all the values
for each OPC Gateway will be returned in a single event. The default is to send data as soon
as it is available to allow a more responsive user interface.
Signature
Function Item(Index As Variant) as Variant
Parameters
Return Value
This method is called back on the client for asynchronous events initiated by Execute().
Signature
Event OnAE(EventReturnType As qaeEventReturnType, _
Events As Variant)
Parameters
qeaNew=0 This is new data for this OPCAEPumpHistId. This is always the type for
the first notification for an OPCAEPumpHistId after Execute(). This is not used if
Execute is called with ReturnEventsAsReady=False.
Variant OPCAEPumpHistId
String Source
String Message
Date Timestamp
Long SequenceNo
Long Category
Long Severity
String ConditionName
Long NumberOfAttributes
Variant Attributes
The Attributes column contains a 1-dimensional array of Variant attributes, the number and
order of which are configured in the QConfig database for the particular Event Category.
The data is returned in time order from the oldest to the newest event with records from
different OPC Gateways interleaved as necessary.
Note: Events may be NULL and clients should check for this. This indicates that no data
is returned for this firing of the event.
This information is as defined by the OPC Foundation for the OPC Alarm and Event
Interface Specification.
This method is called back on the client for asynchronous requests if an error occurs.
Signature
Event OnError(Number As Long, _
Description As String, _
Source As String, _
HelpFile As String, _
HelpContext As Long)
Parameters
HelpFile - is the name of the HelpFile containing further information on the error.
Perform a synchronous read for values of Alarm and Events data using the current time,
filter and processing options set for the QAEAccess Object.
Note: If the user calls the ReadValue Method during asynchronous operations (Execute
request) is in progress, it returns an error.
Signature
Function ReadValue () As Variant
Return Value
Variant OPCAEPumpHistId
String Source
String Message
Date Timestamp
Long SequenceNo
Long Category
Long Severity
String ConditionName
Long NumberOfAttributes
Variant ATTRIBUTES
The Attributes column contains a 1-dimensional array of Variant attributes, the number and
order of which are configured in the QConfig database for the particular Event Category.
The data is returned in time order from the oldest to the newest event with records from
different OPC Gateways interleaved as necessary.
Note: The Return Value may be NULL and clients should check for this. This indicates
that no data is returned for this query.
This information is as defined by the OPC Foundation for the OPC Alarm and Event
Interface Specification.
Signature
Sub Remove(AEPumpID As Variant)
Parameters
AEPumpId - specifies the OPC Gateway of interest. This should be an 8 element byte array
from column OPCAEPumpHistId from the table OPCServer.
Allows filtering of the Alarm and Event data that will be returned to be specified.
Signature
Sub SetFilterOptions(
FilterField As qdaAEFilterField, _
FilterOperator As qdaAEFilterOperator, _
varMatch As Variant)
Parameters
varMatch - is the filter operator parameter. May contain the wildcard * to match many or
no characters and the wildcard ? to match any single character.
The filters are applied in the form <alarm/event query> WHERE ( message LIKE
<MsgFilter> ) AND ( <Filter> ). For example, to return events that have a Severity of
500 and a Data Value of more than 20 use the string (Severity = 500) AND (DataValue
> 20).
It is important that this field is set correctly as now validation is carried out. The names of
the fields for comparison can be obtained from the event storage tables in the Historian
databse.
Signature
Sub SetProcessOptions(Optional UpdateRate As Variant, _
Optional ActiveTime As Variant, _
Optional MaximumEvents As Long = -1)
Parameters
UpdateRate - specifies the rate at which history should be polled to check for new
alarms/events (must be specified as DATE). The DATE is converted to an interval by
subtracting the earliest date that can be represented by the DATE data type i.e. midnight on
30th December 1899. This allows VB assignments such as #00:00:05# for 5 seconds or
#00:02:00# for 2 minutes.
ActiveTime - specifies the time band before the previous EndTime which should be re-
queried to catch any late-arriving events (must be specified as DATE). See UpdateRate for
details of how the DATE data type is interpreted as an Interval.
MaximumEvents - specifies the maximum number of Alarm and Event records that will be
returned to the client. Processing begins at the specified start time, with data returned to the
client for subsequent times until this limit is reached. At this point any additional events are
discarded and not returned to the client. This option allows the client to limit the number of
events returned in the case where this may be very large. MaximumEvents is ignored if an
UpdateRate is specified.
Allows the period to be specified for the portion of Alarm and Event history of interest.
Signature
Sub SetQueryTimes(Optional StartTime As Variant, _
Optional EndTime As Variant)
Parameters
StartTime & EndTime - If only StartTime is specified, then return data from this time to
the latest data. If both StartTime and EndTime are specified, then return data over this
period (must be specified as DATE).
This method may be called by a client to allow the QAEAccess object to share its Session
connection. This is the recommended way to use QAEAccess.
If this method is not called before a request to fetch data, the QAEAccess object will create
its own Session object.
Signature
Sub SetSession (pSession As Object)
Parameters
The Raw Data Quality of an Item encodes both Primary and Secondary qualities. The
QQualityHelper object has enumeration qdaQuality and qdaSecondaryQuality to determine
the Primary and Secondary Data Qualities respectively.
Tests whether the Primary Data Quality is Bad based on the Raw Data Quality passed in.
Signature
Function IsBad(RawQuality As Long) as Boolean
Parameters
Return Value
Tests whether the Primary Data Quality is Good based on the Raw Data Quality passed in.
Signature
Function IsGood(RawQuality As Long) as Boolean
Parameters
Return Value
Tests whether the Primary Data Quality is Uncertain based on the Raw Data Quality passed
in.
Signature
Function IsUncertain(RawQuality As Long) as Boolean
Parameters
Return Value
Tests whether the Primary Data Quality is Assumed, based on the Raw Data Quality passed
in.
Signature
Function IsAssumed(RawQuality As Long) as Boolean
Parameters
Return Value
Returns an enumeration for the Primary Data Quality based on the Raw Data Quality passed
in.
Signature
Function Quality(RawQuality As Long) as qdaQuality
Parameters
Return Value
Returns the Primary Quality Text as a string based on the Raw Data Quality passed in.
Signature
Function QualityText(RawQuality As Long) as String
Parameters
Return Value
Returns an enumeration for the Secondary Data Quality based on the Raw Data Quality
passed in.
Signature
Function SecondaryQuality(RawQuality As Long) As qdaSecondaryQuality
Parameters
Return Value
qdaSecondaryQualityNone=0 None
qdaSecondaryQualityDeleted=10 Deleted.
qdaSecondaryQualityUnknown=9 Unknown.
Returns the Secondary Quality Text as a string based on the Raw Data Quality passed in.
Signature
Function SecondaryQualityText(RawQuality As Long) As String
Parameters
Return Value
Returns the Raw Data Quality based on the enumerations qdaQuality and
qdaSecondaryQuality passed in.
Signature
Parameters
SecondaryQuality - specifies the enumerated Secondary Quality for an Item. If not supplied
then assumes
Return Value
Returns the Raw Data Quality based on the combination of Primary Quality and Secondary
Quality passed in.
This may be used by a Client to present a list of possible Primary Qualities to a user.
Signature
Property QualityTexts () As Object
This may be used by a Client to present a list of possible Secondary Qualities to a user.
Signature
Property SecondaryQualityTexts () As Object
Additional general errors may be raised by the recalculation engine these will also be
logged in the Application EventLog to aid in error diagnosis.
General errors
The user calls this method to create a new recalculation job definition. If successful, the
RecalcJobName property is set to the new job definition.
Signature
Sub NewRecalcJobDefinition ( _
ByVal Name As String, _
Optional ByVal Reason As String = )
Parameters
Name - A unique name to identify this recalculation job. May be up to 256 characters.
Errors
E_JOBEXISTS (58435) - A recalculation job already exists with the specified name
The user calls this method after creating a new RecalcJobDefinition to specify the items
whose values have been updated in history and whose dependent items should be
recalculated. If changes to the list of items are required, the whole list should be re-specified.
If a failure status code is returned for any Item, this Item is not added to the RecalcInputItem
table.
Signature
Function SetRecalcInputItems (ByVal ItemPaths As Variant) As Variant
Parameters
For R2.01.50 only aggregation result items may be specified. An error is returned if any
other item type is specified.
The return value is a single HRESULT defining the status of the requested ItemPath, or if an
array of ItemPaths is specified, a SAFEARRAY of HRESULTS, one for each ItemID in the
input array.
S_OK - The Item is valid and was successfully added as an input Item for this
RecalcJobDefinition
E_INVALIDITEMTYPE (58441) - The Item is not a valid type for recalculation. This
error is returned if a reference data Item is specified.
For R2.01.50 this error is returned if the Item is not an Aggregation Result Item.
Errors
Signature
Sub DeleteRecalcJobDefinition (ByVal JobName As String)
Parameters
Errors
E_JOBNOTFOUND (58436) - No recalculation job was found with the specified name
The user sets this property to specify an existing job definition to use. Only one user may use
a given recalculation job definition at one time.
Signature
Property Let RecalcJobName (ByVal Name As String)
Property Get RecalcJobName () As String
Parameters
Name - A unique name to identify this recalculation job. May be up to 256 characters. When
setting the property, any existing JobName is cleared. The property may be set to an empty
string.
Errors
E_JOBNOTFOUND (58436) - No recalculation job was found with the specified name
The user calls this method to set the time range for recalculation. Either SpotTime should be
specified for a single point, or StartTime and optionally EndTime to recalculate a range of
data. If StartTime is specified and EndTime is not specified, recalculation will continue to
the current systemtime.
Signature
Sub SetRecalcTimes( _
Optional ByVal SpotTime As Variant, _
Optional ByVal StartTime As Variant, _
Optional ByVal EndTime As Variant)
Parameters
SpotTime - The local timestamp of a single updated point to use to recalculate dependent
items. If specified, must be type VT_DATE. If SpotTime is specified, StartTime and
EndTime will be ignored.
StartTime - The inclusive local start time of a range of data points to use to recalculate
dependent items. If specified, must be type VT_DATE.
EndTime - The inclusive local end time of a range of data points to use to recalculate
dependent items. If specified, must be type VT_DATE. If not specified and StartTime is
specified, EndTime is taken to be the current system time. If SpotTime is specified,
StartTime and EndTime will be ignored.
Errors
The user calls this method to perform the recalculation. A Recordset of recalculated values is
returned for inspection. The user is not allowed to modify the recalculated values they can
only Commit all values to history or Cancel the recalculation. The QConfig database
RecalcSession table is populated to indicate that a recalculation is active and no other
recalculation may be performed from the beginning of the Recalc() method until completion
of a Commit() or Cancel() call for this recalculation.
If any error occurs during recalculation, the QConfig database RecalcSession table is cleared
of data. Additional error information will be logged to the Windows Application Event Log.
Signature
Function Recalc( _
Optional ByVal bAutoCommit = False, _
ItemValueRS As Variant) As Long
Parameters
Recordset fields:
ItemID - long
ItemPath - BSTR
Value - VARIANT
Quality - long
Where a previous value does exist, PreviousTimestamp will only be different from the new
timestamp when the timestamp of an Aggregation Minimum or Maximum has changed.
The return value is a unique ID assigned for this calculation and referenced in the
recalculation audit logs.
Errors
E_INVALIDITEMTYPE (58441) - The Item is not a valid type for recalculation. This
error is returned if a reference data Item is specified.
For R2.01.50 this error is returned if the Item is not an Aggregation Result Item.
The user calls this method to write all recalculated data to history. Any updated live
aggregation results are notified to the Exaquantum RTDB. Control is not returned to the user
until data has been written to Historian and the QConfig database RecalcSession table is
cleared of data.
If one or more current aggregation values are recalculated and a new live aggregation
period completes between the Recalc and the Commit, an error is returned and the
recalculation must be re-executed.
Signature
Sub Commit (ByVal RecalcSessionID As Long)
Parameters
Errors
The user calls this method to terminate the current recalculation session and discard all
recalculated data. The QConfig database RecalcSession table is cleared of data. The Cancel()
method may only be called after a successful Recalc() which is not committed.
Signature
Sub Cancel (ByVal RecalcSessionID As Long)
Parameters
Errors
A read-only property to allow the user to view the input items defined for the current job.
Signature
Property Get RecalcInputItems () As Variant
Parameters
InputItemsRS - An ADO Recordset containing a list of all the Recalc Input Items defined
for the current RecalcJob.
ItemID - long
ItemPath - BSTR
Errors
Signature
Property Get RecalcJobDefinition () As Variant
Parameters
The return value is a variant containing an ADO Recordset containing results from a query
of the QConfig RecalcJobDefinition table for the current job.
Errors
The user may set this property to alter the Reason associated with the current
RecalcJobName at any time after creation of the Recalculation Job Definition.
Signature
Property Let Reason (ByVal Reason As String)
Property Get Reason () String
Parameters
Reason - The reason for this recalculation. May be up to 2000 characters. The property may
be set to an empty string.
Errors
This method may be called without setting the RecalcJobDefinition property to determine all
Items that are immediately dependent upon the specified Item ID. This would typically be
called by a user-interface application to display Items affected by changing a highlighted
Item path.
Signature
Function GetDependentItems (ByVal ItemPath As String) As Variant
Parameters
The return value is a variant containing an ADO Recordset listing all Items dependent upon
the specified ItemID.
Recordset fields:
ItemID
ItemPath
3 = aggregation
4 = calculation
Errors
This method may be called without setting the RecalcJobDefinition property to return a
recordset of all configured Recalc Job Definitions.
Signature
Function GetRecalcJobs () As Variant
Parameters
The return value is a variant containing an ADO Recordset listing all configured
Recalculation Job Definitions, ordered in descending time order by LastRunDate.
Recordset fields:
Name
CreationDate
Reason
LastRunDate
LastRecalcStartTime
LastRecalcEndTime
LastRunUserId
LastMachineName
LastCommitStatus
The interfaces supported by the Exaquantum OPC are listed in the following section.
The rest of the chapter provides extra information concerning the Exaquantum OPC server
implementation and highlights specific behaviour and any differences from the published
standard.
Custom Interface
Automation Interface
Table 23-1
Method / Property
Object Name Description
Name
OPCHDAServer OPCHDAItems
HDA Item Property
Property
Connect Connect
Disconnect disconnect
OPC DA Server
The following custom interfaces are supported, partially compliant with OPC DA Version
2.05A.
IOPCCommon Version 1.0
IOPCServer
IOPCItemMgt
IOPCGroupStateMgt
IOPCSyncIO
IOPCAsyncIO2
IOPCCommon::GetLocaleID
Exaquantum OPCHDA server behaviour:
IOPCCommon:: QueryAvailableLocaleIDs
Exaquantum OPCHDA server behaviour:
IOPCCommon::GetErrorString
Exaquantum OPCHDA server behaviour:
This method calls the ::FormatMessage API to obtain an error description for standard
Windows errors or for Exaquantum OPC HDA Server-specific errors. The only OPC-
defined errors and information codes returned by the Exaqauntum OPC HDA server are:
OPC_UNKNOWNITEMID
OPC_E_INVALIDHANDLE
OPC_E_UNKNOWNATTRID
OPC_E_NOT_AVAIL
OPC_S_MOREDATA
OPC_S_NODATA
OPC_S_CURRENTVALUE
Calling this method with any other OPC-defined code will return E_INVALIDARG.
IOPCCommon::SetClientName
Exaquantum OPCHDA server behaviour:
QOPCHDAServer.HDAServer.1
A second object is implemented which returns filtered data rather than raw data to allow
more efficient operation for OPC clients that could require this behavior. See
IOPCHDA_SyncRead::ReadRaw. The creatable version dependent ProgId for the HDA
server object is:
QOPCHDAServer.HDAServerEx.1
In the following pages, the Exaquantum-specific behavior is noted for each method. For a
fuller discussion of OPC HDA functionality, and definition of interface behavior, refer to the
OPC Foundation document, OPC Historical Data Access Custom Interface Standard
Version 1.1.
IOPCHDA_Server::GetItemAttributes
Exaquantum behaviour:
OPCHDA_ITEMID
OPCHDA_DATA_TYPE
OPCHDA_DESCRIPTION
OPCHDA_ENG_UNITS
OPCHDA_NORMAL_MAXIMUM
OPCHDA_NORMAL_MINIMUM
IOPCHDA_Server::GetAggregates
Exaquantum behaviour:
OPCHDA_INTERPOLATIVE
IOPCHDA_Server::GetHistorianStatus
Exaquantum behaviour:
Status is returned as OPCHDA_UP if the Exaquantum server is running and HDAServer has
successfully connected, otherwise OPCHDA_DOWN.
MaxReturnValues is set to zero as the number of values returned is limited only by available
memory.
IOPCHDA_Server::GetItemHandles
Exaquantum behaviour:
This method expects the ItemIDs will be specified as an array of full Exaquantum Item Path
names, for example:
Root.Folder1.Function Block1.Tag1.Value
Root.Folder1.Function Block1.Tag1.Description
Root.Folder1.Function Block1.Tag1.HighEng
Root.Folder1.Function Block1.Tag1.LowEng
Root.Folder1.Function Block1.Tag1.Units
Root.Folder1.Function Block1.Tag1.Aggregations.Hour.Mean.Value
Root.Folder1.Function Block1.Tag1.Aggregations.Day.Minimum.Value
Server handles returned are an array of corresponding Exaquantum Item IDs as unique long
integers. The Server Handles are ordered corresponding to the input ItemIDs array.
Any Item path not found will have Server Handle returned as 0 and the corresponding Error
set to the standard OPC error OPC_E_UNKNOWNITEMID.
IOPCHDA_Server::ReleaseItemHandles
Exaquantum behaviour:
This method removes the association of the specified Exaquantum Item ID with a previously
supplied Client Handle. If the Exaquantum ItemID is not associated with a registered Client
Handle, the corresponding error is set to the standard OPC error
OPC_E_INVALIDHANDLE
If GetItemHandles() is called multiple times for the same Item path, the server will not
remove the server handle until ReleaseItemHandles() has been called a corresponding
number of times. Subsequent calls to read methods succeed until the server handle is
removed.
IOPCHDA_Server::ValidateItemIDs
Exaquantum behaviour:
This method expects the ItemIDs will be specified as an array of full Exaquantum Item Path
names, for example:
Root.Folder1.Function Block1.Tag1.Value
Any Item path not found will have the corresponding Error set to the standard OPC error
OPC_E_UNKNOWNITEMID.
IOPCHDA_Server::CreateBrowse
Exaquantum behaviour:
Exaquantum OPC browsing presents a flattened view of the Exaquantum folder hierarchy.
HDA browsing supports only a single filter on full Item Path name.
If a filter other than OPCHDA_ITEMID is specified, or more than one filter is specified, the
corresponding Error code is set to the standard OPC error OPC_W_NOFILTER.
OPCHDA_EQUAL
OPCHDA_LESS
OPCHDA_LESSEQUAL
OPCHDA_GREATER
OPCHDA_GREATEREQUAL
OPCHDA_NOTEQUAL
The single filter value must be supplied as a string with optional wildcards, for example;
Root.Folder1.*
The list of item paths returned includes all raw items matching the specified filter. Reference
item paths (Description, Units, HighEng and LowEng) are not returned.
The Exaquantum OPC Server does not support # as a wildcard due to the possible valid
inclusion of the # character as part of an item path. The pattern [0-9] can be used to provide
the same functionality.
[] Any single character within the specified range or set, e.g. [0-9], [abc]
[^] Any single character not within the specified range or set, e.g. [^abc]
HKLM\Software\Quantum\OPC Server\BrowseAggregations
Type=DWORD
A Non-zero value will include aggregation result items matching the filter.
IOPCHDA_Browser::GetEnum
Exaquantum behaviour:
For all other values of BrowseType the returned enum set contains a list of the full paths of
all historized Value or Aggregation result Items that match the filter criterion supplied in the
IOPCHDA_Server::CreateBrowse() method, starting at the current browse position. Item
paths are in ascending alphabetical order. The initial browse position is always set to the first
alphabetical Item path.
IOPCHDA_Browser::ChangeBrowsePosition
Exaquantum behaviour:
This method has no effect as Exaquantum presents a flat address space for browsing. The
return code is set to E_FAIL.
IOPCHDA_Browser::GetItemID
Exaquantum behaviour:
As the enumerated string set obtained from the GetEnum() method already contains the full
Item path, a copy of the NodeName is made to the output ItemID parameter. No check for
validity is made.
IOPCHDA_Browser::GetBranchPosition
Exaquantum behaviour:
This method sets the output BranchPos parameter to the hard coded string Root.
IOPCHDA_SyncRead::ReadRaw
Exaquantum behaviour:
The OPCHDA_QUALITY bits (bits 16-31) of the quality DWORD are always set to
OPCHDA_RAW, or OPCHDA_NODATA if not available. The Data Access quality bits are
returned directly from Exaquantum (bits 0-15). If the Exaquantum primary quality is
ASSUMED (i.e. the tag has been set offline) bits 0-15 are set to
OPC_QUALITY_UNCERTAIN.
If data does not exist in the requested time period, a valid point is returned with Data Access
quality set to BAD and the error return is S_OK.
Exaquantum does not support calculation of StartTime which must therefore always be
specified.
In most cases, if the HDAServerEx object is used, a call to ReadRaw() is converted to a call
to ReadProcessed(), in order to return filtered data. However, when dwNumValues is
specified to be less than or equal to 8, raw data is returned. To give as close a representation
of the trend data as possible, the number of points requested will be returned as minimum
and maximum values. OPC_S_MOREDATA will never be returned.
IOPCHDA_SyncRead::ReadProcessed
Exaquantum behaviour:
The OPCHDA_QUALITY bits (bits 16-31) of the quality DWORD are always set to
OPCHDA_RAW, or OPCHDA_NODATA if not available. The Data Access quality bits are
returned directly from Exaquantum (bits 0-15). If the Exaquantum primary quality is
ASSUMED (i.e. the tag has been set offline) bits 0-15 are set to
OPC_QUALITY_UNCERTAIN.
IOPCHDA_SyncRead::ReadAtTime
Exaquantum behaviour:
IOPCHDA_SyncRead::ReadModified
Exaquantum behaviour:
IOPCHDA_SyncRead::ReadAttribute
Exaquantum behaviour:
If no attribute data is available for a requested item, the error code for each requested
attribute is set to OPC_E_UNKNOWNITEMID.
If a specific attribute is not available for a requested item, the error code for that attribute is
set to OPC_E_NOT_AVAIL.
If an attribute is requested that is not supported by Exaquantum, the error code for that
attribute is set to OPC_E_UNKNOWNATTRID.
If the service is entered as a key under the Quantum\Services registry key, the service will be
started automatically after Exaquantum is started and stopped on shutdown.
[HKEY_LOCAL_MACHINE\SOFTWARE\Quantum\Services\0]
@="Exaquantum OPC HDA"
"HaltStartup"=dword:00000000
IOPCHDA_SyncUpdate::QueryCapabilities
Exaquantum behaviour:
OPCHDA_INSERTREPLACECAP=0x04
OPCHDA_DELETERAWCAP=0x08
OPCHDA_DELETEATTIMECAP=0x10
IOPCHDA_SyncUpdate::Insert
Exaquantum behaviour:
IOPCHDA_SyncUpdate::Replace
Exaquantum behaviour:
IOPCHDA_SyncUpdate::InsertReplace
Exaquantum behaviour:
IOPCHDA_SyncUpdate::DeleteAtTime
Exaquantum behaviour:
IOPCHDA_SyncUpdate::DeleteRaw
Exaquantum behaviour:
Yokogawa.ExaopcDAEXQ.1
Descriptions of interface behaviour are as defined in the OPC Foundation document OPC
Data Access Custom Interface Specification Version 2.05A which should be read for a
fuller discussion of OPC DA functionality. Exaquantum-specific behaviour is noted for each
method.
The Exaquantum OPC DA server caches all requested item paths and holds metadata for
each item for enhanced performance. This cache is monitored and managed periodically.
Changes in the namespace are reflected if necessary. The frequency of monitoring is defined
by the registry value:
HKLM\Software\Quantum\Client\NamespaceCheckPeriod
Type = DWORD
IOPCServer::AddGroup
Exaquantum behaviour:
IOPCServer::GetErrorString
Exaquantum behaviour:
This method should not be called from within a callback method (for example;
OnDataChange) or the server may be locked.
IOPCServer::GetGroupByName
Exaquantum behaviour:
IOPCServer::GetStatus
Exaquantum behaviour:
IOPCServer::RemoveGroup
Exaquantum behaviour:
IOPCServer::CreateGroupEnumerator
Exaquantum behaviour:
This is a required interface on the OPCServer object. It is used to return selected metadata
for items.
Exaquantum behaviour:
Table 23-2
Some items may not have Engineering Units and/or Engineering Range defined.
IOPCItemProperties::GetItemProperties
Exaquantum behaviour:
If the Exaquantum server is unavailable, individual item error codes are set to E_FAIL and
the method returns S_FALSE.
IOPCItemProperties::LookupItemIDs
Exaquantum behaviour:
IOPCBrowseServerAddressSpace:: QueryOrganization
Exaquantum behaviour:
IOPCBrowseServerAddressSpace:: ChangeBrowsePosition
Exaquantum behaviour:
Exaquantum supports only a FLAT address space but returns E_FAIL if called.
IOPCBrowseServerAddressSpace:: BrowseOPCItemIDs
Exaquantum behaviour:
Exaquantum only filters on ItemPath datatype and access rights filters are ignored.
If a filter value is specified, it must be supplied as a string to match ItemPath with optional
wildcards, for example:
Root.Folder1.*
The list of item paths returned includes all raw items matching the specified filter. Reference
item paths (Description, Units, HighEng and LowEng) are not returned.
The Exaquantum OPC Server does not support # as a wildcard due to the possible valid
inclusion of the # character as part of an item path. The pattern [0-9] can be used to provide
the same functionality.
[] Any single character within the specified range or set, e.g. [0-9], [abc]
[^] Any single character not within the specified range or set, e.g. [^abc]
HKLM\Software\Quantum\OPC Server\BrowseAggregations
Type=DWORD
A Non-zero value will include aggregation result items matching the filter.
IOPCBrowseServerAddressSpace:: GetItemID
Exaquantum behaviour:
As the enumerated string set obtained from the GetEnum() method already contains the full
Item path, a copy of the ItemDataID string is made to the output ItemID parameter. No
check for validity is made.
IOPCBrowseServerAddressSpace:: BrowseAccessPaths
Exaquantum behaviour:
IOPCItemMgt::AddItems
Exaquantum behaviour:
IOPCItemMgt::ValidateItems
Exaquantum behaviour:
IOPCItemMgt::RemoveItems
Exaquantum behaviour:
Exaquantum returns S_OK rather than S_FALSE if one or more invalid handles is specified.
IOPCItemMgt::SetActiveState
Exaquantum behaviour:
Exaquantum returns S_OK rather than S_FALSE if one or more invalid handles is specified.
IOPCItemMgt::SetClientHandles
Exaquantum behaviour:
IOPCItemMgt::SetDatatypes
Exaquantum behaviour:
IOPCItemMgt::CreateEnumerator
Exaquantum behaviour:
IOPCGroupStateMgt::GetState
Exaquantum behaviour:
IOPCGroupStateMgt::SetState
Exaquantum behaviour:
IOPCGroupStateMgt::SetName
Exaquantum behaviour:
IOPCGroupStateMgt::CloneGroup
Exaquantum behaviour:
IOPCSyncIO::Read
Exaquantum behaviour:
If the Exaquantum primary quality for an item is ASSUMED (i.e. the tag has been set
offline), the returned quality is set to OPC_QUALITY_UNCERTAIN.
If the Exaquantum server is unavailable, individual item error codes are set to E_FAIL and
the method returns S_FALSE.
IOPCSyncIO::Write
Exaquantum behaviour:
The user running the EXA Bossd service must be a member of the QDataWriteGroup or
QAdministratorGroup in order to be able to write to Exaquantum items.
If the Exaquantum server is unavailable, individual item error codes are set to E_FAIL and
the method returns S_FALSE..
IOPCAsyncIO2::Read
Exaquantum behaviour:
If the Exaquantum primary quality for an item is ASSUMED because the tag has been set
offline, the returned quality is set to OPC_QUALITY_UNCERTAIN.
If the Exaquantum server is unavailable, individual item error codes are set to E_FAIL and
the method returns S_FALSE.
IOPCAsyncIO2::Write
Exaquantum behaviour:
The user running the EXA Bossd service must be a member of the QDataWriteGroup or
QAdministratorGroup in order to be able to write to Exaquantum items.
If the Exaquantum server is unavailable, individual item error codes are set to E_FAIL and
the method returns S_FALSE.
IOPCAsyncIO2::Refresh2
Exaquantum behaviour:
IOPCAsyncIO2::Cancel2
Exaquantum behaviour:
IOPCAsyncIO2::SetEnable
Exaquantum behaviour:
IOPCAsyncIO2::GetEnable
Exaquantum behaviour:
IOPCDataCallback::OnDataChange
Exaquantum behaviour:
If the Exaquantum primary quality for an item is ASSUMED, because the tag has been set
offline, the returned quality is set to OPC_QUALITY_UNCERTAIN.
IOPCDataCallback::OnReadComplete
Exaquantum behaviour:
If the Exaquantum primary quality for an item is ASSUMED, because the tag has been set
offline, the returned quality is set to OPC_QUALITY_UNCERTAIN.
The table below lists some of the most common errors and their possible causes:
Table 23-3
EXAQUANTUM IS UNAVAILABLE
Event log error only: The user running the client process is not a
member of QUserGroup.
FAILED TO CREATE SESSION
EVENT SINK OR REGISTER FOR
EXAQUANTUM SESSION EVENTS
Either:
In addition, the API provides programmatic control over the Startup and Shutdown of the
Exquantum Server.
Table 24-1
Table 24-2
AggregationPeriodManger Acquisition of
AggregationPeriodManager
Shutdown Shutdown
Exaquantum Server
Combined Server
It is not installed on
Exaquantum Client
To install the Exaquantum .NET API on an Exaquantum Client or Web Server, please refer
to Chapter 8 Installing the .NET API on an Exaquantum Client or Web Server in the
Exaquantum Installation Guide (IM 36J04A13-01E).
Session Property
Description
Gets/sets a Session object from/on the Exaquantum API. The session object gives the API:
Signature
Session Session{get;set;}
AggregationPeriodManager Property
Description
Signature
AggregationPeriodManager AggregationPeriodManager{get;}
TemplateManager Property
Description
Signature
TemplateManager TemplateManager{get;}
TagManager Property
Description
Signature
TagManager TagManager{get;}
Operation Property
Description
Signature
Operation Operation{get;}
Sample Code
This section gives example of how to access the Exaquantum API objects.
using Yokogawa.Exa.Exaquantum;
using Yokogawa.Exa.Exaquantum.Common;
QSession = api.Session ;
QSession.ServerName = MyServer ;
Qtm = api.TagManager ;
Tm = api.TemplateManager ;
Ap = api.AggregationPeriodManager ;
op = api.Operation ;
ServerName Property ()
Signature
string ServerName{get;set;}
Namespace: Yokogawa.Exa.Exaquantum.
GetAggregationPeriod Method
Description
This returns the Production Calendar Period detail, in the output QAggregationPeriod()
object, corresponding to the supplied handles.
Signature
GetAggregationPeriod(int handles, _
out QAggregationPeriod[] aggregationPeriod, _
out int[] errors)
Parameters
Errors Returned
S_OK - Succeeded
AddAggregationPeriod Method
Description
Adds one or more Production Calendar Periods. If a Production Calendar already exists, an
error occurs.
Signature
AddAggregationPeriod (QAggregationPeriod[] aggregationPeriods, _
out int[] handles, _
out int[] errors)
Parameters
Note: In the instance where two or more elements have the same name in
AggregationPeriods, the EQ_E_DUPLICATE_NAME error is returned for all
elements having this condition, except for the initial one.
Errors Returned
S_OK - Succeeded
API Exception
ModifyAggregationPeriod Method
Description
Allows modification of one or more Production Calendar periods. When the target
production calendar period does not exist, an error occurs.
Signature
ModifyAggregationPeriod (int[] handles, _
in QAggregationPeriod[] aggregationPeriods, _
out int[] errors)
Parameters
Errors Returned
S_OK - Succeeded
API Exception
DeleteAggregationPeriod Method
Description
Signature
DeleteAggregationPeriod(int[] handles, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
EQ_E_INUSE The production calendar period is used with the tag template.
API Exception
CheckAggregationPeriod Method
Description
Validates the contents of the QAggregationPeriod array. The result of each array entry is
returned in the errors array.
Signature
CheckAggregationPeriod(QAggregationPeriod[] aggregationPeriods, _
out int[] errors)
Parameter
Note: In the instance where two or more elements have the same name in
AggregationPeriods, the EQ_E_DUPLICATE_NAME error is returned for all
elements having this condition, except for the initial one.
Errors Returned
S_OK - Succeeded
API Exception
QueryAggregationPeriod Method
Description
Signature
QueryAggregationPeriod(out int[] handles, _
out QAggregationPeriod[] aggregationPeriod)
Parameter
Sample Code
GetAggregationPeriod
AggregationPeriodManager Agg =
new ExaquantumAPI().AggregationPeriodManager;
QAggregationPeriod[] aggregationPeriod;
int[] handles = new int[2];
int[] errors;
// get
handles[0] = 97;
handles[1] = 1;
Agg.GetAggregationPeriod(handles, out aggregationPeriod, out errors);
AddAggregationPeriod
AggregationPeriodManager Agg =
new ExaquantumAPI().AggregationPeriodManager;
ParaOfAgPd[0].Name = "aaa";
ParaOfAgPd[0].Description = "";
ParaOfAgPd[0].Period = 2;
ParaOfAgPd[0].Offset = 2;
ParaOfAgPd[0].ParentHandle = 0;
ParaOfAgPd[1].Name = "bbb";
ParaOfAgPd[1].Description = "";
ParaOfAgPd[1].Period = 3;
ParaOfAgPd[1].Offset = 5;
ParaOfAgPd[1].ParentHandle = 0;
// add calender
Agg.AddAggregationPeriod(ParaOfAgPd, out handles, out errors);
AddAggregationPeriod/CheckAggregationPeriod/ModifyAggregationPeriod/De
leteAggregationPeriod
AggregationPeriodManager Agg =
new ExaquantumAPI().AggregationPeriodManager;
// parameter set
QAggregationPeriod[] ParaOfAgPd = new QAggregationPeriod[1];
int[] handles;
int[] errors;
int i = 0;
ParaOfAgPd[i].Name = "ccc";
ParaOfAgPd[i].Description = "";
ParaOfAgPd[i].Period = 2;
ParaOfAgPd[i].Offset = 1;
ParaOfAgPd[i].ParentHandle = 0;
// add calender
Agg.AddAggregationPeriod(ParaOfAgPd, out handles, out errors);
i = 0;
ParaOfAgPd[i].Name = "ddd";
ParaOfAgPd[i].Description = "";
ParaOfAgPd[i].Period = 2;
ParaOfAgPd[i].Offset = 2;
ParaOfAgPd[i].ParentHandle = 0;
// check
Agg.CheckAggregationPeriod(ParaOfAgPd, out errors);
// change calander
Agg.ModifyAggregationPeriod(handles, ParaOfAgPd, out errors);
// delete
Agg.DeleteAggregationPeriod(handles, out errors);
QueryAggregationPeriod
AggregationPeriodManager Agg =
new ExaquantumAPI().AggregationPeriodManager;
int[] Handles;
QAggregationPeriod[] AggPeriods;
Namespace: Yokogawa.Exa.Exaquantum.
GetTagTemplate Method
Description
The Tag Template(s) for the specified handle(s) is returned the error
EQ_E_INVALID_HANDLE is returned if the handle does not exist.
Signature
GetTagTemplate(int[] handles, _
out QTagTemplate[] tagTemplates,_
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
AddTagTemplate Method
Signature
AddTagTemplate(QTagTemplate[] tagTemplates, _
out int[] handles, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
API Exception
ModifyTagTemplate Method
Description
Modify one or more Tag Templates. If the template is already in use, then a new version of
the template is added. This new version will be applied when the tag(s) that are built to the
template are rebuilt (or upgraded).
Signature
ModifyTagTemplate(int[] handles, _
QTagTemplate[] tagTemplates, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
EQ_E_INUSE One or more parameters cannot be changed, as the template has been
used to create tags (for example tag type).
API Exception
DeleteTagTemplate Method
Description
Delete an existing tag template. This will fail if the template is in use.
Signature
DeleteTagTemplate (int[] handles, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
API Exception
CheckTagTemplate Method
Description
Signature
CheckTagTemplate (QTagTemplate[] tagTemplates, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
API Exception
QueryTagTemplate Method
Description
Signature
QueryTagTemplate(out int[] handles, _
out QTagTemplate[] tagTemplates)
Parameter
API Exception
ApplicationException This is thrown if an error occurred during the reading of the Tag
Templates. The detail of the error is described in the Message property of the exception..
SampleCode
This section gives some examples on how to use the TemplateManager methods..
GetTagTemplate
TemplateManager templateManager = new ExaquantumAPI().TemplateManager;
QTagTemplate[] TaT;
int[] handles = new int[]{1};
int[] errors;
int[] handles;
int[] errors;
int[] APid = new int[1];
QAggregationInfo[] AInfo = new QAggregationInfo[1];
APid[0] = 3;
AInfo[0].aggregation =
AggregationCalcType.AGGREGATION_MAX;
AInfo[0].parameter = null;
AddTemp[0].Name = "CALC-R4";
AddTemp[0].TagType = TagType.TAG_TYPE_CALC;
AddTemp[0].DataType = DataType.DATA_TYPE_FLOAT;
AddTemp[0].AggregationType =
AggregationType.AGGREGATION_TYPE_CONTINUOUS;
AddTemp[0].RawHistorianInterval =
RawHistorianIntervalType.RAW_INTERVAL_ONCHANGE;
AddTemp[0].EngUnitsFlag = false;
AddTemp[0].EngRangeFlag = false;
AddTemp[0].DescriptionFlag = false;
AddTemp[0].AggregationPeriodIDs = APid; // AggregationPeriodID(array)
AddTemp[0].WriteToOPCGatewayFlag = false;
AddTemp[0].OPCPeriod = OPCPeriodType.OPC_PERIOD_NOUSE;
AddTemp[0].PercentDeadband = QTagTemplate.PercentDeadbandNoUse;
AddTemp[0].AggregationSuppliedByCalculationFlag = new bool[] {false};
AddTemp[0].AggregationInfo = AInfo;
AddTemp[0].EngUnitsFlag = true;
AddTemp[0].EngRangeFlag = true;
AddTemp[0].DescriptionFlag = true;
templateManager.CheckTagTemplate(AddTemp, out errors);
int[] handles;
QTagTemplate[] TaT;
Namespace: Yokogawa.EXA.Exaquantum
GetTag Method
Description
Signature
GetTag(string[] paths, _
out int[] handles, _
out QTag[] tags, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
AddTag Method
Description
Adds one or more tags. Where folders do not exist, they are created prior to adding of the
tags..
Signature
AddTag (QTag[] tags, _
out int[] handles, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
API Exception
ModifyTag Method
Description
Modification of one or more tags. If the tag template is to be changed, the only case where
this will succeed is if the new template has the same tag type and data type to which the tag
is currently built.
Signature
ModifyTag (int[] handles, _
QTag[] tags,_
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
API Exception
DeleteTag Method
Description
Signature
DeleteTag (int[] handles, _
out int[] errors, _
bool force)
Parameter
Force - If this flag is true, then the tag(s) will be deleted, even if they are being referenced
by other tags (for example, by a calculation tag script).
Errors Returned
S_OK - Succeeded
API Exception
CheckTag Method
Description
This method is used for the verification of the content of the QTag array.
Signature
CheckTag (QTag[] tags, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
API Exception
FindTag Method
Description
Signature
FindTag (QTagFilter[] TagFilters, _
out int[] handles, _
out QTag[] tags)
Parameter
?: represents a character.
API Exception
GetFolder Method
Description
Signature
GetFolder (string[] paths, _
out int[] handles, _
out QFolder[] folders, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
AddFolder Method
Description
Signature
AddFolder (QFolder[] folders, _
out int[] handles, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
API Exception
ModifyFolder Method
Description
Signature
ModifyFolder (int[] handles, _
QFolder[] folders, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
API Exception
DeleteFolder Method
Description
Signature
DeleteFolder (int[] handles, _
out int[] errors, _
bool force)
Parameter
Force - If this flag is true, tags under the folder will be deleted even if they are being
referenced by other tags.
Errors Returned
S_OK - Succeeded
API Exception
CheckFolder Method
Description
This method is used for the verification of the content of the QFolder array.
Signature
CheckFolder (QFolder[] folders, _
out int[] errors)
Parameter
Errors Returned
S_OK - Succeeded
API Exception
Sample Code
This section gives some examples of sample code, showing how to use the TagManager API.
AddTag/DeleteTag
TagManager tagManager = new ExaquantumAPI().TagManager;
// tag create
//OPC R4
int i = 0;
tags[i].Name = "OPC-TAG";
tags[i].Path = "Root.Test.OPC";
tags[i].TemplateName = "OPC-R4";
tags[i].Description = "";
tags[i].Units = "";
tags[i].LowEng = 0;
tags[i].HighEng = 0;
tags[i].InitValue = 0;
tags[i].InitQuality = QualityType.qdaQualityGood;
tags[i].OPCGateWay = "Gateway1";
tags[i].OPCItemID = "F001.PV";
tags[i].Script = "";
tags[i].LockStatus = false;
tags[i].Online = true;
//MAN R4
i = 1;
tags[i].Name = "MAN-TAG";
tags[i].Path = "Root.Test.Man";
tags[i].TemplateName = "MAN-R4";
tags[i].Description = "float";
tags[i].Units = "l";
tags[i].LowEng = 0;
tags[i].HighEng = 9999;
tags[i].InitValue = 100;
tags[i].InitQuality = QualityType.qdaQualityGood;
tags[i].OPCGateWay = "";
tags[i].OPCItemID = "";
tags[i].Script = "";
tags[i].LockStatus = false;
tags[i].Online = true;
//CAL String
i = 2;
tags[i].Name = "CAL-TAG";
tags[i].Path = "Root.Test.CAL";
tags[i].TemplateName = "CAL-STR";
tags[i].Description = "";
tags[i].Units = "";
tags[i].LowEng = 0;
tags[i].HighEng = 0;
tags[i].InitValue = 0;
tags[i].InitQuality = QualityType.qdaQualityGood;
tags[i].OPCGateWay = "";
tags[i].OPCItemID = "";
tags[i].Script = "[Result] = CStr(0)";
tags[i].LockStatus = false;
tags[i].Online = true;
// add
tagManager.AddTag(tags, out handles, out errors);
// delete
tagManager.DeleteTag(handles, out errors);
GetTag/CheckTag/ModifyTag
TagManager tagManager = new ExaquantumAPI().TagManager;
paths[0] = "Root.Test.MAN-R4";
// Get
tagEditor.GetTag(paths, out handles, out tags, out errors);
tags[0].Name = "MAN-REAL";
tags[0].InitValue = 0;
// Check
tagManager.CheckTag(tags, out errors);
if(errors[0] != 0)
{
return; // error
}
// Modify
tagManager.ModifyTag(handles, tags, out errors);
FindTag
TagManager tagManager = new ExaquantumAPI().TagManager;
tagFilters[0].tagFilterID = FilterIDType.FILTER_PATH;
tagFilters[0].filter = "Root.Test.*";
GetFolder
TagManager tagManager = new ExaquantumAPI().TagManager;
paths[0] = "Root.Test";
AddFolder/CheckFolder/ModifyFolder/DeleteFolder
TagManager tagManager = new ExaquantumAPI().TagManager;
// parameter set
// folder create
f_folders[0].Name = "OPC";
f_folders[0].Path = "Root.Test";
f_folders[0].Online = true;
f_folders[1].Name = "MAN";
f_folders[1].Path = "Root.Test";
f_folders[1].Online = true;
f_folders[2].Name = "CAL";
f_folders[2].Path = "Root.Test";
f_folders[2].Online = true;
f_folders[0].Name = "OPC-TEST";
// folder check
tagManager.CheckFolder(f_folders, out f_errors);
// folder modify
tagManager.ModifyFolder(f_handles, f_folders, out f_errors);
// folder delete
tagManager.DeleteFolder(f_handles, out f_errors);
Namespace: Yokogawa.EXA.Exaquantum
Startup Method
Description
Signature
Startup()
StatusChanged Event
Description
Signature
Event EventHandler StatusChanged;
Shutdown Method
Description
Signature
Shutdown()
Status Property
Description
Get the Exaquantum Service Status. The returned value is one of the following:
ContinuePending
Paused
PausePending
Running
StartPending
Stopped
StopPending
Signature
System.ServiceProcess.ServiceControllerStatus Status{get;}
IsMonitoring Property
Description
Set the notification of Exaquantum Service status change. In case of TRUE, notice
Exaquantum Service status changed.
Signature
bool IsMonitoring(get; set;)
24.8 Enumerations
This section defines the Enumerations user in the Exaquantum .NET API.
TagType
DataType
AggregationType
AggregationCalcType
SummationTimeFactorType
RawHistorianIntervalType
OPCPeriodType
TagFilterType
QualityType
TagType Enumeration
Table 24-3
DataType Enumeration
DATA_TYPE_LONG = 3,
DATA_TYPE_FLOAT = 4,
DATA_TYPE_DOUBLE = 5,
DATA_TYPE_STRING = 8
}
Table 24-4
AggregationType Enumeration
AGGREGATION_TYPE_CONTINUOUS Continuous
AGGREGATION_TYPE_DISCRETE Discrete
AggregationCalcType Enumeration
Table 24-6
AGGREGATION_MAX Maximum
AGGREGATION_MIN Minumum
AGGREGATION_MEAN Mean
AGGREGATION_SUM Summation
SummationTimeFactorType Enumeration
RawHistorianIntervalType Enumeration
OPCPeriodType Enumeration
Table 24-9
TagFilterType Enumeration
QualityType Enumeration
QUALITY_BAD Bad
QUALITY_UNCERTAIN Uncertain
QUALITY_GOOD Good
QAggregationPeriod
QTagTemplate
QAggregationInfo
QTag
QFolder
QTagFilter
QAggregationPeriod Structure
Table 24-12
Table 24-13
Hour Raw
Custom Raw
QTagTemplate Structure
Table 24-14
character
s
Set to NULL if no
aggregations are used
*4
Table 24-15
X: Mandatory
XX: Optional
*2: If AggregationPeriods has one or more elements (i.e. one or more aggregation
periods defined), then AggregationInfo must also have one or more elements (one
or more aggregation types defined).
QAggregationInfo Structure
Table 24-16
Table 24-17
[1] Differential
Summation Flag
[4] Percentage
Difference
*1: These must have the same value. The value must be a string, with a maximum of 32
characters
QTag Structure
Table 24-18
characters
(Including Name,
where
applicable)
characters
characters
characters
*2: Only applicable to Manual tags. When using a numeric data type, and the tag
template calls for LowEng and HighEng, then the value must be between LowEng
and HighEng, and within the range of the data type. When using a string data type,
the value can be up to, and including 256 characters. For tag types other than
Manual, this should be set to NULL.
*3: This is only applicable to OPC tags. For non-OPC tags, this should be set to NULL.
*4: This is only applicable to Calculated tags. For non-Calculated tags, this should be
set to NULL.
Table 24-19
Description Description XX XX XX
*1: Only required when Engineering Units are defined by the Tag Template.
*2: Only required when Engineering Range is defined by the Tag Template.
*3: When adding a tag, the initial quality is always set to Good, regardless of what is
specified. This value is used when modifying the tag.
QFolder Structure
Table 24-20
Characters
(Including folder
name, where
applicable)
QTagFilter Strucure
Table 24-21
Yokogawa.Exa.Exaquantum.Common.ErrorCode
Table 24-22
EQ_E_FAIL Failure
S_OK SUCCEED