opc foundation road shows go to the webinar...
TRANSCRIPT
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
OPC Foundation Road Shows go to the Webinar Format
Unleash the Power of OPC: Developing custom business and
manufacturing software applications with OPC & Visual Studio .NET
A standard object model and set of interfaces for applications and servers
Before OPC: With OPC:
DisplayApplication
TrendApplication
OPC OPC
DCSController
PLC
• reduce cost
• protect investment
• more choices
• increase productivity
• costly
• inefficient
• risky
Performance
Connectivity / Collaboration
Application X ...
DCS ControllerPLC
Application Y
Custom interfaces Client and Server write to a standard
InterOperability
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Using OPC DA with Visual Studio & Visual Studio.NET
Nathan PocockChief Architect and Applications Engineer
Software Toolbox, Inc.
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Overview
• What is Visual Basic & Why use it?• Real-world Customer examples• Ways to make Visual Studio an OPC DA
client• Ways to add OPC DA Server Interface to
Your Custom Applications• Live Demonstrations• Summary, Q&A
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Questions for you…
• Do you have custom software applications in your plant?
• Has anyone ever asked you for shop floor data in a front office application?
• Have you ever worked with Visual Basic or any other programming language?
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
What is Visual Basic & Why?
• One of the world’s most popular rapid software development languages
• May be the foundation for applications you already use
• Lots of people and IT people know it
• Taught in schools• Lots of available tools• Not a replacement for off-the-
HMI shelf solutions
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Why Do Custom Applications Exist?
• Achieve very specific business results• To Extend existing business applications• Enhancing & expanding functionality of off-the-shelf
software• Implementing complex algorithms• Cheaper than commercial alternatives?
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
What kind of applications can I create?
• Windows/Web applications for visualization• Background services for continuous monitoring• Shell scripts for complete systems automation• Mobile / PDA interactive applications• Web Services for total system platform-independence
and interoperability
Most of this can beDone without having
to write any code
Most of this can beDone without having
to write any code
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Example –HACCP Compliance
BENEFITS:
• No need to develop a “Driver”
• A scalable OPC “driver” was delivered by 3rd party vendor
• Existing HMI and VB application can consume data from OPC Servers
• Extended use of existing commercial HMI/SCADA
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Example – Water Treatment
BENEFITS:
• Able to migrate from MS-DOS to Windows while allowing maximum scalability
• Get out of Protocol developing
• Application now agnostic to device and protocol details
• Developer can now focus on their core application functionality & enhancements
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Example - .NET, Oil & Gas Industry
BENEFITS:
• Experience and knowledge turned into a “product”
• Avoided developing Protocols
• Able to connect to any PLC via an OPC Server
• Application developed very quickly because of RAD toolkit
• Didn’t even learn OPC details!
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Using Visual Studio as OPC Client
• When you configured an HMI, you configured an OPC client connection
• In VB/VS.NET you need an OPC client connection tool
• Good Design and Planning Still Required Visual Basic to 1 OPC
Server to 1-N Devices
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Putting it to Work
Server Application
Client ToolPlug-In
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
OPC Client Plug-In Tools• Wrapper Objects
– Two Types• Automation Wrapper• .NET Wrapper
– Available from OPC Foundation for OPC Foundation members only– Requires understanding of key OPC interfaces and working with
handles & collections– Community support
• Commercial Software Tools– Variety of types & languages available– Details of OPC implementation abstracted for user– User focuses on “read this”, “write that”– Available from OPC Foundation members– Seek OPC Certified solutions– Phone, email support usually included
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Wrappers – Code for Subscribing to 4 itemsOption ExplicitOption Base 1 ‘Makes all arrays start with an index of 1
Dim WithEvents AnOPCServer As OPCServerDim WithEvents ConnectedOPCServer As OPCServerDim ConnectedServerGroup As OPCGroupsDim WithEvents ConnectedGroup As OPCGroup
Dim OPCItemCollection As OPCItemsDim ItemCount As LongDim OPCItemIDs(10) As StringDim ItemServerHandles() As LongDim ItemServerErrors() As LongDim ClientHandles(10) As LongDim ConnectedServerName As String
'Create a new OPC Server objectSet ConnectedOPCServer = New OPCServer'Load the selected server name to start the interfaceConnectedServerName = “Developer - Enter Your OPC Server Name Here in
quotes”'Attempt to connect with the server (Local only in this example)ConnectedOPCServer.Connect (ConnectedServerName)'Prepare to add a group to the current OPC Server' Get the group interface from the server objectSet ConnectedServerGroup = ConnectedOPCServer.OPCGroups' Set the desire active state for the groupConnectedServerGroup.DefaultGroupIsActive = True'Set the desired percent deadband - enter an integer from 0 to 100 for the
deadbandConnectedServerGroup.DefaultGroupDeadband = 0 ' Add the group and set its update rate - enter whatever group name you want in
place of “DataGroup1”Set ConnectedGroup = ConnectedServerGroup.Add(“DataGroup1”)' Set the update rate for the group - enter an long integer value representing the
millisecond group update rateConnectedGroup.UpdateRate = 500
‘ The following line is crucial -- without it you won’t be subscribed to the server and DataChange events will not fire!ConnectedGroup.IsSubscribed = True ItemCount = 4Dim i As IntegerFor i = 0 To 3‘This line builds a string like “GE9030.R1@10” - a valid item name for the OPC server we are using
OPCItemIDs(i + 1) = “GE9030.R” & (I + 1) & “@10”ClientHandles(i + 1) = I ‘ Sets a reference pointer number for this pointOPCItemActiveState(i).Value = 1‘ Tells the server we want this item to be
activeNext I‘Gets an items collection from the current GroupSet OPCItemCollection = ConnectedGroup.OPCItems‘Sets the items collection to activeOPCItemCollection.DefaultIsActive = True‘This line adds the items we’ve chosen to the items collection and in turn to
the group in the OPC ServerOPCItemCollection.AddItems ItemCount, OPCItemIDs, ClientHandles, ItemServerHandles, ItemServerErrors
‘In the Connected Group Object Data Change Event you get the data whenever it changesDim i As Integer
For i = 1 To NumItemstxtData(ClientHandles(i)).Text = ItemValues(i)If Qualities(i) And &HC0 Then
txtQuality(ClientHandles(i)).Text = "Quality Good"Else
txtQuality(ClientHandles(i)).Text = "Quality Bad"End IftxtTimeStamp(ClientHandles(i)).Text = TimeStamps(i)
Next i
This code is provided to illustrate the level of work required to use free wrappers
But, where is the….Error Checking?
Validation?That is your job!
But, where is the….Error Checking?
Validation?That is your job!
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Visual Basic 6.0 - Reads
VB6 to OPC How To - Reads
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Commercial Tool ExampleVisual Studio.NET Extenders
• Extenders are a Visual Studio.NET concept
• Extenders “magically” add functionality to any .NET component
• Visual Studio.NET asks Extender objects for any additional properties on a .NET component
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
VS.NET Value-Added Tools
• Trending• Alarming• Reporting• Recipe
Management• Logging• Web• Mobile
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Adding OPC DA Server Interfaces to Custom Applications
DA Server ToolPlug-In
Your Custom Visual Studio or Visual Studio.NET Application
Historian
MES & others
HMI/SCADA
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Live Demos
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
• Re-invent the wheel• Build large, complex,
systems (just because you can)
• Assume NO errors will occur with Local Servers
• Use polled reads instead of Subscriptions
• Make Sync read/write calls too quickly, can slow down your system
Custom Development Do’s and Don’ts
• Plan your projects!• Use popular IDEs and
languages like VB(many are FREE)
• Benefit from IOP Tested RAD Toolkits
• Build smaller, more manageable systems
• Development Advice? buy consultation from a trusted OPC Vendor
Content is Copyright Software Toolbox, 2008No re-use or copying without written permission
Summary
• Business applications often need OPC Data• Other applications need data from your
custom applications – OPC provides an open transport
• Connecting doesn’t have to be hard• Widespread adoption of OPC has created
supply of tools• Use OPC for anything, not just for PLCs!• Don’t let them tell you “it can’t be done”
OPC Foundation
• International Industry Standard Organization – 500+ Member Companies / 100+ end-users Members– 3500+ Total Companies Build OPC Products = 22000+ Products
• The vision of OPC is to be the Foundation for interOperability– for moving information vertically from the data sources through
the enterprise of multi-vendor systems (with stops in between…)– For moving information horizontally between data sources on
different industrial networks from different vendors;– Not just data but information…….
• Reliable, Secure Integration is not an Option• Collaboration is key to pulling multiple “open” standards
into unified open platform architecture….• Success is measured by level of adoption
For more information
• Email questions to – [email protected]– [email protected]
• Visit the sponsors– www.Automation.com– www.Softwaretoolbox.com– www.OPCFoundation.org