tanyel - michigan state university

15
Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007” LABVIEW IN ELECTROMAGNETICS Murat Tanyel Geneva College, Beaver Falls, PA 1. ABSTRACT Most Electromagnetics (E&M) courses rely heavily on MATLAB and/or C, representing the state of the art in textual programming, for their standard computer tools. Many textbooks are published containing examples, if not sections, devoted to these textual languages. However, my preferred language is LabVIEW, having developed extensive toolkits in Digital Signal Processing (DSP) and Communication Systems in this language. When I was given the task of teaching E&M, I had the choice of switching to MATLAB or reinventing the wheel with LabVIEW. Fortunately, latest developments in the LabVIEW programming environment facilitated a much less painful alternative. With this alternative, I was able to use the Electromagnetics course to introduce students to LabVIEW and LabVIEW to simplify/clarify concepts learned in E&M. This paper will report on this alternate approach taken in my E&M class as well as the advantages LabVIEW might offer over MATLAB in E&M. I. Introduction As computer applications become indispensable tools in the engineering curriculum, we observe that a number of applications have become widespread computer tools in electrical engineering textbooks. Spice and its derivatives pervade courses that cover circuit analysis and electronics, with most standard textbooks on these subjects devoting sections or having supplements available with simulations in this application 1-7 . MATLAB and its derivative SIMULINK have become the standard computer tool for control systems 8-11 , communication systems 12-14 , digital signal processing (DSP) 15-16 , electromagnetics 17 , and even circuit analysis 1 . The C programming language has replaced FORTRAN in the electrical engineering curriculum, as the more senior author has observed this transition from his undergraduate studies in the late seventies to graduate studies in the eighties. Numerical recipes in C, either in software or printed book form 18 , have helped many a graduate student in getting through different projects. With the exception of SIMULINK and the graphical interface for PSpice, these different computer tools of the trade are text-based environments, as opposed to a newer breed of programming environments that take advantage of the more recent development of the graphical interface. The most ardent employer of this graphical programming environment has been National Instruments with their LabVIEW package that runs on a number of platforms, namely, MacOS, Windows, UNIX and Linux. A contender is Hewlett-Packard’s HP VEE, available on Windows, HP-UX and SunOS 19 . Another serious contender is SIMULINK with its textual roots on MATLAB. My

Upload: others

Post on 18-Dec-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

LABVIEW IN ELECTROMAGNETICS

Murat Tanyel

Geneva College, Beaver Falls, PA

1. ABSTRACT Most Electromagnetics (E&M) courses rely heavily on MATLAB and/or C, representing the state of the art in textual programming, for their standard computer tools. Many textbooks are published containing examples, if not sections, devoted to these textual languages. However, my preferred language is LabVIEW, having developed extensive toolkits in Digital Signal Processing (DSP) and Communication Systems in this language. When I was given the task of teaching E&M, I had the choice of switching to MATLAB or reinventing the wheel with LabVIEW. Fortunately, latest developments in the LabVIEW programming environment facilitated a much less painful alternative. With this alternative, I was able to use the Electromagnetics course to introduce students to LabVIEW and LabVIEW to simplify/clarify concepts learned in E&M. This paper will report on this alternate approach taken in my E&M class as well as the advantages LabVIEW might offer over MATLAB in E&M.

I. Introduction

As computer applications become indispensable tools in the engineering curriculum, we observe that a number of applications have become widespread computer tools in electrical engineering textbooks. Spice and its derivatives pervade courses that cover circuit analysis and electronics, with most standard textbooks on these subjects devoting sections or having supplements available with simulations in this application1-7. MATLAB and its derivative SIMULINK have become the standard computer tool for control systems8-11, communication systems12-14, digital signal processing (DSP)15-16, electromagnetics17, and even circuit analysis1. The C programming language has replaced FORTRAN in the electrical engineering curriculum, as the more senior author has observed this transition from his undergraduate studies in the late seventies to graduate studies in the eighties. Numerical recipes in C, either in software or printed book form18, have helped many a graduate student in getting through different projects. With the exception of SIMULINK and the graphical interface for PSpice, these different computer tools of the trade are text-based environments, as opposed to a newer breed of programming environments that take advantage of the more recent development of the graphical interface. The most ardent employer of this graphical programming environment has been National Instruments with their LabVIEW package that runs on a number of platforms, namely, MacOS, Windows, UNIX and Linux. A contender is Hewlett-Packard’s HP VEE, available on Windows, HP-UX and SunOS19. Another serious contender is SIMULINK with its textual roots on MATLAB. My

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

choice of software tool has been LabVIEW because of its graphical programming environment which particularly suits the field of signals and systems, my particular interest 20, 21, 22.

For the most recent two offerings of ELE 305, Introduction to Electromagnetic Theory, I used Wentworth17 as the textbook. The back cover of the book reveals the author’s choice of programming environment as one of the key features of the book: “Detailed MATLAB examples and MATLAB end-of-chapter problems allow for deeper exploration of the subject matter.” When I adopted the book, I was cognizant of the choice I had to make in regards to software. I could either switch to MATLAB or take this opportunity to develop a LabVIEW toolkit for the course. My personal preference, combined with our efforts to expose our students to LabVIEW in different contexts23, lead me to the decision to adopt LabVIEW as the computer tool for E&M. This paper will describe how LabVIEW programming was incorporated into the E&M course. Section 2 will provide general information on the course as well as the class composition. Section 3 will describe the some of the routines developed by students. Section 5 will present results of the survey conducted among the students and conclude with a discussion.

II. ELE 305: Electromagnetic Fields & Waves

Geneva College catalog describes the E&M course as follows:

Such topics as Coulomb’s Law, Gauss’ Law, energy and potential, Poisson’s and Laplace’s Equations, the steady magnetic field, time-varying fields and Maxwell’s Equations. Prerequisites: PHYS 202, MAT 405

The course is taken by electrical engineering juniors and physics majors. There has been one physics major in the class every year I have taught it along with the majority (3-5) of electrical engineering students. The class meets three times a week (M-W-F) for 55 minute lectures and on Thursdays for a 75 minute session, which I use for hands-on work. The hands-on session was conducted in a computer laboratory with a projection system for the instructor’s computer.

This year’s group was composed of 3 electrical engineering students who started out at Geneva College and therefore had taken Introduction to Engineering course (EGR 101) in Fall ’04, two transfer students to electrical engineering and one physics student who had not taken EGR 101 at Geneva College. All of the students had taken the introductory C++ programming course.

III. LabVIEW Exercises

Students who took EGR 101 were already familiar with LabVIEW since we covered LabVIEW programming in that course24. The topics covered were basic skills that would be the basis for further development in upper level courses. They were:

Introduction to LabVIEW: The Front Panel, where students learned about the user interface.

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

The Block Diagram, where they learned about the first steps in programming in this graphical environment

The Case Structure & Boolean Algebra, where they learned about decision making in programs using LabVIEW’s version of if...then statements and switches, as well as various Boolean functions such as AND, OR, NOR, NAND, XOR.

Graphical & Textual Formulae, where they learned about expressing mathematical functions both in a graphical setting and in special structure called the Formula Node that uses a C-like syntax.

Looping, where they learned about FOR loops and WHILE loops.

Since only half the class were exposed to LabVIEW, this offering was meant to be a refresher/jump-start course on LabVIEW programming. The first few weeks were spent presenting material in the form of short exercises which the students could follow on their own computers. The topics covered were the same as those listed above and were based on a revised version of 1990s freshman level textbook25 on LabVIEW. The electronic version of these notes were made available to students on the intranet. However, the exercises were taken from material in the E&M textbook, rather than from this textbook to make them more relevant to this class. Table 1 compares the exercises in the notes to those worked out in class.

Topic Exercise(s) in the notes

Class Exercise

Introduction to LabVIEW Addition (front panel) Vector addition (front panel) The Block Diagram Addition of two

numbers Vector addition

The Case Structure Sine calculator in degrees/radians, 4-Operation calculator

Vector calculator, Smart tan-1y/x calculator

Graphical & Textual Formulae; intro to loops and graphs

Sine calculator in degrees/radians

Degrees <-> radians converter, ERatio (ratio of E from disc to E from sheet)

More on looping & graphing Plots of simple functions

Electrical flux density, Dρ, of a coaxial cable

Table 1: The order of topics in LabVIEW overview sessions.

3.1 Vector Calculator

The first topic we review in this course is vectors; vector algebra, vector calculus and coordinate system conversions. One of the first routines that students program is a virtual instrument (VI) that can perform the selected one of three operations between two vectors, namely, vector

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

addition, the dot product and the cross product. This exercise teaches student about the case structure in LabVIEW programming, which performs the same task as switch case statements in C. This routine makes use of embedded case structures. The dot product results in a scalar and needs to be displayed by a scalar indicator. The cross product and the result of vector addition are vectors and need to be displayed by an array of indicators. Figure 1-a shows the side of the case structure that calculates the dot product, which is obtained through LabVIEW’s built-in function (marked by “1.” in the figure). The result is displayed in indicator labeled Result (“2.”), which is enabled (“3.”) while the array Resultant, which displays the result of the other vector operations, is dimmed and disabled (“4.”). Figure 1-b is a snapshot of the front panel displaying the result of (1, 0, 0)•(0, 1, 0).

(a)

(b)

Figure 1: a) The dot product between two vectors is obtained through LabVIEW’s built-in function. b) The front panel showing (1, 0, 0)•(0, 1, 0).

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

(a) (b)

Figure 2: a) The cross product between two vectors is obtained through Mathscript built-in function while vector addition utilizes simple addition. b) The front panel showing

(1, 0, 0) X (0, 1, 0).

The other side of the case structure of Figure 1-a is depicted in Figure 2-a. This is where the cross product or the vector addition is performed. The inner case structure (“1”) calculates the cross product through Mathscript function cross, while the vector addition (“1” on the TRUE side of the inner case structure) utilizes LabVIEW’s addition block. This time, the result is displayed in the indicator array labeled Resultant (“2.”), which is enabled (“3.”) while the scalar Result, which displays the result of the dot product, is dimmed and disabled (“4.”). Figure 2-b is a snapshot of the front panel displaying the result of (1, 0, 0) X (0, 1, 0).

3.2 Smart tan-1y/x Calculator

Some coordinate conversions require the calculation of an angle from the components of the Cartesian representation of a vector. For example, φ in spherical coordinates is given by

φ = tan−1 yx

⎛ ⎝ ⎜

⎞ ⎠ ⎟ (1).

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

Figure 3: The block diagram for the smart tan-1 y/x calculator. The cases are numbered by the number of the quadrant that the vector points to.

However, when this angle is computed, the tendency is to take the ratio y/x first and then to compute the arctangent, which loses the distinction between the 1st and 3rd or the 2nd and 4th quadrants. In order to avoid this pitfall, students were assigned to implement a smart tan-1y/x calculator that would take the quadrant into consideration when taking the arctangent. Figure 3 depicts the block diagram that computes arctangent by taking the proper quadrant into account. Figure 4 shows the results for vectors whose |x| = 3 and |y| = 4.

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

Figure 4: The angles that vectors with |x| = 3 and |y| = 4 make computed by the smart tan-1 y/x calculator.

3.3 ERatio VI

Wentworth17 presents a MATLAB exercise which studies the effect of moving closer to a charged disk of finite radius as far as the electric filed is concerned. The closer one gets to a finite radius disk of charge, the more one would expect it to resemble an infinite sheet. In this exercise, Wentworth considers a charged disk of radius a and finds the electric field intensity at a point h above the center of the disk. The electric field due to such a disk is given by

E =ρs

2ε0

1−h

a2 + h2

⎣ ⎢

⎦ ⎥ a z (2).

So, the ratio of this Ez to the Ez for an infinite sheet is the portion of the expression inside the brackets. If one plots this ratio against a factor k = a/h, the ratio turns out to be

Ez( )actual

Ez( )ideal

= 1−1

1+ k 2

⎣ ⎢

⎦ ⎥ (3).

Wentworth provides the MATLAB code for this exercise and plots the result as k goes from 0.1 to 100. We repeated this example in three ways: (1) by “translating” the MATLAB code into LabVIEW’s graphical environment completely, (2) by utilizing LabVIEW’s formula node to program mathematical functions in C-like syntax, (3) by utilizing LabVIEW’s Mathscript node,

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

which will run MATLAB commands. This exercise served to show the inefficiency of the graphical programming environment as well as demonstrate tools that are more efficient for math-intensive applications. Figure 5 depicts the four possible ways of implementing this exercise in LabVIEW.

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

(a)

(b)

(c)

(d)

Figure 5: The Eratio plotter implemented (a) with purely graphical blocks (b) with the formula node, (c) with the Mathscript node, (d) with a while loop within the formula node.

All four VIs gave identical results, revealing that when the radius of the disk is 10 times the height, the filed is 90 % of what we would get for an infinite sheet (Figure 6).

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

Figure 6: The results of the three VIs of Figure 5 were identical.

3.4) Dρ of a Coaxial Cable

The final exercise I will describe is the one we used to show more features of looping and graphing in LabVIEW. After we study Gauss’s law, we compute the electric flux density of an infinitely long coaxial cable. The coaxial cable is assumed to have an inner conductor of radius a surrounded by a thin conductive shell at radius b. Using cylindrical coordinates, we find that, for ρ < a,

Dρ =ρv

2ρ (4)

where ρ is the radial distance and ρv is the volume charge density. For a < ρ < b,

Dρ =ρv

2a2

2 (5).

Finally, for ρ > b, Dρ = 0. With this piecewise defined function, this exercise helps to combine loops and case structures. Figure 7 depicts the result for a = 3 cm, b = 6 cm and ρv = 8nC/cm3 while Figure 8 shows the block diagram (graphical program) that generated this result.

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

Figure 7: The electric flux density for a coaxial cable with inner radius of 3 cm, outer radius of 6 cm and a volume charge density of 8 nC/cm3.

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

Figure 8: The graphical program that generated the plot in Figure 7 with (1) computing Dρ for ρ < 3 cm, (2) computing Dρ for 3 cm < ρ < 6 cm, (3) computing Dρ for ρ > 6 cm.

IV. Discussion

After the course was offered, a survey was distributed to gage the reaction of students to this exposure to LabVIEW. Four results were returned. Table 2 summarizes the responses of the four students.

Questions SA A N D SD

1. I enjoy working with computers 3 1

Percentages 75 % 25 % 2. As a result of my exposure to LV in E & M, I feel

confident that I can program simple engineering/scientific problems in LV. 2 1 1

Percentages 50 % 25 % 25 %

3. I appreciated the exposure to LV in E&M. 2 1 1

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

Percentages 50 % 25 % 25 % 4. LV projects helped me to apply material from

lectures and reading. 3 1

Percentages 75 % 25 % 5. I feel confident that I am capable of using

already developed LV VIs in future labs. 2 1 1

Percentages 50 % 25 % 25 % 6. I feel confident that I am capable of developing

LV VIs in future courses/labs. 2 1 1

Percentages 50 % 25 % 25 % 7. Having course-specific applications helped me

appreciate LV programming. 3 1

Percentages 75 % 25 %

Table 2: Summary of responses to survey questions.

With only 4 responses, a statistical analysis would be an overkill. However, we can say that the exposure to LabVIEW in E&M was generally appreciated and the exercises gave most of the students confidence to utilize LabVIEW in future work.

This year we started building a library of LabVIEW VIs that can be utilized in the E&M class. The flexibility of LabVIEW to incorporate C or MATLAB has made it possible to utilize routines originally written in those languages. This advantage, combined with LabVIEW’s strength in communicating with lab instrumentation and in data acquisition makes it a better candidate to develop future labs in E&M that involve data acquisition as well as analysis.

Bibliography

1. Nilsson, J. W. and Riedel, S. A. Electric Circuits, Sixth Edition, Upper Saddle River, NJ: Prentice Hall (2000).

2. Rashid, M. H., Spice for Power Electronics and Electric Power, Englewood Cliffs, NJ: Prentice Hall (1993).

3. Sedra, A. S. and Smith, K. C., Microelectronic Circuits, Fourth Edition, New York, NY: Oxford University Press (1998)

4. Roberts, G. W. and Sedra, A. S., Spice for Microelectronic Circuits Third Edition by Sedra/Smith, New York, NY: Oxford University Press (1992).

5. Howe, R. T. and Sodini, C. G., Microelectronics – An Integrated Approach, Upper Saddle River, NJ: Prentice Hall (1997).

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

6. Franco, S., Electric Circuit Fundamentals, Philadelphia, PA: Saunders College Publishing (1995).

7. Jaeger, R. C., Microelectronic Circuit Design, New York, NY: McGraw-Hill (1997).

8. Nise, N. S., Control Systems Engineering, New York, NY: John Wiley & Sons (2000).

9. Ogata, K, Modern Control Engineering, Upper Saddle River, NJ: Prentice Hall (1997).

10. Dorf, R. C. and Bishop, R.H., Modern Control Engineering, 8th Ed., Reading, MA: Addison Wesley (1998).

11. Palm III, W. J., Modeling, Analysis, and Control of Dynamic Systems, 2nd Edition, New York, NY: John Wiley & Sons (2000).

12. Couch II, L. W., Digital and Analog Communication Systems, Sixth Edition, Upper Saddle River, NJ: Prentice Hall (2001).

13. Bateman, A., Digital Communications: Design for the Real World, 1/e, Upper Saddle River, NJ: Prentice Hall (1999).

14. Anderson, J. B., Digital Transmission Engineering, 1/e, Upper Saddle River, NJ: Prentice Hall (1999).

15. Orfanidis, S. J., Introduction to Signal Processing, Upper Saddle River, NJ: Prentice Hall (1996).

16. Moon, T. K. and Stirling, W. C., Mathematical Methods and Algorithms for Signal Processing, Upper Saddle River, NJ: Prentice Hall (2000).

17. Wentworth, S. M., Fundamentals of Electromagnetics with Engineering Applications, New York, NY: McGraw-Hill (2004).

18. Press, W. H., Teukolsky, S. A., Vetterling, W. T., Flannery, B. P., Numerical Recipes in C : The Art of Scientific Computing, Cambridge: Cambridge University Press (1993)

19. Helsel, R., Cutting Your Test Development Time with HP VEE, Englewood Cliffs: Prentice Hall (1994).

20. Viss, M. and Tanyel, M. “From Block Diagrams to Graphical Programs in DSP,” 2001 ASEE Annual Conference & Exposition Proceedings, Albuquerque, NM, June 24-27 2001.

21. Tanyel, M., Nguru, K. “Preparation of a Virtual Toolkit for Communication Systems”, 2002 ASEE Annual Conference and Exposition Proceedings, Montréal, QC, June 16-19 2002

22. Tanyel, M., Adams, C., “On the Aesthetics of Computer Aided Tools for Signal Processing”, Proceedings of 64th Annual ASEE North Midwest Section Meeting, Madison, WI, Oct. 2002.

23. Shaw, D., Tanyel, M., “Hot Wheels® and LabVIEW Meet at NHRA Division 1”, Proceedings of 2006 ASEE Illinois-Indiana and North Central Joint Section Conference, Indiana University Purdue University, Fort Wayne, Fort Wayne, IN, March 31- April 1, 2006

24. Tanyel, M. (2005). “Hot Wheels®, Blackboard and LabVIEW – What Do They Have in Common?” 2005 ASEE Annual Conference and Exposition Proceedings, Portland, OR, June 12-15 2005.

“Proceedings of the Spring 2007 American Society for Engineering Education North Central Section Conference at West Virginia Institute of Technology (WVUTech), March 30-31 2007”

25. Tanyel, M., Engineering Explorations with LabVIEW, Philadelphia, PA: Harcourt Brace Custom Publishers (1994).