• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Building HMI with VB Tutorial [1998]
 

Building HMI with VB Tutorial [1998]

on

  • 5,569 views

"Building HMI with Visual Basic Technologies - 1998". Though they are old slides but still worth having a look especially for those who are new to HMI and SCADA technologies.

"Building HMI with Visual Basic Technologies - 1998". Though they are old slides but still worth having a look especially for those who are new to HMI and SCADA technologies.

Statistics

Views

Total Views
5,569
Views on SlideShare
3,970
Embed Views
1,599

Actions

Likes
0
Downloads
122
Comments
0

38 Embeds 1,599

http://plcsemwatchdog.blogspot.pt 427
http://plcsemwatchdog.blogspot.com.br 403
http://plcsemwatchdog.blogspot.com 276
http://plcsemwatchdog.blogspot.fi 74
http://plcsemwatchdog.blogspot.com.es 73
http://translate.googleusercontent.com 45
http://plcsemwatchdog.blogspot.ro 42
http://plcsemwatchdog.blogspot.ca 25
http://plcsemwatchdog.blogspot.in 24
http://plcsemwatchdog.blogspot.de 23
http://plcsemwatchdog.blogspot.ch 22
http://plcsemwatchdog.blogspot.mx 22
http://www.plcsemwatchdog.blogspot.com.br 20
http://plcsemwatchdog.blogspot.gr 17
http://plcsemwatchdog.blogspot.ru 13
http://plcsemwatchdog.blogspot.it 12
http://www.plcsemwatchdog.blogspot.com 11
http://plcsemwatchdog.blogspot.co.uk 10
http://plcsemwatchdog.blogspot.fr 10
http://plcsemwatchdog.blogspot.be 7
http://plcsemwatchdog.blogspot.sg 7
http://plcsemwatchdog.blogspot.com.ar 5
http://plcsemwatchdog.blogspot.hk 4
http://plcsemwatchdog.blogspot.cz 4
http://plcsemwatchdog.blogspot.nl 4
http://plcsemwatchdog.blogspot.dk 3
http://plcsemwatchdog.blogspot.kr 3
http://131.253.14.66 2
http://plcsemwatchdog.blogspot.sk 2
http://plcsemwatchdog.blogspot.se 1
http://feeds.feedburner.com 1
http://plcsemwatchdog.blogspot.ae 1
http://plcsemwatchdog.blogspot.no 1
http://www.plcsemwatchdog.blogspot.ch 1
http://plcsemwatchdog.blogspot.hu 1
http://www.plcsemwatchdog.blogspot.it 1
http://www.plcsemwatchdog.blogspot.com.es 1
http://plcsemwatchdog.blogspot.tw 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Building HMI with VB Tutorial [1998] Building HMI with VB Tutorial [1998] Presentation Transcript

    • Building Your HMI Using Visual Basic Technologies - A Tutorial John Weber The Software Toolbox ® jweber@softwaretoolbox.com October 21, 1998 Houston, TX Poster PresentationCopyright 1998 Qualitrol International & Software Toolbox.All rights reserved worldwide.The Software Toolbox is a registered trademark of Qualitrol International.
    • Why are we here today ?• Take the mystery out of objects and VB – Objects & terminology – ActiveX & Containers – VB - The “Glue”• Sample Applications – Process Graphics – Alarming/Logging – PLC Connections – Recipes – Networking – Trending/Logging
    • Defining the Technologies
    • Software Objects What are they ?• You can’t touch them - except on the disks or CD you loadthem onto your PC from• You can see them in many cases through their user interface• Are pieces of software for a specific task or family of similartasks• Are similar to subroutines or functions• May contain numerous subroutines and functions of theirown• Used to model software after real-world machine or processcomponents or sections• Are easily transported from one PC to another providedstandard interfaces are followed• Much of the software you use on your PC is built of objects
    • Objects - The Building Blocks Example - an object representation of a PLC Input Modules Output Class Modules Class Interfaces Comms. Output Output Output Input Input Input CPU 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 Input 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 TerminologyA simple software object - a text box on a VB form Properties Methods Events Alignment Drag Change BackColor Move Click BorderStyle OLEDrag DblClick Font Refresh DragDrop Height SetFocus DragOver Name ShowWhatsThis GotFocus Text and 5 others LostFocus Visible KeyPress Width Mousedown and 43 others Mouseup and 13 others
    • More Object Terminology • COM - Component Object Model • DCOM - Distributed Component Object Model = COM + Networks • ActiveX - a type of COM object • Container - a place you assemble your objects to form an application – Office productivity applications – Development tools - visual basic, etc. – Web browser • OLE - Object Linking and Embedding
    • Software Objects Examples Command Button Object Command Button Properties Everything on your Excel spreadsheet is an object! - the worksheet is a collection of cell objects, a workbook is a collection of Cell Cell worksheet objects Properties Object
    • Software Objects Examples Invoking the Print Method The Print Event
    • Software Objects Examples Visual Basic (VB) comes with a lot of free objects that give you the Windows look and feel with minimal work
    • Software Objects Examples ActiveX control objects “plug-in” to VB to let you add functionality • PLC Communications • Trends • Gauges • Tanks
    • Adding an ActiveX Component to the VB Toolbar & To A Form Right Mouse Click with pointer over the toolbar and select “components”The DefaultVB Toolbar Double click Check the component the new you want to add component on “ABCTL OLE Control the toolbar module” in this case, and it is added click the Apply button, to your form! click the OK button, and the control is added to the toolbar
    • An Automation Software Object 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
    • Browsing the Object’s Interfaces Actual PLC ActiveX object in a VB container application where its properties, methods, and events are browseable using VB’s Object Browser Function Events Properties Methods
    • VB - The Glue to connectobjects in your container• VB - Visual Basic - a full fledged development environment• VBA - Visual Basic for Applications – It is macro language in the Office applications – Is licensed by over 100 companies for use as their scripting language for customization• Both Use simple object.property, object.method, object_event syntaxes• VB known by 3,000,000 people worldwide
    • Assembling the Objects in a Container Simple Visual Basic Syntax for referring to objects Properties - ObjectName.Property = variable or value Methods - Objectname.Methodname (parameters) Events - Private Sub Objectname_EventName( ) user Logic End Sub Example Statements displays text in a text box by setting the Text1.Text = “Hello World” .Text property on the Text1 text box object Sets a PLC memory address property ABCTL1.FileAddr = “N7:0” (.FileAddr) to read using a plug-in ActiveX control object ABCTL1.Autopoll(500) Invokes the .Autopoll Method to read data every 500ms using a plug-in ActiveX control object
    • Human Machine Interface Apps • HMI = Human Machine Interface • Process Graphics • PLC Connectivity for Data • Trending and Logging • Alarming and Logging • Recipe Loading • Networking
    • Process Graphics - Static Step 1- Select the VB image control from the VB toolbar and add to the form 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
    • Process Graphics - Dynamic Add an instance of a dynamic gauge ActiveX plug in to your VB toolbar and then to your form 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 we’ve used a pre- configured look and feel from the object’s library to get setup quick
    • PLC Connectivity and Data - adding the ActiveX Control 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 don’t require you to use separate instances for reading and writing
    • PLC Connectivity and Data - setting properties This particular PLC communications ActiveX control represents each physical hardware adapter as a “logical adapter”. You run a simple config program shown here to set the hardware settings and communications parameters. By doing this, the developer of this control gives you the ability to change the hardware interfaces to your PLC without recompiling your program. When you right click on each instance of the PLC control, you bring up this properties page to set the properties on the control for whether you are reading or writing (.function), the PLC node address (.node), the PLC memory address (.Fileaddr), and the number of points to read/write.
    • PLC Connectivity and Data - Making the read happen • 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
    • Trending and LoggingBuilds upon what you’vealready learned by adding 2new controls• Trending ActiveX control• VB’s standard Data controlfor database connectivitySetup a single instance of thePLC ActiveX control and itsproperties like before but thistime use the standard VBcommand button’s On_Click() Properties Pageevent to start the polling of the for the TrendingPLC based on user input ActiveX Control
    • Trending and Logging - VB CodeInvoke the PLC ActiveXControls’ .Autopoll method tostart/stop polling when userclicks on command buttons These lines setup the timebase and variables on the trend chart ActiveX control when the form is loadedUpdate text boxes on screen with datafrom the PLC ActiveX Control This OnReadDone EventPlot data on the trending ActiveX fires every time a pollcontrol completes - the autopoll rate sets your trend update rateLog the data to the database using for youthe VB data controls methods
    • Trending and Logging The Finished Product in Run Mode
    • Alarming and Logging - Building the Form • Uses same controls and adds one new • Uses new methods and events on PLC ActiveX VB List Box Control PLC ActiveX control to for simple alarm VB Data Control Communications display - new to this for Database provide alarm project Connectivity Control generation capability
    • Alarming and Logging Generating the Alarms• Watchpoint Methods – Method included in PLC ActiveX control – User specifies high, low limits and type of alarms desired (on high, on low, on change, on normal, on discrete change) – Autopoll method used to tell control how often to check the points• Could all be done with VB If-then structures• Using the ActiveX controls’ methods instead saves code and troubleshooting time
    • Alarming and Logging• You setup the watchpoints and go on doing other things in your applications• Handle the events when they happen• OnAnalogHigh• OnAnalogLow• OnAnalogChange• OnAnalogNormal• OnDiscreteChange
    • Alarming and Logging- VB Code Setting up the watchpoint by invoking the .WatchPointAdd method in the PLC Comms ActiveX Control 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 thedatabase using the data controls methods
    • Alarming and Logging- VB Code 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
    • Alarming and Logging- VB Code Build the normal alarm message text string, display it in the list box, then log the data to the Update a text box on the database using the data screen each time a new controls methods value is read from the PLC Do some simple data validation when the user enters a PLC memory address
    • Alarming and Logging - Finished Product
    • Alarming and Logging - Advanced DisplaysFor more advanced alarmdisplays, ActiveX plug-ins are available toprovide the neededfunctionality
    • Recipe Loading - Setting up the Data Control Use VB’s standard Data Control to connect to a database • Don’t let all the properties confuse or worry you • Key properties to set on data control: • DatabaseName = pathname and filename of the database • RecordSource = table name or query name to get records from in the database - data control gives you a pull-down list
    • Recipe Loading - Data Binding Text box properties page has 2 key properties that allow the user to connect or “bind” the value shown in the field to a column in a database table or query • DataSource - the name of the data control that you setup to connect to the database • DataField - the actual column, pulled from an auto-generated pulldown Each text box field on the form is “bound” using the list, whose data will be DataSource and DataField properties to a column in bound to the text box the database
    • Recipe Loading - In Action When the user clicks on the next or previous recipe buttons, the code shown below advances the database pointer forward or backward one record while checking to make sure the beginning or end of the database table is not passed
    • Recipe Loading - In Action When user clicks on “Download to PLC”, the code below loads the displays values into the PLC ActiveX control and invokes its trigger method to write the data to the PLC. When the OnWriteDone event fires, the user is notified with a message box
    • Networking - Leveraging Newer Ethernet Aware PLCs Client PCs running your VB HMI Application and using a PLC ActiveX control that supports direct Ethernet connections to the PLC TCP/IP Ethernet Network PLCs with built-in Ethernet Interfaces
    • Networking - Retrofitting to Proprietary PLC Networks Client PCs running your VB HMI Application and utilizing a PLC ActiveX control that provides with it an EXE application for your server to bridge from Ethernet to the PLC networks or an ActiveX control that is an OPC client and can talk to an OPC server Remote user via TCP/IP Ethernet Windows Dial-Up Gateway Server running a software Network Networking bridge between the PLCnetworks and TCP/IP Ethernet Proprietary PLC Network• Provides a solution when the investment to replace PLCs with Ethernet Based CPUs is too high or thePLC network interface cards for each client are cost-prohibitive• The gateway software bridge can be either an EXE program that is included with some PLCcommunications ActiveX controls or an OPC server
    • Transfer Line Application
    • Transfer Line Application
    • Microbrewery Application
    • Benefits of Using Visual Basic for HMI Applications • Use the right tool for the right job – Simple to moderately complex apps – Don’t reinvent a pre-configured HMI in VB if that’s really what you need • 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
    • Resources for further learning • Understanding ActiveX & OLE - David Chappel, Microsoft Press • Office97 Visual Programmers Guide - Microsoft Press • Microsoft Websites - msdn.microsoft.com/vba • Download copy of this presentation and other presentations and technical papers at www.softwaretoolbox.com/isaexpo98
    • Where do I find ActiveX controls andtools 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