DESIGN OF A DATA ACQUISITION SYSTEM TO CONTROL AND MONITOR A VELOCITY PROBE IN A FLUID FLOW FIELD

by

~lancy Lou Hen4ig

Thesis submitted to the faculty of the

Virginia Polytechnic Institute and State University in partial fulfillment of the requirements fo: the degree of MASTER OF SCIENCE

r n

Mechanical Engineering

Approved:

Dr. R.T. Stone, Chairman

Dr. F ..J. Pierce Dr. S.8. Thomason

December, 1982

Blacksburg, Virginia Acknowledgements

There is no one beside thee, and no one above thee Thou standest alone as the nightingale sings! Yet my words that would praise thee are impotent things For none can express thee, though al I should approve thee

EI i zabeth Barrett Browning

I would I ike to thank Dr. R.T. Stone for the wealth of knowledge that he made avai I able to me, and for the trust and confidence that he bestowed upon me during the course of this project.

I am very grateful to Dr. F.J. Pierce for his editorial efforts on this work, for his emotional support, and for his philosophical contributions to my perceptions of I ife.

I am indebted to Mr. M.D. Harsh I I I for the technical support and the time that he has invested to Improve the quality of this project. His aid and encouragement wi I I never be forgotten. I wish to acknowledge Mr. J.R. Lucas for his excellent work on the fabrication of the Probe Control and Support Stand.

I express my sincere appreciation to Mr. R.W. Wood,Jr. for the i I lustrations in this work, and for the pati~nce and love that carry me through difficult times.

I am grateful to my parents for their unqualified support for me in my endeavors. They provide strength, security, and continuity in a chang(ng world.

I thank all who have loved me in their hearts With thanks and love from mine.

i i Table of Contents

~ Ac know I ed geme nts ••.•••. , ••• , ••• , • • . • • . . • • • 1 1 Table of Contents ...... iii Li st of Figures , .••.•.•.•.•.•••.•••••••••• v List of Tables •.••••••••••••••••••••••••.• vii I. Introduction .•.•.••....•..••.•••.•.•.•. , .•• I I. System Description ••.••....••..•..•••••••• 3 I I I. Extern a I Interfaces ...... 9 External Input/Output Bus ••••••.•.••• 9 Computer Cable ...... 15 STD Interface System •.•.••••••.•.•.•• 15 DE-80 Interface Box .•..••••••••..•••. 17 I nte rf ace Stations . . . • • • . • • • . . • • • . • . • 2.0 Digital Inputs ...... 38 S t e p p e r Mot o rs . . • • . • • • • . • • . . • . • • . . • • • 4 5 Stepper Motor Interface Box •.•..••••• 48 IV. Program Description ...... 53 MAIN Program ...... 53 Primary Loop •...••....••...•.•. 55 Secondary Loop ...... 57 Tertiary Loop •.••...•..••••••.. 58 INITIAL Subprogram ...... 58 STEPPER Subprogram ...... 58 STEP/CMD Subprogram ...... 61 MEASURE Subprogram ...... 63 INPUT Subprogram ...... 64 Nu I Ii ng Procedure ...... 65 STORAGE Subprogram •.....•••••...•.... 74 RETRIEVE Subprogram ...... 74 V. Concluding Remarks ...... 76

i i i Table of Contents (continued)

References ...... • • 78 Appendices Appendix A - System Operating Procedures ...... 79 Appendix Al - STEP/CMD Program Description ...... 84 Appendix A2 - Terminal Program Procedure ...... 92

Appendix B - Program Descrip~ion 99 Appendix C - Troubleshooting and Warnings ...... 134 Appendix D - Glossary ...... 140 Vita 143 Abstract

i v List of Figures

Figure No. Title

The Data Acquisition System 4

2 Block Diagram of the Data Acquisition System...... 5

3 Velocity Probe Control and Support Stand ...... 7

·4 Detailed Block Diagram of the External Interfaces ...... 10

5 External Input/Output Signals on the Card Edge ...... 12

6 Conceptual Diagrams of 1/0 Operations ...... • ...... 14

7 The 1/0 Select Circuit ...... 16

8 Signals Available on the STD Bus in the DE-80 Interface Box 18

9 Connections Between the Computer Cable and STD Card Two ...... ;······ 19 10 Station Layout for STD Card One 21

I I Station Layout for STD Card Two 22 12 Si gna I Map in the Interface Station . . • ...... 23

13 Sample Wiring Diagram for an Interface Station ...... 24

14 PPI Port Configuration for S tat i o n Z e ro ...... 2 6

15 PPI Port Configuration for Stations One Through Five • ...... 27

16 ·Signals Available at Station Zero .. 28

v List of Figures (continued)

Figure No. Title Page

17 Signals Aval I able at Stations One th rough Five ...... • . . . . . 28

18 Address Select Circuit for Station Five ...... 29

19 Address Select Circuits for Stations Zero and One .•...... 30

20 Address Select Circuits for Stations Two and Three ....•...... •.. 31

21 Address Select Circuits for Stations Four and Five ...... 32

22 Signal Assignments for the Digital Interfaces ...... 37

23 Location of Digital Signals in the DB-25 Connector on the DISA Voltmeter ...... 42 24 Location of the Digital Signals on the Card Edge in the DANA Voltmeter ..•...... 43 25 Location of Digital Signals on the DB-25 connector on the DATAMETRICS manometer ...... 44 26 Conceptua I Diagram of a Stepper Motor ...... 46

27 Stepper Motor Excitation Sequence .• 47

28 Stepper Motor Pow~r Supply 49

29 Interface Circuit for One Stepper Motor Phase ...... ~I

30 Stepper Motor Interface Cable 52

31 Relationship between the MAIN Program and the Subprograms ...... 54

vi List of Figures (continued)

Figure No. Title

32 General Flow.chart of the MAIN Program .•.•..•••.•.•...•.•..•• 56

33 Typical Voltage Data Distribution for an Odd Probe Response Function ..•...... •...•...... •..... 66

34 Typical Voltage Data Distribution for an Even Probe Response Function •.•••..•..••••..•....•..... 67

35 Digital Filter - Spatial Domain 70

36 Digital filter - Frequency Domain ...... •...... 72

37 Probe Nul I Procedures .••...... •.• 75 38 Deta i I ed Program FI owcha rt .•.•..... 100

39 STEPPER Subprogram •...... •.••.. 104

40 STEP/CMD Subprogram ..•••...... •... 105

41 MEASURE Subprogram ..•..•..••....••.• 106

42 INPUT Subprogram ...... •...... •...•. 107

43 Signal Description of STD Control Signals ...... ••.. 139

44 Stepper Motor Cab I e Connector .•••... 137

vii I . INTRODUCTION

A data acquisition system was designed to control the I inear and angular position of a velocity probe, and to record up to five voltage readings from thfs probe. This system replaces a similar manually operated system. The manual acquisition system includes hand control of the translational and rotational movement of a probe, and the visual estimation of fluctuating voltage signals using digital meters. The operation of this traverse system requires a period of from four to six hours for one traverse. Typically, multiple traverses are desired ' in a flow field so that manual operation can extend into several days of data acquisition. There is a potential for relative inconsistencies in the manual probe posi- tioning and acquisition process since operator techniques can conceivably change during the extensive hours of data ·acquisition. The automated data acquisition system uses two stepper motors to translate computer commands into translational or rotational probe movement. The heart of the system is the TRS-80, Model 111 microcomputer. The sys- tem in its current configuration is designed to acquire fluid velocity information during the vertical traverse of a velocity probe. The number of translational points to be used, and their positions are variables that are defined by the user. The velocity information provided by the probe is translated to digital voltages and re- corded by the computer. The direction of the fluid vel- ocity in the flow field at each point of translation is determined through a series of rotational .measurements. The vertical position, the angular position, and up to five voltage values are recorded at each data position. This computerized data acquisition system wi I I 2

relieve the experimenter from the tedious exercise of con- tinuously positioning ~he probe and recording data. ·Al- though it is recommended that the system be checked peri- odically, it wi 11 operate automatically, and require no user input after the initial start-up for each traverse. This automatic system also creates a more consistent ap- proach to al I aspects of the data acquisition process, and, hence, more consistency in the recorded data is ex- pected. The array of data resulting from one vertical tra- verse is stored on a in a data file. This f i I e can be referenced by ana I ys is programs deve I oped on the TRS-80. The computer may a I so send the data f i I e to other larger systems, such as the IBM 370, using the ter- minal package discussed in Appendix A2. Existing data reduction software on the IBM 370 may then be used to process the recorded data. 11. SYSTEM DESCRIPTION

~ photograph of the automated data acquisition system is included in Fig. I A block diagram of the system elements is given in Fig. 2 The TRS-80, Model 111 computer, based upon the Z-80 microprocessor, is used. It contains forty-eight thousand bytes of programmable memory. In addition, there are two floppy disk drives that accom- modate five inch floppy disks, each with a storage ca- pacity of 184,000 bytes. The computer uses TRSDOS, the Radio Shack disk op- erating system. The traversing control program is written in the BASIC language [i]. The TRS-80 may also be programmed in Z-80 machine language, the language of the microprocessor. BASIC is translated to machine language in the computer before any commands are executed. Pro- grams written in machine language are communicated di- rectly to the microprocessor and are, therefore, faster programs. They are required in applications where speed is the important program characteristic. One machine language program is used in the data ac- quisition system to operate the stepper motors. A BASIC program written to step one motor generates twenty steps per second. The same program written in machine I anguage wi 11 generate six hundred steps per second; however, it is capable of generating these steps at even higher speeds. The system software is a series of subprograms that are control led by a master program, MAIN. The MAIN pro- gram defines variables, maintains position information, and assigns tasks to the subprograms. The TRS-80 has an extern a I Input/Output (I /0) bus that provides signals for external interfacing purposes. A fifty-conductor cable is attached to this bus to extend

3 Figure I. The Data Acquisition System. TRS-80 interface

digital software mete rs stepper interface box

Figure 2. Block Diagram of the Data Acquisition System. 6

these slgnals to the system interfaces through the DE-SD lnterface box. This system has been designed wtth stx interface sta- tions for computer input or output tn the DE-80 box, which houses power supp I ies and card edge connectors for inter- facl ng cards. One station (station zero) dedicated to the stepper motor operation, the other five stations can be used for any digital input or output purpose. In the data acquisition application, any digital instrument that ls equipped with a Binary Coded Decimal CBCD) output capabi I ity is compatible with this system, and may be at- tached t~ interface stations one through five. At the present time, a DISA 55D31 three and one-half 'digit volt- meter with an accuracy of 0.01% and a resolution of I , may be used. A DANA 5100 five and one-ha If digit volt- meter, with an accuracy of o;003% and~ resolution of 10 uV, is also available. A DATAMETRICS 1400 four and· one-half digit manometer, with an accuracy of 0.01% and a resolution of I mV, may also be used.

The probe movement ls control led by two stepper motors mounted on the traverse as shown in Fig. 3. The computer commands that are used to step either motor are trans- ferred to the motors through station zero in the DE-80 box and through the stepper motor interface box. The stepper motor movements drive the probe through worm and spur gear combinations. The translational movement ls actuated by a stepper motor and gearl ng system on the top of the traverse. The mechanical limitations on the translational movement are a minimum vertical increment of 0.0002 inches, due to the step size of the motor and the gear ratio, and a traverse trans I ati ona I range of seven inches of trave I. 7

Figure 3. Velocity Probe Control and Support Stand. 8

The rotational movement is actuated by a stepper motor and gearing system mounted on the traverse car- ridge. The mechanical I imitations on the rotational movement are a minimum angular increment of 0.036°, due to the motor step size and the gear ratio, and an arbitrary rotation range of 360°. 111. EXTERNAL INTERFACES

The external interfaces in this system provide the communications I ink between the computer and the measure- ment and control devices of the the experimental system. A detailed block diagram of the external interfaces is given in Fig.~

External Input/Output Bus

The TRS-80 computer contains an external Input/Output ( 1/0) capabi I ity to be used for interfacing purposes [2]. This capability, known as the external 1/0 bus, is avail- able through fifty connectors mounted on the edge of a printed circuit card. Twenty-four 1/0 signals, twenty- f ive ground signals, and one inactive connector are pre~ sent on the 1/0 bus. The 1/0 signals include eight data, eight address, and eight control signals. Table I indi- cates the function of these signals. The locations of these twenty-four signals on the fifty-element card edge are I isted in Fig. ) In this sys.tern, only four of the eight control signals are used. The TN, OUT, RESET, arid the EXTIOSEL signals are used. Al I other control signals are ignored. The external 1/0 bus is connected directly to the in- ternal circuitry of the computer. There are fifty leads associated with this interface in a space of three inches, each of which may have an operating potential of 0-5 volts. Inadvertent low impedence connections (short cir- cuits) between connectors can damage the external bus drive circuitry. Thus, a great deal of caution should be observed to avoid short circuits when these information I ines are accessed. Al I external 1/0 devices communicate with the

9 +5 volt +12 volt power power supp 1. y supply

STD motherboard

stepper moto card STD ca rd External interface Input/Output #2 #I box Bus

0

BiBrATAMETRl·cr

.motor motor . #I #2

Figure .4. Detailed Block Diagram of the External Interfaces. I I

Table 1. List of Input/Output Signals

Signal Direction Purpose DO DI 02 D3 D4 in/out Data bus- D5 carries information D6 D7

AO Al A2 A3 A4 out Address bus- A5 selects device for A6 data exchange A7 - IN out signals an input -- OUT out signals an output

RESET out signals a system reset

EXTIOSEL in reverses 1/0 bus for internal inputs --*INT i n signals an external interrupt --*WAIT in external wait signal IOREQ * i n interrupt acknowledge -*Ml in signals

*- these signals are not used in this system. 12

pin #

DO ~ DI D2 D3 D4 05 D6 D7 AO Al A2 A3 A4 A5 A6 A7 TN OUT RESET INT WAIT EXTIOSEL N/C MT IOREQ

Flg~re 5. External Input/Output Signals on the Card Edge. 13 computer through the eight data I ines on the external 1/0 bus. In this system, two stepper motors and five digital meters w i I I be accessing these Ii nes. The data Ii nes can only accept one set of data at any time. Thus, the infor- mation on these I ines must be control led to al low only one device to communicate with the computer at any time. Clea~ly, a selection mechanfsm is required to desig- nate the proper device to exchange information with the computer. The address information generated by the com- puter is used to select the 1/0 device that wi I I be ac- cessed. Up to 256 devices may. be selected. Each device has a separate, unique address. When this address is used i n conj u. n ct i on w i th a cont ro I s i g n a I , s u ch as TN o r 0 UT , the information avai I able at the selected 1/0 device is exchanged with the computer through the data I ines while al I other devices are ignored. Both of the control and address signals must occur si~ultaneously. The combined effect of these signals is that. of a signal traffic con- t ro I I er for the data I i n es . F i g u re Ca cont a i n s concept u a I representations of the input and output functions. The external 1/0 bus is normally configured in the output direction. If an external input is requested from the 1/0 bus, its directi~n must be reversed. In the TRS- 80, Model Ill computer, this procedure is accomplished by applying a logical "O" to the EXTIOSEL element on the 1/0 bus when an external input is selected. When any input is requested in the computer, the TN pin is pulsed with a logical "O". This occurs for both i nterna I and extern a I inputs. An internal input is an exchange of information with- in the computer, such as from a memory port to the micro- processor. An external input is an exchange of informa- tion with an external device, such as from a voltmeter to the microprocessor. 14

time I ADORES s BUS> device address ~ I CONTROL BUS> IN lJ I device address ~ I CO~TROL BU·S > OUT u I DATA BU-S output I I I > I I I I ADDRESS BUS device address ~ CONTROL BUS TIT or OUT Lr I DATA BUS I no signals

Figure 6. Conceptual Diagrams of 1/0 Operations. 15

A distirrction must be developed between internal and ex- ternal inputs. -The external 1/0 bu.s should not be re- versed when an internal input is requested. It should only be reversed when an external input is desired. It is a characteristic of this computer system that al I in- ternal inputs have addresses that are larger than 128 10 or 1000 0000 2. Therefore, when the largest address bit, A7, is logical "I", then an internal input has been re- quested. The circuit shown in Fig. 7 reverses the direction of the extern a I I /0 bus on I y when an extern a I input has been requested. That is, when address bit A7 is logical "O" and when the TN signal is logical "O", the output of NANO gates one and two is a logical "I". The output from NANO gate three is a logical "O" and the EXTIOSEL signal is en- abled, thus reversing the direction of operation of the 1/0 bus. This circuit is labelled as the 1/0 select cir- cuit on the schematic of card #2 in Fig. ti.

Computer Cable

A fifty-conductor cable extends the 1/0 bus signals from a circu.it card edge, located on the TRS-80, to the interface elements. A card edge connector on the cable end attaches to the 1/0 bus card edge. The information signals present on the external 1/0 bus are then extended to the end of the fifty-conductor cable. The free end of the cable is attached to an STD card, which transfers the TRS-80 1/0 signals to the STD motherboard.

STD Interface System

The STD configuration is a standardized assignment of information signals to positions on a fifty~six element A7 NANO gate #I NANO EXTIOSEL

gate 0\ #3 TN ·NANO gate #2

Figure 7. The 1/0 Select Circuit - 74LSOO chip on STD Card #2. 17 card edge connection [3]. The STD assignments on a card edge connection are defined in Fig. 8. The twenty 1/0 bus signals that are used in this system are connected to their respective STD positions on the edge of card #2. Figure 9 i I I ustrates the connection of the computer cab I e to the STD card. The advantage of a standardized config- uration is system flexibi I ity. Any STD based card may be connected to any STD based card edge connector. There are over 100 manufacturers of STD cards with a wide range of control and interface functions available. This provides g re a t f I ex i b i I i t y f o r I ate r d e s i g n a n d lo r t a s k c h a n g e s f o r this system.

DE-80 Interface Box

The first interface box, I abe I I ed the DE-80 box, houses an eight-member STD-based motherboard. This board is simply a printed circuit board with eight fifty-six element STD card edge connectors wired in parallel. The printed circuit board provides the para I lei contact be- tween the similar elements on the connectors. Therefore, a group of signals present at one connector is available to a 11 of the connectors. The uti I ity of the motherboard system is that the external 1/0 bus signals, carried by the computer cable to card #2, are avai I able at each of the corresponding connectors on the motherboard. In this system, the motherboard allows communication to STD card #1. If additional interfacing capabilities are desired, six more STD-based cards may be added to the present sys- tem. The DE-80 box also houses a five-volt power supply and two twelve-volt power supplies, one positive and one negative. These are connected to the motherboard at their respective STD positions. The five-volt supply powers the integrated circuits used on the STD interface 18

CARD EDGE

signal ~ ~ signal +sv 2 +5V GND 3 4 GND logic power bus -5V 5 6 -5V D3 7 8 D7 D2 9 10 D6 DI I I 12 D5 data bus DO 13 14 D4 A7 15 16 Al5 A6 17 18 Al4 AS 19 20 Al3 address bus A4 21 22 Al2 A3 23 24 A I I A2 25 26 AIO Al 27 28 A9 AO 29 30 AB WR 31 32 RD IOREQ 33 34 MEMRQ IOEXP 35 36 MEMEX REFRESH 37 38 MCSYNC STATUS I 39 40 STATUS 0 ·* BUS AK 41 42 BUSRQ control bus INTAK 43 44 INTRQ WAITRQ 45 46 . NM I RQ SYS RESET 47 48 PBRESET CLOCK 49 50 CNTRL PCO 51 52 PCI AUX GND 53 54 aux i I i a ry +12V 55 56 power bus

*- see Appendix for a description of the control signals.

Figure 8. Signals Avai I able on the STD bus in the DE-80 Interface Box. 19

signal pin ~ signal DO 13 DO DI 3 I I DI D2 5 9 D2 D3 7 7 D3 D4 9 14 04 D5 11-12 D5 D6 13--10 D6 07 15--8 D7 AO 17--29 AO Al 19--27 Al A2 21--25 A2 A3 23--23 A3 A4 25--21 A4 A5 27--19 A5 A6 29-·-17 A6 A7 31--15 A7 IN 33--32 RD OUT 35--31 WR RESET 37--47 SYSRESET TNT 39--42 BUSRQ WAIT 41--45 WAITRQ EXTIOSEL 43 device select circuit N/C 45 -Fig. 7 Ml 47--39 STATUS IOREQ 49--33 IORQ

Figure 9. Connection Between the Computer Cable and the STD Card. 20 cards. The positive twelve-volt supply is used in the stepper motor interface circuit.

Interface Stations

In this system, interface stations are used to buffer the information between the external devices and the com- puter. There are six 1/0 inter.face stations, three on each STD card. Figure 10 i I lustrates the station layout for STD card #I, and Fig. 11 i 11 ustrates the station I ay- out for card #2. This card is al.so attached to the com- puter cable. Figure 12 i I lustrates the flow of signals through an interface station. A port is an external or an internal address loca~ion that may hold or transfer eight bits of data. In this case, each interface station contains three external input/output ports. The stations must be used consecutively from zero to five. If three stations are used, only card #I is needed. Card #2 is used as required until al five stations are samp'led in the acquisition process. The computer 1/0 cable is attached to card #2 to relieve cable congestion on card #I. Each interface station consists of an address gating circuit, a Programmable Peripheral Interface circuit

------L------'------t I I -,7-4-L S-0--.41 : station PPI #2 two 8255 74LS301 : addresses: I 24-27 f 74 LS041: I

Figure 10. Station Layout for STD Card One. 7 4 LSO 41: station I PPI #3 th iee 174LS30 8255 addresses: --7 ...... 4 Ls ~ 0 41t... :! ~ I 28-31 I g' J ------~ I

station I 7 4 L so 41 l PP I ll4 f o lj r 174 LS30 N 8255 I N addresses: ,-7-4-Ls-o-41 32-35 l 1 ------1 I

station I74LS041~ five PP I #5 17 4 LS 30 1 addresses: 8255 ~---.1 36-39 I 7 4 LS 0 41: I

Figure I I. Station Layout for STD Card Two. 0 0 6> 6> aaaress 6its AO, Al ) 0 0 6> 6> port A device 0 0 e 6> address select PPI bus circuit Q:::i (}~6> ( 8255) -+ 0 (I) 74LS04 (I) 74LS30 o~ 0 o;& Q) 0 0 0(1) 0 e:<9 (f) -+ -+ port B o~ 0 o;, & N VJ 0 og 6>:::i c9 0 0 a a fa bus (f) og 0 <9~ c9 ')\" (I) (I) o-+ 0 0~6>.., 0 0 6> 6> QOrt c control bus 0 0 6> <9 RD, vm, RESET 0 0 0 <9

Figure i'2. Signal Map of the Interface Station. STD BUS CARD EDGE PPI INPUT PPI OUTPUT signal pin pin signal signal pin

AO 29 9 AO PAO 4 Al 27 8 Al PAl -··--·-* 3 RESET 47 35 RESET PA2 2 WR 31 36 WR PA3 1 port RD 32 5 RD PA4 40 A DO 13 34 DO PA5 39 Dl 11 33 Dl PA6 38 D2 9 32 D2 PA7 37 D3 7 31 D3 D4 14 30 D4 PBO 18. D5 12 29 D5 PBl 19 D6 10 28 D6 PB2 20 D7 8 27 D7 PB3 21 port GND 3 7 GND PB4 22 B N +5 v 1 74LS04 74LS30 26 +5 v PB5 23 +>- pin chip pin pin chip pin pin chip pin .6 cs PB6 24 in # out in # out in # out PB7 25 A2 25 ~ 5-=j)5o=-6------, r 6- ----., I A3 23-+- 3----(1>o-4 I I 5 1 PCO 14 PCl 15 A4 21~~~2___ ~::_~:~ __ i ! 4 PC2 16 A5 19-f--5~5------:: 3 PC3 17 port c PC4 A6 1 7 --: -3---{3>o--4 I 2 I 13 PC5 12 A7 15-- 1 -1~2 1 I L ____ ------___ ...J PC6 11 +5 v--1 11 i PC7 10 I I +5 v--1 ~l:_ ____ J

* -RESET Is Inverted using an extra gate on the 74LS04 chip to produce RESET.

Figure I 3. Sample Wiring Diagram for an Interface Station Station Five. 25 gates. The functional differences between station zero and the other stations are the programmed functions of the PPI chips, and special pin assignments in the twenty- tour pin station connectors. figures 14 and 15 i I lus- trate the PPI functions tor the stations, and Figs. 16 and 17 i I lustrate the pin assignments tor the station connectors. The address gating circuit distinguishes the ad- dress of the particular interface station from al I other addresses that are present on the address bus. This cir- cuit uses address bits A2 through A7. Address bits AO and Al are reserved tor addressing within each interface station. When the correct address appears on the address bus, all of the inputs to the NANO gate in Fig. 18 are logical "I", and the output from the NANO gate is logi- cal "O". vvhen any other address appears on the address bus, at least one input to the NANO gate wi 11 be logical "O", and the output of the gate wi 11 be logical "I". An address gating circutt diagram is presented in Figs .. 19- 21 tor al I of the stations. Table 11 displays the address information tor the six interface stations. The PPI (8255) is a forty-pin, software configur- able integrated circuit [4]. There are tour eight-bit ports in the chip. Three ports are available for pro- grammed input and/or output operations. When these ports are addressed by the computer, information is passed to/ from the port to/from the data bus. Table I I I describes the possible functions of these ports. The fourth port is a control port used to configure the functions of the other three 1/0 ports [5]. The uti I ity of the PPI chip is that it may be re- programmed tor many input/output combinations. Each time t h a t t h e s y s t e m i s t u r n e d o n , t h e PP I m u s t b e p r o g r a mm e d as a combination of input and/or output ports. 26

Port A - output

Port B - output

Port C -output

Figure 14. PPI Port Configuration for Station Zero. 27

Port A - input

Port B - input

Port C, lower 4 bits- input > .<:: Port C, upper 4 bits- output

Figure 15. PPI Port Configurations for Stations One Through Five. 28

PAO GND PAI +12 v PA2 port B PA3 upper port A PA4 PCO PA5 PCI PA6 ·Pc2 PA7 PC3 port c . PBO PC4 PBI PC5 port B PB2 PC6 lower PB3 24 GND

Figure 16. Sign.afs Available at Station Zero.

PAO PB4 PAI PB5 B PB6 port PA2 upper PA3 P.B7 port A PA4 ·pea PA5 PC I PA6 PC2 PA7 PC3 PBO PC4 ·.PB I port C port· a PB2 lower PB3 24 GND

Figure 17. Signals Available at Stations One Through Five. Inverters decimal 36 (74LS04) A2 0

A3 0 i

A4 0

0 A5 NANO gate 0 cs A6 0 (74LS30)

N \.0 A7 0

+5 v

+5 v lk resistors

Figure 18. Address Select Circuit for Station Five - Chips 74LS04 and 74LS30. 30

decimal 16

A2 0

A3 0

A4 J

A5 0

A6 0

A7 0

+5

+5V

station zero

decimal 20 A2

A3 0

A4

A5 0

A6 0

A7 0

+sv····

+5V lk station one Figure 19. Address Select Circuit for Stations Zero and One. 31

decimal 24

A2 0

A3

A4

A5 0

A6 0

A7 0 +5V lk +5V lk station two

decimal ii\

A2

A3

A4

A5 0

A6 0

A7 0 +sv--..1 lk +5V lk station three

Figure 20. Address Select Circuits for Stations Two and Three. 32

decimal 32

A2 0

A3 o·

A4 0

AS

A6 0

A7 0 +SV

+5 lk station four decimal 36 A2

A3 0

A4 0

AS

A6· 0

A7 0

+SV lk +SV

station five

Figure 21. Add~ess Select Circuits for Stations Four and Five. 33

Table II. PPI Addresses for Stations Zero Through Five.

Addresses station # po rt A po rt B po rt c control po rt (PA) (PB) (PC) CPR)

0 16 17 18 19

I 20 21 22 23

2 24 25 26 27

3 28 29 30 31

4 32 33 34 35

5 36 37 38 39 34

Table I I I. Possible PPI Port Configurations.

PORT FUNCTION

port A input/output port B input/output port c input/output upper 4 bits port c input/output lower 4 bits control port input

Table IV. Port Addressing on PPI Chips.

PORT AO Al Decimal Value

po rt A 0 0 PA= PA+O

po rt B 0 I PB= PA+I

port c I 0 PC= PA+2 control port I I PR= PA+3

PA port A address, the base address for each interface station. 35

The versatility of this approach to 1/0 interfacing is that, with appropriate software, these interface stations may be used for any 1/0 application. The four ports in a PPI are addressed using the AO and the Al bits from the address bus. These two bits represent decimal numbers zero through three. Table IV gives the proper address sequence for each of the ports. For example, to output a number to the control register, the command is:

OUT PA+3, number 10

Before the PPI is used for input/output, the role of the three-, /0 ports must be defined. The contro I mode word is a binary value that is output to the control port. The individual bits of the binary word define the functions of the three PPI 1/0 ports. Table V i I !us,_ trates the control mode word composition. For example, in this data ac.quisition system, stations one through five are designated as:

port A input port B input ~ort C - lower four bits input port C - upper four bits output

This is accomplished using the following control mode word derived from Table V: 07 DO 1001 00112 = 14 7 10 To define the control mode, the computer command: OUT PA+3, 147 10 wi 11 set the PPI for the desired configuration. The PPI may be used in several modes. This system wi 11 uti I ize mode 0. Thus, bits 2,5, and 6 wi I I be zero at al I times .. 36

TABLE V. Control Mode Word Composition to Program a PPI Chip.

BIT # FUNCTION PROGRAMMING

DO Ro rt c- lower 4 bits I-input, 0 output DI port B I-input, a-output

02 mode selection 0- mode 00 03 port c- upper 4 bits I-input, 0-output

04 port A I-input, G-o.utput

05 mode selection 0- mode 00

06 mode selection 0- mode 00

07 mode set flag I- setting mode 37

To input a value from port A, the command:

INP(PA+O) may be used. To output a value to port C, the command:

OUT PA+2, N10 where O~N 10 s_255 may be used. In this case, only the upper four values in the binary number wi 11 be output to port C since the lower half of port C is designated as an input port. Likewise, the command:

INP

1000 00002 = 12810

OUT 19,128 10

The CS pin al lows the PPI to be enabled and disabled on request. When a logical "O" is applied to the CS pin, and a WR or RD signal is also present, information is ex- changed between the computer and the PPI. If either of the above signals are missing, or if the signals do not coincide, then no information exchange occurs. The WR and RD signals are generated by the computer on output and in- put requests. The CS signal is generated through the ad- dress gating circuit only when the correct address of the interface station has been chosen by the computer. 38

The three output ports of each interface PPI are wired to a twenty-four pin station. The stepper motor interface cable must be attached to station zero. Any other twenty-four connector cable may be connected to any other station.

Digital Inputs

Twenty-four conductor cables are provided to interface the digital meters with 1/0 stations one through five. Figure 22 defines the signal locations in these interface cables. Al I digital inputs must be similar in form so that they may be interpreted by the computer.

Fluid velocity is measured wi~h a velocity probe. The resulting voltage or ~resSure is m~asured with a digi- tal instrument, a voltmeter or a manometer. In the pre- sent system, the digital meters that may be used are the DISA 55D31, the DANA 5100, or the DATAMETRICS 1400. These instrumerrts are equipped with Binary Coded Decimal (BCD) outputs. This BCD output is a coded representation of the information that· is given on the digital display pane I. Each instrument has individual BCD characteristics that must be incorporated into a common signal arrange- ment defined for the twenty-four conductor cables. In stations one through five~ four pins.are defined tor computer output, and the remaining twenty pins are defined for computer input. One decimal digit in BCD is represented by tour binary bits. In the voltmeters, five binary bits are used to translate polarity, decimal point, and overflow information. Due to the station I imitation

of twenty input I ines, only three and o~e-half digit de- cimal numbers are interpreted by the computer. The 39

pin signal

2 2 10° digit 3 4 4 8 port A 5 10 6 20 I 0 I 7 40 digit 8 80 9 roo ro 200 2 I I 400 ro digit 12 800 port B 13 N/C 14 N/C 15 N/C 16 +/- polarity 17 1000 10 4 digit 18 po rt decimal c 19 lower information 20 } 21 HOLD display hold 22 po rt c N/C upper l2 3 N/C 24 GND digital ground

Figure 22. Signal Assignments for th~ Digital Interfaces via the Station Coanectors. 40

DATAMETRICS manometer does not utilize the decimal point input I ines. Therefore, these three I ines are used in conjunction with one vacant If ne to interpret one more digit for a total of four and one-half digits. The information that is recorded by the computer must be received in eight-bit groupings (bytes). Three input commands must be executed to record the digital values needed to define one decimal value. These commands are:

A=INPCport A) B=INPCport B) C=INPCport C)

The v o I tag e s i g n a I s f ro m the v e I o c i t y p robe t y p i ca I I y f I uctuate. To reduce the recording error during the input process, a HOLD pin is available on all of the instruments. This signal enables an internal hold circuit in the digi- tal instrument when a logical "O" is applied to the HOLD pin. The internal hold circuit retains the BCD informa- tion on the digital display until a logical "I" is applied to the HOLD pin, releasing the internal circuit. The volt- meter is not inhibited from digitizing the signal during this process. When the HOLD signal is released, the dis-. play and the BCD output are updated.

Duet~ the fluctuating characteristic of the nomi~ nal ly steady voltage signals that are measured, some form of averaging is also desired. The DISA voltmeter has in- ternal averaging capabilities, The DANA and the DATA~. METRICS meters do not average. Therefore, the signal av- eraging must be accomplished in the system software. The DISA voltmeter is a three and one-half digit volt- meter with a least count of one mi 11 ivolt. The BCD output i s I o e d on the back pane I of the v o I t mete r an d i s a c- c es s i b I e from a DB-25 connector. The signal locations on 41

this connector are given in Fig. 23 There are threee decimal ranges available on the voltmeter. Only the 0-1 volt range and the 0-10 volt range wi I I be used in this application. The DANA voltmeter is a five and one-half digit volt- meter with a least count of one microvolt. Due to the smal I capacity of the interface 1/0 ports, only three and one-half digits from the voltmeter are used with a result- ing least count of one mi 11 ivolt. The BCD output is avai 1- a~le on the back panel of the voltmeter on a card edge. The signal locations on the card edge are given in Fig. 24 No averaging capabi I ity is avai I able in the DANA voltmeter. Averaging must be accomplished in the program software. This is a simple task to perform in BASIC using the com- puter as a control !er. The DATAMETRICS 1400 is a four and one-half digit electronic manometer. The BCD output is avai I able on the back panel of the manometer through a DB-25 connector. The signal locations at this connector are given in Fig. 2 5 No averaging capabi I ity is avai I able on the manometer. Al I of the digital instruments are susceptible to short circuits. The instrument cables should not be con- nected to the interface stations. unless the stations are at higher voltage potentials. All of the pins at each station must be initially set to logical "I" before the meter cables are attached. For this reason, do not attach the instrument cables to the interface stations unti I prompted to do so by the computer. The digital displays of the instruments should be observed and compared to values as measured by the computer. If they are not com- patible, refer to the Troubleshooting section in Appendix c. 42

cable DB-25 cable connector connector connector pin signal pin pin signal pin

16 +/- 2 I . 000 17 ,X8> 0.000 3 4 100 9 10 200 5 6 400 I I 12 800 7 8 0.00 19 5 10 9 10 20 6 7 40 I I 12 80 8 Ci~o) 00.0 13 14 2 2 15 16 4 3 4 8 17 18 HOLD 21 24 GND 23

Figure 23. Location of Digital Signals in the DB-25 Connector on a DISA 55D31 Voltmeter. 43

cable ca rd edge cable connector connector

pl n signal pin p i n. signal pin

39 HOLD 3 H 800 32 37 GND 4 J 8K 30 31 RC3 7 L SOK 26 25 400 10 N +/- 22 23 4K I I R RC2 18 21 40K 12 u 200 12 15 RCI 15 v 2K 10 9 100 18 y 20K 4 7 IK 19 3 IOOK 21 I OK 22

Figure 24. Location of Digital Signals on the Card Edge in a DANA 5100 Voltmeter. 44

DB-25 cab le and connector signal pin pin signal I, '- 2 2 4 ,, 3 4 ,s 1"0 5 6 20 40, 7 8 80 I E>O 9 10 200 400 I I 12 80,0 IK 14 15 2K 4K" 16 17 SK I OK 18. 19 +/- HOLD 2.2 25 GND

note: the cable signals and the connector signals coincide for the DATAMETRICS manometer.

Figure 25. Location of Digital Signals in the DB-25 Connector on a DATAMETRICS 1400 Manometer. 45

Stepper Motors

Stepper motors are used to actuate the rotational and transverse motion of the velocity probe. The rotation of the rotor is generated in discrete steps. The size of the step is a characteristic of the motor. Two identical Bodine stepper motors are used in this system. The step- ping increment is 1.8° per step, or 200 steps/revolution. They can operate at speeds up to 800 steps/second at a maximum holding torque of two inch-pounds. The number of steps taken by a motor is a direct indication of the position of the rotor. Rotor position translates to probe position through worm and spur gear combinations, as discussed in Chapter I I. The computer controls the number of steps that are taken by the motors which, in turn, define the change in position of the probe. A conceptual drawing of a stepper motor is given in Fig. 26. The basic principle is that the two rotors wi I I seek the lowest energy position in the magnetic field. As two of the coi I windings, or phases, are ener- gized a new magnetic field is developed, and the rotors move to accommodate the change in the field. The phases must be excited sequentially as shown in Fig. 27. The stepper motors are control led by one eight-bit word that is output from the computer through port 16. Each bit in Port 16 regulates one motor phase. The lowest four bits, 00-03, control stepper motor #1. The highest four bits, 04-07, control stepper motor #2. The clock-wise stepping sequence for each motor consists of four output states that are described as follows: 46

Figure 26. Conceptual Di~gram of a Steppe~ Motor. 47

phase number

JI #2 fl.3 #4

..c n n -- -- 0) :::; 0 L -- .c. (/) -- n n +- (]) (/) +- ltl. c:_z. (]) a:. -- -- n n t.. t.. ::J u n - -- n

phase number

.#I 112 #"!J #4

L (!) ..Cl 9 I. I o. 0 E ::J c: c 0 t Q_ - I co E ·-u 3 0 0 I 1 (!) -0 co x (!) 6 I 0 0 -1 ..c

figure 17. Stepper Motor Excitatfon Sequenc~. 48

excited phases motor #I motor #2 binary Hex binary Hex

and 2 I I I I 1001 F9 1001 I I I I 9F

2 and 3 I I I I I I 00 FC I I 00 I I I I CF

3 and 4 I I I I 00 I I F3 00 I I I I I I 3F

4 and I I I I O I I 0 F6 01 IO I I I I 6F

A phase is excited with a logical II 0 II signal generated by the computer. A phase is dormant when a logical " I " i s output to the phase from the computer. To reverse the direction of stepping the order of the stepping sequence is reversed. Thus, the counter- clock-wise stepping sequence consists of the fol lowing output states:

excited-phases motor #I motor #2 binary Hex binary Hex

and 2 I I I I 1001 F9 1001 I I I I 9F

4 and I I I I O I I 0 F6 O II O I I I I 6F

3 and 4 I I I I 00 I I F3 00 I I I I I I 3F

2 and 3 I I I I I I 00 FC I I 00 11 11 CF

One ampere of current is required to excite one phase of one motor. To step one motor, two phases must be excited for each step. Thus, a two-ampere, five-volt power supply is necessary.

Stepper Motor lnterfac~ Box The second interface box houses the motor power sup- ply and the motor interface circuit. A schematic diagram of the power supply is given in Fig. 28. It can supply a three-ampere current at five volts. The two motors may not be stepped concurrently since the poser supply cannot transistor 5V ~------.------... 2 N 3 0 5 5 ------+

voltag~--.J regulator transformer 6.3 volts LM 323K 5 amps 3300 uf 3300 uf 500

(adjustable)

GND

Figure 28. Stepper Motor Power Supply. 50 generate the four amperes of current that would be re- quired. The motor ihterface circuits enable the low-power computer signals to switch the current flow in the motor phases. The circuit for one phase is given in Fig. 29 Eight of these circuits, one for each motor phase, are in-

~luded on the interface board. The major component in the circuit is a Vertical Metal Oxide Semiconductor Field Effett Transistor CVMOS- FET). This is the best approximation of an ideal switch that i s av a i I ab I e at th i s t i me [ 6]. I t i s used i n th i s appl !cation to control the current flow through one motor phase. VMOSFETs are parti·cularly useful because they switch on voltage input levels. A negligible amount of current is drawn from the system in the switching process. They are not susceptible to thermal runaway and their switching time is very short. The major disadvantage of VMOSFETs, as with all switching transistors, is that they require large heat sinking capacities to dissipate the power that they absorb. The VMOSFETs in this system are mounted on two aluminum plates to provide sufficient heat sink capacity. The VMOSFET is activated by voltage levels above ten volts. The 2N2222 transistor is used to switch the VMOS- FET gate supply voltage between ground and +12 volts. The 2N2222 transistor is directly control led by the signals generated f rbm the computer. A twenty-five conductor cable is used to distribute the control signals for the stepper motor operation. Ten signals are transferred from interface station zero to the interface circuits. Fifteen signals are transferred to the motor phases from the interface circuit. Figure 30 defines the signal locations in this stepper motor cable. +12 v +5 v

4001 motor ~h ase

I k VN46AF computer CVMOSFET) s i na I from Ul Port 16 10 k

note: eight of these circuits, one for each motor phase, are included in the stepper motor interface box.

Figure 29. Interface Circuit for One Stepper Motor Phase, 52

E...!...!2. signal DO" 2 DI 3 02 4 03 data from 5 04 bus station (port I 6) 6 05 zero 7 06 8 07 9 10 GND I I phase #I 12 +5V 13 phase #2 14 +5V 15 phase #3 16 +5V 17 phase #4 18 +5V to stepper 19 phase #5 motors 20 +5V 21 phase #6 22 +5V 23 phase 117 24 +5V 25 phase #8

note: Phase #I and Phase #2 share a common +5 Volt supply at pin #12.

Figure 30. Stepper Motor Interface Cable. 53

IV. PROGRAM DESCRIPTION

The task of the system software is to acquire accu- rate voltage information from a velocity probe as it is positioned along the length of the vertical traverse. Other variables to be measured and recorded are vertical height and yaw angle of the probe at each position. The general sequence of events involves first positioning the probe at a vertical location, rotating the probe unti I the direction of the fluid velocity is found, and an optional repositioning of the probe using a predetermined yaw cor- . rection angle. At this final position, voltage data are recorded from up to five channels. The vertical traverse is accomplished through a se- ries of vertical ranges. A range is comprised of a group

of data points taken along the traverse a~ constant ver- tical increments. The number of ranges in a traverse, the number of points in a range, and the vertical increments for each range are defined in the subprogram INITIAL. A modular approach has been used in the development of the system software. The MAIN program is supported by nine subprograms. The relationship between these programs is i 11 ustrated in Fig. 31. The function of each of these subprograms in relation to the MAIN program wi I I be des- cribed in the fol lowing sections.

MAIN Program

The data acquisition tasks are distributed among the subprograms. The MAIN program coordinates the overal I procedure, defines variables, and maintains rotational and translational probe position records. The MAIN program is subdivided into three reiterative 54

INITIAL

STEPPER

STEP/CMD

MEASURE

MAIN INPUT

ZERO CROSSING NULL TECHNIQUE

METHOD OF LEAST SQUARES 1st ORDER POLYNOMIAL

METHOD OF LEAST SQUARES 2nd ORDER POLYNOMIAL

DIGITAL FILTER

Figure 31. Relatlonshtp between the MAIN Program and the Subprograms. 55

loops. Figure 32 i I lustra.tes these loop relationships.

In the primary loop th~ direction of the fluid velocity is determined, the probe is positioned for data acquisi- tion, and the data are recorded. The secondary loop re- positions the probe at the next vertical location, and recal Is the primary loop unti I one vertical range has been completed: The tertiary loop resets range parameters and recalls the secondary loop program until the acquisi- tion task has been completed.

MAIN Program - Primary Loop

The primary loop includes two major procedures, the probe nul I procedure and the voltage measurement proce- dure. Figure 32 presents a flowchart of this primary · loop. The user may choose to skip the nul I procedure. In this case, the computer wi I I go directly to the voltage measurement procedure after the probe ts positioned at a vertical location. The nul I procedure is accomplished through a series of rotational, voltage sampling sweeps of the probe across the flow field. The number of voltage sampling sweeps, the range of ~ach sweep, and the number of points in each sweep are defined by the user in the INITIAL subprogram. These variables enable the user to deffne coarse or fine sampling swe.eps tailored for the i·ndividual probe response. Three techniques, arranged in five user options, are avai I able to identify the nul I position of the probe from the resulting data field. On~ of the five options is chosen by the user in INITIAL. The zero-crossing technique com- pares the values in the data field, and determines the interval that contains the zero voltage crossing point. It estimates the voltage nul I point within this interval The method of least squares technique determines 56

INITIAL parameter definition r------

4

method of method of methods I ,2,3 zero-crossing least squares least squares technique 2nd order with I s·t order igital tilter polynomlal polynomial

MEASURE all channels

.._. ______primary loop _

secondary loop

tertiar loo

END

Figure 32. General Flowchart of the MAIN Program. 57

the nu! I point through a least squares approximation of the probe response function. Either a I inear function or a second order polynomial function may be approximated with this technique. The digital filter technique manipulates the data field resulting in a band-pass digital filter. The ex- treme point, the maximum or the minimum, within the fil- tered array is identified as the null position. Five nul I procedure options are presented to the user in INITIAL. The first choice, as mentioned earlier, is to bypass the nulling process and move directly to the measurement procedure. A second choice is to apply the zero-crossing technique to a 11 of the samp Ii ng sweeps. The third and fourth choices uti I ize the least squares approximation technique for a I inear or a polyno~ial func- tion, respectively, to determine the null point in all of the sweeps. The final choice incorporates the digital filter in the last sampling sweep after an approximate nu! I location is found using any of the above options. An optional yaw correction angle can be added to the nu! I angle by the MAIN program to move the probe to the final angular position. Such a yaw correction could, for example, be required by an earlier probe calibration. It would be defined by the user in INITIAL. The voltage data from al I of the input channels is recorded by the computer in the voltage measurement procedure. The vertical and angular positions, as wel I ~s the voltage data, are stored on a data disk in a file designated by the user in INITIAL.

MAIN Program - Secondary Loop

The secondary loop determines whether the desired number of data points in the current vertical range have been recorded. If the range has not been completed, the 58

velocity probe Is moved to the next vertical position within this range, and the program returns to the pr~mary loop. If the range has been completed, the program con- tinues to the tertiary loop.

MAIN Program - Tertiary Loop

The tertiary loop determines if the number of verti- cal ranges requested has been exhausted. If there are more ranges to be completed, the number of steps per range and the step size are updated, and the program returns to the secondary loop. If a 11 of the ranges have been covered, the program ends.

INITIAL Subprogram

In setting up the system to prep~re for a traverse, the INITIAL subprogram prompts the user for the program

variabt~s and constants at the start of execut1on in the

MAIN program. Arrays are dimensioned ~n-d program counters are set in this section. Table IV includes a listing of the user-defined variables. Detailed flowcharts de-- scribing the system programs are Included in Appendix B. Control is returned from the INITIAL subprogram to the MAIN program.

STEPPER Subprogram

The STEPPER subprogram Is designed to interface the BASIC language programs with the machine language STEP/ CMD subprogram. This machine language program is used to step the motors at a faster rate than can be achieved using a similar BASIC program. It is used in a manner analogous to the subroutines but it is referenced with a different command: The STEP/CMD subprogram is discuss&d in the next section. 59

Table VI. User inputs in the INITIAL Subprogram. variable unit range function

DI l:SDl:S2 traverse direction flag: l=down, 2=up

s 1Sss:s

DVCmJ 1$DVCmlS3 instrument f I ag for m th channe I where: m=I ,2, ... ,S I= DISA digital voltmeter 2= DANA digital voltmeter 3= DATAMETRICS digital manometer

RNCml IS RNCml$ 2 range flag for DATAMETRICS manometer m= I , 2, •.• , S I= xi range 2= x. I range

R R-;;:: I number of vertical ranges

NSCnl NSCn l~ I number of vertical steps in the nth range n=I ,2, ••• ,R th DZ(nl in. DZ

FL OSFLS:4 the nul I ing method flag where: O= non-nu I Ii ng method I= zero-voltage search 2= root of Ii near I east squares 3= extremization of I inear least squares 4= digital filter added to the last nu 11 pass

PN IS: PN S: 5 nu 11 i ng channe I number

Tl sec Tl~O initial time delay before nul I data acquisition *

N number of samples per average in nul I procedure*

T2 sec time delav. between samples in nul I procedure*

NL NL I number of I oops through the nu 11 procedure

AR deg AR~O total included yaw angle in nul I procedure

T3Cml sec T3Cml2:.0 initia+htime delay before data acquisition m= I , 2, ••• , 5 for m channel

B

T4Cml sec T4Cml2: 0 time delay between samples for mth m= I, 2, ... , 5 channel in data acquisition

z ( 0) in. initial vertical position

TH(Ol deg initial yaw position yaw correction angle (optional l YC deg

N$ name of data file

* not.e: the parameters for the nul I channel are defined separately for the nul I procedure and for the measurement procedure. 60

There are two program sections In the STEPPER sub- program. The first section is a that al- lows the user to initially position the probe prior to the actual data acquisition traverse. This section con- tains user prompts to input the motor to be stepped, the amount of movement to be taken, and the direction of stepping. This section also contains a prompt to deter- mine if the user wishes to continue the positioning pro- cess. The second section of the program reduces the stepping information to the binary data required in the STEP/CMD subprogram. The motor number and the direction of stepping are stored in the STEP/CMD memory locations. The amount of movement is ti rst reduced to the total num- ber of steps to be taken. The STEP/CMD program uses a sixteen-bit word as a step counter. Therefore, it can only step 65,536 steps at one time. This number repre~ sents the largest number that may be d~fined by a sixteen- bit binary word. If more steps are requested, the STEP/ CMD subprogram must be cal led more than once. The number of t i mes that STEP ICM D must be ca I I e d i 5 ca I cu I ate d i n the STEPPER subprogram as:

NC= the integer portion of (steps/65536) Tota I ca I Is = NC + 1

STEPPER requests the maximum number of steps from the STEP/CMD ·subprogram NC times. ThE? remaining number of steps in .the final STEP/CMD call is:

ST = steps - NC*65536

The BASIC program calls the bPginning of the machine language program, STEP/CMD, with the command:

X=USRIC1) 61

This command wi I I send computer control to the beginning of the STEP/CMD subprogram. The control is returned to STEPPER from STEP/CMD. Control is returned to the MAIN program from STEPPER.

STEP/CMD Subprogram

The actual pulse train used to run the stepper motors is generated by the STEP/CMD subprogram. It is written in Z-80 machine language, the language of the TRS-80 microprocessor. Since machine I anguage is the primary language of the microprocessor, programs are exe- cuted faster than the programs written in the higher level BASIC language. The STEP/CMD program occupies the memory locations above 65,250 in the computer memory. This area must be reserved for STEP/CMD when the BASIC language is first entered on the TRS-80. If these locations are not re- served, the BASIC operation procedures may overlap parts of the STEP/CMD program. The STEP/CMD program controls the two stepper motors with one eight-bit word that is sent to the motors through port 16. The lower four bits of this word con- trol motor #I while the upper four bits control motor #2. The motor that is to be stepped, the direction of rotation, tion, and the number of steps that are to be taken must be defined before entering the STEP/CMD program. Two sections of memory are referenced by this program. A permanent storagk section contains informa- tion on the number of steps to be taken, the direction of rotation, and the motor number. It also contains the forward stepping sequence, the reverse stepping sequence, and the time delay between each step. A temporary storage section contains the stepping sequence for the current stepping request. 62

The STEP/CMD program includes three tasks. The first task is to define the system parameters. The motor number and the direction of rotation are interpreted, and the correct stepping sequence is I oaded into the tempo- rary storage section. When either motor is stepped, the last stepping value that was sent to the motor in the last stepping series must be the first output value in the current series. This repetition stabi I izes the motor po- sition before any additional movement is taken. Thus, the position of the first value to be sent to the motor is also identified in the initial parameter definition. The second program task involves the generation of the motor movement. Once the current stepping sequence, the starting value for the stepping series, and the number of steps in the series have been deter- mined, the STEP/CMD program wi I I use this information to excite the designated motor. The output value pointer is set at the first number to be sent to the motor. This number is sent to the motor through port 16. The pointer is incremented to indicate the next value in the sequence and this new value is then sent to the motor. The com- puter continues to loop through the stepping sequence unt i I a I I of the requested steps have been taken by the motor. The third program task is to store the .last number that was sent to the motor in the permanent memory section. Computer control returns to the STEPPER program when this task is completed. A description of the STEP/ CMD program is included in Appendix Al. 63

MEASURE Subprogram

When the probe is moved to an angular position, and a voltage input is required, the MEASURE subprogram is cal led to acquire an averaged voltage value. The INPUT subprogram is cal led from MEASURE to obtain an array of digital voltages. These voltages are averaged and a standard deviation is calculated. Chauvenets 1 cri- terion [7] is estimated with the fol lowing equation:

2 X = 0.82 + 0.54*tog(B) - 0.023*1og(B) where: B, number of samples, > 3

Chauvenets' criterion is applied to an array of data to remove erran~ data points. In this case, the digital voltages are conditioned as fol lows:

= VACQ) v max + X*SD = VACQ) v min -X*SD V C.I) v min $ <: v max

where: VACQ)= average value of the array SD = standard deviation = minimum value for accepted data v min v max = maximum value for accepted data v CI l = accepted data.

A new average value and standard deviation are calculated from the resulting array of acceptable data. The average value is returned to the MAIN program. 64

INPUT Subprogram

The INPUT subprogram achieves the inpu+ of a series of digital voltage values from an interface st~tion. The time delay before data Is taken, the number of values recorded, and the time delay between each value are defined by the user in INITIAL. In the TRS-80, the external 1/0 bus must be activated with the fol lowing software:

A = INP(252) OR 16 OUT 236, A

The external card edge on the TRS-80 wi 11 not carry any s i gna Is unti I these commands are executed. The voltage readings are acquired in a data Input loop. In this loop, a HOLD signal, a logical "O", is generated by the computer and is transmitted to the meter through port C, bit four, to maintain a constant signal from the meter. The digital information in port A, port 8, and the lower half of port C is input to the computer. A logical "I" signal is generated by fhe computer and trans- mitted through port C, bit four, to the meter, thus re- leasing the Signal hold on the meter. The time delay between values is implemented, and the computer returns to the top of the loop. This process continues unti I al I of the readings have been recorded. The external 1/0 bus is closed with the fol lowing software:

A = INP(252) : OUT 236,A.

The digital information from ports A,B, and C is en- coded and translated to a decimal voltage value. This value is returned to the calling subprogram, MEASURE. 65

Nu I Ii ng Procedure

The nul I tng procedure defines the direction of the fluid velocity at a vertlcCll position, Essentially, one specified voltage channel is monitored, and an array of data points is acquired, at constant angular increments, as the probe is rotated across the flow field. One typ- ical velocity probe response that behaves I ike an odd function is shown in.Fig. 33. One typical probe response that behaves I ike an even function is shown in Fig. 34. There are three nu·1 Ii ng techn I ques inc I uded in. the present software that may be.used to identify the nul I position from the data array. The zero-crossing tech- nique is applied to the data array when the probe response function is expected to act I ike an odd function. This technique I ocates the i nte rva I between data points that contains the change in sign, and thus the zero point, in the voltage data. Within this interval the zero-crossing point is estimated using:

T f i n a I = T k - V k C T k + 1 -T k I V k + 1 -V k where: T = angular position V ~ voltage at T.

The method of least squares technique is employed to approximate the probe response function from the array of data [8]. The I inear least squares routine approx ... imates an odd probe response function with the following equations:

y = co + cl

n n n n 2 < y. x. ) ( x y x. ) 2: * L: - :L L: I i =1 I i =1 i =4 * i =1 co = n 2 n 2 n L x. ( -~ x.) * I - I i =1 i =1 66

0.8

0.6

volts

0.4

0.2

0.0 . 0 deg

-0.2

-0.4

-0.6

Figure 33. Typical Voltage Data Distribution for an Odd Probe Response Function. 67

8.0

7.5

7.0

6.5 volts

6.0

5. 5

5. 0

0 deg -4 5. -30. -I 5 . f) • I 5 . 30. 45. yaw angle Figure 34. Typical Voltage Data Distribution for an .Even Probe Response Function. 68

n n n n * L. x.y. - ( x. ) c 2= y.) . I I 2:: I * l = 1 i =1 i =1 I c, = n 2 n 2 n x. ( 2: x.) * L: I - i =1 .1= 1 I

where: n = number of data points

y ~voltage value x = angular position

The nu! I position is the angular location where the vol- tage is zero. Therefore, the probe nu! I is found using:

x -c /c = 0 1

The second-order polynomial least squares routine approximates an even probe response function. The nu! I position for an even function is defined as the extreme point, the maximum or the minimum. This extreme point is identified in the following equations:

i1'... = c dx 1

n n 4 n 2 n 3 c1 = n*(( L:x.y.)*( L x.) ( _Lx.y.)*(L x.)) .1= 1 I I .1= 1 i = 1 I I i ='= 1 I

n 2 n 2 .n n +CL x.)(( L x.y.)*( I: x.) - ( L x.y.) i=1 I i=1 I I i=1 I i=1 I I

n 2 * c .L: x. ) ) . I= 1 I 69

·n 2 n 2 n n c2 ;::: n*(_(_ L_x.y.)*<:Lx.) - ( ',Lx.y.)*( L:x~)) i=1 I I -i=1 I i-=1 I _I i=1 I n n n 2 n 2 + <2:.x.)*cc'Lx.y.)*

where n,x, and y are defined as above.

As the probe approaches th~ nul I position, the dif- ferential voltage output between samp-les decreases. Also, as the interval distance between samples is reduced, the dif"- ferential voltage output again decreases. In ~his range, high frequency signal noise and low frequency process noise have a greater impact on the measured voltage samples. Digital fil- tering is the manipulation of a field of data with weighting functions. It is employed in noise reduction to relieve the effects of system noise, and to accentuate informative trends, such as maxima and minima, in the data field [9]. The·digital filter used in this system is a differential integrator that is composed of two step furictions, one with a positive weighting factor and one with a negative weighting factor. This filter is sketched in Fig. 35. When the digital filter option is selected in INITIAL, the computer wi 11 prompt the user to choose option 1,2, or 3 to define the approximate nul I position. The filter is described in equation form as follows:

filtered point= positive step + negative step. 70

A r------,

vol ts

{ +)

l I I _____ J 0 m n s data samples

(-)

B k=1

Figure 35. Digital Filter - Spatial Domain. 71

n s Fl LU 2 = A* L VCK+J+M) + C-B)*LVCK+J) k= rn k=1 where: J =one filtered point m = starting point for positive step n = ending point for positive step s = ending point for negative step A = positive weighting factor B = negative weighting factor.

The number of filtered data points that comprise the fi 1- tered array is:

points in array= points in data field - width of negative step

It is assumed that the sampled data is recorded randomly with respect to the signal noise that is associated with the time variance of the signal. As the data p9ints are summed, in effect averaged, across the width of eac.h step function, this noise is eliminated from the filtered data. Figure 36 i I lustrates the response of the combined function in the frequency domain. This frequency is re- lated to the spatial domain rather than to the time domain. Both functions are low-pass filters. However, the negative step function has a smaller frequency range than the positive step function frequency range. The com- bined function, a band-pass filter, results when the fre- quency response of the negative function is subtracted from the frequency response of the positive function, The major spatial frequency in the band-pass function represents the frequency of the probe reponse as a function of angular position. The information in the data that occurs at this frequency is passed through the filter while any other extraneous information is not. Thus, the spatial AR __ -:. =:: .=-:::: :-:---= =-=- -:-. = :-:- -=:-. =--:-:.::: ------...... --·-==.. -=.::.._-:- ._ ...... ··- ...... / . -.....::: ·....:::::...... ' ·~ ...... I "~~ ...... ' . ~:-.... ~' ·.,I.. . \ I I'··' ·., "'·~\, . "\ / \ \, / \ •\ 0 ·- B positive step function negative step function band-pass digital filter

Figur·-e. 36. Digital Filter - Spatial Frequency Domain. 73

data trends are accentuated by this selective filter. The filter may be tuned +o respond to different fre- quency levels by varying the size of t~e two step func- tions. To alter the high frequency response in the band- pass filter, the width of the positive function must be increased or decreased. In Fig, 36, this would move the high cut-off frequency, w8, to points B and B+, respec- tively. To alter the low frequency response of the fil- ter, the width of the negative function must be increased or decreased. This would move the low cut-off frequency, wA, to points A- and A+, respectively. The effective area of both step functions must remain equal, thus, the weighting factors should be adjusted to maintain this equality.

A related consideration in the dev~lopment of the band-pass filter characteristics is the width of the fil- tered array. The purpose of the filter is to determine the extreme point-within the data field. The probability of identifying this point increases with the size of the filtered array. For example, if a field of fifty data points is considered, a filter resulting in an array of five points is less likely to include the extreme point than a filter resulting in an array of twenty points. Also, the sensitivity of the filtered data increases with the width of the filtered array. Therefore, a wide fil- ter is more effective than a narrow filter. The effects of the weighting factors, the size of the data field, and the filter width must be balanced to provide the most effective digital filter. A parametric study should be planned to determine the optimal filter configuration for each probe based upon filter sensi- tivity, noise reduction requirements, and acquisition time. 74

In the INITIAL subprogram, the user may choose one of five nulling procedures that utilize these techniques. The zero-crossing technique and the method of least squares techniques may be used to determine a final nul angle, or they may be used to identify a general null position, which is then refined in the last nul loop using the digital filter technique. Figure 37 i lustrates these nul I procedure options.

STORAGE Subprogram

The final system information at each data point is stored on the system floppy disk in a data file. The STORAGE subprogram opens the data file when a traverse is started. It adds the information acquired at each data point to the data file at the end of the primary loop. The resulting data file is particularly useful for data reduction programs in the TRS-80 and in the IBM 370. It may be transferred directly to the IBM 370. with the terminal package described in Appendix A2.

RETRIEVE Subprogram

The data f i I e may be accessed from the f I oppy disk with the RETRIEVE subprogram. This subprogram is not referenced by the MAIN program. It may be implemented using the statement:

RUN 6120

This program wi I I load the computer memory with the information as it was stored in the data file. 75

ZERO-CROSSING TECHNIQUE loop NL times

METHOD OF LEAST SQUARESi----...---~~~~~~~­ lst ORDER POLYNOMIAL

METHOD .OF LEAST SQUARES 2nd ORDER POLYNOMIAL

METHODS I·, 2, 3 loop for --DIGITAL FILTER NL-I times

Figure 37. Probe Nul I Procedures. 76

V. CONCLUDING REMARKS

The automated data acqulsttion system records an array of data during the vertical traverse of a velocity probe in a fluid flow field. No operator input is rep quired during the traverse after the program parameters are defined by the user at the beginning of the program. The voltage and position information that is acquired during the traverse is stored in a data file on a floppy disk in the TRS-80. After a traverse is completed, the data fl le is transferred through the TRS-80 to the IBM 370 computer, where it is used in a I ready existing data reduction programs. The system software is composed of compact subprograms that support the MAIN operating program. Additions to this software are easily incorporated as subprogra'ms that contrtbute to the MAIN program. The system hardware is extreme I y versat i I e. The STD motherboard arrangement permits general expansion of system capabilities with additional components. In particular, a twelve-bit analog to digital converter wi I I be added to the system. The converter and the supporting circuitry are mounted on an STD-based card which may be plugged directly into the present motherboard. Additional 1/0 stations may also be wired on an STD card and added to the system. In fact, any system additions a re eas i I y accomp Ii shed th rough the STD bus system. From the beginning of the vertical traverse to the uti I ization of the recorded data in a program on the IBM

370, th~ user does not record, manipulate, or transcribe any recorded data. The operator ls I I berated from the monotonous positioning and estimation methods that result in the long hours of data acquisition. The data are 77

acquired during the traverse, and transferred to the mainframe computer in a consistent, systematic manner. Therefore, the possibi I ity of human error, or random error, in the acquisition process is notably reduced. References

I. TRS-80 Model 111 Disk System Owner's Manual, , Ft. Worth, 1980, pp. 91-160.

2. TRS-80 Model 111 Operation and BASIC Manual, Tandy Corporation, Ft. Worth, 1980, p.6 •

3. Series 7000 STD Bus Technical Manual, Pro-Log Corporation, July,1981, p.1-1

4. Goldsborough, P.F., Microcomputer Interfacing With the 8255 PPI Chip, Howard W. Sams and Co., Inc., Indianapolis, 1979, p. 6.

5. ~, p. 44.

6. Stone, R.T., and Berlin, H.M., Design of VMOS Circuits With Experiments, Howard W. Sams amd Co., Inc., Indianapolis, 1980, p.9.

7. Holman, J.P., Experimental Methods for Engineers, McGram-H i I I, New York, I 978, p. 65.

8. ~, p.74.

9. Smith, C.L., Digital Computer Process Control, lntext Educational Pub I ishers, San Francisco, r 912.

10. TRS-80 Model I I I Disk System Owner's Manual, Tandy Corporation, Ft. Worth, 1980.

78 APPENDIX A

79 80

SYSTEM SET-UP

Computer User Action Taken By Prompt Response the Computer

turn on the TRS-80

insert the system disk

press the orange RESET button

CRADIO SHACK text) text) mo/da/yr records the date

hr:mn:sec sets the internal clock

CRADIO SHACK text) TRSDOS ready BASIC loads the BASIC operating program into the computer

How many files? defines the number of disk data files that wi 11 be open at one time

Memory size? 65250 reserves user mem- ory for the machine language program

READY CMD"L","STEP/CMD loads the machine language program 81

SYSTEM SET~UP (continued)

Computer User Action Taken By Prompt Response the Computer

READY RUN "MAIN" loads and runs the BASIC language program MAIN

The fol lowing information exchange occurs between the user and the computer at the beginning of the MAIN program. The computer poses the question, whf le the user defines these key sys~em parameters.

AUTOMATED DATA ACQUISITION PROGRAM ON LINE DESIGNED & PROGRAMMED BY N. L. HERWIG INTERNAL FLOW LABORATORY DEPARTMENT OF .MECHANICAL ENGINEERING VIRGINIA POLYTECHNIC INSTITUTE & STATE UNIVERSITY BLACKSBURG, VIRGINIA 24061 PRESS 'ENTER' WHEN READY 7 TURN ON POWER SUPPLIES. PRESS 'ENTER' WHEN READY. 7 PLUG IN INSTRUMENT CABLES. PRESS 'ENTER' WHEN READY. SHOULD PROBE BE POSITIONED BEFORE START OF DATA ACQUISITION? l=>YES, 2=>NO 7 1 INPUT TRAVERSE MODE. l=>YAW, 2=>VERTICAL. ? 1 lNPUT ANGLE TO BE TRAVERSED IN DEGREES ? 10 INPUT 1 TO CONTINUE POSITIONING, 2 IF FINISHED 7 1 ·INPUT TRAVERSE MODE. !=>YAW, 2=>VERTICAL. ? 2 1INPUT DISTANCE TO BE TRAVERSED IN INCHES ? .001 INPUT 1 TO CONTINUE POSITIONING~ 2 IF FINISHED ? 2 ., .-, lINPUT TRAVERSE DIRECTION FLAG: !=>DOWN, 2=>UP : L iINPUT NO. OF CHANNELS ON LINE

INSTRUMENT FLAGS FOR CHANNELS ON LINE 1=>DISA, 2=>DANA, J=>DATAMETRICS INPUT INSTRUMENT FLAG FOR CHANNEL NO. 1 ? 1 INPUT INSTRUMENT FLAG FOR CHANNEL NO. 2 ? 2 INPUT INSTRUMENT FLAG FOR CHANNEL NO. 3 ? 3 INPUT THE RANGE USED ON THE DATAMETRICS METER 1=>X1 RANGE, 2=>X.1 RANGE ? 1

INPUT NO. OF VERTICAL RANGES ? 3

INPUT NO. OF STEPS IN RANGE NO. 1 ? 10 INPUT STEP SIZE IN RANGE NO. ...1 ? .©01

INPUT NO. OF STEPS IN RANGE NO. 2 ? 10 INPUT STEP SIZE IN RANGE NO. 2 ? .01

-z INPUT NO. OF STEPS IN RANGE NO. w ? 10 INPUT STEP SIZE IN RANGE NO. 3 ? .01 ENTER FOLLOWING DATA GOVERNING PROBE NULLING SELECT METHOD FOR NULLING PROBE. INPUT~ 0=>NON-NULLING MODE !=>ZERO-VOLTAGE SEARCH 2=>ROOT OF LEAST SQUARES, 1ST-ORDER POLYNOMIAL 3=>EXTREMIZATION OF LEAST SQUARES. 2ND-ORDER 4=>METHODS 1, 2, OR 3 COME.I NED WITH A DIGITAL FILTER FOR THE LAST NULL LOOP? 4 SELECT METHODS FOR THE FIRST NULL PASSES -

INPUT NO. OF PASSES THROUGH NULL LOOP ? 3

INPUT YAW STEP SIZE FOR NULL PASS NO. 1 ? 5 INPUT NO. OF POINTS IN NULL PASS NO. 1 ? 5

INPUT YAW STEP SIZE FOR NULL PASS NO. 2 ? 5 INPUT NO. OF POINTS IN NULL PASS NO. 2 ? 5

INPUT YAlrJ STEP SIZE FOR THE LAST NULL PASS 15>7 15

INPUT CHANNEL NO. USED FOR NULLING ? 3 INPUT TIME DELAY BEFORE DATA ACQUISlTION CSEC> ? 20 INPUT NO. OF SAMPLES TO BE ACQUIRED ? 10 INPUT TIME DELAY BETWEEN SAMPLE POINTS

ENTER FOLLOWING DATA GOVERNING MEASUREMENT IN THE MEASUREMENT PROCEDURE FOR CHANNEL 1 INPUT TIME DELAY BEFORE DATA ACQUISITION ? 20 INPUT NO. OF SAMPLES TO BE ACQUIRED 7 10 INPUT TIME DELAY BETWEEN SAMPLE POINTS ? 0 INPUT NO. OF SAMPLES TO BE ACQUIRED ? 10 INPUT TIME DELAY BETWEEN SAMPLE POINTS CSEC> ? 1 IN THE MEASUREMENT PROCEDURE FOR CHANNEL 3 : INPUT TIME DELAY BEFORE DATA ACQUISITION ? 0 INPUT NO. OF SAMPLES TO BE ACQUIRED ? 10 INPUT TIME DELAY BETWEEN SAMPLE POINTS (SEC> 7 1

INPUT INITIAL VERTICAL POSITION CIN. > 7 .001 INPUT INITIAL YAW POSITION ? 280,.2 INPUT YAW CORRECTION ANGLE

84 85

STEP/CMD Subprogram Information

The machine language STEP/CMD subprogram is accessed using the DEBUG capab i Ii ti es in the TRS-80 [IO]. The fo I I owing commands w i I I a I I ow the user to access this program from the TRSDOS language:

LOAD STEP/CMD DEBUG

The program I isting as it appears in DEBUG is as fol lows:

FEF0 0000 0000 0000 0000 0000 16FF 0E10 ED51 FF00 3AE3 FFE6 0228 0621 E8FF C310 FF21 E8FF FF10 11F0 FF01 0400 ED80 3AE2 FFE6 0228 1521 FF20 F0FF 1604 0604 C806 10FC 2315 20F5 3AE5 FF30 FFC3 37FF 3AE4 FF4F 21F0 FF7E 8928 0423 FF40 C338 FF00 0000 0000 0000 0000 3E02 32DD FF50 FFE5 21E0 FF5E E100 003E FFA3 2827 0600 FF60 560E 10ED 5123 3EF4 8020 0321 F0FF C5ED FF70 4BDE FFCD 6000 C1D5 CD2B 00FE 0001 203A FF80 10DE 1020 D43A DOFF 3028 0F32 DOFF E521 FF90 E1FF 4604 E 11E 01C3 60FF 283E EFBD 2002 FFA0 2EF3 3AE2 FFFE 0128 077E 32E5 FFC3 B4FF FFB0 7E32 E4FF 1~·FF 0E10 ED51 C9FF 00FF 00FF FFC0 00FF 00FF 00FF 00FF 00FF D7FF 00FF 00FF FFD0 0 10 1 00FF 00FF 00FF 00FF 00FF 0001 0A01 FFE0 0088 0102 FC3F 0000 F9FC F6F3 F6FC F9FF FFF0 F3F6 FCF9 F2FF 0000 00FF 00FF 00FF 00FF 86

The permanent and the temporary storage areas in the STEP/CMD program a re defined as fol lows:

location contents FFDD MSB/LSB loop flag FFDE time delay between steps FFDF FFEO MSB counter FFEI LSB counter FFE2 motor flag temporary I-motor #I , 2-motor #2 section FFE3 direction flag 1-CCW, 2-CW FFE4 1st output value i n next sequence- motor #I FFE5 1st output value i n next sequence- motor #2 FFE8 FFE9 forward stepping sequence FFEA FFEB FFEB FFEC reverse stepping sequence FFEE FFED

FFFO permanent FFFI current stepping sequence section FFF2 { FFF3

A description of the program commands is included in the next few pages. 87

· Opcode Mnemonic Operation

FEFA 16 LO D,FF load D register with 25510 FF OE LO C, 10 load c with address 1610 10 ED OUTCC),0 output 51 25510 to port 1610 FFOO 3A LO A,CFFE3) load A with the direction E3 of rotation FF flag E6 AND 2 AND with 02 210; ze ro-fo rwa rd nonzero-reverse 28 JR Z,06 i f forward 06 jump to FFOD 2f LO HL,FFEB load HL with starting ad- EB dress of reverse FF sequence C3 JP FFIO jump to FFlO 10 FF 21 LO HL,FFE8 load HL with starting ad- ES dress of forward sequence FF FFIO I 1 LO DE,FFFO load DE with the address FO for the 1st sequence number i n FF t h.e temp. storage section 01 LO BC,0004 set BC counter 04 =410 00 NOP no operation ED LDIR load DE with the contents of BO location CH L) , increment HL and DE, decrement BC and jump to FFl5 if BC ;t:Q 3A LO A,CFFE2) load A with the motor number E2 flag FF E6 AND 2 compare to 210 ; zero- motor 2 02 nonzero- motor I 28 JR,Z,15 jump on zero to FF34 15 88

21 LD HL,FFFO load HL with address of the FF20 FO 1st number in current se- FF quence. 16 LD D,04 load D with 04 410 06 LD B,04 load B with 04 410 CB RLC (HU rotate the number in loca- 06 ti on HL right one bit 10 DJNZ, FF26 decrement B, jump to FF26 FC if B~O 23 INC HL increment HL 15 DEC D decrement D 20 JR NZ, to FF24 jump to FF24 i f 010 F5 3A LD A,(FFE5) load A with the starting E5 output number for motor #2 FF30 FF C3 JP to FF37 jump to FF37 37 FF 3A LD A,CFFE4) load A with the starting E4 output number for motor #I FF 4F LD C,A load c with this n umber 21 LD HL,FFFO load HL with the first ad- FO dress in the current sequence FF 7E LD A, CHU load A with contents of lo- cation CH L) 89 c comp a re this number to the starting output number z~ro-equa I ,nonzero-not equal 28 JR NZ to FF43 jump to FF43 i f nonzero 04 23 INC HL increment the sequence num- ber pointer FF40 C3 JP to FF3B jump to FF3B 38 FF 89

FF43 3E LO A,02 load A with 2 02 10 32 LO (FFDD),A load location FFDD with A (flag for MSB and LSB loops) FF50 FF E5 PUSH HL save the contents of HL 21 LD HL,FFEO I oa d HL with MSB counter EO location FF 5E LD E, CHU load E with the MSB counter El 00 NOP 00 NOP 3E LO A,FF load A with 25510 FF A3 AND E AND with the MSB value zero-MSB=O, nonzero-MSB=O 28 JR Z,27 jump on zero to FF85 27 06 LD B,00 load B with 25610 00 FF60 56 LD D,(HU load D with the output number i n location CHU OE LD C, I 0 load c with 1610 10 ED OUTCC),D output this number to port 51 16 23 INC HL increment the sequence pointer 3E LO A, F4 load A with F4 to see if HL F4 pointer exceeds FFF3 BD CP L compare A with L . , zero-equa I 20 JR NZ,03 jump to FF62 i f non-zero 03 21 LO HL,FFFO load HL with FFFO FF60 FO FF C5 PUSH BC save the contents of BC 90

ED LD BC,FFDE load BC wi~h the time delay FF70 48 value DE FF CD ca I I DELAY cal I the delay subroutine 60 00 Cl POP BC return the value to BC 05 PUSH DE save the contents of DE CD call $KBCHAR cal I the keyboard scan sub- 28 routine; key pressed-nonzero 00 FE CP A and 0 compare A to O; zero-no key 00 pressed, nonzero-key pressed DI POP DE return value to DE 20 JR NZ,3A jump to FFB4 on nonzero 3A FF80 10 DJNZ,DE decrement B and jump to FF54 DE if 8'10 ID DEC E decrement E 20 JR NZ,04 jump to FF52 if E#O 04 3A LD A,CFFDD) load A with MSB,LSB flag DD 2-MSB I oop, I -LSB I oop FF 30 DEC A decrement MSB,LSB flag 28 JR Z,OF if A=O then jump to FF98 OF 32 LD CDDFF) ,A load FFDD with the MSB,LSB DD flag FF E5 PUSH HL save the contents of HL 21 LD HL,FFEI load HL with the LSB value FF90 El position FF 46 LD B, CHU load B with the LSB value 04 INC B increment the LSB counter 91

El POP HL return value to HL IE LD E,01 load E with f fO 01 C3 JP to FF60 jump to FF60 60 FF 28 DEC HL decrement HL- to point to last value that was output 3E LD A,EF load A with EF to see if HL EF value is less than FFFO 80 CP L compare A to L; zero-equal 20 JR NZ,2 jump to FFAI on nonzero re- 02 su It FFAO 2E LD L,F3 load L with F3 if HL was F3 equal to FFEF 3A LO A,(FFE2) load A with the motor number E2 flag FF FE CP 01 comp~re the flag to I 10 ; 01 zero-motor #2,nonzero-motor #I 28 JR NZ, 07 jump to FFBO if result is 07 nonzero 7E LO A,(HL) !oad A with the last number to be output.to motor #2

32 LO (FFE5l,A save this value in FFE4 E5 (the 1st value to be output FF next time) C3 JP to FF84 jump to FFB4 84 FF FF80 7E LD A,

92 93

TERMINAL PROCEDURE

The terminal program was developed by R.C. Kirk at Central Michigan University.

Computer User Action Taken By Prompt Response the Computer

turn on the TRS-80

insert the terminal disk

press the orange RESET button .

CRADIO SHACK text) mo/da/yr records the date

hr:min:sec sets the internal clock

(RADIO SHACK tBxt) TRSDOS ready SETCOM CWORD=7,BAUD=300,STOP=I ,PARITY=!, NOWAIT) sets the internal communications parameters

TRSDOS ready LOAD HTERM3/CIM I o a d s ma c h i n e I a n- g u age terminal program

TRSDOS ready BASIC loads the BASIC operating program into the computer 94

TERMINAL PROCEDURE Ccontinuerl)

How many files? defines the number of data f i I es that wi 11 be open con- currently

Memory size? 65250 reserves user mem- ory for the machine language program

READY RUN "TERM3/BAS" loads and runs the BASIC language term- mina I program

The text on the fo I I owing pages i I I ustrates the exchange between the user and the computer during the terminal program execution. INTELLIGENT TERMINAL PROGRAM REMEMBER TO DO THE ·'SET COM' Y /N? Y INDICATE IF YOU ARE RUNNING THE ( D 32K OR ( 2) 48K SYSTEM ? 2 INTELLIGENT TERMINAL PROGRAM 'CONTROL KEY' FUNCTION: SIMULATANEOUSLY PRESS TO CONTINUE? IF SHIFTING DATA FROM TRS, THE PROGRAM SENDS A LINE, THEN LOOPS UNTIL ONE OF THE FOLLOWING CUES/RESPONSES IS RECEIVED: ASCII HEX/DEC EFFECT 1. NUL 00/00 (CONTINUOUS FEED, NO LOOP AFTER CR) 2. LF 0A/10 (LOOP UNTIL LINE FEED IS RECEIVED --C.D.C.) 3. ) 3E/62 (LOOP UNTIL CARAT 'READY' IS RECEIVED--UNIVAC) 4. USER (USER INPUTS E> Y !=TERMINAL MODE 2=RECEIVE DATA 3=SEND DATA 4=INSTRUCTIONS ENTER NUMBER OF SELECTION: 3 DATASHIFTER PERFORM THE FOLLm,JING (IN SEQUENCE) : 1. PREPARE ASCII DISK FILE TO SEND 2. PREPARE MAINFRAME TO RECEIVE 3. SEND DATA TO MAINFRAME 4. Et,ID DATASHI FTER, RETURN TO MAIN PROGRAM MENU ENTER CHOICE: 1 SHIFT DATA FROM DISK TO RAM BUFFER INSERT DATA DISK AND ENTER FILE NAME? D1124A/DAT LOAD THE ENTIRE FILE ? N STARTING RECORD NUMBER? 0 ENDING RECORD NUMBER? 10 2 8 0 0 0 171 1 1 21 1E-03 40 2E-03 20 5E-03 20 • 01 20 .02 20 .05 20 . 1 10 . 2 ENDED 102 CHARACTERS ( 11 LINES> PLACED IN RAM 0.3% OF THE RAM BUFFER IS FILLED

DO YOU ~'lANT TO ADD A SPECIAL CONTROL CHARACTER TO THE EMD OF THE DATA BUFFER CY/N)? N PERFORM THE FOLLOWING

welcome to virginia tech vm timesharing system vml

.LOGON HARSHMD MUSTANG LOGON AT 20:38:57 ON FRIDAY 11/26/82 CMS 1.13/SP-VT03 VM3 09/28/82

Y (19E) R/O F (5CE) R/O R; E SAMPLE DATA CP TERM PROMPT ) DEFAULT FORMAT NEW FILE: SAMPLE DATA- Al EDIT: >I INPUT: ) PERFORM THE FOLLOl..J I NG ( IN SEQUENCE> :

1. PREPARE ASCII DISK FILE TO SEND 2. PREPARE MAINFRAME TO RECEil.)E 3. SEND DATA TO MAINFRAME 4. END DATASHIFTER, RETURN TO MAIN PROGRAM MENU ENTER CHOICE: 3

TRANSMISSION SPEED ( 0=FAST TO 5=SLOl-

FINISHED!HIT TO CONTINUE? RETURNING TO TERMINAL MODE. )

EDIT: >FILE SAMPLE DATA Al R; APPENDIX B

99 100

OPEN EXTERNAL 1/0 BUS

OPERATOR PROMPT FOR POWER SUPPLIES

SET CHANNEL COUNTER l=O

INDEX CHANNEL COUNTER i;--11---. l=l+I

OUTPUT MODE CONTROL WORD TO PPI FOR I th CHANNEL

OUTPUT METER-HOLD RELEtKE SIGNAL JO I CHANNEL

NO

OPERATOR PROMPT FOR INSTRUMENT AND MOTOR CABLES

CALL INITIAL

A

Figure 38. Detatled Program Flow~hart. I 0 I

A SET PO I NT COUNTER l=O

SET RANGE COUNTER R=O

INDEX RANGE COUNTER R=R+I

SET STEPS/RANGE COUNTER NSCRl=O

INDEX STEPS/RANGE COUNTER NSCRl=NSCRl+I

INDEX POINT COUNTER I= I +I

YES

B

YES

CALL STEPPER MOVE PROBE TO ARCNLl

SET DATA COUNTER Q=O

E D c B F

Figure 38. Ccontinuedl 102

E D c B F INDEX DATA COUNTER Q=Q+I

CALL MEASURE

YES

ZERO-VOLTAGE SEARCH

METHOD OF 2 1----i LEAST SQUARES >------1 lsi" ORDER POLYNOMIAL

METHOD OF 1--.,_-- 3 2nd ORDER --•---t POLYNOMIAL

IGITAL FILTE 4 ON LAST NULL ,_.__ _. _ _... PASS

CALL STEPPER ""'""1--lMOVE PROBE TO NULL POINT

NO

N M L

Figure 38. (continued) 103

N M L

SET CHANNEL COUNTER Q=O

INDEX CHANNEL COUNTER Q=Q+I

CALL MEASURE

YES

CALL STORE

NO

NO

END

Fi g u re 3 8 . Cc on t i· nu e d l 104

enter from MAIN for initial positioning before start of program ®

#2

Input input rotational translational movement movement variables variables

reduce to enter from MA I N-7 binary ® information

define the number of STEP/CMD calls

store values for 65536 steps

loop NC times ca I I STEP/CMD

store values for remaining steps

ca I I RETURN STEP/CMD to MAIN

Figure 39. STEPPER Subprogram. 105

~nter from STEPPER

interpret stepping commands

motor load steppin ______12 ,...sequence into temp. storage rotate each member of motor #I sequence to upper 4 bits

output ------1 stepping word to port 16 loop for ST times, where ST= # of step delay between stepsi------'

save ending locations

RETURN to STEPPER

Figure 40. STEP/CMD Subprogram. 106

ca I I INPUT

calculate average and standard deviation

apply Chauvenets' criterion

calculate new average

calculate new standard deviation

RETURN to MAIN

Figure 41 MEASURE Subprogram. 107

enter from MEASURE

in it i a I time delay (TA)

input values from al I ports CA,B, C)

intermediate time delay CTB) loop 8 times

encode decimal value DV()=I 3 adjust value adjust value adjust value for DISA for DANA fol DATAMETRIC voltmeter voltmeter manometer

calculate final value

RETURN to MEASURE

Figure 42. INPUT Subpr-ogram. 10 '********************** MAIN PROGRAM *********************** 20 • TRAVERSE CONTROL & DATA ACQUISITION PROGRAM 30 ' DESIGNED & PROGRAMMED BY N. L. HERWIG, SUMMER/FALL, 1982 40 1 50 •CONTROLS VERTICAL & YAh POSITION OF P~OBE. CONTAINS 5 60 'ALGORITHMS FOR NULL-POINT ESTIMATION. ACQUIRES DATA FROM 70 'MAX OF 5 CHANNELS & RECORDS ON TRS-80 DISKETTE. DEFINITION 80 'Of VARIABLES: 90 1 ARU ONE-HALF OF INCLUDED YAW ANGLE USED IN ACQUIRlNG 100 ' VECTOR Of DATA FOR NULL-POINT ESTIMATION 110 1 B NO. OF SAMPLES ACQUIRED 120 ' 8() NO. OF SAMPLES ACWUIREO PER CHANNEL 130 ' BC(} VECTOR OF BINARY COOED DIGITS 140 • Bl() BACKLASH COMPENSATION CONSTANTS 150 ' DI VERTICAL TRAVERSE DIRECTION FLAG. l=>DOWN,2=>UP. 160 • DJ{} SEARCH INCREMENT USED IN ACQUIRING VECTOR Of DATA 170 ' FOR NULL-POINT ESTIMATION 0 180 ' DZIJ VECTOR OF STEP-SIZE/VERTICAL RANGE co 190 • f NULL-LOOP FOR-TC-NEXT COUNH:F. 200 1 FL NULL METHOD FLAG. O=>NON-NULLING MOOE,l=>ZER0- 210 1 VOLTAGE SEARCH,2=>MEHiOD OF LEAST SQUARES,lST-ORDER 220 1 POLYNGMIAL,3=>MEJH~D OF LEAST SQUARES, 2ND-OKOER 230 1 POLYNOM1Al 14=>METHODS 112,0R J COMBINED WITH A 235 ' DIGITAL FILTER. 240 ' H DUMMY VARIABLE FGR 1/0 250 1 I VERTICAL STEP COUNTER 260 ' J MOTOR CONTROL FLAG. l=>YAW, 2=>VERTICAL. 270 1 K MAGNITUDE OF MOTION FED TO STEPPER SUBPROGRAM 280 ' Kl FOR-TD-NEXT COUNTER USED IN STEPS/RANGE LOOP 290 1 L TRAVERSE MOTION FLAG. 1=>(-), 2=>(+) MOTION. 300' LL() VECTOR STORING PREVIOUS DIRECTIONS OF MOTION 310 ' M DUMMY VARIABLE USEO IN FDR-TU-NEXT LOOPS & NULL- 320 • POINT ESTIMATION LOOP 330 • 110 FLAG FOR APPLICATION OF CHAUVENEl 1S CRITERIA TO 340 I VARIOUS CHANNELS OF DATA 350 • NL NO. Of PASSES THROUGH NULL-POINT EST LOOP 360 • NP() NO. OF AVERAGED DATA POINTS ACQUIRED PER PASS FOk 370 • NULL ANGLE ESTIMATION 380 • NSI> NO. OF SfEPS PER VERTICAL RANGE 390 • PC DEVICE CODE FOR PORT C 400 • PM DEVICE CODE FOR PORT MONITORED BY INPUT SUBPROG 410 ' PN CHANNEL NO. USED FOR NULING 420 • PO YAW ANGLE CORRECTION MOTION FLAG 430 • PR CONTROL PORT DEVICE CODE 440 Pl VERTICAL TRAVERSE POLARITY FLAG. +l=>UP,-l=>DOWN. '(w-50 '• Q FOR-TO-NEXT COUHTER 460 • R TOTAL NO .. RANGES 470 • RA CURRENT-RANGE COUNTER 0 480 ' s NO. OF CHANNELS ON LINE (MAX OF 5) l.O 485 • SS NO. STEPS TAKEN BY YAW STEPPER MOTOR 490 • TA TIME DELAY BEFORE STARr OF DATA ACQUISITION 500 • TB TIME DELAY BETWEEN SAHPlE POINTS 510 ' TH() YAW POSITIONS 520 ' TMO YAW ANGLES GENERATED FOR NULL-POINT ESTIMATION 530 • TN ESTIMATED NULL POINT 540 I Tl (J TIME DELAY BEFORE START OF DATA ACQUISITION 550 • T2() TIME DELAY BETWEEN SAMPLE POINTS 560 t VA() AVERAGED DATA GENERATED BY MEASURE SUBPROGRAM 570 • Vl(.J MEASURED DATA 580 • YC YAW CORRECTION ANGLE 590 • YP YAW CORRECTION MOTION FLAG. SAME AS L • 600 ' l DUMMY VARIABLE FGR I/O 610 • Z() VERTICAL POSITIONS 620 I 630 OEFUSRl=&HFEFA 640 DIM BCl31.Bl(2J,ll(2) 650 st. ( U=l5: Bl. ( 2)=150 660 CtS 670 PRINTa267, "AUTOMATED DATA ACQUISITION PROGRAM ON LINE" 680 PRINTd333, "DESIGNED & PROGRAMMED BY N. L. HERWIG" 690 PRINT0>404, •INTERNAL FLOW LABORATORY"' 700 PRINTGl462, •DEPARTMENT OF MECHANICAL ENGINEERING" 710 PRINTa519, •VIRGINIA POLYTECHNIC INSTITUTE" 720 PRINT@550, "& STATE UNIVERSITY• 730 PRINT@594, "BLACKSBURG, VIRGINIA 24061 11 740 PRINTa832, n n 750 INPUT "PRESS 'ENTER' WHEN READY n;z 760 CLS 770 • 780 'OPEN EXTERNAL I/O BUS 790 • 800 H=lNP(252J OR 16: our 236.H 0 810 • 820 •PROMPT OPERATOR TO TURN ON POWER SUPPLIES 830 • 840 PRINT "TURN ON POWER SUPPLIES. "; 850 INPUT "PRESS 'ENTER' WHEN READY. n;z 860 • 870 1PREPARE DATA STATIONS (SET TO HIGH POTENTIALS) FOR 880 'VOLTMETER & STEPPER MOTOR CONNECTIONS 890 • 900 OUT 19.128: OUT 16,255: OUT 17.255: OUT 18.255 910 FOR M=l TO 5: PC=l8+M*4: PR=PC+l: OUT PR,147: 920 OUT PC, 16: NEXT M 930 I 940 'PROMPT OPERATOR TO CONNECT All INSTRUMENT CABLES 950 • 960 PRINT 11 u 970 PRINT "PLUG IN INSTRUMENT CABLES. u; 980 INPUT "PRESS 'ENTER' WHEN READY. ";Z 990 • 1000 'PROMPT OPERATOR FOR INITIAL POSITIONING 1010 t 1020 PRINT II II 1030 PRINT "SHOULD PROBE BE PUSITIONED BEFORE START OF DATA" 1040 INPUT "ACQUISITION? l=>YES. 2=>NO ";l 1050 IF Z2 THEN GOIC 1030 1060 If Z=l GOSUB 3740 'CALL STEPPER SUBPROGRA~ 1070 GOSUB 2030 'CALL INITIAL SUBPROGRAM 1080 ' 1090 'TOP OF TRAVERSE LOOP 1100 • 1110 I=O: FOR RA=l TO R: FOR Kl=l TO NS(RA}: l=I+l 1120 • 1130 'MOVE PROBE TO VERTl£Al POSITION 1140 I 1150 IF I=l THEN l(l)=l(I-1): GOTO 1180 1160 J=2: L=DI: K=Ol(RAJ: GOSUB 3990 'CALL ST.EJ>PER SUBPROGRAM 1170 Z(IJ=Z(l-l}+K*P2 1180 PRINT "lt";I;")=";Zil) 1190 TH(IJ=TH(l-1) 1200 IF Fl=O THEN GOTO 1650 1210 • 1220 'TOP OF YAW POSITIONING LOOP 12.30 ' 1240 TA=ll{OJ: TB=T2fO): 8=6(0): PM=PN 1250 fQR f=l TO NL 1260 J'=l: L=l: K=AR(F): GDSUB 3990 'CALL STEPPER SUBPROGRAM 1270 TH{l)=JH(ll-SS*0.036 1280 I 1290 •ACQUIRE VECTOR Of DA TA FOR NULL POINT EST I MAT ION 1300 I 1310 l=2: K=OT(f): M=NP(f): t'.D=o: FOR Q=l TOM 1320 GOSllB 4400 1CAlL MEASURE SUBPROGRAM 1330 HUQl=THC I) 1340 PRINT "lM(";Q;">= 0 ;TM{Ql;"VA(";Q;"l=";VA(Ql;TlMES 1350 If Q=M THEN GOTO 1380 1360 GOSUB 3990 'CALL STEPPER SUBPROGRAM 1370 TH(ll=TH(l)+SS*0.036 1380 NEXT Q 1390 • 1400 'CALL NULL ESTIMATION ROUTINE WITH FULL VECTOR OF DATA 1410 I 1420 If F=NL ANO fO=l THEN TA=Tll6):TB=T2(6):B=8(6):Q=6:GOTO 1470 1430 ON FL GOTO 1440 ,1450 ,1460 11470 1440 GOSUB 5270 : GOTO 1510 N 1450 GOSUB 5360 : GOTO 1510 1460 GOSUB 5470 : GOTO 1510 1470 GOSUB 5750 : GOTO 1510 1480 I 1490 'MOVE PROBE TO ESTIMATED NULL POSITION 1500 ' 1510 K=TH(l)-TN: L=l: J=l: GGSUB 3990 1CALL STEPPER SUBPROGRAM 1520 TH{l)=TH{l)-SS•0.036 1530 PRINT nesTIMATEO NUlL ANGLE=";TH(IJ 1540 NEXT f 1550 ' 1560 'MOVE PROBE FOR YAW CORRECTION 1570 ' 1580 L=YP: K=YC: J=l: IF K=O THEN GOTO 1650 1590 GOSUB 3990 'CALL STEPPER SUBPROGRAM 1600 TH(l}=TH(l)+PO*SS*0.036 1610 PRINT "NULL ANGLE+YAW CO.RRECTION=u;nu I) 1620 • 1630 1 PERFORM MEASUREMENT FOR AU .. CHANNELS 1640 • 1650 FOR Q=l TO S: PM=Q: MO=Q: B=B(QJ: TA=Tl(Q): TB=T2(Q) 1660 GOSUB 4400 'CALL MEASURE SUBPROGRAM 1670 Vl(l,QJ=VA(QJ 1680 NEXT Q 1690 IF Fl=O THEN GOTO 1770 1700 • 1710 'RETURN PROBE TO NULL POSITION 1720 • 1730 IF K=O THEN GOTO 1770 1740 l=l: IF YP=l THEN L=2 1750 GUSUB 3990 'CALL STEPPER SU8PROGRAM 1760 THCl)=THIIl-PO*SS*0.036 1770 GOSUB 6040 1CALL DATA STORAGE SUBPROGRAM 1780 NEXT Kl: NEXT RA 1790 END 1800 t 181{) I 1820 '***************** INITIAL SUBPROGRAM **************~***** 1830 'PROMPTS OPERATOR FOR USER-SUPPLIED PARAMETERS GOVERNING 1840 'THE DATA ACQUISITION PROCESS. DEFINITION OF VARIABLES 1850 '(SEE PREVIOUS LIST FOR ITEMS NOT INCLUDED HERE): 1860 ' Cf(j VECTOR OF COEFFICIENTS FDR APPLICATION Of 1870 ' CHAUVENET'S CRITERIA 1880 ' DA () VECTOR OF ENCDOED DATA FROM PDRT A 1890 ' 08 () VECTOR OF ENCODED OAT A FRUM PORT B 1900 ' DC() VECTOR Of ENCODED DATA FROM PORT L 1910 ' DV() VECTOR OF INSTRUMENT FLAGS: l=>DISA, 2=>0ANA, 1920 I 3=>DATAMETRICS. 1930 1 G() VECTOR Gf GAIN FACTORS FOR DATAMETRICS UNITS 1940 ' MM{) VECTOR OF GAIN FACTORS FOK DATAMETRICS UNITS 1950 1 NN DUMMV VARIABLE 1960 ' N$ DISK DATA FILE NAME 1970 1 PP TOTAL ND. DATA POINTS 1980 1 RN() VECTOR Of VOLTAGE RANGE FOR DATAMETRICS UNITS 1990 1 V{J VECTOR Of DATA ACQUIRED HY INPUT SUBPROGRAM 2000 • VF() REMAINING VO DATA AFTER APPLIC.ATlON GF 2010 1 CHAUVENET'S CRITERIA 2020 • 2030 DIM fI{l0),Tlt6l,T2(6)•8(6)•CF{6) 2040 DEF FNCCNJ=.8189205+.54t0019*LOG(N)-.02345955*LOG(N)_2 2050 ' 2060 PRINT " o 2070 INPUT "INPUT TRAVER SE DIRECT ION FLAG: l=>DOWN, 2=>UP 0 ; DI 2080 IF Ol2 THEN GOTG 2070 2090 P2=i.O: IF DI=l THEN P2=-l.O 'SET TRAVERSE POLARITY FLAG 2100 INPUT "INPUT NO. Of CHANNELS ON LINE (MAX Of 5) ";S 2110 IF S5 fHEN GOTC 2100 2120 DIM OV{S),RN(S),G(S},MM(SJ 21.30 I 2140 PRINT u n 2150 PRINT "INSTRUMENT FLAGS FOR CHANNELS GN LINE" 2160 PRINT "l=>DISA, 2=>DANA, 3=>DATAMETRICS" 2170 FOR M=l TO S 2180 PRINT "INPUT INSTRUMENT FLAG FOR CHANNEL NO.";M;n "; 2190 INPUT OVOO 2200 IF DVUO3 TliEN GOTO 2080 2210 IF OV(M) <> 3 THEN GOTO 2270 2220 PRINT "INPUT THE RANGE USED ON THE DATAMETRICS MEIER" 2230 INPUT "l=>Xl RANGE, 2=>X.l RANGE ";RN(M) 2240 IF RN(M)2 ThEN GOTO 2220 2250 IF RN(M)=2 THEN RN(Ml=lO 2260 G(M)=lO/RN(MJ: MM(M)=G(M)*lOO 2270 NEXT M 2280 I Vl 2290 P.RINT n " 2300 INPUT "INPUT NO. OF VERTICAL RANGES ";R 2310 If RB THEN M=R: GOTO 2330 2430 NEXT 1"1 2440 NS(l}=NS(l)+l: PP=PP+l 2450 DIM ZlPP),THIPP),Vl(PP 9S} 2460 • 2470 PR.INT " n 2480 PRINT HENTER FOLLOWING OATA GOVERNING PROBE NUllINGH 2490 PRINT "SELECT METHOD FOR NULLING PROBE. INPUT:u 2500 PRINT" O=>NON-NULLING MODE" 2510 PRINT " l=>ZERO-VOLTAGE SEARCH" 2520 PRINT • 2=.>METHOD Of LEAST SQUARES, lST-ORDER POLYNOMIAL" 2530 PRINT " 3=>M.ETHOD OF LEAST SQUARES, 2ND-ORDER PGLYNOMIALH 2540 PRINT u 4=>METHODS 1121 OR 3 COMBINED WITH A DIGITAL FILTER" 2550 INPUT " FOR THE LAST NULL LDOP";fl 2560 IF FL4 THEN GOTO 2490 2570 PRINT n " 2580 If fl=O THEN GOTO 3100 2590 IF FL<>4 THEN GOTO 2650 2600 FD=l 2610 PRINT 11 SELECT METHODS FOR THE FIRST NULL PASSES -" 2620 INPUT "(METHOD lilt OR 3)"Jfl 2630 IF FL3 THEN GOTO 2610 2640 PRINT tt tt 2650 INPUT "INPUT NO. Of PASSES THROUGH NULL LOOP tt;NL 2660 PRINT " " 2670 IF NL<=O GOTO 2770 2790 PRINT "INPUT NO. OF POINTS IN THE LAST NULL PASS -" 2800 INPUT •(MUST BE >15)";NP(M) : IF NP(M)NN THEN NN=NP(M) 2850 NEXT M 2860 DIM TMCNNl.VA(NN) 2870 INPUT "INPUT CHANNEL NO. USEll FOR NULLING ";PN 2880 IF PNS THEN Gore 2870 2890 PRINT II .. 2900 IF NL=l ANO FO=l GOTO 3010 2910 PRINT "INPUT TlHE DELAY BEFORE DATA ACQUISITION (SEC) "; 2920 INPUT THO) 2930 IF Tl(O)2 THEN CF(O)=FNC(B{O)l 2980 PRINT 0 INPUT TIME DELAY BETWEEN SAMPLE POINTS (SEC) "; 29'90 INPUT T210) 3000 IF T2{0)(0 THEN GOTO 298-0 : If FD<>l GOTO 3100 3010 PRINT •INPUT TIME DELAY BEFORE DATA ACQUISITION IN THE" 3020 INPUT "DIGITAL FILTER NULL LOOP ISEC)«; T1(6) 3030 PRINT •INPUT NO. OF SAMPLES TO BE ACQUIRED IN THIS LOOP" 3040 INPUT 6(6): If 8(6)<1 THEN GOTO 3030 3050 IF 8(6)=1 THEN T2{6)=0: GOTO 3100 3060 Cf(6J=FNC{8(6)) 3070 PRINT "INPUT TIME DELAY BETWEEN SAMPLE POINTS " 3080 INPUT "IN THIS LOOP (SEC)";T2(6): If T2(6l ";T2{M) 3210 IF T2{M)(0 THEN GOTO 3200 3220 PRINT " tt 3230 IF 8(M)>2 THEN Cf{H,=FNC(8(M)) 3240 NEXT M 3250 'DETERMINE MAX ND. Of PO.INTS IN AN AVERAGE OJ 3260 NN=B(OJ: FOR M=l ro s: IF B{HJ>NN THEN NN=BIMJ .3270 NEXT M 3280 DIM VINN),Vf(NN),OA{NNJ,DB(NNl,OCINNl 3290 • 3300 INPUT "INPUT INITIAL VERTICAL POSITION f IN.l ";Z(O) 3310 INPUT "INPUT INITIAL YAW POSITION lDEGl "iTH(O) .3320 IF Fl=O THEN GOTO .3400 3330 INPUT •INPUT YAW CORRECTION ANGLE (DEG) ";YC 3340 IF ABSlYC))360 THEN GOTO 3330 3350 PRINT n " 3360 'SET SIGN DIRECTION FLAGS FOR YAW CORRECTION ANGLE 3370 YP=2: PO=l.O 3380 IF YC

\.0 3430 I 3440 • 3450 '******************* STEPPER SUBPROGRAM **************'**** 3460 'CONTROLS 2 STEPPER MOTORS GOVERNING VERTICAL & YAW 3470 'POSITIONS Of PROBE. DEFINITION Of VARIABLES (SEE PRE- 3480 'VIOUS LISTS FOR ITEMS NCT INCLUDED HERE): 3490 1 H OUTPUT TO ENABLE PPI 3500 1 IT FOR/TO/NEXT COUNTER 3510 ' MS MOST SIGNIFICANT BYTE OF 2-BVTE LONG 3520 I WORD ST 3530 ' NC NO. OF BIG STEPS REQUIRED WHERE A BIG 3540 ' STEP IS 65536 STEPS OF A STEPPER MOTOR 3550 ' ST (1) TOTAL NO. OF STEPS REQUIRED OF A STEPPER 3560 ' MOTOR. OR (2) THE REMAINING NO. OF STEPS 3570 • REQ'D AFTER NC*65536 STEPS HAVE BEEN TAKEN. 3580 1 X DUMMY VARIABLE FOR CALLING MACHINE LANGUAGE 3590 1 SUBPROGRAM N 3600 ' Y CONTINUATION FLAG IN INITIAL POSITIONING 0 3610 ' LOOP. l=>CONTINUE, 2=>REfURN TO MAIN. 3620 • 3630 'DEFINITION OF MEMDRY LOCATIONS ACCESSED: 3640 I -29 MOTOR DIRECTION. l=>(-)• 2=>(+). .3650 • -30 MOTOR FLAG. l=>YAW MOTOR, 2=>VERT ICAL MOTOR. 3660 ' -31 LSB OF STEPS REMAINING IN LAST CALL TO 3670 • SJEP/CMD SUBPROGRAM 3680 ' -32 MSB OF STEPS REMAINING IN LAST CALL TO 3690 I STEP/CMO SUBPROGRAM 3700 ' 3710 'PREPARE STATION DNE FOR OUTPUT TO STEPPER MOTORS, OPEN 3720 'EXTERNAL 1/0 BUS, PROGRAM PPI, G OUTPUT 255 TO PORT 16. 3730 • 3740 H=INP(252) OR 16: OUT 236,H: OUT 19,128: OUT 16,255 3750 Y=l: GOTO 3820 3760 t 3770 'PROMPT OPERATOR FOR INITIAL POSITIONING PARAMETERS 3780 • 3790 INPUT "INPUT l TO CONTINUE POSITIONING, 2 IF FINISHED ";Y 3800 IF Y2 THEN GOTO 3790 3810 IF Y=2 THEN RETURN 3820 INPUT "INPUT TRAVERSE MODE .. l=>YAW, 2=>VERTICAL. n;J 3830 IF J2 THEN GOTO 3820 3840 If J=l THEN GOTO 3920 3850 • 3860 INPUT "INPUT DISTANCE TO BE TRAVERSED IN INCHES »;K 3870 L=2: If K8 OR K=O THEN GDTO 3860 3900 GOTO /+000 N 3910 I 3920 INPUT "INPUT ANGLE TO BE TRAVERSED IN CfGREES »;K 3930 GOTO .3870 3940 IF K>360 OR K=O THEN GOIG 3920 3950 GOTO 4000 .3960 ' 3970 'MAIN PROGRAM ENTERS HERE DURING DATA ACQUISITION 3980 • 3990 Y=3 4000 POKE -29,L: POKE -30.J: ON J GOTC 4010 ,4020 4010 Sf=FlX(K/0.036+0.5): SS;::SJ: GOTO 4060 4020 ST=K*50000 4030 ' 4040 'CALCULATE NO. OF STEP/CMO CALLS 4050 ' 4060 IF L<>LL{J) THEN ST=ST+BL(JJ 1BACKLASH COMPENSATION 4070 NC=FIX(ST/65536): ST=ST-NC*65536: If NC=O THEN GOTO 4160 4080 POKE -31,255: POKE -32,255 4090 • 4100 'CALL STEP/01D SUBPROGRAM FOR 65536 STEPS, NC TIMES 4110 I 4120 FOR IT=l TO NC: X=USRl{l): NEXT IT 4130 • 4140 'CALL STEP/CMO SU!:WROGRAM LAST TIME, ST STEPS 4150 • 4160 MS=f IX( ST /256): POKE -3L, ST-MS*256: PUKE -32 ,MS 4170 X=USRU U 4180 ' 4190 'STORE DIRECTION OF STEPPING 4200 • 4210 LL(JJ=l! If Y=l THEN GOT£ 379J 4220 RETURN

N N 4230 ' 4240 ' 4250 '****************** MEASURE SUBPROGRAM ******************* 4260 'ACQUIRES N SAMPLES OF DATA BY CALLING INPUT SUBPROGRAM" 14270 ' & COMPUTES AVERAGE & STANDARD DEVIATION. INCORPORATES 4280 '2 TIME DELAYS: (1) USER-SPECIFIED INTERVAL BEFORE DATA 4290 'ACQUISITION BEGINS, {2) USER-SPECIFIED INTERVAL BETWEEN 4300 'SAMPLED DATA POINTS. DEFINITION OF VARIABLES (SEE PRE- 4310 'VJOUS LISTS FOR ITEMS NOT INCLUDED HEREl: 4320 1 BT NO. SAMPLES REMAINING AFTER APPLICATION OF 4330 ' CHAUVENET'S CRITERIA 4340 ' H FOR-TO-NEXT COUNTER 4350 ' MN MIN ACCEPTABLE VALUE FOR UNCERTAIN DATA 4360 ' HX MAX ACCEPTABLE VALUE FOR UNCERTAIN DATA 4370 ' SO STANDARD DEVIATION RETURNED BY MEASURE SUBPROG 4380 ' VA SCALAR SUM 4390 • 4400 GOSUB 4730 'GOTO INPUT SUBPROGRAM FOR VECTOR Of OATA 4410 • 4420 'CALCULATE AVERAGE 4430 • 4440 VA=O: FOR H=l TO B: VA=VA+V{H): NEXT H: VAIQ)=VA/B 4445 IF 8<2 THEN SO=O: RETURN 4450 ' 4460 'CALCULATE STANDARD DEVIATION 4470 ' 4480 VA=O: FOR H=:l TO B: VA=VA+(V(H)-VA(Q)J_2: NEXT H 4490 SD=SQR{VA/{B-1)): If 8<3 THEN RETURN 4500 • 4510 1APPlY CHAUVENET'S CRITERION 4520 t 4530 BT=O: MX=VA(Q}+Cf(MDl*SO: MN=VA(Q)-CFOi!Ol*SD 4540 FOR H=l TO B: IF V(H)>MX OR V(HJ

N -..J 5310 • 5320 • 5330 '********** NULL POINT ESJIMATIO~ VIA ROOT OF ************ 5340 '********** LEAST-SQUARES lST-OROER POLYNOMIAL *********** 5350 1 X X_2 X*Y Y 5360 Cl=O.O: C2=0.0: C5=D.O: C1=0.0 5370 FOR Q=l TO M 5380 Cl=C l+HH Q} :C2=C2+ TM( Q)_2 :C5=C.5+HH Q) *VA{ Q) .:Cl=C7+VA ( Q > 5.390 NEXT Q 5400 TN=(Cl*C5-C7*C2)/(M*C5-C7*Cl) 5410 RETURN

N OJ 5420 • 5430 I 5440 '******** NULL-POINT ESf IfolATION VIA LEAST SQUARES ******** 5450 '********** 2NO-OROER POLYNOMIAL EXTREIUZATION *********** 5460 I x x_2 x_3 X_4 X*Y X_2*Y ~ 5470 Cl=O.O: C2=0.o: C3=0.o: C4=0.o: C5=0.o: C6=0.0: C7=u.O 5480 FOR Q=l TO Jt \i 5490 Cl=Cl+UUQ) :ca=HUQ)_2: C2=C2+C8: C3=C3•TM(Q) •ca 5500 C4=C4+C8_2: C5=C5+TM(Q)*VA(Q) :C6=C6+C8*VA(Q):C7=C7+VA(Q) 5510 NEXT Q 5520 C8=M*fC5*C4-C6*C3J+C7*lC2*C3-Cl*C4l+C2*1C6*C1-C5*C2J 5530 C9=M* (C6*C2-C5*C3)+Cl*( C5*C2-C6*C l )+C 7•CC1*C3-C2*C2) 5540 TN=-C8/2.0/C9 5550 RETURN

N \0 556D I 5570 I 5580 '********** DIGITAL FILTER NULL-POINT ESTIMATION********** 5590 'APPLIES A DIGITAL FILTER TO THE DATA FIELD RESULTING IN A 5600 'FILTERED DATA VECTOR ONE-THIRD AS LARGE AS THE ORIGINAL 5610 'VECTOR. DEFINITION OF VARIABLES tSEE PREVIOUS LISTS FOR 5620 'ITEMS NOT INCLUDED HERE): 5630 1 FO NO~ Of POINTS IN THE FILTERED ARRAY 5640 1 Fl WIDTH OF DIGITAL FILTER 5650 1 F2 WIDTH OF PuSITIVE STEP fUNCTIUN 5660 1 Ff FLAG FOR THE EXTREME POINT IN THE FILTERED 5670 ' ARRAY 5680 1 H FOR-TO-NEXT COUNTER 5690 ' J FILTER P

134 135

TROUBLESHOOTING Throughout the deveiopment of this system, several potential areas for operational problems have benn iden- tified. These areas and some associated problems are

discussed in this section. T~e suggested solutions are presented to enable the operator to define and resolve system difficulties that have occured previously.

I. The Computer Does Not Communicate with External Devices. A. Computer does not output- motors w i I I not step meters do not hold no indication of signals on the exte rna I I /0 ca rd edge I. reattach the 50-conductor cable connector to the 1/0 bus card edge to ensure that the connection is complete . 2. check the software for commands to open the I /0 bus: A=INPC252) or 16 : OUT 236,A . 3. plug all STD cards into connectors. B. Computer does not input does not input expected meter reading. I. reattach the 50-conductor cable connector to the 1/0 bus card edge. 2. plug in all STD cards. 3. replace 74LSOO integrated circuit.

II. Meter Readings Are Incorrect. A. Check the digital output of the meter. output from meters should correspond to the display reading. I. see Figs. 23-25 for signal positions. 2. repair any faulty meters. B. Check the station potential - all pins must be a logical "I". 136

I I • B. I. is tb_e power supply turned on? 2 . Has t b.e f o l I o '« i n g soft w o re been i n - c I u de d i_ n t h.e program? OUT PA+3,128 OUT PA, -255 OUT PA+ I , 255 OUT PA+2,255 where: PA= the base address of the station, the ad- dress of port A. C. Are the cables connected to stations one through five?

111. Stepper Motors Do Not Turn. A. No movement is detected. I check that 1/0 bus software has been run. 2. Is the motor power supply on? 3.ls the cable connected to station zero, the power supply, and to the motors? 4. Has the STEP/CMD program been saved in protected memory? 8. Motors appear to run but rotors do not turn. I. Check the output of the stepper motor interface box ( the cable that connects directly to the motor wires) with an osci I loscope. Pulsing signals should be observed when the stepping programs are run. See Fig. 44 for signal locations. if any of the pins do not produce a pulse as expected, replace the 2N2222 transistor on the associated circuit in the interface box. 2. If all pulses are supplied as expected, the gear system is binding. Realign the gears unti I the motor turns free I y. · 137

Q (:;\ Q v ~ v Q r::\ ~ ~ '.A.se. v ~v vA vA

to osc i I I oscope

to osci I loscope ground

Figure 44. Stepper Motor Cable Connector. 138

WARNINGS

The components in this system are sensitive in- struments that must be treated with care. This section presents some warnings concernlng the use of these in- struments.

I. Al I power systems should be turned off when major 1/0 bus connections are made. A. power is off when connecting the 50- conductor cable to the card edge on the TRS-80. A short circuit across any of the pins may damage the internal circuitry of the computer. 8. DE-80 power supp I y is off when con- necting/disconnecting STD cards to the motherboard. The motherboard is con- nected to the computer through the computer cable attached to STD card #2. Thus, a short circuit across any pins on the motherboard can affect the computer. 11. Observe al I computer prompts Do not turn on the external power supplies unti I prompted to do so by the computer. A. Connect the stepper motor cable to the motors only when prompted to do so by the computer. The resting state of the motor interface circuits occurs when al I of the computer inputs are logical "I". If the cable is connected before the computer can pre-set the interface station to logical "I" at all pins, all phases could be energized resulting in an overload on the motor power supply.

B. Connect the meter cables to the meters only when prompted to do so by the compu- ter. Again, all of the pins at each inter- face must be pre-set before the cables are attached. If the cables are attached be- fore the stations are pre-set, current wi I I flow from the meters to the station, and the meter readings wi I I be affected.

I I I. Always remove any disks from the disk drives before turn~ng the computer on or off. 139

signal d e s c r i p t i. o n

WR write to memory or 1/0 device IOREQ 1/0 address select IOEXP 1/0 expansion REFRESH refresh timing STATUS I CPU status BUSAK bus acknowledge INTAK interrupt acknowledge WAITRQ wait request SYS RESET system reset CLOCK clock from processor PCO priority chain out RD read from memory or external device MEMRQ memory address select MEMEX memory expansion MCSYNC CPU machine cycle sync. STATUS 0 CPU status BUSRQ bus request INTRO interrupt request NMIRQ non-maskable interrupt request PBRESET push-button reset CNTRL AUX timing PCI priority chain in AUX GND auxi I iary ground AUX +V auxiliary positive (+12 v ) AUX -v auxiliary negative (-12 v)

Figure 43. Signal Description of STD Control Signals. APPENDIX D

140 141

GLOSSARY address bus - eight lines available from the computer to select internal locatlons or external devices for data transfer. BASIC - a high-level computer language designed for user ease. bit - one piece of binary information. Eight bits constitute one byte. BCD Binary Coded Decimal. A code to represent a decimal number in binary (eight bit) format. byte - eight binary bits. Often referred to as binary word. Represents·decimal numbers zero through 255. control bus - eight lines available from the computer to indicate the of data transfer, and to activate the transfer process. - an input to the PPI chip to enable the chip when a logical "O" is applied to the pin. data bus - eight lines available from the computer to transfer information to/from one location/device to/from the computer. enable - to turn on a device such as an integrated c i re u it. external - data, address, and control buses in the 1/0 bus computer made available for external use. EXTIOSEL - an input to the computer in the external 1/0 bus that reverses the output bias on the bus to allow external inputs. floppy disk - form of computer storage of programs and data. ,, HOLD - an input to a digital meter to hold a reading while it is recorded.

TN - signal ge~erated by the computer to indicate an input operation. INP(a) - BASIC command to input a number from port a. logical II Q II - any signal from 0-2 volts. logical II I " - any signal from 3-5 volts. 142

GLOSSARY (cont.) LS B - Least Significant Byte : smallest eight bits in a sixteen bit word. MSB - Most Sign if leant Byte : I a rgest eight bits i~ a sixteen bit word. NANO - a d·igital logic circuit that results in: i ) I o g i ca I 11 0 11 when a I I i n puts a re logical 11 1 11 •

ii) logical 11 1 11 when any input is logical "O". - s igna I generated by the computer to indicate an output operation.

OUT A.B - BASIC command to output the number B10 , to port A10 . po rt - a location containing eight bits of binary information. PPr - Programmable Peripheral Interface chip. Contains three ports that may be pro- grammed for input and/or output opera- tions. - signal applied to the PPI chip to indi- cate an input operation. Corresponds to the computer generated TN. RESET - signal generated by the computer to reset system peripherals. station a group of circuits comprising an interface on the STD boards. STD - a standardized configuration of signals on a fifty-six element card edge connetor. TRSDOS - the computer language resident in the TRS-80 computer. VMOSFET - Vertical Metal Oxide Semiconductor Field Effect Transistor. The power transistor used to switch current through one stepper motor phase. - signal applied to the PPI chip to indi- cate an output operation. Corresponds to the OUT signal generated by the computer. The vita has been removed from the scanned document DESIGN OF A DATA ACQUISITION SYSTEM TO CONTROL AND

MONITOR A VELOCITY PROBE IN A FLUID FLOW FIELD

by

Nancy Herwig

(ABSTRACT)

A data acquisition system to control the position of a velocity probe, and to acquire digital voltages as an indication of fluid velocity Js presented. This system replaces a similar manually operated traverse system, It relieves the operator of control and acqui- sition tasks, while providing a more consistent and systematic approach to the acquisition process. The design includes the TRS-80 microcomputer, with external interfacing accomplished using the STD-based bus design.