PPT Template

Download Report

Transcript PPT Template

Slide 1
WW TSS-8:
Technical Deep Dive into
Historian 11 Toolkit
Presented by Chris Azer
© 2012 Invensys. All Rights Reserved. The names, logos, and taglines identifying the products and services of Invensys are proprietary marks of
Invensys or its subsidiaries. All third party trademarks and service marks are the proprietary marks of their respective owners.
Presenter Profile
Chris Azer, Technical Account Manager, Wonderware
In October 2006, he joined Wonderware as a Technical Support
Engineer supporting Wonderware Historian, Operations and
Performance, Historian Client (ActiveFactory), Application Server,
Intelligence, Corporate Energy Management, Wonderware
Information Server, and Toolkits. Chris joined the strategic support
group as a Technical Account Manager in 2009.
Slide 4
Historian Toolkit Outline
• Classic Toolkit vs. Historian 11 Toolkit
– What has changed?
– What new APIs are available
• How to connect
– Understanding connection state
– Best practices
Slide 5
Historian Toolkit Outline
• Tag Creation
– Creating tag
– Data to retain for storage after tag creation
– Best Practices
• Storing Data
– Storing Streamed values
– Storing non-Streamed value collections
– Adding revised values
– Best Practices
Slide 6
Historian Toolkit Outline
• Retrieval
– Retrieving data from History
– Retrieving Analog and State Summary History
– Best Practices
Slide 7
Historian Toolkit Overview
Classic toolkit vs. Historian 11 Toolkit
How to connect
Tag Creation
Storing Data
Retrieval
Slide 8
Classic Toolkit vs. Historian 11 Toolkit
What has changed?
Slide 9
•
Data is stored using the new storage system. Historian 9 Toolkit
stores to the classic storage system
•
Real-time and late data performance is significantly improved
•
Tag creation and storage can occur prior to connecting to the
Historian
•
Entire client interface and toolkit is completely compiled into the
aahClientManaged.dll and aahStorage.exe files. MDAS not required
to be installed.
Classic Toolkit vs. Historian 11 Toolkit
Significant changes have been made to API. Here are the list of
functions in the HistorianAccess object, once called Historian.
Slide 10
Historian Toolkit Overview
Classic Toolkit vs. Historian 11 Toolkit
How to connect
Tag Creation
Storing Data
Retrieval
Slide 11
Connecting to Historian - Highlights
• Connection status is asynchronous. You must check status of
connection to see if it is pending, in storeforward, or connected to
the historian and storage process
• Connection is performed by WCF and requires a port. Prior, this was
a DCOM connection. This also requires the username/password to
be included in connection arguments.
• Late Data is not set during connection. It is set per tag.
Slide 12
Connecting to Historian
Create ConnectionHistorianArgs object which will store all connection
settings including username/password. Ensure that readOnly is also set
as the default is true.
Slide 13
Connecting to Historian
In a separate thread,
open connection then
repeatedly monitor
connection status.
Events not created by
toolkit, so have to
connection manager
class to monitor the
connection and raise
events.
Slide 14
Toolkit comparison
Archestra.Historian historianClient = new Archestra.Historian();
historianClient.Open("localhost");
historianClient.SetLateDataParams(true, 10, 10);
historianClient.ConfigureStoreForward(true, @"C:\TestSF", 120);
historianClient.ReconfigureStoreForward();
mStatus = new ArchestrA.HistorianConnectionStatus();
mLastError = null;
//We will open connection then continue to monitor status
if (HistorianAccess.OpenConnection(HistorianConnection, out mLastError))
{
while(true)
{
HistorianAccess.GetConnectionStatus(ref mStatus);
UpdateStatus(mStatus);
System.Threading.Thread.Sleep(5000);
}
}
else
{
UpdateStatus(null);
}
Slide 15
Connecting to Historian - Demo
Slide 16
Historian Toolkit Overview
Classic Toolkit vs. Historian 11 Toolkit
How to connect
Tag Creation
Storing Data
Retrieval
Slide 17
Tag Creation - Highlights
What has changed?
• Tag creation can now be performed offline.
• HistorianTagStatus can provide information if an error occurred.
Slide 18
Tag Creation
After adding tags, retain
tags in an a local array
so you can utilize the
tagkey later when
storing.
If AddTag returns false,
you can use
GetTagStatusByName
to find the error.
Slide 19
Toolkit comparison
Archestra.Tag newtag = new Tag();
newtag.Tagname = "MyTag";
newtag.TagType = Archestra.TagType.Analog;
newtag.AcquisitionType = AcquisitionType.Manual;
newtag.DataType = DataType.Int4;
newtag.Description = "This is my new tag";
newtag.EngUnit = "m/s";
newtag.MaxEU = 1000;
newtag.MinEU = 0;
newtag.StorageType = StorageType.Delta;
//Add tag and check result
Boolean result = historianClient.AddTag(ref newtag);
ArchestrA.HistorianTag tag = new ArchestrA.HistorianTag();
tag.MaxEU = 100;
tag.MinEU = 0;
tag.ServerTimestamp = false;
tag.TagChannelStatus = Convert.ToUInt16(EnableChannelStatus);
tag.TagDataType = DataType;
tag.TagDescription = Description;
tag.TagKey = 0;
tag.TagName = TagName;
tag.TagStorageType = StorageType;
uint tagkey = 0;
mLastError = null;
Boolean result = access.AddTag(tag, out tagkey, out mLastError);
Slide 20
Tag Creation - Demo
Slide 21
Historian Toolkit Overview
Classic Toolkit vs. Historian 11 Toolkit
How to connect
Tag Creation
Storing Data
Retrieval
Slide 22
Storing Data - Highlights
• Data can now be stored without ever connecting to the Historian.
• The new Toolkit refers to real-time data now as Streamed Values.
• Late data still must be store in sequence of time. But unlike the
classic storage, late data is processed as fast as real-time.
• Non-Streamed Values contain a collection of manual inserts that do
not need to be in sequence of time. Data storage is much faster
than the classic system and does not cause multiple data streams
which affects retrieval performance.
• Revised Values will update existing values.
Slide 23
Slide 24
Storing Data – Streamed
if(historianClient.ReadyForRealtimeStorage)
{
//Must register tag prior to storing. This tag must be committed as well
historianClient.RegisterTag("MyTag");
//Create Value point
Archestra.Value value = new Archestra.Value();
value.DoubleValue = 100;
value.EndTime = DateTime.Now;
value.StartTime = DateTime.Now;
value.TagName = "MyTag";
value.OPCQuality = 192;
historianClient.Store(ref value);
}
// Must get tag key to store data. Call GetTagInfoByName
// to obtain the tag information including the tagkey.
access.GetTagInfoByName(tagname, false, out tag, out error);
value.DataValueType = HistorianDataType.Float;
value.OpcQuality = 192;
value.StartDateTime = System.DateTime.Now;
value.Value = randomgenerator.Next(100);
value.TagKey = tag.TagKey;
error = null;
parameters.access.AddStreamedValue(value, out error);
Slide 25
Storing Data – Non-Streamed
if (historianClient.ReadyForOldDataStorage)
{
Archestra.Value value = new Archestra.Value();
value.DoubleValue = DateTime.Now.Second;
value.StartTime = DateTime.Now.Subtract(new TimeSpan(5, 0, 0));
value.TagName = "MyTag";
value.OPCQuality = 192;
ValueList list = new ValueList();
list.Add(value);
//Insert values
historianClient.Insert(ref list, VersionType.Latest);
}
// Must get tag key to store data. Call GetTagInfoByName to
// obtain the tag information including the tagkey.
access.GetTagInfoByName(tagname, false, out tag, out error);
if (!access.CreateNonStreamedValueCollection(out collection, out error))
return;
value.DataValueType = HistorianDataType.Float;
value.OpcQuality = 192;
value.StartDateTime = System.DateTime.Now;
value.Value = randomgenerator.Next(100);
value.TagKey = tag.TagKey;
error = null;
// Repeatedly add non streamed values to collection before sending values
collection.AddNonStreamedValue(value, out error);
// Send collection
collection.SendNonStreamedValues(out error);
Slide 26
Storing Data – Revised Values
if (historianClient.ReadyForOldDataStorage)
{
Archestra.Value value = new Archestra.Value();
value.DoubleValue = DateTime.Now.Second;
value.EndTime = DateTime.Now;
value.StartTime = DateTime.Now.Subtract(
new TimeSpan(Convert.ToInt32(tbHours.Text), 0, 0));
value.TagName = "MyTag";
value.OPCQuality = 192;
//Update value
historianClient.Update(ref value);
}
ArchestrA.HistorianDataValueList valuelist = new ArchestrA.HistorianDataValueList();
// Must get tag key to store data. Call GetTagInfoByName to obtain the tag information including the tagkey.
access.GetTagInfoByName(tagname, false, out tag, out error);
value.DataValueType = HistorianDataType.Float;
value.OpcQuality = 192;
value.StartDateTime = System.DateTime.Now;
value.Value = randomgenerator.Next(100);
value.TagKey = tag.TagKey;
error = null;
// Repeatedly add revised values to collection before sending values
valuelist.Add(value);
// Send collection
access.AddRevisionValues(ArchestrA.HistorianRevisionMode.RevisionUpdateMultiple, valuelist, out error);
Slide 27
Storing Data – Demo
Slide 28
Historian Toolkit Overview
Classic Toolkit vs. Historian 11 Toolkit
How to connect
Tag Creation
Storing Data
Retrieval
Slide 29
Retrieval– Highlights
• Retrieval API has been improved significantly with this release of
toolkit. Can query History or Analog and State Summaries.
• Data result that is received is not loaded into memory of toolkit
application. Instead you can step through a pointer that loads
values directly from History.
• Developer must clone values and manage internally their own
ObservableCollection or any other collection.
Slide 30
Retrieval– Building Query Arguments
ArchestrA.HistoryQueryArgs queryArgs = new ArchestrA.HistoryQueryArgs();
queryArgs.TagNames = new System.Collections.Specialized.StringCollection();
foreach (String tag in listBoxTagsToRetrieve.Items)
queryArgs.TagNames.Add(tag);
queryArgs.StartDateTime = dateTimePickerStart.Value.Value;
queryArgs.EndDateTime = dateTimePickerEnd.Value.Value;
queryArgs.Resolution = (ulong)Convert.ToUInt32(textBoxResolution.Text);
queryArgs.TimeDeadband = Convert.ToUInt32(textBoxTimeDeadband.Text);
queryArgs.ValueDeadband = Convert.ToUInt32(textBoxValueDeadband.Text);
queryArgs.RetrievalMode = ArchestrA.HistorianRetrievalMode.Delta;
Slide 31
Retrieval– Executing Query
ArchestrA.HistoryQuery result;
ArchestrA.HistorianAccessError error = null;
access.CreateHistoryQuery(out result);
result.StartQuery(((ArchestrA.HistoryQueryArgs)param.arguments), out error);
HistoryCollection = new ObservableCollection<ArchestrA.HistoryQueryResult>();
while (result.MoveNext(out error))
HistoryCollection.Add((ArchestrA.HistoryQueryResult)result.QueryResult.Clone());
Slide 32
Retrieval– Demo
Slide 33
Performance Comparison
Slide 34
Thank
You!
Slide 35