Data Logging High Speed Data from Visual Studio Applications

OPC Systems.NET will support data logging from Visual Studio application with resolution to 100 nanoseconds.

View the following video for a quick tutorial on high speed data logging and automated setup.


In order to log values directly from a Visual Studio application you will need to implement the OPC Controls Data Component as demonstrated in the WinForm Example Code under FormDataLogging.  You can log values just as if the values were from an OPC Server, just setup Tags with a data source of Value, the desired data type, and then from your Visual Studio application use the WriteTags method of the OPC Controls Data component.  If you also include TimeStamps array in the WriteTags method the service will use the TimeStamps you write instead of the CPU clock time when writing values to the database.

You can also setup data logging groups to be triggered based on event and assign a Boolean Tag as the Trigger Tag.  From your Visual Studio application your code in simple form would look like the following.

        Dim sourceTimeStamps(2) As Date

        Dim timeNow As Date = Now

        sourceTimeStamps(0) = timeNow

        timeNow = timeNow.AddTicks(1)

        sourceTimeStamps(1) = timeNow

        timeNow = timeNow.AddTicks(1)

        sourceTimeStamps(2) = timeNow

        Dim TagsToWrite(14) As String

        Dim ValuesToWrite(14) As Object

        Dim TimeStampToWrite(14) As Date

        TagsToWrite(0) = "Value01.Value"

        ValuesToWrite(0) = 1

        TimeStampToWrite(0) = sourceTimeStamps(0)

        TagsToWrite(1) = "Value02.Value"

        ValuesToWrite(1) = 1

        TimeStampToWrite(1) = sourceTimeStamps(0)

        TagsToWrite(2) = "Value03.Value"

        ValuesToWrite(2) = 1

        TimeStampToWrite(2) = sourceTimeStamps(0)

        TagsToWrite(3) = "Trigger.Value"

        ValuesToWrite(3) = True

        TimeStampToWrite(3) = sourceTimeStamps(0)

        TagsToWrite(4) = "Trigger.Value"

        ValuesToWrite(4) = False

        TimeStampToWrite(4) = sourceTimeStamps(0)


        TagsToWrite(5) = "Value01.Value"

        ValuesToWrite(5) = 2

        TimeStampToWrite(5) = sourceTimeStamps(1)

        TagsToWrite(6) = "Value02.Value"

        ValuesToWrite(6) = 2

        TimeStampToWrite(6) = sourceTimeStamps(1)

        TagsToWrite(7) = "Value03.Value"

        ValuesToWrite(7) = 2

        TimeStampToWrite(7) = sourceTimeStamps(1)

        TagsToWrite(8) = "Trigger.Value"

        ValuesToWrite(8) = True

        TimeStampToWrite(8) = sourceTimeStamps(1)

        TagsToWrite(9) = "Trigger.Value"

        ValuesToWrite(9) = False

        TimeStampToWrite(9) = sourceTimeStamps(1)


        TagsToWrite(10) = "Value01.Value"

        ValuesToWrite(10) = 3

        TimeStampToWrite(10) = sourceTimeStamps(2)

        TagsToWrite(11) = "Value02.Value"

        ValuesToWrite(11) = 3

        TimeStampToWrite(11) = sourceTimeStamps(2)

        TagsToWrite(12) = "Value03.Value"

        ValuesToWrite(12) = 3

        TimeStampToWrite(12) = sourceTimeStamps(2)

        TagsToWrite(13) = "Trigger.Value"

        ValuesToWrite(13) = True

        TimeStampToWrite(13) = sourceTimeStamps(2)

        TagsToWrite(14) = "Trigger.Value"

        ValuesToWrite(14) = False

        TimeStampToWrite(14) = sourceTimeStamps(2)


        OpcControlsData1.WriteTags(TagsToWrite, ValuesToWrite, TimeStampToWrite)


The result in the database for this one WriteTags method would be 3 records.