Lab view as a Teaching Aid for Control Engineering

Lab view as a Teaching Aid for Control Engineering

Copyright © IFAC Advances in Control Education Oulu. Finland. 2003 ELSEVIER IFAC PUBLICATIONS www.elsevier.comllocatelifac Lab VIEW AS A TEACHING A...

753KB Sizes 0 Downloads 85 Views

Copyright © IFAC Advances in Control Education Oulu. Finland. 2003

ELSEVIER

IFAC PUBLICATIONS www.elsevier.comllocatelifac

Lab VIEW AS A TEACHING AID FOR CONTROL ENGINEERING Dr. Petra ARADI, Dr. Gyorgy LlPOVSZKI Systems and Control Engineering Group Department ofInformation Engineering Faculty of Mechanical Engineering Budapest University of Technology and Economics Goldmann Gy. !er 3.. Budapest. H-J J J J. HUNGARY (petra.lipovszki}@rit.bme.hu

Abstract: LabVIEW-based simulation programs help staff and students in various systems and control engineering courses at BUTE. This paper reports on the development and application of two LabVIEW-based simulation systems TUBSIM and .:PSim:. The importance of interactive, modifiable simulation programs lies both in coursework and in individual study. The courses taught, theses written and defended during the last years have proven grounds to this kind of applied simulation. Copyright © 2003 IFA C Keywords: educational aids, control engineering, systems engineering, simulation, control system analysis, design and synthesis

I. INTRODUCTION

programs, usually simulations. This approach is suitable for the expansion of documents from both the second and third types mentioned above. Animated illustrations and video clips help the students in understanding real world processes, that are otherwise very difficult or plain impossible to demonstrate. The application programs can serve multiple purposes from simply illustrating systems and processes, to providing the users with interactive access to the process itself. For disciplines involving experimentation, computing and the Internet further widens the horizon. There are examples of virtual laboratories on the net, that simulate a real world experiment, and there are laboratories with experiments set up for interactive usage over the Internet.

Computer-based materials are increasingly used in education, nowadays. The style of these materials range from simple hand-written lecture notes, through computerised documents, to interactive, hypermedia-type online systems. Each of these styles has its uniqueness, advantage and disadvantage. Hand-written notes are usually scanned and made available in a standard document format (PS, PDF, RTF, DOC, etc.). While such a document has a more personal touch from its author, it clearly has lots of drawbacks: it is rather difficult to correct the incidental mistakes, it has no interactivity at all, but has limits in extensions. Lecture and lab notes generated with word processors have the advantage of clear reproducibility, the ease of correction and further development. The above-mentioned two categories can be classified as static documents: once they are written, they are usually made available on the Internet, and can be down loaded and printed. Their aim is similar to those of textbooks.

A number of interactive, computer-based course materials in various disciplines and subjects, from all over the world are available through the Internet. These courseware materials have diverse target audiences both in level and type of students, e.g. from primary school to university, from regular weekly lectures to distant-learning.

The next evolutionary step is the extension of static documents with dynamic content, such as hypertext capabilities. Such documents can still be of certain common formats (e.g. PDF, DOq, but with internal references implemented. A more common format for hypertext documents is HTML, namely web pages. HTML documents are usually publicly available, and are mostly intended for online reading. It is however possible, to get the contents of such a web-site for offiine browsing.

This paper focuses on systems and control engineering course materials developed and used in various courses and study levels at the Faculty of Mechanical Engineering of BUTE.

2. SIMULATION SYSTEMS USED IN SYSTEMS AND CONTROL ENGINEERING COURSWARE Systems Engineering courses are taught prior to Control Engineering courses at BUTE, to introduce

Further enhancements to education materials are embedded animations, video, and interactive sample

321

modelling and simulation theory, methods and applications, not only for control, but for other disciplines as well. Modelling and simulation theories, methods and techniques - parallel with and serving the needs of systems and control engineering - have undergone a significant development during the last century. Measurement technology achieved important milestones, too. Up-to-date instruments and principles; accurate and fast measurements characterise today's measurement technology. Modem computing resources increase data management speed and capacity. Scientific results of the above mentioned fields are joined together in interdisciplinary applications. The most recent information should be included in education, at the same time the basics have to be taught, too.

2.2. Lab VIEW

Lab VIEW stands for Laboratory Virtual Instrumentation Engineering Workbench. It is a graphical programming environment, originally developed for measurement, analysis and process instrumentation. Recent upgrades allow the integration of databases, data-acquisition and control over the Internet. The programming language itself is called G. LabVIEW has numerous built-in functions that make creating user interfaces, data processing, file I/O and communication with various instruments easy. LabVIEW is available for multiple platforms, such as Microsoft Windows, Macintosh and UNIXvariants. In LabVIEW terminology programs are called virtual instruments (VIs). Except for VIs with OS specific functions VIs can be transferred between platforms without any problem. Each LabVIEW VI consists of two parts: the Front Panel is the graphical user interface, the Block Diagram is the actual program (Fig. I). Unlike conventional text-oriented programming languages, G uses data-flow programming. The program elements are structures (e.g. loops, case structures), and LabVIEW functions (basic mathematical, logical and matrix operations, file and instrument I/O functions, user defined subroutines, etc.). The VIs are "wired together" and these wires carry the data-flow. LabVIEW has several basic data types (numeric, string, Boolean, etc.) and special types (for example Graphs, Intensity Charts). These data types may be bundled into userdefined clusters.

Keeping the "old" knowledge and including the new improvements poses a problem for educators. They have to find the balance between the amount and quality of information relayed to students. In systems and control engineering frequency-domain techniques are still taught, however their importance have been reduced by the improvement in computing and time-domain simulation. They are however necessary, because of the insight and handy techniques they give to students. At the same time modem modelling and control knowledge, such as soft computing, adaptive and optimal control have to be included into the curriculum. To satisfy both tasks a number of programs have been developed to help visualise the conventional information (text, diagrams, drawings, and equations) in textbooks and lecture notes. These programs could easily be considered as computer games. It is widely proven that leaming-by-doing is a leader among the approaches of learning. Playing with these simulations radically improve the understanding and future application in real world situations.

2.1. Simulation Programs

During the years various tools have been used in systems and control engineering courses, from the first text-based simulation systems running in DOS to up-to-date programs with user-friendly graphical interfaces. Most of these programs are written for simulation only, however there are add-ons to use with general-purpose programming environments. The mostly used programming languages at the Systems and Control Engineering Group today are PascaUDelphi and LabVIEW. From 1994 National Instruments' LabVIEW is extensively used both in courses and for research . The next part describes the properties of LabVIEW, and emphasises its ease of use and versatility. In 1994 when it was time to buy a new software for data acquisition, simulation, teaching and research purposes, Lab VIEW was the only one to provide an ideal environment for all of these tasks.

mf!:.-··-6>-@ Fig. I. Front Panel and Block Diagram of a simple LabVIEW program Two simulation packages - TUBSIM and .:PSim:. have been developed for LabVIEW at the (former) Department of Systems and Control Engineering by the authors of this paper. Both packages were initially developed according to the CSSL (Continuous System Simulation Language) recommendations.

322

2.3. TUBS/M/or Lab VIEW

2.4 . . :PSim:.for LabV/EW

TUBSIM TUBSIM was originally written as a simulation extension to Pascal for DOS and Windows. Later it was implemented, as a set of LabVIEW VIs. TUBSIM is the interpretation of an analogue computer in the Lab VIEW graphical programming environment. Analogue computers were widely used for simulation, but they had many disadvantages (e.g. the size of the computer grows with the size of the model). When digital computers became universally available, analogue computers and analogue simulation were soon replaced with digital simulation. One group of the digital simulation systems uses the same principles as analogue simulation does. TUBSIM belongs to this group. The TUBSIM VI Library (Fig. 2) contains the basic blocks typical to analogue computers (summers, integrators, potentiometers, signal generators). In addition TUBSIM has different Boolean blocks, typical systems engineering elements (for example first order element, continuous time controllers - like PI, PID -, time de and discrete time blocks.

.:PSim:., like TUBSIM, was first developed as a set of Lab VIEW VIs for simulating continuous time processes, according to the CSSL (Continuous System Simulation Language) recommendations. Through the design and implementation of .:PSim:. the experience from the development and application of TUBSIM helped a lot and served as a basis. .:PSim:. however includes not only time-domain methods, but frequency domain methods as well, thus making it useful for demonstration purposes. Further additions to .:PSim:. include libraries for soft computing methods, specifically fuzzy systems and neural networks to handle complex non-linear models or models based on measured data. Bondgraph models, discrete-time systems, identification and stability analysis are also recent .:PSim:. enhancements. The most recent addition is .:PSim:.Compartment, a set of VIs for compartment modelling (used e.g. in biomedical, physiological and pharmacokinetical simulations). A compartment model is basically a state-space model that is why it can be used not just in the above-mentioned areas, but for systems and control engineering, too. Compartment models require the ability to simulate non-linear, time-dependent dynamic state-space models with time delay, so .:PSim:.Compartment implements such models . .:PSim:. blocks are functionally organised into LabVIEW libraries. These libraries are made directly available for easy programming, as Diagram Panel menus (Fig.3

Fig. 3.. :PSim: . VI libraries as function menus in LabVIEW

Fig. 2. TUBSIM VIs in LabVIEW TUBSIM has successfully been used in various applications from teaching aids to large-scale industrial processes (e.g. the secondary side water chemistry model of the Nuclear Power Plant in Paks, Hungary).

While TUBSIM implements model definition similar to analogue computer programs (block diagrams with simulation elements) and transfer functions, .:PSim:. offers more. Model defmitions and conversion among models have much similarity with MATLAB conventions. Time-domain models may be defmed as transfer functions, in pole-zero-gain format, as statespace models, and can be build from basic elements like integrators, proportional and first-order blocks

323

The first task is to set up the model of the ballground system according to the governing physical laws. The second task is to solve the mathematical model with different parameter and input settings. This task is best done with a simulation tool. Introducing computer simulation in systems engineering courses help students understand the necessity and advantages of such an approach, compared to conventional numerical solution techniques. Graphical model definition is a great plus, too, because of its ease of use. Basic LabVIEW programming skills are relatively easy to acquire, so using TUBSIM or .:PSim:. for simulation does not pose a big problem for students. When there is no need to show the subtleties of modelling and simulation with TUBSIM or .:PSim:., there are simulation-shells available, that students can use to solve their particular problems with.

etc. To facilitate model defmition, there are Front Panel Controls for these formats available, as wel1 as predefined diagrams for Bode, Nyquist and Nichols plots (Fig.

Fig. 4 .. :PSim:. Front Panel Controls

3. SIMULATION APPLICATIONS Further examples from the area of systems engineering are frequency-domain representations and state-space models. It is imperative to emphasise the connection between time- and frequency domain models of systems. Naturally, it can be worked out with classical methods (paper-pencil, or blackboardchalk), however interactive, simulation-based approaches are far more effective (Fig. 6). This method is supported by the improvement of facilities in auditoriums. An increasing number of auditoriums are equipped with computers and multimedia projectors. Partly these equipment force the continuous development of educational materials into interactive "documents".

A continuously increasing number of TUBSIM and .:PSim:. simulation applications are used in both introductory and advanced systems and control engineering courses at BUTE. There are other advanced studies (e.g. Computer Control1ed Systems, MSc and PhD theses) too, which utilise similar applications. Some examples are shown in the fol1owing figures. One of the first models introduced in a systems engineering course is the problem of a bouncing ball

~

l-..--. Yl loO)

~ vt

:m:::J



:Ji1lDl I ~

:f@D R

~
~~

~~

·11110

I

o

l lXXl

2!Ul

DD

4000

-

Fig. 6. .:PSim:. application to illustrate time- and frequency domain properties of systems

!iDI

State-space models are particularly hard to solve with conventional methods, especially when non-linearity and time-delays are involved. An example of such a complex non-linear system from the area of biomedical engineering is the compartment model of entherohepatic circulation (Fig 7). Biomedical simulations are especially useful when "control systems" have to be designed to compensate the effects of illnesses. One such example is the development of medication regimes for patients with diabetes.

Fig. 5. Bouncing Ball - a TUBSIM application

324

Fig. 8. illustrates LabVIEW's VI help feature: each VI can have a small help window, that shows the VIs connection points and a short description. Both TUBSIM and .:PSim:. VIs are equipped with such help windows.

....

DISTURBANCE

11:m0011-11.

--1_

I j 1 .0.i#:~~~~"""~ i

..... TM:

!o.*t+-'o-P-----

end ; 1600.00

...

I

~- i o.

Sio.l°ool_ i end

11 600.00 I

Fig. 7. .:PSim:. model of entherohepatic circulation Simulation is a very appropriate way for presenting and comparing different types of controllers. The application of knowledge studied is basic control theory courses is best tested with simulation programs. One application to be presented deals with PID controllers, specifically analogue and digital implementations (Fig. 8). Another widely used application is the computer model of a real world a water-level control

I'ICM

1600.00

i.c.s

1i

no.

INFO

600.0.

Fig. 9. Computer simulation of a real world process The three-tank level-control system is a real world process, so students have a chance to see and operate the process in life, and to use the simulator (Fig. 9). This particular application stresses the importance of simulation, namely in cost- and risk-reduction. Fig. 9 is also an example of simultaneously presenting time-domain and frequency-domain parameters and properties of control loops. Soft computing applications are also presented, such as the fuzzy logic control of an automatic transmission system, which was developed as an MSc project, using TUBSIM and .:PSim:. simulation and VIs

!fI. _

.... .(-_. .. _ _

....... -,.,;. .. ,

___' __

";"'~"'o~'

Fig. 10. Fuzzy control of automatic transmission

Fig. 8. TUBSIM application for introducing continuous and discrete time PID controller implementations

There are Lab VIEW applications directly connected to real world process models, too. One such application is a National Instruments Process Demo Box with a fan, a light bulb, a thermometer and a

325

theory presented in lectures and labs. The use of the presented simulations improved the standards of information transfer both in classroom and individual studies.

microphone. The utilisation of this box is dual. First of all it serves as an example of data acquisition and process control with the help of a National Instruments DAQ board. Besides, this system allows the combination of simulation and data acquisition in a real world process. Another real world application is a LEGO Dacta system, which is connected to the computer through an RS232 port. The versatility of LEGO blocks, sensors and motors allow the construction of various models. These LEGO models are controlled from LabVIEW, too. LabVIEW simulations serve as a substitute for real world processes in some PLC-controlled applications used by the students in laboratory exercises.

Current research and development work includes the development and integration of special purpose DLLs, for fuzzy logic, neural network and genetic algorithm applications. The introduction of the recently developed discrete-event simulation system into the education is planned for the next semester. According to the internalisation needs of educational materials, everything developed at the Systems and Control Engineering Group has to be at least bilingual, Hungarian and English.

Some of the simulation applications presented in this paper are used as illustrations in lectures and labs, others are publicly available on the Internet for studying and practising. In each semester newer additions are developed both by staff and students, so the list of simulation examples grows almost exponentially. More and more students, not just from the Faculty of Mechanical Engineering, but from other Faculties as well, become interested not just in control engineering, but simulation as well, and use their simulation knowledge in individual and team projects and theses.

REFERENCES Astrom, K.J., Wittenmark B. (1997) ComputerControlled Systems, Prentice-Hall Bardossy, A., Duckstein, L. (1995) Fuzzy Rule-Based Modelling with Applications to Geophysical. Biological and Engineering Systems, CRC Press Bequette, B. W. (1998) Process Dynamics, Prentice Hall Bronzino, J.D. (Editor-in-Chief) (1995) The Biomedical Engineering Handbook, CRC Press Dorf, R.c., Bishop, R.H. (1998) Modern Control Systems, Addison Wesley Longman Gordon, G. (1969) System Simulation, Prentice Hall Hartley, T.T., Beale, G.O., Chicatelli, S.P. (1994) Digital Simulation of Dynamic Systems - A Control Theory Approach, Prentice Hall Johnson, GW (1994) LabVIEW Graphical Programming. Practical Applications in Instrumentation and Control, McGraw-Hill Kheir, N.A. (editor) (1995) Systems Modeling and Computer Simulation, Marcel Dekker, Inc. Law, A.M., Kelton W.D. (1991) Simulation Modeling & Analysis, McGraw-Hill Man, KF, Tang, KS and Kwong, S. (1999) Genetic Algorithms, Springer Monsef, Y. (1997) Modelling and Simulation of Complex Systems. Concepts. Methods and Tools, Society for Computer Simulation International National Instruments (2002) LabVIEW User Manual at http://www.ni.com/pdflmanuals/320999d.pdf Wells, L.K.; Travis 1. (1995) Lab VIEW for EveryOne - Graphical Programming Made Even Easier, Prentice Hall Zeigler, B.P., Praehofer, H., Kim T.G. (2000) Theory of Modelling and Simulation, Academic Press

Currently the speed of Lab VIEW applications, especially the ones with a large need of run-time calculation is considered. When for example a fuzzy controller has to be optimised with a genetic algorithm (as was the case in a recent MSc thesis), DLLs (dynamic link libraries) are used to speed up the calculation. Although each algorithm could be implemented in LabVIEW, it is worth to take into account the speed of a native LabVIEW application and a compiled function library. The advantage of developing native Lab VIEW programs lies in the ease and speed of development, however the speed of calculation is best boosted with the use of external function calls from a DLL. DLLs open the world of object-oriented programming to LabVIEW, as well. Objects can be dynamically created and destroyed inside the simulation (especially in discrete-event simulation).

4. CONCLUSION This paper reviews the use of simulation as teaching aid for systems and control engineering education. LabVIEW is the mostly used programming environment for these applications, with two simulation packages - ruBSIM and .:PSim:. developed at the (former) Department of Systems and Control Engineering, by the authors of these paper. The courses taught, theses written and defended during the last years have proven grounds to this kind of applied simulation. Educators use prepared simulations to illustrate their lectures. Students can download simulations from the intemet to help them understand and practice the

326