Escolar Documentos
Profissional Documentos
Cultura Documentos
Copyright 1998 Qualitrol International & Software Toolbox.All rights reserved worldwide.The Software Toolbox is a registered trademark of Qualitrol International.
Sample Applications
Process Graphics PLC Connections Trending/Logging Alarming/Logging Recipes Networking
Interfaces
Power Supply
PLC Rack
Object Terminology
Classes - groupings of similar object types Properties - define how the object behaves Methods - make things happen Events - occur when things happen
Hypothetical PLC Analog Input Module class
Properties - number of channels, voltage level, scaling set points, channel type Methods - send analog input to CPU, scale value Events - voltage changed on field input side, scaling updated, updated value sent to CPU, configuration change received from CPU
Object Terminology
A simple software object - a text box on a VB form
Properties
Alignment BackColor BorderStyle Font Height Name Text Visible Width and 43 others
Methods
Drag Move OLEDrag Refresh SetFocus ShowWhatsThis and 5 others
Events
Change Click DblClick DragDrop DragOver GotFocus LostFocus KeyPress Mousedown Mouseup and 13 others
Everything on your Excel spreadsheet is an object! - the worksheet is a collection of cell objects, a workbook is a collection of worksheet objects
Cell Properties
Cell Object
Visual Basic (VB) comes with a lot of free objects that give you the Windows look and feel with minimal work
Actual PLC Communciations ActiveX Object instances Placed into a Visual Basic form container Instance (noun) - a single copy of a type of software object (I.e. text box or ActiveX control) on a form Instanciate (verb) - the act of placing a single copy of an object onto a form
Events Properties
Methods
Both Use simple object.property, object.method, object_event syntaxes VB known by 3,000,000 people worldwide
Example Statements
Text1.Text = Hello World ABCTL1.FileAddr = N7:0 ABCTL1.Autopoll(500)
displays text in a text box by setting the .Text property on the Text1 text box object Sets a PLC memory address property (.FileAddr) to read using a plug-in ActiveX control object Invokes the .Autopoll Method to read data every 500ms using a plug-in ActiveX control object
Step 2 - Paste an image from a Symbol Library to the image control, set the stretch property on the image control to true and size to fit your needs
Right click on the object with your mouse, select properties on the pull down menu that appears and use this properties page to set your look and feel. Here weve used a preconfigured look and feel from the objects library to get setup quick
Add an off-the-shelf ActiveX control for PLC connectivity to your VB toolbar and then add instances of the control to your VB form Use multiple instances of the PLC ActiveX control to keep code to a minimum Give the each instance an intuitive name such as PLCMachine1 and PLCMachine2 in your applications Use separate instances for reading and writing to keep your code to a minimum, even though most PLC Communications ActiveX controls dont require you to use separate instances for reading and writing
Reading occurs when the .Trigger or .Autopoll methods are invoked In this example when the Form Loads, (Form_Load() Event) the Autopoll method on the instance of the PLC ActiveX control called ABCTL1 is invoked. The PLC control does its job and when it is done, it fires the OnReadDone() event Displays are updated using the 3 lines of code shown above in the ABCTL1_OnReadDone() Event Data is accessed in the PLC ActiveX control using the WordVal and BitVal methods to properly format the data Other methods such as floatval, stringval, longval, etc. are available for other data types
Uses new methods and events on PLC ActiveX control to provide alarm generation capability
VB List Box Control for simple alarm display - new to this project
Could all be done with VB If-then structures Using the ActiveX controls methods instead saves code and troubleshooting time
Use the .Autopoll method to start polling the PLC when the command buttons are clicked - also clear the alarms display when polling starts
Build the high alarm message text string, display it in the list box, then log the data to the database using the data controls methods
Build the low alarm message text string, display it in the list box, then log the data to the database using the data controls methods
Update a text box on the screen each time a new value is read from the PLC
Do some simple data validation when the user enters a PLC memory address
For more advanced alarm displays, ActiveX plugins are available to provide the needed functionality
Dont let all the properties confuse or worry you Key properties to set on data control:
Each text box field on the form is bound using the DataSource and DataField properties to a column in the database
Gateway Server running a software bridge between the PLCnetworks and TCP/IP Ethernet
Provides a solution when the investment to replace PLCs with Ethernet Based CPUs is too high or the PLC network interface cards for each client are cost-prohibitive The gateway software bridge can be either an EXE program that is included with some PLC communications ActiveX controls or an OPC server
Microbrewery Application
Support for wide range of ActiveX plug-ins Widely known scripting language Flexibility - you control the application Cost
you can distribute your VB code royalty free ActiveX components have low or no royalty fees for
www.softwaretoolbox.com/isaexpo98
Where do I find ActiveX controls and tools for Industrial HMI Applications ?
Although this presentation is a non-commercial, sharing of knowledge presentation, we added this slide after show because so many of you at the show were asking this question! The Software Toolbox is a company that provides you with a single place to look to find all the software tools you need for automation applications, including Visual Basic based HMI applications. Visit our website today for more product information.
www.softwaretoolbox.com