Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OPC and Visual Basic

Status
Not open for further replies.

daisy4u721

Programmer
Aug 24, 2009
34
US
Hello,

I am a newbie to Visual basic and OPC, and I hope someone can help me here. I have an historical database which has data in intervals of 40mins, I also have an OPC server which intends to go into the database and get data. I am trying to write a Visual basic script to tell the OPC Server to get the historical data (from a “start date” to an “end date”) and manipulate the data such that the intervals are 1 min and the value remain the same until the next time. Below is the description of what I want to achieve:

Historical database data looks like this:
Number Date/Time Value
536 10/1/2011 0:00 AM 21
400 10/1/2011 0:40 AM 18
256 10/1/2011 1:20 AM 16
589 10/1/2011 2:00 AM 17
896 10/1/2011 2:40 AM 20

I want the VB Script to keep adding 1 min to the “Date/Time”, and keep the same “Value” and “Number” until the next “Number”. Description below:

Number Date/Time Value
536 10/1/2011 0:00 AM 21
536 10/1/2011 0:01 AM 21
536 10/1/2011 0:02 AM 21
536 10/1/2011 0:03 AM 21
:
:
536 10/1/2011 0:39 AM 21
400 10/1/2011 0:40 AM 18
400 10/1/2011 0:41 AM 18
:
:
:
400 10/1/2011 1:19 AM 18
256 10/1/2011 1:20 AM 16
:
:

Any help will be appreciated.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top