Simple Historical Access without an Underlying System

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
Soolik
Jr. Member
Jr. Member
Posts: 1
Joined: 26 May 2015, 13:44

Simple Historical Access without an Underlying System

Post by Soolik »

Hi,

I am trying to understand how Historical Access works for a simple variable. I have a variable in my address space and I am updating the value of the variable on the basis of a timer. I do not have an underlying system (as shown in the example server in the sdk). I am updating the value of the variable something like this :

Code: Select all

variableNode.Write(13,newValue);
ReportDataChanges(Server.DefaultRequestContext, variableHandle);
here variableHandle is the handle returned by the nodemanager for the variableNode.

Now I would like this variable to have Historical Access as well. What I understand from the documentation is this:

1. add a child HAConfiguration node under this variableNode.
2. set Historizing to true.
3. Call LinkModeltoNode method with appropriate parameters ,
I did all this like this :

Code: Select all

variableNode.Historizing = true;
variableNode.AccessLevel |= AccessLevels.HistoryReadOrWrite;
variableNode.UserAccessLevel |= AccessLevels.HistoryReadOrWrite;

settings = new CreateObjectSettings()
            {
                ParentNodeId = variableNodeId,
                ReferenceTypeId = ReferenceTypeIds.HasHistoricalConfiguration,
                RequestedNodeId = new NodeId(9999,2),
                BrowseName = BrowseNames.HAConfiguration,
                TypeDefinitionId = UnifiedAutomation.UaBase.ObjectTypeIds.HistoricalDataConfigurationType
            };

CreateObject(Server.DefaultRequestContext, settings);
LinkModelToNode(variableNodeId, new HistoricalDataConfigurationModel(), null, null, 500);
I understand that i have to manually insert the updated value to the History associated with this variable with the help of an InMemoryHistoryDataSource object. Something like this I hope :

Code: Select all

history.Insert(new Variant(value, null), StatusCodes.Good, DateTime.UtcNow);
I can create a new object of this type but how do I associate this InMemoryHistoryDataSource with my variable. I cannot find the documentation about this. This is the place where I need help. Please suggest how I should do it.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3072
Joined: 18 Mar 2011, 15:09

Re: Simple Historical Access without an Underlying System

Post by Support Team »

Hello,

You need to implement CreateHistoryContinuationPoint. Please see Lesson 7, Step 3 in Server Getting Started.
Instead of calling m_system.GetHistoryDataSource you can use your instance of InMemoryHistoryDataSource.

Best regards
Support Team

Post Reply