Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Historian SDK

Storing Original Streamed Data on the Redundant Historian

Storing Original Streamed Data on the Redundant Historian

Storing original streamed data for the MultiHistorianAccess class is similar to the HistorianAccess class, except that in the case of the MultiHistorianAccess class, every data value gets automatically queued for storage into all internal HistorianAccess objects. 

Example

HistorianAccessError error;
HistorianDataValue myVTQ = new HistorianDataValue();
myVTQ.TagKey        = tagKey;
myVTQ.DataValueType = myTag.TagDataType;
myVTQ.OpcQuality    = 192;


for (int i = 0; i < 1000000; i++)
{
    myVTQ.Value         = i;
    myVTQ.StartDateTime = DateTime.Now;
    if (!multiHistorian.AddStreamedValue(myVTQ, out error))
        Console.WriteLine("Failed to enqueue VTQ to multi-historian: {0}",
            error.ErrorDescription);    
}

IMPORTANT: If at the very first startup of the Historian SDK application the primary historian is unavailable, the original streamed data will be stored locally in store-and-forward mode only for the primary historian, which name is specified in the arguments of the OpenConnection() call. After the primary historian has been reached for the first time and the name of its partner has been discovered, the data will be stored for both. However the secondary historian will not have the data collected by the primary historian during the time when secondary historian name remained unknown.