You are on page 1of 4

5/30/13

Using .NET with Wonderware - CodeProject


9,900,913 members (28,667 online)

home

articles

quick answers

discussions

Sign in

features

community

Articles Languages VB.NET Applications

Article
Browse Code
Stats
Revisions (11)
Alternatives
Comments &
Discussions (68)

help

w onderw are 7.1 dbdump

Next

Using .NET with Wonderware

About Article

By earl the dead cat, 24 Aug 2010

This article will show how


to read and write to
Wonderware from VB

3.33 (6 votes)

Type

18 Aug 2010

Views

This article is born out of several projects I have had extending Wonderware by calling VB.NET applications.
Wonderware is an HMI/SCADA front end made by Wonderware. Wonderware is fairly easy to use, although I am
not a huge fan of it, I don't have much against it either. It is just a common program in the SCADA industry. This will
show you how to write applications that communicate with Wonderware. I usually have to do this to extend the
functionality or to fill in the gaps between what Wonderware can do and what the customer requires.

GPL3

First Posted

Introduction

Article

Licence

Download source - 1.38 KB

46,360

Downloads

736

Bookmarked

17 times

VB .NET Dev
Intermediate VB.NET , +

Background
I write HMI/SCADA software mostly for the oil and gas industry. In this industry, many companies use a product called
Wonderware. I have also come across it in waste water plants as well as food processing plants (Cheese Cake to be
exact!!!). At most of these facilities, they need a function in the Wonderware application, but Wonderware can't do it.
This will give you another option. I have seen other options using DDE. However, DDE is no longer supported so we
will be using the Wonderware Toolkit. This code will contact the Wonderware running on the same computer.

Using the Code


Using the code will be pretty easy. We will create 2 VB files that are required to call the Wonderware toolkit (ptacc.dll
and wwheap.dll). After that, all that will be left is your application to call the read/write functions of the Wonderare
Toolkit. These files were created based on information from Wonderware West and my experience with using the 2
DLLs.
To do this, you need to copy the Intouch.vb and the Ptacc.vb into your project as well as reference the wwheap.dll and
the ptacc.dll. Doing this will allow you to communicate with the Wonderware database.
The Ptacc.vb file will contain everything necessary to communicate with Wonderware. However it isn't very pretty, so
that is why we use the Intouch.vb file. It is just the basic level.
The Intouch.vb file is going to contain our commands for reading and writing values with the Wonderware database.
This will allow you to read/write Strings, Floats, Booleans(Discrete), and Integers.
So if you want to read the first 132 characters from the s r n variable with the tag S u f rthen you call
tig
Bfe,
I t u h o l i . e d t i g " B f e " 1 2 or you can use R a I t g rR a D s r t and R a F o t
nocToktRaSrn(Sufr, 3)
ednee, edicee
edla
for the respective types. Also, the similar is t u but the functions is W i e t i gW i e l a , W i e n e e
re
rtSrn, rtFot rtItgr
and W i e i c e eThe T g name is always a s r n .
rtDsrt.
a
tig
Now that we got the basics out of the way, you need to call this from your application. This is pretty simple. In your
main VB file, whether it is Windows Form or console application doesn't matter. I have not tried this with a web form,
but I would like to hear your experience with it if you do try it.
Collapse | Copy Code

Pbi CasFr1
ulc ls om
DmacdA Itgr
i ci s nee
DmhtA Itgr
i P s nee
DmS A Srn
i B s tig
DmItuholi A Ituh
i nocTokt s noc
'----------------------------------------------'om_od
Fr1La
'----------------------------------------------PiaeSbFr1La(ya sne A Sse.bet _
rvt u om_odBVl edr s ytmOjc,

www.codeproject.com/Articles/102533/Using-NET-with-Wonderware

1/4

5/30/13

Using .NET with Wonderware - CodeProject

PiaeSbFr1La(ya sne A Sse.bet _


rvt u om_odBVl edr s ytmOjc,
BVleA Sse.vnAg)HnlsMBs.od
ya
s ytmEetrs ade yaeLa

Ituholi =NwItuh0 0
nocTokt
e noc(, )
S =Ituholi.edtig"Bfe" 12 'Bfe i teTg
B
nocToktRaSrn(Sufr, 3) Sufr s h a
' wn t ra i Wnewr
I at o ed n odrae
EdSb
n u
PiaeSbbnpnCikBVlsne A Sse.bet _
rvt u tOe_lc(ya edr s ytmOjc,
BVleA Sse.vnAg)HnlsbnpnCik
ya
s ytmEetrs ade tOe.lc
Ituholi =NwItuh0 0
nocTokt
e noc(, )
Ituholi.rtDsrt(SmTg,1
nocToktWieicee"oea" )
EdSb
n u
EdCas
n ls

Top News

These are the write functions available to call:


Collapse | Copy Code

Ituholi.rtSrn(SmTg,"oBr)
nocToktWietig"oea" Foa"

Old Japanese Man Creates


Amazing Art Using Excel
(Wait, Excel?)
Get the Insider News free each
morning.

This is to write a s r n value.


tig
Collapse | Copy Code

Related Videos

Ituholi.rtFot"oea" 311)
nocToktWiela(SmTg, .45

This is to write a f o t value.


la
Collapse | Copy Code

Ituholi.rtItgr"oea" 1)
nocToktWienee(SmTg, 0

This is to write an i t g r value.


nee
Collapse | Copy Code

The
Mobile Development
Landscape

Collapse | Copy Code

Building Rich Mobile Apps


with HTML5, CSS3 and
JavaScript

Ituholi.rtDsrt(SmTg,1
nocToktWieicee"oea" )

This is to write a b o e n value.


ola
These are the read functions available to call:

Ituholi.edtig"oea"
nocToktRaSrn(SmTg)

This is to read a s r n value.


tig

Related Articles
Collapse | Copy Code

Ituholi.edla(SmTg)
nocToktRaFot"oea"

Auto Backup for PostgreSQL


Embedded Controls in HMIs

This is to read a f o t value.


la

A Coder Interview With Dave


Auld
Collapse | Copy Code

Ituholi.ednee(SmTg)
nocToktRaItgr"oea"

Linking Multiple Embedded


Controls
Matrix Multiplication in C#

This is to read a i t g r value.


nee

Creating animations with


Dundas Chart for ASP.NET
Collapse | Copy Code

Ituholi.edicee"oea"
nocToktRaDsrt(SmTg)

This is to read a b o e n value.


ola
*NOTE: Replace "S m T g with the t g a e you want to read or write from.
oea"
anm

Points of Interest
As you can see, this is pretty simple. I have used this code several times on Wonderware 7.1 to 10.0. I usually put in
some code that starts my application when an icon in Wonderware is clicked. This is the reason why I get the x and y
values from Wonderware. It took me about a week with Wonderware support to find this information, and they do
not support the Wonderware toolkit, but it has been reliable for me.

History
Well, this is the initial version.

Smarter Data Labels with


Dundas Chart SmartLabels
Understanding Chart Areas with
Dundas Chart for .NET
Add "Select All" to parameter
lists in SQL Reporting
Using screensavers inside the
Windows Media Player
Making Sense of Geographic
Data with Dundas Map and
AJAX
SmartLink
Create data-driven applications
with the Hera Application
Framework
Towards the self-documenting
database: extended properties
Accessibility audit vs.
accessibility testing
Digital Signatures and PDF
Documents
Color Scale Filter

License
www.codeproject.com/Articles/102533/Using-NET-with-Wonderware

WMP Power Hour APP


Merge Landscape and Portrait

2/4

5/30/13

License

Using .NET with Wonderware - CodeProject


PDFs using ASP.NET

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

How to conduct an SMS survey


using a cell phone connected
SMS gateway and MS Access

About the Author


earl the dead cat
Software Developer (Senior)
National Oilwell Varco
United States
Member

I am a Developer and Electrical Engineer. I work mostly on HMI


and SCADA systems in the Houston area. I have worked mostly
around oil and gas industry. I have also spent time in Indiana
working on automotive assembly plants.

Article Top

Like

Tw eet

Sign Up to vote Poor

Excellent

Vote

Comments and Discussions


You must Sign In to use this message board.
Search this forum
Profile popups Spacing Relaxed

Noise Medium

Layout Open All

Go
Per page 10

Update

First Prev Next

need help

Member 9993496

22 Apr '13 - 22:01

do you know about .sdf files? sdf is a sql database for mobile devices (sql compact version)
i am going to make a sdf viewer but i dont know where to start.
can you help me?
i need to make a sdf viewer application using vb.net (window-based)
Sign In View Thread Permalink

Re: need help

earl the dead cat

24 Apr '13 - 2:57

a) this has nothing to do with the article above


b) yes.. it is simple... you can attach a db at runtime using a connection string.
Sign In View Thread Permalink

dll call help

Member 8637012

14 Mar '12 - 7:46

can u please show me how can i call dll file?


Sign In View Thread Permalink

Re: dll call help

5.00/5 (1 vote)
Member 8637012

14 Mar '12 - 9:30

BTW when i try to reference this dll files, does it need to be located in my project bin folder or in programfile
folder? my windowviewer needs to be running while i try to add refrence?

www.codeproject.com/Articles/102533/Using-NET-with-Wonderware

3/4

5/30/13

Using .NET with Wonderware - CodeProject

folder? my windowviewer needs to be running while i try to add refrence?


Sign In View Thread Permalink

2.00/5 (1 vote)

Re: dll call help

Member 8637012

14 Mar '12 - 10:51

Are you using this dll file in visual studio 08 or 10? i guess u might be using this in older vb version.
Sign In View Thread Permalink

Re: dll call help

earl the dead cat

14 Mar '12 - 14:20

I originally wrote this for VS.NET 08, you need to go to references and add the dlls you need.
Sign In View Thread Permalink

Re: dll call help

Member 8637012

15 Mar '12 - 2:46

error:Please make sure that the file is accessible, and that it is a valid assembly or COM component
i did put this files in my project folder.
do you remember what version of intouch you were using also what version of .net framework you
used.
Sign In View Thread Permalink

Re: dll call help

Member 8637012

16 Mar '12 - 4:32

i have both dll files in their location but i am not sure i have toolkit install or not. my question
would be do i need that toolkit in order to run the application.
please reply i want this to work.
Sign In View Thread Permalink

Re: dll call help

earl the dead cat

16 Mar '12 - 16:05

The toolkit is on a disc that comes with WW and Archestra. As long as you have WWHeap.dll
and PTACC.dll you are good. Have you referenceed the dlls in Visual studio?
Sign In View Thread Permalink

Re: dll call help

Member 8637012

19 Mar '12 - 2:33

As I said earlier when i try to reference there dll files it gives me error
error:Please make sure that the file is accessible, and that it is a valid assembly or COM
component
now i am guessing these files are not compatible with vs 10, do you know any other way i
can reference them into my application.
Sign In View Thread Permalink

Last Visit: 31 Dec '99 - 18:00


General

News

Last Update: 30 May '13 - 12:15


Suggestion

Question

Permalink | Advertise | Privacy | Mobile


Web02 | 2.6.130527.1 | Last Updated 24 Aug 2010

www.codeproject.com/Articles/102533/Using-NET-with-Wonderware

Refresh

Bug

Answer

Layout: fixed | fluid

Joke

1 2 3 4 5 6 7 Next
Rant

Admin
Article Copyright 2010 by earl the dead cat
Everything else Copyright CodeProject, 1999-2013
Terms of Use

4/4

You might also like