Using .NET With Wonderware
description
Transcript of Using .NET With Wonderware
5/30/13 Using .NET with Wonderware - CodeProject
www.codeproject.com/Articles/102533/Using-NET-with-Wonderware 1/4
9,900,913 members (28,667 online)
Sign in
home quick answers discussions features community help w onderw are 7.1 dbdump
Articles » Languages » VB.NET » Applications
Article
Browse Code
Stats
Revisions (11)
Alternatives
Comments &Discussions (68)
About Article
This article will show howto read and write toWonderware from VB
Type Article
Licence GPL3
First Posted 18 Aug 2010
Views 46,360
Downloads 736
Bookmarked 17 times
VB .NET Dev
Intermediate VB.NET , +
Next
Using .NET with WonderwareBy earl the dead cat, 24 Aug 2010
Download source - 1.38 KB
Introduction
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.
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 string variable with the tag SBuffer, then you call
IntouchToolkit.ReadString("SBuffer", 132) or you can use ReadInteger, ReadDiscrete and ReadFloat
for the respective types. Also, the similar is true but the functions is WriteString, WriteFloat, WriteInteger
and WriteDiscrete. The Tag name is always a string.
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
Public Class Form1 Dim accid As Integer Dim hPt As Integer Dim SB As String Dim IntouchToolkit As Intouch
'------------------------------------------------ 'Form1_Load '------------------------------------------------ Private Sub Form1_Load(ByVal sender As System.Object, _
3.33 (6 votes)
articles
5/30/13 Using .NET with Wonderware - CodeProject
www.codeproject.com/Articles/102533/Using-NET-with-Wonderware 2/4
Top News
Old Japanese Man Creates
Amazing Art Using Excel
(Wait, Excel?)
Get the Insider News free eachmorning.
Related Videos
TheMobile DevelopmentLandscape
Building Rich Mobile Appswith HTML5, CSS3 andJavaScript
Related Articles
Auto Backup for PostgreSQL
Embedded Controls in HMIs
A Coder Interview With DaveAuld
Linking Multiple EmbeddedControls
Matrix Multiplication in C#
Creating animations withDundas Chart for ASP.NET
Smarter Data Labels withDundas Chart SmartLabels
Understanding Chart Areas withDundas Chart for .NET
Add "Select All" to parameterlists in SQL Reporting
Using screensavers inside theWindows Media Player
Making Sense of GeographicData with Dundas Map andAJAX
SmartLink
Create data-driven applicationswith the Hera ApplicationFramework
Towards the self-documentingdatabase: extended properties
Accessibility audit vs.accessibility testing
Digital Signatures and PDFDocuments
Color Scale Filter
WMP Power Hour APP
Merge Landscape and Portrait
Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load
IntouchToolkit = New Intouch(0, 0) SB = IntouchToolkit.ReadString("SBuffer", 132) 'SBuffer is the Tag 'I want to read in Wonderware
End Sub Private Sub btnOpen_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnOpen.Click IntouchToolkit = New Intouch(0, 0) IntouchToolkit.WriteDiscrete("SomeTag", 1) End SubEnd Class
These are the write functions available to call:
Collapse | Copy Code
IntouchToolkit.WriteString("SomeTag", "FooBar")
This is to write a string value.
Collapse | Copy Code
IntouchToolkit.WriteFloat("SomeTag", 3.1415)
This is to write a float value.
Collapse | Copy Code
IntouchToolkit.WriteInteger("SomeTag", 10)
This is to write an integer value.
Collapse | Copy Code
IntouchToolkit.WriteDiscrete("SomeTag", 1)
This is to write a boolean value.
These are the read functions available to call:
Collapse | Copy Code
IntouchToolkit.ReadString("SomeTag")
This is to read a string value.
Collapse | Copy Code
IntouchToolkit.ReadFloat("SomeTag")
This is to read a float value.
Collapse | Copy Code
IntouchToolkit.ReadInteger("SomeTag")
This is to read a integer value.
Collapse | Copy Code
IntouchToolkit.ReadDiscrete("SomeTag")
This is to read a boolean value.
*NOTE: Replace "SomeTag" with the tagname you want to read or write from.
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.
License
5/30/13 Using .NET with Wonderware - CodeProject
www.codeproject.com/Articles/102533/Using-NET-with-Wonderware 3/4
PDFs using ASP.NET
How to conduct an SMS surveyusing a cell phone connectedSMS gateway and MS Access
Article Top
0 TweetTweet 0
Sign Up to vote Poor Excellent Vote
Search this forum Go
License
This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)
About the Author
earl the dead catSoftware 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.
Comments and Discussions
You must Sign In to use this message board.
Profile popups Spacing Relaxed Noise Medium Layout Open All Per page 10 Update
First Prev Next
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
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
Member 8637012 14 Mar '12 - 7:46
can u please show me how can i call dll file?
Sign In · View Thread · Permalink 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?
Like 0
need help
Re: need help
dll call help
Re: dll call help
5/30/13 Using .NET with Wonderware - CodeProject
www.codeproject.com/Articles/102533/Using-NET-with-Wonderware 4/4
Permalink | Advertise | Privacy | Mobile Web02 | 2.6.130527.1 | Last Updated 24 Aug 2010
Article Copyright 2010 by earl the dead catEverything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid
folder? my windowviewer needs to be running while i try to add refrence?
Sign In · View Thread · Permalink 2.00/5 (1 vote)
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
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
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
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
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
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 Last Update: 30 May '13 - 12:15 Refresh 1 2 3 4 5 6 7 Next »
General News Suggestion Question Bug Answer Joke Rant Admin
Re: dll call help
Re: dll call help
Re: dll call help
Re: dll call help
Re: dll call help
Re: dll call help