Sunteți pe pagina 1din 130

The Pennsylvania State University The Graduate School College of Engineering

DESIGN AND USE OF A CYLINDRICAL COORDINATE MEASURING MACHINE FOR NON-CONTACT ROUNDNESS MEASUREMENT

A Thesis in Mechanical Engineering by Mark Elliott Glauner

2002 Mark Elliott Glauner

Submitted in Partial Fulfillment of the Requirements for the Degree of Master of Science December 2002

I grant The Pennsylvania State University the nonexclusive right to use this work for the University's own purposes and to make single copies of the work available to the public on a not-for-profit basis if copies are not otherwise available.

Mark Elliott Glauner

We approve the thesis of Mark Elliott Glauner.

Date of Signature

Eric R. Marsh Associate Professor of Mechanical Engineering Thesis Advisor

Panagiotis Michaleris Assistant Professor of Mechanical Engineering

Richard C. Benson Professor of Mechanical Engineering Head of the Department of Mechanical Engineering

iii

ABSTRACT The Cylindrical Coordinate Measuring Machine, or C2M2, was developed to measure the out-of-roundness of cylindrical artifacts. High precision machine components, coupled with the use of filtering and active error separation, result in out-ofroundness measurements with microinch-level repeatability and accuracy. The machine is a four axis positioning system manufactured by Professional Instruments. Using an air bearing spindle and linear air bearing ways, it achieves positioning accuracy of approximately 40 microinches with low error motion, which, when coupled with precise position feedback, makes high precision measurement possible. Software was developed using C for Virtual Instrumentation (CVI) that manages the data acquisition and motion control, effectively automating the test procedure. The user interface can display a polar representation and harmonic analysis of each cylindrical cross section, as well as a three-dimensional wireframe model of the artifact surface. This work builds upon the significant contributions of other MDRL graduate students. After the lab acquired the machine, Vincent Vigliano installed and configured the controls. The software borrows from programs written by Vincent Vigliano and David Schalcosky for similar metrology projects. The specific tasks for this project include further tuning and programming of the control system, analysis and troubleshooting of the machine, software adaptation, and integration of the sensors and data acquisition hardware. The accuracy and repeatability of this machine are on par with the leading coordinate measuring machines that are currently available. The C2M2 adds to that the benefit of non-contact measurement, an important factor in the inspection of delicate optical-quality artifacts. This represents a significant improvement to the metrology capabilities of the Penn State Machine Dynamics Research Laboratory.

iv

TABLE OF CONTENTS

LIST OF FIGURES......................................................................................................vi LIST OF TABLES .......................................................................................................x ACKNOWLEDGMENTS............................................................................................xi CHAPTER 1: OVERVIEW .........................................................................................1 1.1 Introduction.....................................................................................................1 1.2 Project Goals ...................................................................................................2 1.3 Definition of Roundness .................................................................................3 1.3.1 Calculation of the Least Squares Center...............................................5 1.3.2 Harmonic Analysis ...............................................................................6 1.4 Background on Cylindricity............................................................................7 1.5 Experimental Methods ....................................................................................8 1.5.1 Diametral Methods ...............................................................................8 1.5.2 Chordal Methods...................................................................................9 1.5.3 Radial Methods .....................................................................................10 1.5.4 Available Probes ...................................................................................13 1.5.5 Grazing Incidence Interferometry.........................................................14 CHAPTER 2: HARDWARE DESIGN AND ANALYSIS .........................................18 2.1 Hardware Setup...............................................................................................18 2.1.1 Machine Design ....................................................................................18 2.1.2 Motion Control System.........................................................................20 2.1.2.1 Motors and Feedback..................................................................20 2.1.2.2 Motion Controller .......................................................................20 2.1.3 Data Acquisition ...................................................................................21 2.1.4 Sensors ..................................................................................................22 2.1.5 Hardware Interaction ............................................................................23 2.2 Active Error Separation ..................................................................................24 2.2.1 Y-Stage Position Tracking....................................................................25 2.3 Error Motions..................................................................................................28 2.3.1 Vibration Measurement ........................................................................28

v 2.3.2 Spindle Analysis ...................................................................................31 2.3.3 Experimental Modal Analysis ..............................................................35 2.3.4 Thermal Effects.....................................................................................39 2.4 Uncertainty Estimation ...................................................................................45 2.4.1 Accuracy of Capacitance Probes ..........................................................46 2.4.2 Accuracy of Data Acquisition...............................................................47 2.4.3 Uncertainty Budget ...............................................................................47 CHAPTER 3: SOFTWARE DESIGN AND USE .......................................................48 3.1 Data Acquisition and Storage .........................................................................49 3.2 Automatic Motion Control..............................................................................50 3.3 Measurement Analysis....................................................................................52 3.4 User Interface..................................................................................................54 3.4.1 Test Setup .............................................................................................55 3.4.2 Acquisition............................................................................................58 3.4.3 Plotting Results .....................................................................................58 3.4.4 Saving Test Data...................................................................................60 3.4.5 Loading Saved Data..............................................................................61 CHAPTER 4: RESULTS .............................................................................................62 4.1 Effects of Digital Filtering ..............................................................................62 4.1.1 Comparison to Moore No. 3 UMM ......................................................65 4.2 Repeatability ...................................................................................................68 4.3 Inspection Capability ......................................................................................69 4.4 Possible Applications......................................................................................72 CHAPTER 5: CONCLUSIONS AND FUTURE WORK ...........................................74 BIBLIOGRAPHY ........................................................................................................76 APPENDIX A: WIRING DIAGRAM .........................................................................78 APPENDIX B CVI CODE..........................................................................................79

vi

LIST OF FIGURES

Figure 11: Diamond turned aluminum cylinder and flat............................................2 Figure 12: Four common definitions for the determination of roundness (after Whitehouse [7]).....................................................................................................4 Figure 13: Least squares center of a roundness profile (after Whitehouse [7]). ........5 Figure 14: Diametral roundness measurement...........................................................8 Figure 15: Illustration of the three-point method (after Gleason [9]). .......................9 Figure 16: Axial, face, radial and tilt error motion of a spindle rotor (after ANSI B89.3.4M [12]). ....................................................................................................11 Figure 17: Taylor-Hobson Talyrond 290 coordinate measuring machine .................13 Figure 18: Schematic of a grazing incidence interferometer (after Badami [16]). ....15 Figure 19: Examples of typical fringe patterns from flat grazing incidence interferometry. These patterns indicate (a) part tilt, (b) convexity or concavity of the part, (c) astigmatism (saddle), (d) form error curving to the bottom of the part, and (e) a cylindrical form (after Schalcosky [5]). ..................16 Figure 110: Schematic of a cylinder interferometer (after Badami [16]). .................17 Figure 21: Schematic of the C2M2..............................................................................19 Figure 22: Aerotech motion control hardware with 4020-LS amplifiers...................21 Figure 23: National Instruments BNC-2110 breakout box used for data acquisition. ............................................................................................................22 Figure 24: Lion Precision C1-C capacitance probe and DTM-10 amplifier..............23 Figure 25: Hardware architecture...............................................................................24 Figure 26: Two capacitance probes are used in order to compensate for the vibration of the stage.............................................................................................26

vii Figure 27: Two capacitance probes are used to isolate the motion of the stage from the profile of the artifact........................................................................................27 Figure 28: Two capacitance probes, at the corners of the stage, are used to measure the yaw motion of the Y stage ................................................................29 Figure 29: Motion of the two corners of the Y stage, and the difference between the signals..............................................................................................................30 Figure 210: FFT of Measured Stage Vibration. .........................................................31 Figure 211: A reference spindle is mounted on top of the test spindle for a master axis test. .....................................................................................................32 Figure 212: A capacitance probe, mounted on the left side of the can, measures the combined radial error motion of two stacked spindles. A gage ball, seen on the right, restricts only the rotation of the stator of the reference spindle. ..................................................................................................................33 Figure 213: Results of master axis test showing the radial error motion of the C2M2 spindle. Plot (a) shows a repeatable radial error motion of 32.5 in occurring at 79 upr. With a digital low pass filter applied in plot (b), the error motion is reduced to 1.3 in and is fairly random. ...............................................34 Figure 214: Wireframe model of C2M2 ......................................................................36 Figure 215: Mode 4 characterized by translation of Y-axis stage..............................38 Figure 216: Bending modes 7, and 8. These represent (a) the X-direction vibration of the Y-axis stage, and (b) clamshell bending of the column. .............39 Figure 217: Time traces from probes 1 and 2. Due to thermal expansion in the metrology loop, the artifact appears to have effectively shrunk by 12 in...........41 Figure 218: Curve fit and residual thermal growth after the curve fit is subtracted. .............................................................................................................42 Figure 219: Temperature fluctuation over a 56 minute period. .................................43 Figure 220: Thermal drift over a one minute period for probe 1 and 2, and the resulting thermal growth. ......................................................................................44 Figure 221: Thermal growth and curve fit, and residual error after the curve fit is subtracted. The error can be reduced to less than 0.5 in....................................45 Figure 31: Cylinder City user interface......................................................................49

viii Figure 32: Process for data acquisition. .....................................................................50 Figure 33: Flowchart for the motion control process.................................................52 Figure 34: A small portion of a polar plot. The light blue lines, known as the cloudband, show the result from each individual revolution of the artifact. The width of the cloudband is the asynchronous, or unrepeatable error. .............54 Figure 35: Settings window........................................................................................55 Figure 36: Square wave and index pulse from the spindle encoder...........................56 Figure 37: Total Indicated Runout gauge used for artifact centering and for zeroing the capacitance probes. ............................................................................57 Figure 38: Test Setup Box..........................................................................................58 Figure 39: Polar plot and harmonic analysis for an artifact cross-section. ................59 Figure 310: Two wireframe models of the same artifact, showing how the model can be rotated for viewing.....................................................................................60 Figure 41: Unfiltered result of one step. ....................................................................63 Figure 42: The same experimental data, digitally low-pass filtered with a cutoff frequency of 75 upr. ..............................................................................................64 Figure 43: A cylindrical artifact is measured using the 'Cylinder City' software on a Moore Universal Measuring Machine...........................................................65 Figure 44: Roundness of an artifact and asynchronous error with and without the use of a digital low-pass filter with a cutoff frequency of 75 upr.........................66 Figure 45: Comparison of one measurement with and without the use of digital filtering..................................................................................................................67 Figure 46: Asynchronous error levels present in tests run on the C2M2 and on the Moore UMM. ........................................................................................................68 Figure 47: The roundness value for ten measurements taken at the same Z-axis height, with and without the use of stage motion compensation. The standard deviation with compensation is 0.116 in. ...........................................................69 Figure 48: A pair of lines drawn on the side of the cylinder with a marker are clearly visible. .......................................................................................................70 Figure 49: Roundness of a cylindrical artifact. ..........................................................71

ix Figure 410: The profile measured at 0.1875" shows a protrusion on the surface of the artifact. ..................................................................................................................72

LIST OF TABLES

Table 11: Roundness signal typology (after Whitehouse [7])....................................7 Table 21: Summary of natural frequencies and mode shapes....................................37 Table 22: Error multipliers for non-flat targets for Lion Precision C1-C capacitance probes. ...............................................................................................46 Table 23: Factors of uncertainty budget.....................................................................47

xi

ACKNOWLEDGMENTS

I would like to thank my advisor, Dr. Marsh, for giving me the opportunity to learn so much. I could never have predicted how many unique opportunities I would have to get my hands dirty and absorb countless things about the world of precision engineering. My colleagues and the alumni of the MDRL have each taught me so much through their own independent research. Bob Grejda, Byron Knapp, Vincent Vigliano, Brian OConnor, David Schalcosky, Steve Henry, Jeremiah Couey, and Anuj Bhardwaj all deserve thanks for their mentorship, technical expertise, and generous contributions to this project. Moreover their friendship made life in the MDRL enjoyable. Several corporate sponsors also made this project possible. Contributions from Aerotech, Inc., Kistler, Lion Precision, and Professional Instruments were invaluable. Steve Ludwig of Aerotech, and Dan Oss of Professional Instruments have also been very generous with their time and knowledge. Finally I would like to thank my family for their support that made graduate school easier. Their unfaltering encouragement never failed to pick me up.

Chapter 1 Overview

Precision engineering can be casually defined as the pursuit of the next decimal point of accuracy [1]. With this goal, metrologists constantly work to increase the resolution and accuracy of their instruments in order to evaluate workpieces or processes in finer detail. One facet of this field is the measurement of workpiece roundness. Many instruments have been developed that possess the ability to measure a variety of nominally round parts with very fine accuracy; some of the most recent instruments resolve form errors on the level of tenths of microinches [2]. 1.1 Introduction There is an increasing demand for accurately measuring workpiece roundness to improve the manufacturing of roller bearings, diesel fuel injectors, and other cylindrical parts, which will continue to push the capabilities of metrology. It is predicted that parts with a roundness error less than 0.2 in and a cylindrical form error of 4 in will be commonplace in the near future, and the accuracy of inspection instruments will need to keep pace [3]. Thus there is motivation to constantly explore new techniques that may define the next generation of metrology tools. Previous projects conducted at the Penn State Machine Dynamics Research Laboratory have achieved high levels of accuracy in the measurement of ultra-precision round and circularly flat workpieces. These parts, shown in Figure 11, possess superior surface finish and dimensional accuracy compared to a comparable part manufactured on a standard lathe. Non-contact inspection is required to avoid damaging the delicate mirror finish of the typically aluminum, copper or silicon workpieces. Commercially available non-contact measurement machines are prohibitively expensive, so alternative probing techniques are being researched [4-6].

Figure 11: Diamond turned aluminum cylinder and flat.

1.2 Project Goals The purpose of this work is to develop a measurement system for nominally axissymmetric parts that maintains a high level of precision while broadening the range of allowable workpiece geometries. This project started with a complete air bearing machine that was designed and built by Professional Instruments Company. Aerotech provided a complete set of control hardware and software for the PI machine and a previous MDRL student, Vincent Vigliano, worked with Aerotech engineer Dr. Steve Ludwick to perform much of the integration work. There was considerable additional work required to properly drive the machine using the Aerotech U500 controller including tuning the four axes and chasing down a few lingering mechanical problems so the first task of this work is to finish tuning the computer control that allows precise motion of the four axis machine. The second task is to automate the data acquisition process with custom software written in National Instruments CVI. The final task is to integrate the Aerotech machine control system to the National Instruments data

3 acquisition system so that a wide range of parts can be handled by the completed instrument. The Cylindrical Coordinate Measuring Machine meets these objectives with accuracy that rivals that demonstrated by other commercially available offerings. In our instrument, sample workpieces with a right cylindrical shape are inspected by making roundness measurements at several heights along the workpiece, constructing a threedimensional representation of the surface. The system is automated, allowing the roundness to be measured at up to 100 axial locations. The machine can accommodate workpieces up to six inches in height and twelve inches in diameter. Measurement repeatability of 0.25 in has been demonstrated, but with a calculated uncertainty of 3.0 in. This value reflects the thorough analysis of the machine that is presented herein and is the motivation for the recommendations found in the future work section. 1.3 Definition of Roundness Many methods have been devised that attempt to quantify the form error of round parts with a single number. Most of these methods measure the peak-to-valley height between the innermost and outermost points of the profile. This is known as the out-of-roundness, or simply roundness. This requires the definition of a center of revolution. The main differences between these methods pertain to how the center is defined. Examples of the four main techniques for defining this center are shown in Figure 12. Each technique is illustrated on an exaggerated profile of an out-of-round part. The four methods are known as the minimum circumscribed circle, the maximum inscribed circle, the minimum radial separation, and the least squares methods [7,8].

4 (a) (b)

Rmax Rmin

Rmax Rmin

(c)

(d)
Rmax Rmin

Rma Rmin

Figure 12: Four common definitions for the determination of roundness (after Whitehouse [7]). (a) (b) (c) (d) Minimum circumscribed circle Minimum inscribed circle Minimum zone Least squares

The first step of each method is to determine a center. On that center, the maximum inscribed and minimum circumscribed circles are drawn. The distance between these rings is called the zone. Example (a) in Figure 12 demonstrates the maximum circumscribed circle (MCC) center. This is also know as the ring gauge center, since the center is that of the smallest ring that surrounds the outside of the profile. The name is from the similarity to using a ring gauge. Example (b) illustrates the maximum inscribed circle (MIC) center. The MIC center is also known as the plug

5 gauge center, representing the center of the largest plug gauge that would fit within the profile without interference. Example (c) shows the minimum radial separation (MRS) center. This center is determined by finding the position of the maximum inscribed and minimum circumscribed concentric circles that have the smallest radial separation. Example (d) shows the parameters that are perhaps the most commonly used in metrology, the least squares center (LSC) and the resulting least squares zone (LSZ). The first three methods, the MCC, MIC and minimum zone, are graphical in nature, because they are controlled by specific graphical features. This makes them vulnerable to excessive influence from sharp peaks or valleys of the profile. Furthermore they are difficult to calculate, and may not result in a unique solution. 1.3.1 Calculation of the Least Squares Center The least squares center can easily be calculated from a set of discrete points describing the part profile. Figure 13 illustrates the least squares center, OLSC, relative to the center of rotation, OR.

r OR a

r OLSC b

Figure 13: Least squares center of a roundness profile (after Whitehouse [7]).

The center is found in Cartesian coordinates by Equations 1.1 and 1.2. For this project, all data are collected and stored in polar coordinates, which is reflected in Equations 1.1 and 1.2. The angle is given by Equation 1.3.

6
a= b= 2 N 2 N

r cos
N i =1 N i

1.1 1.2 1.3

r sin
i =1 i

i 1 2 number of encoder counts

For each point i, the radius r is calculated from the least squares center by Equation 1.4. ri ' =

(ri cos i a )2 + (ri sin i b )2

1.4

The radius from this center is then used to find the least squares zone. This is commonly accepted as a measure of the part roundness, and is used for the purposes of this work. The width of the LSZ is given by Equation 1.5. Roundness = max(ri ' ) min(ri ' ) 1.3.2 Harmonic Analysis The round profile is often described by identifying its harmonic content using the Fourier series. The frequencies are expressed in upr, or undulations per revolution. Form error is distinguished from surface texture by wavelength; form error significantly changes the low frequency shape of the cross section, whereas features of surface texture usually do not deviate greatly from the nominal diameter of the part. Typically only the lower harmonics have a large enough magnitude to contribute to form error. Thus the 2nd through 15 wavenumber content, or features that repeat 2 through 15 times per revolution, are referred to as the lobing coefficients. Surface texture, then, is typically described by the harmonics greater than 15 upr. The 1st wavenumber (1 upr) component describes only the eccentricity of the workpiece on the axis of rotation and, for a roundness measurement, is not a contributor to form error. Table 11 shows a breakdown of the harmonic coefficients, their common causes, and their most significant effects. 1.5

7 Table 11: Roundness signal typology (after Whitehouse [7]). Fourier Coefficient 0 1 2 3 4-5 5-20 20-50 50-1000 Effect Dimension of Part Instrument setup Instrument setup Ovality of part Instrument setup Trilobe on part Machine tool setup Unequal angle genuine Equal angle machine tool Machine tool stiffness Machine tool stiffness Regenerative Chatter Manufacturing process signal Likely Cause Tolerance/fit Eccentricity on graph Component Tilt Distortion of component due to jaws of chuck clamping Distortion due to clamping Out-of-roundness Out-of-roundness causes vibration Out-of-roundness causes noise

1.4 Background on Cylindricity The concept of roundness can be extended into three dimensions to describe the form error of cylindrical parts. The simplest form of this principle is to compare a series of cross sections of the part, each evaluated using the traditional measures of roundness. To more thoroughly describe the part, other parameters have been defined that, following the roundness model, quantify the deviation of the parts form from that of a perfect cylinder. As with roundness, the significant criteria are determined by the application. Most methods attempt to evaluate the conicity of the workpiece and the straightness of its axis, as well as the overall roundness. The least squares zone concept can be applied to a cylindrical form as well as a circular cross-section. A series of circular cross sections are stacked with the axis, known as the least squares axis, passing through the least squares center of each cross section. The zone is then determined by the maximum radial separation between the minimum and maximum radii among all of the cross sections. Since the LSC is used, this method cannot detect a non-straight axis or component tilt, both of which tend to shift the least

8 square center relative to the machine coordinate system. As is the case with roundness measurements, this method ignores the absolute radius of the workpiece. The straightness of the workpiece can independently be determined from the shift of the least squares center as long as angular consistency is maintained from one measurement to the next. 1.5 Experimental Methods Many tools exist to quantify the roundness of circular parts, ranging from simple dial calipers to advanced, interferometer-based machines. The mechanical techniques can be grouped into three categories: diametral, chordal, and radial. 1.5.1 Diametral Methods The diametral method is the most basic and is also the most familiar. The diameter of the workpiece is measured as the distance between two parallel flat anvils, such as the calipers of a micrometer. A series of readings is taken as the part is rotated, as shown in Figure 14. The roundness is expressed as one quarter of the difference between the maximum and minimum readings, as expressed in Equation 1.6. It must be noted that this method masks errors that have an odd number of lobes. A three lobed part, for example, will appear perfectly round.

d1

d2

Figure 14: Diametral roundness measurement.


Roundness = d 2 d1 4

1.6

9 1.5.2 Chordal Methods Chordal methods use three or more gauging points on the surface of the part instead of two. An example is the vee-block method in which the part rests between two flat surfaces that are at an angle to one another. A probe at a third location measures the change in vertical position of the surface as the part is rotated [7]. In the three-point method, a common form of chordal measurement, the artifact makes point contact with rounded posts rather than vee-blocks. At a third point in between, the tip of a transducer targets the part surface, shown in Figure 15.

s()

10

m()

Figure 15: Illustration of the three-point method (after Gleason [9]).

Like the diametral methods, this technique suffers from harmonic suppression. This means that certain harmonics are attenuated, based on the spacing of the contact points and the probe. The attenuation for the harmonic order n is given by Equation 1.8. If and from Figure 15 are equal angles, particular harmonics will be completely hidden.

10 m( ) = s( )
G (n ) =

sin ( ) sin ( ) sin ( ) s ( + ) sin ( + ) sin ( + )

1.7 1.8

1 2 sin ( + ) sin cos n sin cos n 2 + (sin c sin n sin sin n ) sin ( + )

The advantage of this method is that it avoids the need to use a high precision spindle, upon which most systems rely. Referring to Figure 15, if angles and are made to be 60 and 45, up to the 23rd harmonic can be measured with at least 0.75 sensitivity [9]. 1.5.3 Radial Methods Radial methods compare the workpiece to a reference and are broadly classified as comparative measurements (as opposed to an absolute measurement) [10]. In roundness and cylindricity metrology, the reference is usually in the form of an ultra-precision air bearing spindle. Radial methods are the most straightforward approach and are therefore the most common way of generating a polar plot, the most common and intuitive display format. This shows the workpiece such that the reader can quickly associate features of the graph to the part. The polar plot is not very useful unless the form error is greatly magnified with a large radial magnification superimposed on a circle of arbitrary radius to show the cross-section in greater detail [11]. For any comparative measurement device, the availability of an accurate reference is crucial. Spindles with fluid film bearings, especially aerostatic bearings, are often used because they typically possess very high accuracy and repeatability [12]. Furthermore, the error motion is virtually unchanging over time, aided by the fact that there is no mechanical contact between the rotor and stator during operation. In what is known as error mapping, the error motion of a bearing can be measured and stored in a database. Due to its repeatable nature, it can then be subtracted from subsequent experiments with a high degree of confidence. Error separation techniques can be used to measure the reference spindle error motion to make an accurate error map [2,11-13].

11 There are four types of spindle error motion that will affect the apparent accuracy of the measurement reference. These are (a) axial motion, (b) face motion, (c) radial motion, and (d) tilt motion, as shown in Figure 16. Axial motion is measured on the axis of rotation and is the travel of the rotor along that axis. Similarly, face motion is the motion of the rotor parallel to the axis of rotation that is measured at a specified radius from that axis. Pure radial motion is motion of the rotor perpendicular to the axis of rotation. Tilt motion is the rotation of the rotor about an axis perpendicular to the axis of rotation [12].

Radial location

(a) Axial Motion


Axial location

(b) Face Motion

(c) Radial Motion

(d) Tilt Motion

Figure 16: Axial, face, radial and tilt error motion of a spindle rotor (after ANSI B89.3.4M [12]).

12 In practice, a single measurement reflects the contributions of combinations of radial, axial, and tilt error motion depending on the location and orientation of the displacement indicator. For example, the face motion that is measured is a combination of tilt motion and axial motion. The contribution from tilt error motion increases as the displacement indicator is moved away from the axis of rotation. Likewise, the apparent radial motion is a combination of tilt error motion and pure radial error motion. The effects of tilt error motion are generally larger at a height above the face of the spindle than at the face itself. Therefore when face or radial motion is discussed, it is always given at a specific radius on the face or at a specific height above the face, respectively. Reversal, multistep, or multiprobe error separation techniques are required to characterize the reference spindle errors [2,12]. Machines are commercially available that test for parameters of roundness and cylindricity. They span a large spectrum of accuracy, affordability, and size. Most have the same general configuration, using a high-precision spindle to rotate nominally round workpieces. Some offer computer numerical control (CNC) and software packages that automatically perform the measurement and show the results in a convenient user interface. One such machine, the Talyrond 290 by Taylor Hobson Precision, arguably represents the current state of the art. This instrument most closely matches the goals sought by this project. The Talyrond 290, shown in Figure 17 can accommodate pieces up to 13.7 inches in diameter and 39 inches in height, and weighing up to 165 lbs. It is capable of performing measurements with 0.05 in resolution. Its spindle is rated as having radial error less than 1.6 in. Its measurement capabilities include roundness, cylindricity and flatness measurements with harmonic analysis [14].

13

Figure 17: Taylor-Hobson Talyrond 290 coordinate measuring machine

1.5.4 Available Probes Several means exist to accurately measure small changes in displacement, such as the fluctuations of the form of an artifact. The most economical method relies on a mechanical stylus that follows the surface of the artifact as it is scanned. A transducer measures the deflection of the stylus. This is the probe used by the Talyrond 290. As with any type of contact measurement, the possibility exists that the stylus tip can damage the surface finish of a sensitive artifact. In high-precision applications, the local deflection from the pressure of the stylus tip may become significant. Additionally, factors such as tip shape, radius, and wear must be considered. A very common non-contact transducer is the capacitance probe. These devices sense the capacitance between two surfaces, the probe tip and the target. Ideally the target material is electrically conductive, but dielectric and semiconductor materials can also be used with special considerations. As the distance between the surfaces changes, so does the capacitance of the air gap. The probe amplifier linearizes the voltage change

14 of the underlying measurement and outputs a voltage that is proportional to the air gap [15]. Another class of non-contact measurement systems use a laser to measure the distance to the part surface. The variation in the gap width results in a corresponding change in the intensity of the laser beam that is reflected off of the artifact surface. This is compared to a reference beam from the same light source. Applying the confocal principal, a pinhole aperture allows only light that is focused on that point to pass through to the photo detector. This allows the distinction of the reference beam and the light that is reflected off of the artifact. Two photodetectors independently measure the intensity of these two beams of light. A fluctuations in the difference between them is proportional to the change in distance to the artifacts surface. This method has been employed successfully to perform non-contact roundness measurements [3].

1.5.5 Grazing Incidence Interferometry One other common tool used for non-contact form error metrology is grazing incidence interferometry. The term refers to the interference between two beams of light, on which this method is based. measuring flatness. Light passes through a reference prism that splits each beam into two, reflecting one and allowing the other to pass through and strike the test object. The light that is reflected serves as the reference beam. That which is allowed to pass, called the test beam, is then reflected back into the prism where it combines with a reference beam, parallel to and in phase with the original. This is shown in Figure 18. The concept can best be summarized using the example of

15

Surface under test Air gap

Collimated Incident Wavefront

Prism Image plane

Figure 18: Schematic of a grazing incidence interferometer (after Badami [16]).

Depending on the phase shift between the reference beam and the test beam, the two may constructively or destructively interfere. Constructive interference, where the waveforms of the two beams are in phase, will result in the greatest intensity of the combined light beam. Destructive interference, where the two beams are out of phase, caused the beams to effectively cancel each other, resulting in attenuation of the combined beam intensity. The phase angle between the two beams varies with the width of the air gap separating the prism from the part. Thus as the gap width changes, so does the degree of interference. This results in light and dark areas, or fringes, projected onto the image plane. A single fringe represents a change in the width of the air gap equal to

, where is the wavelength of the light, and is the angle of the test beam from 2 cos
the normal to the part surface. Examples of common fringe patterns and their These patterns indicate (a) part tilt, (b) interpretations are shown in Figure 19.

convexity or concavity of the part, (c) astigmatism (saddle), (d) form error curving to the bottom of the part, and (e) a cylindrical form. This requires a source of light that is parallel with a constant, single wavelength, which is provided by a laser [15].

16

(a)

(b)

(c)

(d) (e) Figure 19: Examples of typical fringe patterns from flat grazing incidence interferometry. These patterns indicate (a) part tilt, (b) convexity or concavity of the part, (c) astigmatism (saddle), (d) form error curving to the bottom of the part, and (e) a cylindrical form (after Schalcosky [5]).

This principle can be applied to measure cylindrical parts as well. Figure 110 illustrates the layout used for grazing incidence interferometry of cylindrical surfaces. The collimator ensures that the beams of light are parallel. Variations in the radius of the test part affect the path length of the test beam, causing similar fringe patterns to emerge on the image plane [16].

17

First grating

Second grating

Point source

Aperture Collimator Part under test

Viewing lens

Image plane

Figure 110: Schematic of a cylinder interferometer (after Badami [16]).

Corning Tropel offers a cylinder interferometer applying this configuration. The CylinderMasterTM 25 accommodates parts up to 25 mm in diameter and 125 mm in length. The manufacturer claims a resolution of 0.4 in and an accuracy of 4 in. The fringe patterns resulting from form error are more complex than those resulting from a flatness measurement. Through the use of a camera on the image plane and computer analysis, the fringes are automatically interpreted into a picture that is more meaningful to the untrained eye. The CylinderMasterTM software is capable of measuring roundness, cylindricity, and harmonic analysis for a roundness slice. Its greatest advantage is the ability to perform non-contact measurement of nearly any material that possesses a good surface finish. Surface finishes that are acceptable are classified as precision ground, honed, polished and superfinished [17]. The main shortcoming of this approach is that only right cylinders can be measured; other geometries will block the light path.

18

Chapter 2 Hardware Design and Analysis

The Cylindrical Coordinate Measuring Machine, or C2M2, is the product of the goal of making high precision roundness measurements. This chapter discusses the operation of the machine, and the motion control and data acquisition hardware, and presents an analysis of the machines characteristics and performance. 2.1 Hardware Setup High precision roundness measurements of a wide variety of components are possible using the C2M2. The machine is a highly accurate four axis positioning system designed and manufactured by Professional Instruments of Minneapolis, Minnesota. 2.1.1 Machine Design The machine structure, consisting of the base and column, is cast iron. According to the manufacturer, the column is installed parallel to the rotational axis to within one arcsecond. The three primary axes are the horizontal axis, vertical axis, and one rotary axis. Each linear axis is an air bearing stage driven by a ballscrew and servo motor. The rotary axis is a motorized air bearing spindle, which is mounted in the Y-axis stage. The artifact or workpiece is mounted on this spindle. A small ball bearing slide is mounted on the vertical axis carriage for fine X-axis adjustment of the measurement probe. The arrangement of these components is show in Figure 21. The Z-axis provides movement of the probe parallel to the part axis of rotation. The horizontal axis provides radial motion of the part with respect to the probe to accommodate parts of varying radii [18].

19

6 5 Z X Y

3 2 1

Figure 21: Schematic of the C2M2 1. 2. 3. 4. 5. 6. Y-axis air bearing stage Air bearing spindle Artifact Capacitance probe holder X-axis ball bearing stage Z-axis air bearing stage

The advantage of using air bearings is the high degree of precision that can be achieved. The linear air bearings ways suffer significantly less error motion than more common flat or vee-groove ways. Similarly, the air bearing spindle rotates with much less error motion than a ball bearing spindle. The error motion of an air bearing spindle is also highly repeatable and can be mapped if necessary.

20 2.1.2 Motion Control System One advantage of the C2M2 over traditional coordinate measuring machines is the addition of computer numerical control. This allows for highly accurate positioning of the artifact, as well as automation of the test procedure. 2.1.2.1 Motors and Feedback Closed loop position feedback is provided by optical encoders on the three air bearing axes. The Y and Z-axis linear stages are each equipped with a Heidenhein LIP401 linear encoder. The scale has a grating period of 0.00157 in (4m), and an interpolated pitch of 0.394 in (10nm). Both axes are driven by Kollmorgen ServoDisc N12M4T DC motors. The spindle is driven by a Magtech V-Line DC motor and has a Heidenhein ERO1324 encoder installed with 4096 counts per revolution. The spindle has a final angular resolution of 79.1 arc-seconds. 2.1.2.2 Motion Controller The motion controller is an Aerotech Unidex 500 motion controller running the Windows-based MMI version 5.18 interface software on a personal computer. Each axis is driven by an Aerotech 4020-LS linear servo amplifier. The amplifiers and feedback devices are connected to the U500 control board via an Aerotech BB500 interface board. The rack of amplifiers and the BB500, on the top shelf, are shown in Figure 22.

21

Figure 22: Aerotech motion control hardware with 4020-LS amplifiers.

2.1.3 Data Acquisition Data is acquired using a National Instruments NI-6110 data acquisition card running on a separate PC. It is connected via a SCSI cable to a BNC-2110 breakout box shown in Figure 23. The card is capable of simultaneously sampling 4 analog channels at 5 million samples per second with 12-bit resolution. Among its other features, it has two 16-bit analog outputs, and analog triggering that are used for this project [19]. Four signals are gathered to form a roundness plot for a given cross section. Two are the output of two Lion Precision capacitance probes; the first measures the form of the part and the second provides position feedback of the stage. The third signal is the square wave output of the rotary encoder on the spindle. A 4096-count encoder is used, meaning that 4096 square wave cycles are seen for one channel in one rotation of the spindle. Each square wave passage triggers all channels to be simultaneously sampled, resulting in 4096 samples per revolution. Spatially-based sampling, rather than timebased, ensures that data points from consecutive revolutions are perfectly in phase, and

22 removes the effects of spindle speed on data acquisition. The final signal that is sampled is the index pulse from the encoder. This is a reference point for defining the absolute angular position of the spindle. Once the angle is known, comparison between different sets of data is simplified.

Figure 23: National Instruments BNC-2110 breakout box used for data acquisition.

2.1.4 Sensors Two Lion Precision capacitance probes are used for form measurement. Each probe is a model C1-C with a diameter of 3/8, driven by a DMT-10 amplifier. These are shown together in Figure 24. Used in Fine range, the sensor is linear over a measurement range of 0.003 to 0.005. The driver output is a DC voltage that is inversely proportional to the gap width at a sensitivity of 10 Volts per thousandth of an inch. The diameter of the sensor area is 0.067. The measurement spot size is a circle 30% larger than the sensor area, with a diameter of 0.0763 [20].

23

Figure 24: Lion Precision C1-C capacitance probe and two-channel DTM-10 amplifier.

2.1.5 Hardware Interaction These components are assembled as shown in Figure 25. The system includes the C2M2 and two personal computers. The motion of the C2M2 is controlled by the U500 motion controller, run by PC 2, which in turn receives position feedback from the encoders on the C2M2. The output of the capacitance probes is recorded by the National Instruments data acquisition system that is run by PC 1. In order to coordinate the experiment, there is communication between PC 1 and PC 2 as well. PC 1 senses the spindle position via the BB500 breakout board. In order to index the probe along the Z-axis, PC 1 sends a 5volt pulse to an analog input of the BB500. A similar trigger at the end of the test signals the spindle to stop.

24

Figure 25: Hardware architecture.

2.2 Active Error Separation The traditional philosophy of precision machine design dictates that the machines structural loop should be as stiff as possible. A common rule of thumb is that a measuring machine should be stiff enough that the user could replace the gauging device with a cutting tool and machine a part with it. The purpose is to reduce machine deflections to a level that wont influence the measurement. The design of the C2M2, then, is a departure from traditional machine design principles. The machine is built with an air bearing stage that moves along the sensitive direction axis. The purpose is to accommodate parts of different geometries. Air bearing ways were chosen for two reasons. First, they provide a straight and flat axis of travel

25 that minimizes motion transverse to the sensitive direction. Furthermore, the frictionless air bearings allow improved velocity and position control. This is crucial if trying to follow the contour of a part with a diameter that varies along its length. The result is that the only mechanical contact between the stage and the machine base is via the ballscrew. This leads to lower stiffness compared to a traditional machine base and extremely low damping. Thus, the machine is unsuitable for any machining operations. The lack of stiffness and damping leads to considerable deflection in the sensitive direction that strongly influences the data gathered from the probe. 2.2.1 Y-Stage Position Tracking The solution is to track the motion of the stage and account for it in the measurement. A second capacitance probe was therefore installed to track the fine vibration of the Y-axis stage. This is in addition to an identical probe that targets the artifact itself. This arrangement is shown in Figure 26. Probe 1 can clearly be seen in the top of the photo, targeting the cylindrical artifact. Probe 2 is seen in the lower left hand corner, facing the side of the stage. A lapped gage block acts as the target surface to avoid effects from the rough surface finish of the stage.

26

Probe 1

Probe 2

Figure 26: Two capacitance probes are used in order to compensate for the vibration of the stage.

The role of probe 2 is only to provide position feedback for the stage. S2, the output of probe 2, is a voltage proportional to the displacement of the stage toward the probe, in the negative Y direction, which will be called B. The displacement sensed by probe 1 has two components. The first is the artifact profile. Since the spindle and the artifact ride on top of the stage, the vibration of the stage also results in a translation of the artifact. Therefore the motion of the stage, B, is also reflected in S1, the output of probe 1. Figure 27 shows the arrangement of the probes and the components of each.

27
R=r() Artifact S1=R+B
Probe 1

Stage S2=B
Probe 2

Figure 27: Two capacitance probes are used to isolate the motion of the stage from the profile of the artifact.

Finding difference of S1 and S2 yields the profile of the artifact, as in Equation 2.1. R = S1-S2 = (B+R)-B 2.1 Continuous position corrections from the Aerotech controller result in step changes in the data, and also induce additional vibration in the structure. For this reason it is advantageous to disable the Y-axis while a test is being performed. It is impractical to try to actively control the stage position when the resolution of the position feedback, in this case the capacitance probe, is finer than that of the motion controller [21]. This approach is unacceptable for a manufacturing tool, because any movement in the structure will manifest itself in the geometry of the part that is being made. For a measuring machine, however, relative motion between the probe and the part is tolerated as long as it can be measured and accounted for. Lasers are commonly used to monitor the small machine deflections, similar to how the capacitance gauge is used. In the most rigorous case, three laser beams can be used to track the motion of the stage in a plane. By measuring the deflection of three

28 points, the translation and rotation of the stage can be precisely monitored. Through active error separation this motion could accurately be removed from the data [2]. The Moore Tool Company routinely uses a laser interferometer to track the fine movements linear stages. Even with a precision leadscrew, an angular encoder or resolver knows only about the angular position of that leadscrew; it doesnt know anything about the position of what the leadscrew is driving. The encoder feeds the information back to the control, which makes incremental adjustments. Thats the accepted definition of a closed-loop system, but is it truly closed? says Phillip Hannah of Moore Tool Company [21]. Similarly, the linear encoder mounted directly to the Yaxis stage does not precisely measure the location of the spindle. This can only be done by mounting a transducer to the spindle, or as close to it as possible. 2.3 Error Motions To fully evaluate the performance of the C2M2, it is necessary to measure the error motions that may affect the experimental data. This includes, primarily, the translation and yaw of the Y-axis stage and the error motion of the spindle. 2.3.1 Vibration Measurement In order to evaluate the error motions of the stage in the sensitive direction, two capacitance probes were mounted at the forward corners to track the motion under typical operating conditions. While the spindle was run at 16.7 RPM, the output of the two probes was recorded. The data acquisition used was a DSP Technologies Siglab model 20-42 four-channel, 12-bit signal analyzer, run by a personal computer within the MATLAB programming environment. Two Lion Precision capacitance probes were mounted on the machine base as shown in Figure 28.

29

Probe 1

Probe 2

Figure 28: Two capacitance probes, at the corners of the stage, are used to measure the yaw motion of the Y stage

Figure 29 shows the result from this test. Plot (a) shows the displacement of both corners, which exhibit periodic vibration that is roughly in phase, indicating translation along the Y-axis. The motion of the left-hand corner, indicated by probe 1, is typically greater than that shown by probe 2. This suggests a yaw component in addition to the translation. Plot (b) shows the difference between these two signals. The displacement of the left and right corners of the stage can be different by up to 30 in. The linear encoder, which sits 6 inches off-axis from the spindle and probe, is therefore inadequate to measure the displacement of the spindle itself. By interpolation, it is possible that the translation in the Y-axis between the measurement point and the encoder may differ by as much as 14 in. A better way to track the stage motion is to locate a position sensor in line with the spindle rather than offset from it. In this way, the translation, including that caused by yaw motion, is equal at the location of the position feedback device as well as at the location of the capacitance probe that measures the

30 artifact form. This is the motivation for adding the second capacitance probe, described in section 2.2.1.

Y-Stage Motion Displacement (microinches) 50 Probe 1 Probe 2 0

-50

0.05

0.1

0.25 0.3 0.35 0.4 Time (s) Difference Between Probe 1 and Probe 2

0.15

0.2

0.45

0.5

Displacement (microinches)

50

-50

0.05

0.1

0.15

0.2

0.25 0.3 Time (s)

0.35

0.4

0.45

0.5

Figure 29: Motion of the two corners of the Y stage, and the difference between the signals

Figure 210 shows the FFT of the data from (a) probe 1, (b) probe 2, and (c) the difference between them. Both probes show a peak near 40 Hz, which is the translation of the stage along the Y-axis. This is confirmed by the modal analysis that is discussed in section 2.3.3. Probe 1, however, shows another strong peak at 22 Hz that is not indicated by probe 2. This suggests that while the right side of the stage is relatively stationary, the left side is pivoting around the right at this frequency. It is reasonable to speculate that the stage is in fact pivoting around the ballscrew, which is located near the right side of the stage. The second yaw mode is seen at 103 Hz, representing the stage rotating about its own center.

31

(a) FFT of Probe 1 300 microinches 200 100 0 300 microinches 200 100 0 300 microinches 200 100 0

20

40

60 80 (b) FFT of Probe 2

100

120

20

40

60 80 (c) FFT of Yaw

100

120

20

40

60 80 Frequency (Hz)

100

120

Figure 210: FFT of Measured Stage Vibration.

2.3.2 Spindle Analysis The second significant source of error is the spindle itself. The purpose for using an air bearing spindle is that it typically offers radial error motion on the order of nanometers. Furthermore, as mentioned in section 1.5.3, if the error motion is repeatable, error mapping can be employed. In order to measure the radial motion of the spindle, a simplified master axis test was performed [2]. A master axis test was selected due to the relative ease with which it could be accomplished on an installed spindle. In this technique, a second air bearing spindle is mounted on top of the first, their rotors fixed together on a common axis of rotation. The top spindle will be referred to as the reference spindle, and the original

32 spindle will be called the test spindle. The stator of the reference spindle is then

restricted in the rotational axis, but free to translate in its five other degrees of freedom. This is accomplished by locating a gage ball, which is mounted to the stage, against a gage block, mounted to the stator of the reference spindle. This arrangement is shown in Figure 211.
Point contact between ground and reference stator Reference Spindle Stator Reference Rotor Test Rotor Test spindle stator

Master axis of rotation

Figure 211: A reference spindle is mounted on the test spindle for a master axis test.

By establishing point contact, the stator is restricted in rotation but friction is negligible in every other direction. A capacitance probe is mounted on the stage, which targets a second gage block mounted to the stator. In this way, the radial motion of the stator in the sensitive direction is measured. The resulting motion is a combination of the error motion of the reference spindle and the test spindle. In a true master axis test, a reversal would then be performed to separate the error motions of the two spindles, assuming they are of similar magnitude. The reference spindle in this case is a Professional Instruments aluminum 3R BLOCK-HEAD, which in previous tests has

33 demonstrated radial error motion of less than 0.15 in. Meanwhile, the test spindle is suspected to exhibit radial error motion greater than 30 in. Thus, in this case, the error motion of the test spindle is known to be much greater than that of the reference spindle, and the error motion of the reference spindle may be neglected. This is similar to simply using an artifact that can be assumed to be perfectly round. The probe is mounted to the stage itself to make the structural loop as small and as stiff as possible. shown in Figure 212. This setup is

Capacitance probe

Gage ball

Figure 212: A capacitance probe, mounted on the left side of the can, measures the combined radial error motion of two stacked spindles. A gage ball, seen on the right, restricts only the rotation of the stator of the reference spindle.

Data was recorded using the Cylinder City software, developed for this project, which is discussed in Chapter 3. The result is shown in Figure 213. The dominant feature of plot (a) is a repeatable radial error motion occurring at 79 upr with a magnitude of 32.5 in. The source of this peculiar error motion has not been determined, but is likely due to an error in the spindle installation or motor coupling. It is certainly not typical of the performance of this model. Plot (b) shows the same data after a digital lowpass filter is applied with a cutoff of 75 upr. When the 79 upr content is removed, the

34 residual error motion is only 1.3 in. The harmonic analysis shows several peaks, but none that are dominant. The asynchronous error motion for the test was 1.3 in. Since the error motion is unrepeatable, experimental data will be averaged over several revolutions. This also limits the benefit of error mapping, which will not be employed in this project.

79 upr

(a)

(b)

Figure 213: Results of master axis test showing the radial error motion of the C2M2 spindle. Plot (a) shows a repeatable radial error motion of 32.5 in occurring at 79 upr. With a digital low pass filter applied in plot (b), the error motion is reduced to 1.3 in and is fairly random.

35 2.3.3 Experimental Modal Analysis A modal analysis was performed on the coordinate measurement machine to explore the dynamic characteristics of the machine, the results of which revealed some significant characteristics of the machine. The analysis was performed using a fixed excitation and roving response method. The excitation was provided by impact with a Kistler model 9722A500 instrumented hammer using a medium rubber tip. The pretest indicated that the most effective drive point would be at the top of the column near a rear corner. An angle block was fixed to the machine in order to permit an impact at a 45 angle to the three axes of the machine, the purpose of which is to excite modes in each plane. The response was measured using a Kistler model 8690C5 tri-axial accelerometer with a sensitivity of approximately 1 V/g in each axis. The accelerometer was moved to 40 different data points and affixed with beeswax. For each point, 10 averages were used to maximize the coherence of the frequency response function. No windowing was used since the measured response was transient and adequately damped. Data was collected with Siglab and analyzed using STAR modal analysis software. Figure 214 shows the wireframe model of the C2M2 that is constructed from the 40 data points. The specific structures visible in the model, seen here undeformed, are the base (1), the Y-axis motor mount (2), the Y stage (3), the spindle face (4), the column (5), the Z-axis stage (6), and the X-axis stage (7). The arrow identifies the location and direction of the drive point, located at the rear, upper right-hand corner of the column.

36

5 7 6

4 3 2 1

Figure 214: Wireframe model of C2M2 1. 2. 3. 4. 5. 6. 7. Machine base Y-axis motor mount Y-axis stage Spindle Column X-axis fine adjustment stage Z-axis Stage

Table 21 lists the first ten modes of vibration that were identified by the modal analysis.

37 Table 21: Summary of natural frequencies and mode shapes Mode 1 2 3 4 5 6 7 8 9 10 Frequency (Hz) 4.1 8.3 13.6 39.2 50.5 117.8 140.8 198.1 321.1 355.9 Damping Ratio () 0.041 0.058 0.081 0.038 0.042 0.004 0.019 0.015 0.004 0.29 Mode Shape Rigid body Y translation of Y stage Rotation of spindle rotor Yaw of Y-axis stage X translation of Y stage Clamshell bending of column X-direction rocking of column Twisting of column

The first several modes identified were rigid body modes that occurred at low frequencies. These are a result of the machines vibration on its isolation mounts. The first structural mode occurs just below 40 Hz, and is the most significant mode. It is characterized by vibration of the Y-axis carriage along its axis of travel, illustrated in Figure 215. Upon further inspection, this is likely a result of compliance in the ballscrew flexure. This is detrimental to the machines structural stiffness, but is necessary to allow for misalignment in the ballscrew. This mode is the most significant for two reasons. The first is that is occurs at a low frequency that may easily be excited by operation of the machine. The second is that the vibration is along the sensitive direction of measurement. Thus vibration in this direction directly affects the data taken by the capacitance gage.

38

Mode 4: 39.1 Hz Figure 215: Mode 4 characterized by translation of Y-axis stage.

The significant remaining structural bending modes are shown in Figure 216. Mode seven, the X-direction deflection of the Y-axis stage, is not detrimental because this motion occurs in the non-sensitive direction and will cause an insignificant measurement error. The eighth mode, at 198 Hz, represents the clamshell bending of the column. This is significant as it results in translation of the capacitance probe mount in the sensitive direction, which could directly influence experimental measurements. Due to the high structural stiffness of the machine base, this vibration is of high frequency and small displacement and does not cause significant measurement errors.

39

(a) Mode 7: 140.8 Hz

(b) Mode 8: 198.12 Hz

Figure 216: Bending modes 7, and 8. These represent (a) the X-direction vibration of the Y-axis stage, and (b) clamshell bending of the column.

2.3.4 Thermal Effects Temperature changes may also induce inaccuracies in the measurements. While this factor is important on most machine tools, the measurement scale of the C2M2 is so fine that thermal expansion becomes a critical consideration. In many high precision applications, the entire machine is kept at a constant temperature using temperaturecontrolled air. Often this recirculating air can be regulated to a within 1/100 of a degree; this is far more stable that the ambient temperature in a typical laboratory or shop [21]. Furthermore, maintaining a constant through-flow brings the entire machine into equilibrium and eliminates temperature gradients that might build up throughout the course of a test.

40 Due to the cost and effort required for this retrofit, this luxury is unavailable for this project. Instead, thermal drift is compensated for in data processing. A polynomial curve fit is matched to the experimental data, and then subtracted from it. For this experiment, the machine was set up in its testing configuration but with the spindle at rest. To record the ambient temperature, a thermistor was placed within the base of the machine, underneath the Y stage. The thermistor used was a Cole Parmer model 8502-16 with an analog output sensitivity of 10 mV/F. The outputs from the two capacitance probes as well as the temperature were recorded for a period of approximately an hour. A Siglab unit was used with a sampling frequency of 12.8 Hz for a record length of nearly 56 minutes. Figure 217 (a) shows the output of the two capacitance probes over the course of the test. Probe 1, as described in section 2.2.1, indicates that the gap between the probe and artifact increased by 17 in in this time. In the same amount of time probe 2 indicated that the gap between the probe and the Y-axis stage increased only 5 in. Plot (b) shows the difference between the two signals, indicating a divergence of 12 in. This means that if the probes were zeroed at the beginning of the test, using the stage probe as a reference, it would appear that the artifact has shrunk 12 in.

41

(a) Thermal Drift Shown by Capacitance Probes 15 10 Microinches 5 0 -5 Probe 1 Probe 2

10

30 40 Time (minutes) (b) Effective Thermal Growth

20

50

60

15 10 Microinches 5 0 -5

10

20

30 Time (minutes)

40

50

60

Figure 217: Time traces from probes 1 and 2. Due to thermal expansion in the metrology loop, the artifact appears to have effectively shrunk by 12 in.

This drift can be reduced significantly by fitting a curve to the line and subtracting it. Figure 218 shows the curve fit that is applied to the plot of the thermal growth in the upper plot, and the lower plot shows the thermal growth with this curve fit subtracted. The reduction in drift is significant, reducing it to less than 1 in.

42

(a) Thermal Growth and Applied Curve Fit 10 Uncompensated thermal growth Curve fit Microinches 5

-5

30 40 50 Time (minutes) (b) Thermal Growth Before and After Subtraction of Curve Fit Uncompensated error Error after temperature compensation

10

20

60

10

Microinches

-5

10

20

30 Time (minutes)

40

50

60

Figure 218: Curve fit and residual thermal growth after the curve fit is subtracted.

This demonstrates that thermal expansion is a slow process, and can be accurately approximated on the relevant time scale by a second order polynomial curve. The machine, due to its thermal mass, is slow to follow any rapid temperature fluctuations. Furthermore the temperature itself changes very little in this short period of time. Figure 219 shows the ambient temperature within the machine base, underneath the Y-axis stage. A FFT of this data reveals no clear period. Similar tests conducted in the same laboratory in the past have possessed a periodic nature due to the HVAC system. This is not apparent in this data, perhaps because of the location of the thermistor, the time of day, the season, or duration of the test. One notable event on this graph occurs just before the 50-minute point, where a small spike occurs. This is due to work being done

43 nearby, indicating that the machine responds, albeit slowly, to its environment. This spike is also notable because it corresponds to the peak error shown in Figure 218.

Ambient Temperature Fluctuation 71.6 71.55 71.5 Temperature (F) 71.45 71.4 71.35 71.3 71.25 71.2 0 10 20 30 Time (minutes) 40 50 60

Figure 219: Temperature fluctuation over a 56 minute period.

An individual test will seldom last for more than one minute, so is it important to look at the effectiveness of the curve fit over a short period. The thermal drift over a one minute period is shown in Figure 220. Plot (a) shows the individual signals of the capacitance probes, and plot (b) shows the difference between them. In this period the total thermal growth is less than one in.

44

(a) Thermal Drift Shown by Capacitance Probes 2 1 0 -1 -2 Probe 1 Probe 2

Microinches

0.1

0.2

0.3

0.4 0.5 0.6 0.7 Time (minutes) (b) Effective Thermal Growth

0.8

0.9

2 1 0 -1 -2

Microinches

0.1

0.2

0.3

0.4 0.5 0.6 Time (minutes)

0.7

0.8

0.9

Figure 220: Thermal drift over a one minute period for probe 1 and 2, and the resulting thermal growth.

The application of a second order polynomial can reduce this error somewhat, as shown in Figure 221. Plot (a) shows the thermal growth with a polynomial fit to it. Plot (b) shows the same thermal growth, and the residual error after the curve fit has been subtracted. For this period the error is reduced to less than 0.5 in.

45

(a) Thermal Growth and Applied Curve Fit 1 0.5 Microinches 0 -0.5 -1 Uncompensated thermal growth Curve fit

0.1

0.4 0.5 0.6 0.7 0.8 0.9 Time (minutes) (b) Thermal Growth Before and After Subtraction of Curve Fit Uncompensated error Error after temperature compensation

0.2

0.3

1 0.5 Microinches 0 -0.5 -1

0.1

0.2

0.3

0.4 0.5 0.6 Time (minutes)

0.7

0.8

0.9

Figure 221: Thermal growth and curve fit, and residual error after the curve fit is subtracted. The error can be reduced to less than 0.5 in.

2.4 Uncertainty Estimation There are several factors that may contribute to the uncertainty of the measurement. Among these are the accuracy of the instrumentation and data acquisition tools and the error motions of the machine that cannot be compensated for. These factors can be assembled into an uncertainty budget, which is a standard method to attach an accuracy label to the data.

46 2.4.1 Accuracy of Capacitance Probes The capacitance probes are assumed to have a nominal sensitivity, but their sensitivity is subject to inaccuracy due to environmental factors as well as the target. The accuracy is also affected by factors such as the surface finish, the shape of the target, and the normality of the probe with respect to the target surface. The curvature of the target surface has an affect on the accuracy of the capacitance probe because the finitely small spot size of the probe will have a very slight curvature. The effect is an offset error since the gap width shown is averaged over the spot size. This is not significant in the operation of the C2M2 since only relative displacement is significant. The electric field acts differently on this shape of a surface, however, and causes a sensitivity error as well. Correction factors for different part geometries are found in Table 22. For artifacts larger than 1 inch in diameter, a correction factor is not needed [20]. Surface finish is not a factor in the operation of the C2M2 due to the high finish of the single-point diamond turned artifacts. Table 22: Error multipliers for non-flat targets for Lion Precision C1-C capacitance probes. Diameter 1 Sphere 0.93 0.77 Cylinder 0.97 0.94

Changes in relative humidity and temperature can cause errors of up to 0.5% of full scale. It is accepted that this can be scaled to 1% of the range over which the gauge is used (the TIR), which for the C2M2 is nominally less than 50 in. 1% of this range results in a maximum uncertainty of 0.5 in.

47 2.4.2 Accuracy of Data Acquisition For the data acquisition system, National Instruments quotes an accuracy of 0.3808% with respect to the input, or RTI. This is a combination of offset error, electrical noise, temperature, and other factors, and is valid for a measurement range of 5 V. This leads to a maximum error of 19 mV, or 0.19 in [22]. 2.4.3 Uncertainty Budget Several sources of error may influence the roundness measurement. Several are transient errors, such as those caused by deflections in the metrology loop or electrical noise, are random and will be minimized by averaging. Other errors are systemic, repeating with each average. These include thermal errors, sensitivity errors of the capacitance probe and data acquisition hardware, and the error motion of the spindle. These errors are random and unrelated, and make a one-time contribution for a given measurement. Thus it is appropriate to add them in quadrature as shown in Equation 2.2 [23].

q =

( x )2 + + ( z )2

2.2

These errors are compiled in Table 23, resulting in a final uncertainty value of 3 in, using a coverage factor of k = 2. Table 23: Factors of uncertainty budget. Error Source Capacitance Probe Data Acquisition Spindle Roundness Thermal Total Uncertainty (k = 2) Accuracy 0.5in 0.19in 1.3 in 0.5 in 3.0 in

48

Chapter 3 Software Design and Use

New software known as Cylinder City, after the term cylindricity, was developed to perform the data acquisition and processing and provide a user interface. The software is programmed in National Instruments C for Virtual Instrumentation (CVI). The tools for data acquisition and roundness analysis were carried over from the Roundcheck software previously developed by Vincent Vigliano and subsequently improved by Robert Grejda and Dave Schalcosky for use in the Penn State Machine Dynamics Research Laboratory. An additional data acquisition channel was added to provide stage motion compensation. The acquisition process was modified to store measurements for several cross sections in matrix form rather than in one array, as was done for a single roundness measurement. Shown in Figure 31, the interface provides for test setup and control and plots the results of the roundness measurements immediately after the conclusion of the test.

49

Figure 31: Cylinder City user interface.

3.1 Data Acquisition and Storage The general data acquisition process is shown as a flowchart in Figure 32. With the Zaxis stationary, one step of data, or one cross section of the artifact, is scanned and recorded. Sampling is triggered by the square wave signal from the encoder on the spindle. For the 4096-count encoder being used on the C2M2, 4096 samples per With each square wave passage, the capacitance probes are If the test is revolution are taken.

simultaneously sampled along with the index pulse channel from the encoder. The user determines during the test setup how many steps will be measured.

50 incomplete, the CVI software triggers the U500 motion controller to index the probe, and another step is measured. Once complete, the stored data is retrieved and analyzed.

Prompt user for test setup

Acquire

Sample capacitance probe and index pulse inputs based on square wave input

Store data for this step

Trigger Z stage move to index probe

Have enough steps been collected? Yes Analyze stored data

No

Display results

Figure 32: Process for data acquisition.

3.2 Automatic Motion Control Although the system is not fully automated, once set up, it is able to complete a surface measurement of the entire part before operator input is needed. Currently the CVI data

51 acquisition program does not interface directly with the Aerotech U500 hardware. In fact, the tasks of the motion control and data acquisition are handled by separate computers, primarily for the sake of convenience. Simple motion control tasks can be triggered by the CVI software. This is done using an analog output channel on the NI breakout board to send a signal to an analog input channel on the BB500 breakout board. Once the Y and Z stages are moved into position, a program is started in the U500 interface that begins rotating the spindle. The user may then begin data acquisition using the CVI program. This process is described in Figure 33. Once one step is complete, a 5 V pulse is sent from the NI card to the U500 board. Upon seeing this pulse, the U500 program moves the Z stage up by a preprogrammed step. After a brief settling period, CVI then automatically begins acquiring the next step of data. This process continues automatically until the selected number of steps has been acquired. Upon completion, CVI sends a pulse via a second analog channel that triggers the U500 to stop the spindle and quit the program. This simple communication allows a degree of automation that enables the user to conveniently take many steps of data. This feature, called the autostep feature, can be turned off if the program is being used on a manual machine, or if manual control is preferred.

52

Select step size

Begin spindle rotation

Sample analog channels 1 and 2

Is channel 1 > 1V? No Is channel 2 > 1V? Yes Stop Spindle, Exit Program

Yes

Index Z-axis one step

No

Figure 33: Flowchart for the motion control process.

3.3 Measurement Analysis The first step in processing is to perform error separation to compensate for the motion of the stage by subtracting the data from probe 2 from that of probe 1. Then, using the index pulse as a marker, the number of data points in each complete revolution is checked to confirm that the number of points agrees with number of encoder counts. This also confirms that the index pulse has been found and the test has been run correctly. The start of the data acquisition does not necessarily coincide with the index marker, so data before the first and after the last index mark is truncated. This leaves integer number of

53 revolutions. This also ensures that the dataset starts at an angle of 0, and an angle vector can be matched to the data. If the user selects to use a digital low-pass filter, the filter subroutine then performs this task. This is done by performing a Fast Fourier Transform (FFT), which creates a series of bins from low to high frequency. For a cutoff frequency of fc, data in the bins corresponding to frequencies higher than fc are set to zero. The same principle is applied to compensate for the eccentricity of the artifact. The off-centeredness of the artifact appears as the 1 upr content. To center the data, the 1 upr bin is set to zero. By performing an inverse FFT the signal is reconstructed with the higher frequency content and the 1 upr content removed. The DC offset is then removed by subtracting the mean value of the vector. A temperature compensation routine is then called that attempts to remove any drift that has occurred throughout the course of the test. As discussed in section 2.3.4, a 2nd order polynomial curve-fit is applied to the vector, and then subtracted from it. By restricted the polynomial to the second order, it can only follow the general trend of the vector. It does not attenuate the form measurement in any way. With the data formatted, the roundness parameters are calculated. The total indicated runout, or TIR, is simply the difference between the maximum and minimum measured values. This serves as an indicator of the eccentricity of the artifact. The asynchronous error for each angular location is found by calculating the difference between the measured values at that angle. The largest asynchronous error value and the corresponding angle are stored. Figure 34 shows a sample of a roundness plot. The blue lines represent the data from each individual revolution, and the black line is the average. The spread of the blue lines is the asynchronous error. A small cloudband, and hence a low asynchronous error, indicate a highly repeatable test.

54

Asynchronous error

Individual revolution Average of all revolutions

Figure 34: A small portion of a polar plot. The light blue lines, known as the cloudband, show the result from each individual revolution of the artifact. The width of the cloudband is the asynchronous, or unrepeatable error.

The mean profile is found by averaging the points measured at each angle over several revolutions. This mean vector is then used to find the least squares center, or LSC, using Equations 1.2 and 1.3. For each point of the mean vector, the radius from the LSC is calculated. Finally, the roundness is calculated from Equation 1.5. This analysis is completed for each step as they are sequentially retrieved from the matrix. As each roundness polar plot is generated, it is also stored in a second matrix that becomes the basis of a three dimensional graph. After each ring has been processed, this matrix is then plotted in a 3-D graph representing the surface of the part. In addition to viewing the 3-D surface graph, the user can select a cross section to be individually displayed on the polar plot. 3.4 User Interface The user interface provides a control panel from which to run the experiment and a medium to display the results. An intuitive interface will also allow an inexperienced operator to easily conduct a test with little training. The interface created for Cylinder City provides the means to customize the software for use on a variety of different

55 machines, and control the acquisition portion of an experiment. The analysis and display tools are automatic and easily manipulated. 3.4.1 Test Setup The user interface has two screens that are used for setting up the test and one for running the test and displaying the results. The first screen that appears upon startup is the Settings window, shown in Figure 35. It is here that the user specifies the number of steps, or cross sections of data, that will be taken. Depending on the hardware being used, the number of encoder counts per revolution and the method of square wave triggering are set. The sensitivity of the capacitance probes being used, as well as the step size, is also entered. The step size does not directly control the size of the step, since this is programmed separately in the U500 G-code. However setting this option will store the step size used along with the test data for the purposed of documentation.

Figure 35: Settings window.

In Figure 36, the index pulse is superimposed over the encoder square wave. Sampling can occur as the square wave goes from low-to-high, as occurs near 0.18, or high-to-low as happens near 0.26. For a 4096 count encoder, there are 4096 full square wave cycles. This distinction is important, as the sample must capture the index pulse. The phasing between the square wave and the index pulse depends on the direction of

56 spindle rotation and which square wave signal is used, since many have two channels that are out of phase by 90. For the initial setup, it is helpful to use an oscilloscope to superimpose the two signals to determine the parameters. For the case shown in Figure 36, the index pulse at 0 coincides with the low to high transition of the square wave. The user would select sampling on low to high. Triggering when the square wave goes low would miss the index mark completely, since this pulse only lasts for one quartercycle of the square wave.

Encoder Output 5 4.5 4 3.5 3 Voltage 2.5 2 1.5 1 0.5 0 -0.5 -0.2 -0.1 0 0.1 Angle (degrees) 0.2 0.3 Square Wave Index Pulse

Figure 36: Square wave and index pulse from the spindle encoder.

Once the settings are stored, the user is taken to the main panel, which controls the data acquisition and displays the results. If an artifact is being setup for test for the first time, it must be centered as closely as possible. The toolbar in the main menu offers two drop-down menus, Measurement and Window. Selecting the TIR indicator from the window menu opens a new window with an image of a dial gauge, shown in Figure 37. Two options on this panel allow the user to select which capacitance probe to look at, and to change the gauge scale. The gauge shows the instantaneous output of the capacitance probe that is selected. It operates like a mechanical dial gauge, but with

57 much higher sensitivity. This is used initially for centering an artifact, and also for zeroing the capacitance probe amplifiers once the artifact is in position for testing.

Figure 37: Total Indicated Runout gauge used for artifact centering and for zeroing the capacitance probes.

Returning to the main panel, the user then may choose the settings that control the data processing. These are located in the box labeled Test Setup, and are shown in Figure 38. First, the user selects the number of revolutions that are averaged. Recording several revolutions of the artifact is beneficial since averaging will help to reduce the effects of asynchronous error and yield a more accurate result.

58

Figure 38: Test Setup Box.

Next the A/D range for the National Instruments data acquisition card is set. Narrowing the range increases the resolution. The units menu chooses whether the results will be displayed in English or metric units. The next two options control whether thermal compensation and automatic overload rejection will be used. The next option controls the feature called autostep. With autostep on, the Z-axis indexes one step automatically, and then continues with the next measurement. Finally the user may select whether a digital low-pass filter is to be used. With this option turned on, a window becomes available where the cutoff frequency is set. 3.4.2 Acquisition The three function buttons, acquire, stop, and clear, control the acquisition process. Old data is automatically cleared when a new test is started, but the clear button is added as a failsafe due to the softwares state of constant evolution. 3.4.3 Plotting Results Once the test is complete, stored data is processed and displayed. On the right-hand side of the screen a polar plot of a single cross-section of data is displayed. A close-up is

59 shown in Figure 39. The black line shows the cloud band as well as the averaged crosssection profile under radial magnification of more than 100,000:1. The nominal polar plot radius is scaled to show the features clearly. The gray line is the mean radius from the least squares center. The green rings bound the mean line on both sides, but not tightly. It should not be interpreted as measurement of roundness. The display inside the polar plot gives the measurements for the selected step. asynchronous error are given for each step. The roundness, TIR, and

Figure 39: Polar plot and harmonic analysis for an artifact cross-section.

Below this polar graph, the FFT for the same step is given. The harmonic analysis is based on revolutions rather than time, so the units used are upr, or undulations per revolution, rather than Hertz. Below that are controls for scaling the FFT graph.

60 Finally at the bottom of the screen, a window shows what step is being viewed. By clicking the up or down arrows the user may scroll through each cross-section. In the center of the screen is a three-dimensional wireframe model of the part surface. It is the result of stacking the individual polar plots on top of one another like a stack of pancakes. By clicking on the image with the mouse and moving the cursor, the user can rotate the model to view it from any angle. Two 3-D plots are shown side by side in Figure 310 demonstrating how the model can be rotated. The model is only a representation of the surface, so measurements cannot be made from it. Like the polar plots, the scaling is arbitrarily chosen in order to give the best visualization of the part surface.

Figure 310: Two wireframe models of the same artifact, showing how the model can be rotated for viewing.

3.4.4 Saving Test Data Finally, once the test has been completed, the data may be saved. To do this the user selects save from the Measurement drop-down menu at the top of the screen. The user is asked to select a folder in which the data arrays will be created. For a new test, it is recommended that an empty folder is selected, or a new one created.

61 3.4.5 Loading Saved Data To recall this data later, Load is chosen from the same menu, and the appropriate folder is chosen. Once the data is loaded, is must be processed again. The settings are automatically set to those that are stored with the saved data, but may be changed at this point if desired. The user is prompted to select reload from the measurement menu, which processes the data according the settings on the screen. If the user changes any of the analysis settings, such as the filter cutoff frequency, the user must again select reload to analyze the data according to the new settings.

62

Chapter 4 Results

The relatively high error motion of the spindle can be corrected for, but is still restrictive to the performance of the C2M2. The master axis test, discussed in section 2.3.2, revealed radial error motion of 32.5 in occurring at 79 upr. It is remarkable that the error motion occurs only at this frequency. In fact, when this data is low-pass filtered below 75 upr, the result is radial error motion of 1.3 in, which is not unusual for a motorized air bearing spindle. This lower frequency content shows asynchronous error of 1.3 in presumably due to compliance in the structure and not the spindle. 4.1 Effects of Digital Filtering Since the error motion is relatively small below the 79 upr content, low pass digital filtering will remove most of the spindle error from experimental data. Figure 41 shows the results from a typical test without the use of the digital filter. The polar plot is dominated by the periodic error motion. The roundness indicates that the peak-to-peak difference of the mean is over 30 in. The asynchronous error is measured at 21.4 in. The FFT also shows a peak at 79 upr that dwarfs the rest of the frequency content, with its second and third harmonics also visible.

63

Figure 41: Unfiltered result of one step.

The same data was processed with the digital filter selected, with a cutoff frequency of 75 upr. The result is shown if Figure 42. The periodic error motion is completely gone, and the profile of the part emerges. The roundness indicated for this test is 4.4 in, with a greatly reduced asynchronous error value of 1.6 in.

64

Figure 42: The same experimental data, digitally low-pass filtered with a cutoff frequency of 75 upr.

The analysis software and data acquisition package were used to conduct a similar test on a Moore No. 3 Universal Measuring Machine from the Moore Tool Company. This is a four axis positioning system with high structural stiffness. Rather than the air bearing ways used in the C2M2, the Moore base uses double V-ways on the three linear axes [24]. While the straightness of travel does not match that of the linear air bearings, the stiffness in the axis of travel is far superior.

65 4.1.1 Comparison to Moore No. 3 UMM The fourth axis of motion is provided by an air bearing spindle, similar to that used on the C2M2. The spindle is a non-motorized Professional Instruments model 4R. A Heidenhein 512-count rotary encoder is installed for position tracking. The setup is shown in Figure 43.

Figure 43: A cylindrical artifact is measured using the 'Cylinder City' software on a Moore Universal Measuring Machine.

One purpose of using the Moore UMM is to explore the validity of the use of a digital low pass filter. Out of necessity, data taken with the C2M2 is usually filtered using a digital low-pass filter with a cutoff frequency of 75 upr. Figure 44 (a) shows a comparison of the roundness data obtained with and without the use of the low-pass filter. The asynchronous error of the data is shown in plot (b). The use of the filter has a tendency to reduce the roundness value by an average of 0.09 in. The asynchronous error is also reduced at most points by an average of 0.23 in.

66

(a) Effect of Low-Pass Filter on Measured Artifact Roundness 8 Roundness (microinches) 6 4 2 0 Roundness Roundness with Filter

0.2

Asynchronous Error (microinches)

0.8 1 1.2 1.4 1.6 Artifact Height (in.) (b) Effect of Low-Pass Filter on Asynchronous Error

0.4

0.6

1.8

8 6 4 2 0 Asynchronous Error Asynch with Filter

0.2

0.4

0.6

0.8 1 1.2 Artifact Height (in.)

1.4

1.6

1.8

Figure 44: Roundness of an artifact and asynchronous error with and without the use of a digital low-pass filter with a cutoff frequency of 75 upr.

Figure 45 shows a typical measurement where the roundness value has been reduced by filtering. Plot (a) on the left shows the unfiltered data. Plot (b) shows the same data after the use of the digital low-pass filter with a cutoff frequency of 75 upr. It is clear in this example that the use of the filter tends to reduce the sharpness of the features. In some cases, rounding sharp features also reduces the measured roundness value.

67

(a) filtering.

(b)

Figure 45: Comparison of one measurement (a) without and (b) with the use of digital

When measuring the same part on the C2M2 as well as the Moore UMM, it is impossible to maintain the same datum. Therefore no attempt was made to correlate the roundness values measured by the two methods. However, it is valid to compare the levels of asynchronous error present in both tests. Figure 46 shows the asynchronous error for each cross section for a test on the C2M2 as well as the asynchronous error present when the same artifact was tested on the Moore UMM. In general the asynchronous error shown by the Moore UMM is much lower. In some cases it achieved an error value as low as 0.2 in. The C2M2 consistently exhibits asynchronous error values between 1 and 2 in.

68

Asynchronous Error of Roundness Measurement 3 C2M2 Moore No.3 UMM Asynchronous Error (microinches) 2.5

1.5

0.5

0.2

0.4

0.6

0.8 1 1.2 Artifact Height (in.)

1.4

1.6

1.8

Figure 46: Asynchronous error levels present in tests run on the C2M2 and on the Moore UMM.

4.2 Repeatability To measure the repeatability of the C2M2, ten consecutive measurements were taken with the Z-axis help stationary. Figure 47 shows the scatter of the roundness values calculated from each measurement. This was also a check of the validity of the use of a second capacitance probe to compensate for the motion of the Y-axis stage. Using this method of error separation, the data appears more closely clustered. deviation is reduced to 0.116 in. The standard deviation without compensation is 0.237 in. With compensation used, the standard

69
Repeatability of a Single Scan 4.5 With Compensation Without Compensation 4 Roundness (microinches)

3.5

+2

-2

2.5

5 6 Test Number

10

Figure 47: The roundness value for ten measurements taken at the same Z-axis height, with and without the use of stage motion compensation. The standard deviation with compensation is 0.116 in.

4.3 Inspection Capability The C2M2 is well suited for the evaluation of macroscopic surface features, and the wireframe plotting feature becomes very useful to visualize the part surface. This is demonstrated in Figure 48 by simply drawing a pair of lines on the side of an aluminum cylinder with a marker.

70

Figure 48: A pair of lines drawn on the side of the cylinder with a marker are clearly visible.

The C2M2 also proves useful as an inspection tool to evaluate defects in the surface of the artifact. By plotting the roundness of each step together anomalies in the form stand out. Figure 49 shows the roundness values of a test where 32 cross sections of the artifact were measured at a vertical spacing of 1/16 inch. The peak roundness value occurs slightly below a height of 0.2 inches.

71
Measured Roundness of a Test Artifact 8 7 Roundness (microinches) 6 5 4 3 2 1 0 0 0.2 0.4 0.6 0.8 1 1.2 Artifact Height (in.) 1.4 1.6 1.8 2

Figure 49: Roundness of a cylindrical artifact.

Upon inspection of the corresponding cross section, shown in Figure 410, a feature juts out from the nominal profile of the cylinder. The wireframe model on the left also shows this feature, near the bottom-right of the model.

72

Figure 410: The profile measured at 0.1875" shows a protrusion on the surface of the artifact.

4.4 Possible Applications One possible application for this technology is the non-contact measurement of parts with a delicate surface finish, such as artifacts that are made through single point diamond turning. The growing field of infrared optics will necessitate such inspection methods. Furthermore, the field of optics is beginning to include parts with geometries that are more complex than simple cylinders, such as nonrotationally symmetric shapes. The generation of more complex shapes is becoming more common with the development of fast tool servos. Traditional single point diamond turning techniques can only produce surfaces of revolution. With the addition of active tool control, shapes may be created

73 that are not symmetrical around an axis of rotation. A fast tool servo has been demonstrated that controls the displacement of the tool via a piezoelectric actuator. The position of the tool, controlled as a function of the angle of the workpiece, can cut varying features into the part surface with a maximum travel of up to 787 in (20 m). The C2M2 would be a uniquely suited inspection tool to evaluate the shape of such parts [25].

74

Chapter 5 Conclusions and Future Work

The C2M2 has demonstrated the ability to make accurate and repeatable roundness measurements along the length of a cylindrical workpiece and shows promise as a useful inspection tool. An experimental repeatability study shows that consecutive measurements lie within 0.25 in of the mean with 95% confidence. The calculated uncertainty is 3 in, a reflection of the several potential sources measurement error. Future work may be helpful to realize the unique potential of the machine. The spindle suffers from radial error motion that is significantly outside of the manufacturers specifications, and could be repaired with a moderate investment. Elimination of the 79 upr error motion would increase all aspects of the machines performance. Most noticeably, the need for low-pass filtering would be done away with, increasing the machines measurement bandwidth. Eliminating this error motion would also decrease the overall vibration of the machine, reducing asynchronous error resulting from machine deflection. Currently, the error motion of the Y-axis stage is compensated for by tracking the stage position with a capacitance probe. This yields very good performance, but reduces the versatility of the machine. If an artifact of a different diameter is to be inspected, the capacitance probe needs to be relocated so the Y-axis stage can be moved. This limitation can be solved with the use of a different type of position sensor. It has been shown that the single Heidenhein linear encoder is insufficient due to its location relatively far from the spindle. An ideal solution would be to mount a laser interferometer in line with the spindle. This would provide position feedback that is comparable in accuracy to the capacitance probe, but would work over a much larger range. This provides the ability for the Y-axis to be moved to accommodate artifacts of varying diameters. Another solution may be to mount an additional linear encoder on the

75 opposite side of the stage. By knowing the displacement of each side of the stage, the position of the spindle could be interpolated. Other contributions to the uncertainty budget are related to environmental influences. The thermal growth of the machine, the sensitivity of the capacitance probes, and the accuracy of the data acquisition system are influenced by variations in ambient air temperature, pressure, and humidity. Improved temperature control through the use of an enclosure or air bath would help to mitigate these unknowns. Further investment in hardware has the potential to yield even greater accuracy and versatility than is currently achievable. The addition of a non-contact probe provides a unique measurement tool capable of measuring an artifact with a delicate surface finish, previously possible only by optical methods. The C2M2 promises to be a useful tool in the inspection of high-precision workpieces.

76

BIBLIOGRAPHY

1. 2. 3.

Mel Liebers. Personal Communication. April, 2002. Grejda, Robert D. Axis of Rotation Metrology Tutorial. Presented at the ASPE 17th Annual Meeting, St. Louis, MO, Oct. 21, 2002. Tan, Jiubin; Zhao, Weiqian; Yang, Wenguo. Development of Research on SuperPrecision Measurement Techniques for Circle and Cylindrical Contour . Proceedings of SPIE, v. 4222, 2000, pp. 21-26. Vigliano, Vincent. Computer Control for Precision Bearing Analysis. M.S. Thesis, The Pennsylvania State University, 2001. Schalcosky, David C. Design of a Precision Parallel Axis Flatness Inspection Machine. M.S. Thesis, The Pennsylvania State University, 2002. Grejda, Robert D. Use and Calibration of Ultraprecision Axes of Rotation with Nanometer Level Metrology. Ph.D. Thesis, The Pennsylvania State University, 2002. Whitehouse, David J. Handbook of Surface Metrology. Philadelphia: Institute of Physics Publishing, 1994. ANSI B89.3.1-1972. Measurement of Out-of-Roundness. New York, NY: ASME, 1997. Gleason, E., Schwenke, H. A Spindleless Instrument for the Roundness Measurement of Precision Spheres. Precision Engineering, v. 22, 1998, pp. 37-42. Estler, W. Tyler, Evans, Chris J., Shao, L.Z. Uncertainty Estimation For Multiposition Form Error Metrology. Precision Engineering, v. 21, 1997, pp. 7282. Chetwynd, D.G., Siddall, G.J. Improving the Accuracy of Roundness Measurement. Journal of Physics E: Scientific Instruments, v. 9, 1976, pp. 537544.

4. 5. 6.

7. 8. 9. 10.

11.

77 12. 13. 14. 15. 16. ANSI/ASME B89.3.4M-1985. Axes of Rotation: Methods for Specifying and Testing. New York, NY: ASME, 1992. Horikawa, O., Maruyama, N., Shimada, M. A Low Cost, High Accuracy Roundness Measuring System. Precision Engineering, v. 25, 2001, pp. 200-205. Taylor Hobson Precision. Talyrond 290 Product Sheet. Leicester, England. Slocum, Alexander H. Precision Machine Design. Englewood Cliffs, NJ: Prentice Hall, 1992. Badami, Vivek G. Interferometric Form Metrology for Precision Machined Surfaces. Corning Tropel Corporation. Presented at the 2001 COM Summer School, Fairport, NY, June 2001. Corning Tropel Corporation. CylinderMasterTM 25 Product Sheet. Fairport, NY. Professional Instruments Company/ Apeiron. C2M2 Cylindrical Coordinate Measuring Machine Product Sheet. Minneapolis, MN. National Instruments Corporation. NI-6110 Product Sheet. Austin, TX. Lion Precision. When Precision Matters 2000 Catalog. St. Paul, MN: Lion Precision, 2000. Turning to Millionths of an Inch. American Machinist, November, 1984. National Instruments Accuracy Calculator. National Instruments Corporation. http://www.ni.com/cgi.com/cgi-bin/accuracy_2.cgi Taylor, John R. An Introduction to Error Analysis: The Study of Uncertainties in Physical Measurements. Sausolito, CA: University Science Books, 1982. Moore, Wayne R. Foundations of Mechanical Accuracy. Bridgeport, CT: The Moore Special Tool Company, 1989. Dow, Thomas A., Miller, Michelle H., Falter, Peter J. Application of a Fast Tool Servo for Diamond Turning of Nonrotationally Symmetric Surfaces. Precision Engineering, v. 13 n. 4, October 1991, pp. 243-250.

17. 18. 19. 20. 21. 22. 23. 24. 25.

78

79

Appendix B CVI Code

//Cylinder City (cylindricity) //Mark Glauner //Last mod: 11/13/02 //Based on: //ROUNDCHECK V.2.0 (rndchkv2_1.c) //With help from Flatcheck //Analog acquisition of index //3-D Plotting //Ch 0: Cap //Ch 3: Tach //Ch 2: Cap on Stage ('stage') //PFI1: Squarewave #include "cylinder.h" #include <Dataacq.h> #include <utility.h> #include <formatio.h> #include <ansi_c.h> #include <easyio.h> #include <analysis.h> #include <cvirte.h> #include <userint.h> #include "ba_functions.h" #include "cviogl.h" #define FALSE 0 #define TRUE 1 static int options; static int indpanel; static int panelHandle; static int surfaceControl; static int revpanel; static int tirpanel; int begin, encct, ovalcolor; //Prototypes static int SetControlAttributes(void); static int CreatePlot(void);

/* Needed if linking in external compiler; harmless otherwise */

80
int err, month, day, year, hour, minute, minutetens, secs, revdatapresent; int step, datastep, totalsteps, done; double stepsize, delay, pulse; double sense, pi; long buffersize; static char msgBuf[256]; int error; double data[250000], settings[100]; double cap[80000], tach[80000], stage[80000], capfilt[250000], capprime[250000], angleprime[250000], capfund[250000]; double surfacecap[80000][100], surfacestage[80000][100], surfacetach[80000][100]; double capreduced[80000][100], capsurfclean[80000][100]; double angle[200000], xtemp[200000], capfit[200000], capplot[200000]; double capfft[200000], null[200000], fftx[200000], spindlefft[200000]; double vecx[200000], vecy[200000]; double capsave[2000000], stagesave[2000000], tachsave[2000000]; double capm[512]; double asynch[5000], capmean[5000], cappoints[5000], capmean1[5000], capmean2[5000], rlsc[5000], thetalsc[5000], R[5000]; double capmeanstore[5000][100], capplotstore[5000][100], Rstore[5000][100], fftxstore[80000][100]; double caprev[5000]; double spindle2[5000]; double mark[1000][100], backlog[10000], sqcount[10000], captemp[1000], timevec[1000], rpmvec[1000]; double capthermal[128], coef[100]; double polycoefs[10], xvec[10], yvec[10], nullx[10], nully[10]; double mean, mean2, max, min, asymax, capmin, capmax, cpr, upr; double asynchtest2; double testTIR, testTIRstore[100]; double a1, b1, t1, t2; double mserr; double deg; double deg2; double bcircle, a, b, a2, b2; double dcoffset, dcoffset_prev, dcoffset_max; double lsc, lscpart, lscspindle; double astore[100], bstore[100], lscstore[100], asymaxstore[100], degstore[100]; double maxfftstore[100], ifftmaxstore[100], rpmstore[100], varstore[100]; double maxfft, ct; double maxspindlefft; double rmin, rmax, thetamin, thetamax; double revs,maxrevs,datapoints,maxpoints,pt2; double datum, vcap, vcapin, tirscl; double range, range2; double delta; double wait; double del; double xcoor, ycoor;

81
double tachmax; double maxupr, xupr, halfpts, ifftmax; double order2, circleval, x, y, max2, min2; double t, delt, rpm, rpm2, backlogval, var, var2; double dddzarray[200000], dddmag[200000], dddphase[200000]; double dddvecx[200000], dddvecy[200000], bobert[900000]; short int trigger, live, datapresent, livebar; int orderpoly, capswitch; int perrev, points, pt, logind; int i, j, k, l, m, n, p, w, revnum, inc; double filtcap[250000]; int order, cutoff; int scale; int fftscale, xpts; int imax, imin; int color; int amode; int test; int reversal; int indon, tirdiv; int rgb, fftcolor, backcolor; int windType; int rangeval, ovldrej, ovld; int rgb, superlightgray, backcolor; int autostep, showstep, loaded; unsigned long scanbacklog; long channum, taskID, rpmID, scanstate, scannum, scanbklg, taskIDtir; short brdcode; char path[300], tempchar[3000]; char filename; int liverev; int main (int argc, char *argv[]) { if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in external compiler; harmless otherwise */ return -1; /* out of memory */ if ((panelHandle = LoadPanel (0, "cylinder.uir", PANEL)) < 0) return -1; if ((tirpanel = LoadPanel (0, "cylinder.uir", TIRPANEL)) < 0) return -1; if ((options = LoadPanel (0, "cylinder.uir", OPTIONS)) < 0) return -1; SuspendTimerCallbacks(); SetPanelAttribute (panelHandle, ATTR_WINDOW_ZOOM, VAL_MAXIMIZE); DisplayPanel (panelHandle);

82
// Create OpenGL control on CVI panel surfaceControl = OGLConvertCtrl(panelHandle,PANEL_OGLPORT); if (surfaceControl<0) { OGLGetErrorString (surfaceControl, msgBuf, 255); MessagePopup("OGLConvertCtrl Error", msgBuf); goto Error; } // Setup CVIOGL control SetControlAttributes(); OGLRefreshGraph(panelHandle,surfaceControl); superlightgray = MakeColor (1, 1, 1); SetPanelAttribute (panelHandle, ATTR_DIMMED, TRUE); //Default Values pi = 3.1415927; buffersize = 400000; dcoffset_prev=0; Clear1D(astore, 100); Clear1D(bstore, 100); //Time/Day Stamp err = GetSystemDate (&month, &day, &year); err = GetSystemTime (&hour, &minute, &secs); minutetens = minute/10; minute = minute - minutetens*10; //Date and Time SetCtrlVal (panelHandle, PANEL_MONTHBOX, month); SetCtrlVal (panelHandle, PANEL_DAYBOX, day); SetCtrlVal (panelHandle, PANEL_YEARBOX, year); SetCtrlVal (panelHandle, PANEL_HOURBOX, hour); SetCtrlVal (panelHandle, PANEL_MINUTEBOX_2, minutetens); SetCtrlVal (panelHandle, PANEL_MINUTEBOX, minute); //Calibrate the DAQ Board begin = ConfirmPopup ("PCI-6032E Board Calibration", "Do you want to calibrate the DAQ board?"); if (begin) { MessagePopup ("PCI-6032E Board Calibration", "The Data Acquisition Board Will Now be Calibrated.\n" "This may take a few minutes."); Calibrate_E_Series (1, ND_SELF_CALIBRATE, ND_NI_DAQ_SW_AREA, 0); MessagePopup ("PCI-6032E Board Calibration", " Calibration Complete!"); }

83
InstallPopup (options); RunUserInterface (); // Dicard CVIOGL control OGLDiscardCtrl(panelHandle,surfaceControl); Error : return error; } //Save Settings int CVICALLBACK savesettings (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: GetCtrlVal(options, OPTIONS_ENCCOUNT, &encct); GetCtrlVal(options, OPTIONS_GAGESENSE, &sense); GetCtrlVal(options, OPTIONS_TOTALSTEPS, &totalsteps); GetCtrlVal(options, OPTIONS_STEPSIZE, &stepsize); //RPM Task/Scan Clock/Buffer nidaqAICreateTask ("daq::1!(0,3)", kNidaqWaveformCapture, &channum, &rpmID); nidaqAIConfigBuffer (rpmID, buffersize, kNidaqContinuous); nidaqAIConfigExternalScanClock (rpmID, "daq::1!(PFILowtoHigh1)"); // Ch B, High to Low nidaqAIStart (rpmID); t1 = Timer(); RemovePopup(0); SetPanelAttribute (panelHandle, ATTR_DIMMED, FALSE); ResumeTimerCallbacks(); break; } return 0; } //INITIATE ACQUISITION: //Triggered 1) by pressing Acquire button on control panel // 2) when called by autostep int CVICALLBACK acquire (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: SuspendTimerCallbacks();

84
//Initialize Board Init_DA_Brds (1, &brdcode); done=0; live = 1; //taking data in process livebar = 0; //don't take data for bar indicator pt = 0; //'data' vector indice logind = 0; //'backlog' vector indice ovld = 0; //no overload yet loaded = 0; //new data acquired: not data from file //Time/Day Stamp err = GetSystemDate (&month, &day, &year); err = GetSystemTime (&hour, &minute, &secs); minutetens = minute/10; minute = minute - minutetens*10; //Clear data Clear1D (data, 250000); Clear1D (cap, 80000); Clear1D (tach, 80000); Clear1D (stage, 80000); Clear1D (capprime, 250000); //Delete plots DeleteGraphPlot (panelHandle, PANEL_ROUNDPLOT, -1, VAL_IMMEDIATE_DRAW); DeleteGraphPlot (panelHandle, PANEL_FFTPLOT, -1, VAL_IMMEDIATE_DRAW); //Clear results DefaultCtrl (panelHandle, PANEL_FIM); DefaultCtrl (panelHandle, PANEL_MAXFFT); DefaultCtrl (panelHandle, PANEL_MAXASYNCH); DefaultCtrl (panelHandle, PANEL_ASYANGLE); DefaultCtrl (panelHandle, PANEL_ESYNCH); //Get Encoder Counts/Rev Value GetCtrlVal(options, OPTIONS_ENCCOUNT, &encct); cpr = encct; //Check number of revs GetCtrlVal (panelHandle, PANEL_REVNUM, &revnum); perrev = encct; if(revnum == 0){points = 6*perrev;} // 4 revs if(revnum == 1){points = 10*perrev;} // 8 revs if(revnum == 2){points = 18*perrev;} //16 revs if(revnum == 3){points = 34*perrev;} //32 revs if(revnum == 4){points = 66*perrev;} //64 revs if(revnum == 5){points = 130*perrev;} //128 revs //Create Scan Clock nidaqAICreateTask ("daq::1!(0,2,3)", kNidaqWaveformCapture, &channum, &taskID); GetCtrlVal(options, OPTIONS_SQRLOGIC, &n);

85
if(n == 0){ nidaqAIConfigExternalScanClock (taskID, "daq::1!(PFIHighToLow1)");} if(n == 1){ nidaqAIConfigExternalScanClock (taskID, "daq::1!(PFILowToHigh1)");} nidaqAIConfigBuffer (taskID, buffersize, kNidaqContinuous); //Voltage Range GetCtrlVal (panelHandle, PANEL_VOLTRNG, &rangeval); GetCtrlVal (panelHandle, PANEL_OVLDREJ, &ovldrej); nidaqAIConfigChannelLimits (taskID, "daq::1!(3)", 10, -10); //Fixed ranges if(rangeval == 0){range = 0.2, nidaqAIConfigChannelLimits (taskID, "daq::1!(0,2)", range, -range);} if(rangeval == 1){range = 0.5, nidaqAIConfigChannelLimits (taskID, "daq::1!(0,2)", range, -range);} if(rangeval == 2){range = 1.0, nidaqAIConfigChannelLimits (taskID, "daq::1!(0,2)", range, -range);} if(rangeval == 3){range = 2.0, nidaqAIConfigChannelLimits (taskID, "daq::1!(0,2)", range, -range);} if(rangeval == 4){range = 5.0, nidaqAIConfigChannelLimits (taskID, "daq::1!(0,2)", range, -range);} if(rangeval == 5){range = 10.0, nidaqAIConfigChannelLimits (taskID, "daq::1!(0,2)", range, -range);} //Acquisiiton Start nidaqAIStart (taskID); //Display Acquisition Panel wait = 0; SetCtrlVal(panelHandle, PANEL_WAITBAR, wait); ResumeTimerCallbacks(); t = Timer(); timevec[logind] = t; break; } return 0; } //DPLOT //Creates 3D wireframe model static int dplot(void) { int error = 0; //Plot the 3D plot******************************************************** //format the data correctly //first clear a couple vectors Clear1D (capmean, 5000); Clear1D (capplot, 5000); //For each ring get the synchronous for (m=0;m<totalsteps;m++)

86
{ //begin of all rings //pick off the current ring from the surface array and //add DC offset (constant for each ring) for (w=0;w<perrev;w++) { capmean[w]=capmeanstore[w][m]; capplot[w]= capmean[w] + dcoffset_max; } //put the ring height in an array for (w=0;w<perrev;w++) { dddzarray[m*perrev+w]=stepsize*m; } //Put the radius of the ring in a vector for (w=0;w<perrev;w++) { dddmag[m*perrev+w] = capplot[w]; } //Put the angle of each point on the ring in a vector for (w=0;w<perrev;w++) { dddphase[m*perrev+w] = angle[w]; }

}//end of all rings //take the mag and phase of the circles //and convert to rect ToRect1D (dddmag, dddphase, perrev*totalsteps, &dddvecx[0], &dddvecy[0]); //Assemble the vector for the 3d plot for (p=0;p<perrev*totalsteps/12;p++) { bobert[3*p]=dddvecx[p*12]; bobert[3*p+1]=dddvecy[p*12]; bobert[3*p+2]=dddzarray[p*12]; } //call plot CreatePlot(); //End of 3D plot Error : return error; }

87
//NEXTSTEP: //If autostep is on, NEXTSTEP tells U500 to index, then triggers ACQUIRE function call static int nextstep(void) { Clear1D(cap, points); Clear1D(tach, points); Clear1D(stage, points); GetCtrlVal (panelHandle, PANEL_AUTOSTEP, &autostep); if(autostep==0)ResetTextBox (panelHandle, PANEL_STATUSBOX, "acquire when ready"); else{ ResetTextBox (panelHandle, PANEL_STATUSBOX, "Stepping"); AOUpdateChannel (1, "0", 5.0); pulse=0.1; delay=5; Delay(pulse); AOUpdateChannel (1, "0", 0.0); Delay(delay); ResetTextBox (panelHandle, PANEL_STATUSBOX, "Acquiring"); acquire(panelHandle, 0, EVENT_COMMIT, 0, 0, 0); } Error : return error; } //ANALYZE //after all steps of data have been taken, ANALYZE performs calculations for each step static int analyze(void) { wait=0; live=0; datapresent=1; SetCtrlVal(panelHandle, PANEL_WAITBAR, wait); ResetTextBox (panelHandle, PANEL_STATUSBOX, "Scan Complete"); for(step=0;step<totalsteps;step++){ Clear1D(cap, points); Clear1D(stage, points); points=datapoints; changed by last processing loop for(i=0;i<points;i++){ cap[i] = surfacecap[i][step]; stage[i] = surfacestage[i][step]; } //Remove Offset RemoveOffset(cap,points,&cap[0]); RemoveOffset(stage,points,&stage[0]); //Subtract stage error from cap signal to compensate for y stage motion //Reset 'points' to global 'datapoints'- may have been

88
Sub1D (cap, stage, points, cap); //Remove Offset, just in case subtraction introduced an offset again RemoveOffset(cap,points,&cap[0]); // New 'cap': remove exactly two revs (beginning|rev#1|.....|end) // points = points - 2revs // Note: mark vector is for this step only, but j is left over the the final step // It is assumed that j is equal for all steps (same # of revs for each step) k=0; for(i=mark[1][step];i<mark[j][step];i++){ capprime[k] = cap[i]; k++; } Clear1D(cap,points); points = points-(2*encct); // store reduced, centered data in new matrix for(i=0;i<points;i++){ cap[i]=capprime[i]; } inc = (points/encct); //angle vecy (rad) for(n=0;n<points;n++)angle[n] = (2*pi*inc*n/points); //Filter and Remove Once Around GetCtrlVal (panelHandle, PANEL_FILTCUTOFF, &cutoff); GetCtrlVal (panelHandle, PANEL_FILTTOGGLE, &n); if(n==1){ Clear1D(null, points); FFTFilter(cap,null,points,encct,cutoff,&cap[0]); } if(n==0|cutoff==0){ Clear1D(null, points); cutoff = 0; FFTFilter(cap,null,points,encct,cutoff,&cap[0]); } //Temperature Compensation GetCtrlVal (panelHandle, PANEL_THERMAL, &n); orderpoly = 2; if(n == 1)RemoveThermalDrift(cap,xtemp,points,orderpoly, &polycoefs[0], &cap[0]); //Convert to units GetCtrlVal(options, OPTIONS_GAGESENSE, &sense); for(i=0;i<points;i++){ cap[i] = cap[i]*sense; }

89

//FFT calculation Copy1D(cap, points, capfft); Clear1D (null,points); FFT (capfft, null, points); for(i=0;i<points;i++){ capfft[i] = pow (capfft[i], 2); null[i] = pow (null[i], 2); capfft[i] = sqrt (capfft[i] + null[i]); capfft[i] = capfft[i]*2/points; } Clear1D (null,points); MaxMin1D (capfft, points, &max, &imax, &min, &imin); maxfft = max; //'fftx' plotting vector revs = inc; ct = 0; for(i=0;i<points;i++){ fftx[i] = (1/revs)*ct; ct = ct + 1 ; fftxstore[i][step] = fftx[i]; } //at upr maxupr = encct/2; halfpts = points/2; MaxMin1D (capfft, halfpts, &max, &imax, &min, &imin); ct = (imax/halfpts)*maxupr; ifftmax = ct; //Truncate data again to get rid of end effects from filtering k=0; for(i=encct;i<(points-encct);i++){ capprime[k] = cap[i]; angleprime[k] = angle[i]; k++; } Clear1D(cap,points); Clear1D(angle,points); points = points-(2*encct); // store reduced, centered data in new matrix for(i=0;i<points;i++){ capreduced[i][step] = capprime[i]; cap[i]=capprime[i]; angle[i]=angleprime[i]; } inc=inc-2; //DC offset removed

90
RemoveOffset(cap,points,&cap[0]); //Final Overload reject... MaxMin1D(cap, points, &max, &imax, &min, &imin); if(max == min){ ResetTextBox (panelHandle, PANEL_STATUSBOX, "overload"); } //Acquisition Done wait = 0; SetCtrlVal(panelHandle, PANEL_WAITBAR, wait); //*** //***************CALCULATE MEASUREMENTS**************** //*** //Measurements: //TIR //Asynch. Error //Roundness //FFT //Max FFT //TIR calculation, raw data MaxMin1D (cap, points, &max, &imax, &min, &imin); testTIR = (max - min);//*sense;//in microinches //Maximum asynchronous error motion //Construct 'capmean' which is the mean of all revs Clear1D (capm,512); for(i=0;i<encct;i++){ for(n=0;n<inc;n++){ capm[n] = cap[i + n*encct]; } MaxMin1D (capm, inc, &max, &imax, &min, &imin); asynch[i] = (max - min); Mean (capm, inc-1, &mean); capmean[i] = mean; } MaxMin1D (asynch, encct, &asymax, &imax, &min, &imin); deg = imax*360/(encct-1); //Roundness Measurement (LSC) //'capmean' is mean of all revs MaxMin1D (capmean, encct, &capmax, &imax, &capmin, &imin); for(i=0;i<encct;i++){ capplot[i] = capmean[i] + fabs(capmin); capplot[i] = capplot[i] + bcircle; }

91
//find lsc center using 'capmean' ToRect1D (capplot, angle, encct, &vecx[0], &vecy[0]); a=0; b=0; for(i=0;i<encct;i++){ a = a + vecx[i]; b = b + vecy[i];} a = 2*a/encct; b = 2*b/encct; //create 'R' the radial values of the LSC for(i=0;i<encct;i++){ rlsc[i] = vecx[i] - a; thetalsc[i] = vecy[i] - b;} for(i=0;i<encct;i++){ R[i] = sqrt ((rlsc[i]*rlsc[i]) + (thetalsc[i]*thetalsc[i]));} MaxMin1D (R, encct, &max, &imax, &min, &imin); lsc = (max - min); //Store measurements for that step testTIRstore[step] = testTIR; astore[step] = a; bstore[step] = b; lscstore[step] = lsc; asymaxstore[step] = asymax; degstore[step] = deg; maxfftstore[step] = maxfft; ifftmaxstore[step] = ifftmax; rpmstore[step] = rpm; varstore[step] = var; for(i=0;i<encct;i++){ capmeanstore[i][step] = capmean[i]; Rstore[i][step] = R[i]; } //plot this step showstep=step+1; SetCtrlVal (panelHandle, PANEL_SHOWSTEP, showstep); plotstep(panelHandle, 0, EVENT_COMMIT, 0, 0, 0); } //end step loop //Create 3D plot dplot(); step=0; Error : return error; } //Timer int CVICALLBACK timer (int panel, int control, int event,

92
void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_TIMER_TICK: if(liverev == 1)break; if(indon == 1)break; if(livebar==1)break; if(live == 0){ if(rpmID == 0)break; //Get Current RPM SuspendTimerCallbacks(); nidaqAICheck (rpmID, &scanstate, &scannum); if(scannum>100000){break;} nidaqAIRead (rpmID, "daq::1!(0)", scannum, -1.0, &xtemp[0]); //Elapsed Time Calculation t2 = Timer(); delt = t2 - t1; t1 = t2; GetCtrlVal(options, OPTIONS_ENCCOUNT, &encct); cpr = encct; rpm2 = (scannum/delt)*(60/cpr); //Live RPM SetCtrlVal(panelHandle, PANEL_RPMBOX2, rpm2); //Live Cap Reading GetCtrlVal(options, OPTIONS_GAGESENSE, &sense); SetCtrlVal(panelHandle, PANEL_BARIND, xtemp[0]*sense); ResumeTimerCallbacks(); break; break;} //*** //************DAQ LOOP START ************** //*** //Wait for Square Wave ResetTextBox (panelHandle, PANEL_STATUSBOX, "waiting for trigger"); if(live == 1){nidaqAICheck (taskID, &scanstate, &scanbklg); } //If the scanbacklog vector has data, //Read in data if(scanbklg>0){ t = Timer(); timevec[logind + 1] = t; SuspendTimerCallbacks(); ResetTextBox (panelHandle, PANEL_STATUSBOX, "triggered"); nidaqAIRead (taskID, "daq::1!(0,2,3)", scanbklg, -1.0, &data[pt]); if(ovldrej == 1 | rangeval == 0){ for(i=pt;i<(pt+scanbklg);i++){ // Overloaded at 99.5% of range if(data[i] > 0.995*range | data[i] < -0.995* range){ovld = 1;}

93
} } backlog[logind] = scanbklg; logind++; pt = pt + (3*scanbklg); } //Overload beyond +/- 10 V on autorange, or beyond limits of Fixed scale if(ovld == 1){ ResetTextBox (panelHandle, PANEL_STATUSBOX, "overload"); MessagePopup ("DAQ Error", "Signal overload beyond DAQ limits."); live = 0; datapresent = 0; wait = 0; SetCtrlVal(panelHandle, PANEL_WAITBAR, wait); nidaqAIStop(taskID); nidaqAIDestroyTask(taskID); //RPM Task/Scan Clock/Buffer nidaqAICreateTask ("daq::1!(0,3)", kNidaqWaveformCapture, &channum, &rpmID); nidaqAIConfigBuffer (rpmID, buffersize, kNidaqContinuous); nidaqAIConfigExternalScanClock (rpmID, "daq::1!(PFILowtoHigh1)"); // Ch B, High to Low nidaqAIStart (rpmID); t1 = Timer(); ResumeTimerCallbacks(); break; } //Resume Timer if not complete if(pt<(3*points)){ pt2 = pt; datapoints = points; wait = pt2/(3*datapoints)*100; SetCtrlVal(panelHandle, PANEL_WAITBAR, wait); ResumeTimerCallbacks();} //*** //************DAQ LOOP END ************** //*** //Data Full else{ wait = 0; done=1; SetCtrlVal(panelHandle, PANEL_WAITBAR, wait); ResetTextBox (panelHandle, PANEL_STATUSBOX, "acquisition complete"); SuspendTimerCallbacks();

94
nidaqAIStop(taskID); nidaqAIDestroyTask(taskID); //*** //*****************MANIPULATION************** //*** //create cap and tach vector l=0; //'cap','tach','stage' vector index j=0; //'data' vector index for(n=0;n<logind;n++){ scanbacklog = backlog[n]; for(i=0;i<scanbacklog;i++){ cap[l] = data[j]; tach[l] = data[(j+(2*scanbacklog))]; stage[l] = data[(j+(1*scanbacklog))]; l++; j++;} j=j+(2*scanbacklog);} //Put data in surface array for(i=0;i<points;i++){ surfacecap[i][step] = cap[i]; surfacestage[i][step] = stage[i]; surfacetach[i][step] = tach[i]; } //find once-around vector indicies MaxMin1D (tach, points, &tachmax, &imax, &min, &imin); j=0; n=0; for(i=0;i<points;i++){ if(tach[i] > .5){ mark[j][step] = i; j++; tach[i+1] = 0; tach[i+2] = 0; tach[i+3] = 0; tach[i+4] = 0; tach[i+5] = 0; if(j>999){ break;} } } j = j-1; //No tach pulse error if(j<0){ MessagePopup("DAQ Error", "The last test could not resolve a\n" "once-per-rev pulse. Please change\n" "direction of rotation or side of\n"

95
"square wave logic."); live = 0; datapresent = 0; break; } //point per rev check n = 0; for(i=0;i<j;i++){ sqcount[i] = mark[i+1][step] - mark[i][step]; if(sqcount[i] != encct){ n = 1; k = sqcount[i]; } } step++; SetCtrlVal(panelHandle, PANEL_SHOWSTEP, step); } // end else if(done==1){ //Was that the final ring? If not, acquire again if(step < totalsteps){ nextstep(); } //If that was last pass, clean up screen and start analysis if (step==totalsteps) analyze(); } //end 'done' if break; } return 0; } //PLOTSTEP //create polar plot & FFT and diplay measurements for one step int CVICALLBACK plotstep (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: //Pick which layer to plot GetCtrlVal(panelHandle, PANEL_SHOWSTEP, &showstep); if(showstep>totalsteps){ showstep=totalsteps; SetCtrlVal (panelHandle, PANEL_SHOWSTEP, showstep); } datastep=showstep-1;

96
if(datapresent==0)break; //Delete old plots DeleteGraphPlot (panelHandle, PANEL_ROUNDPLOT, -1, VAL_IMMEDIATE_DRAW); DeleteGraphPlot (panelHandle, PANEL_FFTPLOT, -1, VAL_IMMEDIATE_DRAW); //Read in values for the chosen step from matrix testTIR = testTIRstore[step]; lsc = lscstore[datastep]; asymax = asymaxstore[datastep]; deg = degstore[datastep]; maxfft = maxfftstore[datastep]; ifftmax = ifftmaxstore[datastep]; rpm = rpmstore[datastep]; var = varstore[datastep]; a = astore[datastep]; b = bstore[datastep]; for(i=0;i<encct;i++){ capmean[i] = capmeanstore[i][datastep]; R[i] = Rstore[i][datastep]; } points=datapoints-(2*encct); for(i=0;i<points;i++){ fftx[i] = fftxstore[i][datastep]; } points=points-(2*encct); for(i=0;i<points;i++){ cap[i] = capsurfclean[i][datastep]; } //Show Calculations SetCtrlVal (panelHandle, PANEL_ESYNCH, lsc); SetCtrlVal (panelHandle, PANEL_FIM, testTIR); SetCtrlVal (panelHandle, PANEL_MAXASYNCH, asymax); SetCtrlVal (panelHandle, PANEL_ASYANGLE, deg); SetCtrlVal (panelHandle, PANEL_MAXFFT, maxfft); SetCtrlVal (panelHandle, PANEL_UPRBOX, ifftmax); //Plot Error Motion GetCtrlVal(panelHandle, PANEL_PLOTCONTROL, &n); if(n == 0){ if(lsc>1.0)circleval = ceil (lsc/2); if(lsc<1.0)circleval = (ceil (lsc*10/2))/10; } if(n == 1)circleval = 1; if(n == 2)circleval = 2; if(n == 3)circleval = 5; if(n == 4)circleval = 10; if(n == 5)circleval = 25;

97
if(n == 6)circleval = 50; if(n == 7)circleval = 100; if(n == 8)circleval = 150; if(n == 9)circleval = 200; if(n == 10)circleval = 500; bcircle = 3*circleval; MaxMin1D (cap, points, &capmax, &imax, &capmin, &imin); Mean (capmean, encct, &mean); mean = mean + bcircle + fabs(capmin); //mean error circle radius //Set Axes if(capmax>circleval)max = capmax + bcircle + fabs(capmin); if(circleval>capmax)max = circleval + bcircle + fabs(capmin); SetAxisScalingMode (panelHandle, PANEL_ROUNDPLOT, VAL_XAXIS, VAL_MANUAL, max , max); SetAxisScalingMode (panelHandle, PANEL_ROUNDPLOT, VAL_LEFT_YAXIS, VAL_MANUAL, -max, max); //Plot Total Error Motion for(i=0;i<points;i++)capplot[i] = cap[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, points, &vecx[0], &vecy[0]); rgb = MakeColor (57, 201, 232); PlotXY (panelHandle, PANEL_ROUNDPLOT, vecx, vecy, points, VAL_DOUBLE,VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1,rgb); //Synchronous Error Motion circles MaxMin1D (capmean, encct, &capmax, &imax, &min, &imin); capmax = capmax + fabs(capmin) + bcircle; //new 'capmax' min = min + fabs(capmin) + bcircle; //new 'min' ovalcolor = MakeColor(0, 130, 0); PlotOval (panelHandle, PANEL_ROUNDPLOT, mean, mean, -mean, -mean, VAL_LT_GRAY, VAL_TRANSPARENT);//mean x = circleval + mean; PlotOval (panelHandle, PANEL_ROUNDPLOT, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //outer x = mean - circleval; PlotOval (panelHandle, PANEL_ROUNDPLOT, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //inner PlotPoint (panelHandle, PANEL_ROUNDPLOT, 0.0, 0.0, VAL_CROSS, VAL_BLACK); //center cross PlotPoint (panelHandle, PANEL_ROUNDPLOT, a, b, VAL_CROSS, VAL_GREEN); //lsc center cross dcoffset=fabs(capmin) + bcircle; if (dcoffset>dcoffset_prev)dcoffset_max=dcoffset; //Plot Synchronous; for(i=0;i<encct;i++){ capplot[i] = capmean[i] + fabs(capmin) + bcircle; capplotstore[i][datastep] = capplot[i]; }

98
ToRect1D (capplot, angle, encct, &vecx[0], &vecy[0]); PlotXY (panelHandle, PANEL_ROUNDPLOT, vecx, vecy, encct, VAL_DOUBLE, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_BLACK); if(lsc>1.0)sprintf (tempchar, "-%.0f", circleval); if(lsc<1.0)sprintf (tempchar, "-%.1f", circleval); x = (mean - circleval)*cos(pi/4); y = (mean - circleval)*sin(pi/4); PlotText (panelHandle, PANEL_ROUNDPLOT, x, y, tempchar, VAL_APP_META_FONT, VAL_BLACK, VAL_TRANSPARENT); if(lsc>1.0)sprintf (tempchar, "%.0f", circleval); if(lsc<1.0)sprintf (tempchar, "%.1f", circleval); x = (mean + circleval)*cos(pi/4); y = (mean + circleval)*sin(pi/4); PlotText (panelHandle, PANEL_ROUNDPLOT, x, y, tempchar, VAL_APP_META_FONT, VAL_BLACK, VAL_TRANSPARENT); //Plot FFT GetCtrlVal (panelHandle, PANEL_FFTPLOTSCALE, &fftscale); if(fftscale == 0){if(cutoff == 0){xpts = encct/2*inc;} else{xpts = cutoff*inc;} } if(fftscale == 1){xpts = cpr*revs*0.01/2;} if(fftscale == 2){xpts = cpr*revs*0.05/2;} if(fftscale == 3){xpts = cpr*revs*0.1/2;} if(fftscale == 4){xpts = cpr*revs*0.15/2;} if(fftscale == 5){xpts = cpr*revs*0.25/2;} if(fftscale == 6){xpts = cpr*revs*0.5/2;} if(fftscale == 7){xpts = cpr*revs*0.75/2;} if(fftscale == 8){xpts = encct*inc/2;} xupr = xpts/revs; SetCtrlVal(panelHandle, PANEL_FFTPLOTXSCALE, xupr); //FFT Plot GetCtrlVal(panelHandle, PANEL_FFTYMAX, &max); if(max < 1.00){MaxMin1D (capfft, points, &max, &imax, &min, &imin);} fftcolor = MakeColor (255, 100, 100); FFTPlot2(panelHandle,PANEL_FFTPLOT,capfft,fftx,xtemp,max,points,xpts,fftcolor); //Date and Time SetCtrlVal (panelHandle, PANEL_MONTHBOX, month); SetCtrlVal (panelHandle, PANEL_DAYBOX, day); SetCtrlVal (panelHandle, PANEL_YEARBOX, year); SetCtrlVal (panelHandle, PANEL_HOURBOX, hour); SetCtrlVal (panelHandle, PANEL_MINUTEBOX_2, minutetens); SetCtrlVal (panelHandle, PANEL_MINUTEBOX, minute); //Done With Acq. live = 0; datapresent = 1;

//1% //5% //10% //15% //25% //50% //75% //Full Scale

99
//RPM Task/Scan Clock/Buffer nidaqAICreateTask ("daq::1!(0,3)", kNidaqWaveformCapture, &channum, &rpmID); nidaqAIConfigBuffer (rpmID, buffersize, kNidaqContinuous); nidaqAIConfigExternalScanClock (rpmID, "daq::1!(PFILowtoHigh1)"); // Ch B, High to Low nidaqAIStart (rpmID); t1 = Timer(); ResumeTimerCallbacks(); break; } return 0; } //STOP //stop acquisition when stop button is pressed int CVICALLBACK stop (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: if(live == 1 | liverev == 1 ){ SuspendTimerCallbacks(); nidaqAIStop(taskID); nidaqAIDestroyTask(taskID); live = 0; datapresent = 0; liverev = 0; revdatapresent = 0; wait = 0; SetCtrlVal(panelHandle, PANEL_WAITBAR, wait); ResetTextBox (panelHandle, PANEL_STATUSBOX, " "); if(test == 1)test = 0; if(test == 2)test = 1; step=0; } break; } return 0; } //---------------------------------------------------------------------------// SetControlAttributes For 3d plot //---------------------------------------------------------------------------static int SetControlAttributes(void) { int error = 0;

100
OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_LIGHTING_ENABLE, 1); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_LIGHT_SELECT, 1); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_LIGHT_ENABLE, 1); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_LIGHT_DISTANCE, 3.0); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_VIEW_DISTANCE,2.0); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_PROJECTION_TYPE,OGLVAL_PERSPE CTIVE); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_BGCOLOR,OGLVAL_WHITE); // Setup Axis Labels OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_XNAME_VISIBLE,1); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_YNAME_VISIBLE,1); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_ZNAME_VISIBLE,1); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_XNAME,"Form error"); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_YNAME," "); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_ZNAME,"Height"); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_XLABEL_VISIBLE,0); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_YLABEL_VISIBLE,0); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_ZLABEL_VISIBLE,0); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_XLABEL_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_YLABEL_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_ZLABEL_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_XNAME_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_YNAME_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_ZNAME_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_XY_GRID_VISIBLE, 1); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_YZ_GRID_VISIBLE, 1); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_XZ_GRID_VISIBLE, 1); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_XY_GRID_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_YZ_GRID_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_XZ_GRID_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_XPRECISION,0); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_YPRECISION,0); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_ZPRECISION,0); Error : return error; } //---------------------------------------------------------------------------// CreatePlot 3d plot //----------------------------------------------------------------------------

101
static int CreatePlot(void) { int error = 0; int plotTypeIs3D = 1; int numPlots; double radxStep; double radyStep; int plot; register int i,j; double x,y; double xStep,yStep; void * pts; double *pts3DPtr; OGLVertexD *pts2DPtr;

// Setup control OGLSetCtrlAttribute (panelHandle,surfaceControl,OGLATTR_PLOTAREA_ZSTART, 0.0); OGLSetCtrlAttribute (panelHandle,surfaceControl,OGLATTR_PLOTAREA_ZSIZE, 0.6); OGLSetCtrlAttribute (panelHandle,surfaceControl,OGLATTR_VIEW_AUTO_DISTANCE, 0); OGLSetCtrlAttribute (panelHandle,surfaceControl,OGLATTR_VIEW_DISTANCE, 2.0); OGLGetCtrlAttribute (panelHandle,surfaceControl,OGLATTR_NUM_PLOTHANDLES,&numPlots); // Delete any existing plots for (i=0;i<numPlots;i++) { OGLGetCtrlAttribute(panelHandle,surfaceControl, OGLATTR_FIRST_PLOTHANDLE, &plot); OGLDeletePlot(panelHandle,surfaceControl,plot,0); } plot = OGLPlot3DScatter (panelHandle, surfaceControl, bobert, 1, 30719, OGLVAL_DOUBLE); // Setup plot attributes OGLSetPlotAttribute(panelHandle,surfaceControl,plot,OGLATTR_SURFACE_STYLE,OGLVAL_SMO OTH); OGLSetPlotAttribute(panelHandle,surfaceControl,plot,OGLATTR_SURFACE_COLOR,OGLVAL_RED) ; OGLSetPlotAttribute(panelHandle,surfaceControl,plot,OGLATTR_SURFACE_SPECULAR_FACTOR,1. 0); OGLSetPlotAttribute(panelHandle,surfaceControl,plot,OGLATTR_SURFACE_SHININESS,50); OGLSetPlotAttribute(panelHandle,surfaceControl,plot,OGLATTR_WIRE_STYLE,OGLVAL_SOLID); OGLSetPlotAttribute (panelHandle, surfaceControl, plot, OGLATTR_WIRE_COLOR, OGLVAL_DK_GRAY); //} // Display plot OGLRefreshGraph(panelHandle,surfaceControl);

102
Error : return error; } //---------------------------------------------------------------------------// 3d plot control properties //---------------------------------------------------------------------------int CVICALLBACK properties (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: OGLPropertiesPopup(panelHandle,surfaceControl); break; } return 0; }

//---------------------------------------------------------------------------// DemoPanelCallback - Since CVI does not know about CVIOGL control, we must // manually resize the CVIOGL control whenever the picture control is resized. //---------------------------------------------------------------------------int CVICALLBACK DemoPanelCallback (int panel, int event, void *callbackData, int eventData1, int eventData2) { int width, height, top, left; switch (event) { case EVENT_PANEL_SIZE: GetCtrlAttribute(panelHandle, PANEL_PICTURE, ATTR_TOP, &top); GetCtrlAttribute(panelHandle, PANEL_PICTURE, ATTR_LEFT, &left); GetCtrlAttribute(panelHandle, PANEL_PICTURE, ATTR_WIDTH, &width); GetCtrlAttribute(panelHandle, PANEL_PICTURE, ATTR_HEIGHT, &height); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_TOP, top); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_LEFT, left); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_WIDTH, width); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_HEIGHT, height); OGLRefreshGraph(panelHandle, surfaceControl); break; } return 0; } //---------------------------------------------------------------------------// Change 3d Plot Type //---------------------------------------------------------------------------int CVICALLBACK ChangePlotType (int panel, int control, int event,

103
void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: CreatePlot(); break; } return 0; } //Plot FFT int CVICALLBACK fftplotxscale (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: //if no data, then break if(datapresent == 0){break;} //Clear FFT plot DeleteGraphPlot (panelHandle, PANEL_FFTPLOT, -1, VAL_IMMEDIATE_DRAW); //Plot FFT GetCtrlVal (panelHandle, PANEL_FFTPLOTXSCALE, &xupr); if(xupr > cpr/2)xupr = cpr/2; xpts = xupr*revs; //FFT Plot GetCtrlVal(panelHandle, PANEL_FFTYMAX, &max); if(max < 1.00){MaxMin1D (capfft, points, &max, &imax, &min, &imin);} fftcolor = MakeColor (255, 100, 100); FFTPlot2(panelHandle,PANEL_FFTPLOT,capfft,fftx,xtemp,max,points,xpts,fftcolor); break; } return 0; } //Plot FFT int CVICALLBACK fftplotscale (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: //if no data, then break if(datapresent == 0){break;} //Clear FFT plot

104
DeleteGraphPlot (panelHandle, PANEL_FFTPLOT, -1, VAL_IMMEDIATE_DRAW); //Plot FFT GetCtrlVal (panelHandle, PANEL_FFTPLOTSCALE, &fftscale); if(fftscale == 0){if(cutoff == 0){xpts = encct/2*inc;} else{xpts = cutoff*inc;} } if(fftscale == 1){xpts = cpr*revs*0.01/2;} //1% if(fftscale == 2){xpts = cpr*revs*0.05/2;} //5% if(fftscale == 3){xpts = cpr*revs*0.1/2;} //5% if(fftscale == 4){xpts = cpr*revs*0.15/2;} //5% if(fftscale == 5){xpts = cpr*revs*0.25/2;} //25% if(fftscale == 6){xpts = cpr*revs*0.5/2;} //50% if(fftscale == 7){xpts = cpr*revs*0.75/2;} //75% if(fftscale == 8){xpts = encct*inc/2;} xupr = xpts/revs; SetCtrlVal(panelHandle, PANEL_FFTPLOTXSCALE, xupr); //FFT Plot GetCtrlVal(panelHandle, PANEL_FFTYMAX, &max); if(max < 1.00){MaxMin1D (capfft, points, &max, &imax, &min, &imin);} fftcolor = MakeColor (255, 100, 100); FFTPlot2(panelHandle,PANEL_FFTPLOT,capfft,fftx,xtemp,max,points,xpts,fftcolor); break; } return 0; } //indicator timer int CVICALLBACK timer2 (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_TIMER_TICK: if(livebar == 0){break;} if (livebar == 1){ SuspendTimerCallbacks(); nidaqAIRead (taskIDtir, "daq::1!(0)", 1, -1.0, &datum); GetCtrlVal (panelHandle, PANEL_BARSCALE, &tirdiv); if(tirdiv == 0){tirscl = 100; SetCtrlAttribute (panelHandle, PANEL_BARIND, ATTR_MIN_VALUE, -1000.0); SetCtrlAttribute (panelHandle, PANEL_BARIND, ATTR_MAX_VALUE, 1000.0);} //2000 div if(tirdiv == 1){tirscl = 10;

//Full Scale

105
SetCtrlAttribute (panelHandle, PANEL_BARIND, ATTR_MIN_VALUE, -100.0); SetCtrlAttribute (panelHandle, PANEL_BARIND, ATTR_MAX_VALUE, 100.0);} //200 div if(tirdiv == 2){ tirscl = 1; SetCtrlAttribute (panelHandle, PANEL_BARIND, ATTR_MIN_VALUE, -10.0); SetCtrlAttribute (panelHandle, PANEL_BARIND, ATTR_MAX_VALUE, 10.0);} //20 div GetCtrlVal(options, OPTIONS_GAGESENSE, &sense); vcap = datum*sense/tirscl; //scaled vcapin = datum*sense; //microinches SetCtrlVal (panelHandle, PANEL_LEDR, 0); SetCtrlVal (panelHandle, PANEL_LEDL, 0); if(vcap > 10 | vcap == 10){ vcap = 10; SetCtrlVal (panelHandle, PANEL_LEDR, 1); } if(vcap < -10 | vcap == -10){ vcap = -10; SetCtrlVal (panelHandle, PANEL_LEDL, 1); } SetCtrlVal (panelHandle, PANEL_BARIND, vcapin); } if (livebar == 1){ ResumeTimerCallbacks();}

break; } return 0; } //Polar plot scale int CVICALLBACK plotscale (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: if(datapresent == 0)break; DeleteGraphPlot (panelHandle, PANEL_ROUNDPLOT, -1, VAL_IMMEDIATE_DRAW); //Plot Error Motion

106
GetCtrlVal(panelHandle, PANEL_PLOTCONTROL, &n); if(n == 0){ if(lsc>1.0)circleval = ceil (lsc/2); if(lsc<1.0)circleval = (ceil (lsc*10/2))/10; } if(n == 1)circleval = 1; if(n == 2)circleval = 2; if(n == 3)circleval = 5; if(n == 4)circleval = 10; if(n == 5)circleval = 25; if(n == 6)circleval = 50; if(n == 7)circleval = 100; if(n == 8)circleval = 150; if(n == 9)circleval = 200; if(n == 10)circleval = 500; bcircle = 3*circleval; MaxMin1D (cap, points, &capmax, &imax, &capmin, &imin); Mean (capmean, encct, &mean); mean = mean + bcircle + fabs(capmin); //mean error circle radius //Set Axes if(capmax>circleval)max = capmax + bcircle + fabs(capmin); if(circleval>capmax)max = circleval + bcircle + fabs(capmin); SetAxisScalingMode (panelHandle, PANEL_ROUNDPLOT, VAL_XAXIS, VAL_MANUAL, -max , max); SetAxisScalingMode (panelHandle, PANEL_ROUNDPLOT, VAL_LEFT_YAXIS, VAL_MANUAL, -max, max); //Plot Total Error Motion for(i=0;i<points;i++)capplot[i] = cap[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, points, &vecx[0], &vecy[0]); rgb = MakeColor (57, 201, 232); PlotXY (panelHandle, PANEL_ROUNDPLOT, vecx, vecy, points, VAL_DOUBLE,VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, rgb); //Synchronous Error Motion circles MaxMin1D (capmean, encct, &capmax, &imax, &min, &imin); capmax = capmax + fabs(capmin) + bcircle; //new 'capmax' min = min + fabs(capmin) + bcircle; //new 'min' ovalcolor = MakeColor(0, 130, 0); PlotOval (panelHandle, PANEL_ROUNDPLOT, mean, mean, -mean, -mean, VAL_LT_GRAY, VAL_TRANSPARENT);//mean x = circleval + mean; PlotOval (panelHandle, PANEL_ROUNDPLOT, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //outer x = mean - circleval; PlotOval (panelHandle, PANEL_ROUNDPLOT, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //inner

107
VAL_BLACK); PlotPoint (panelHandle, PANEL_ROUNDPLOT, 0.0, 0.0, VAL_CROSS, //center cross PlotPoint (panelHandle, PANEL_ROUNDPLOT, a, b, VAL_CROSS, VAL_GREEN); //lsc center cross

//Plot Synchronous; for(i=0;i<encct;i++)capplot[i] = capmean[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, encct, &vecx[0], &vecy[0]); PlotXY (panelHandle, PANEL_ROUNDPLOT, vecx, vecy, encct, VAL_DOUBLE, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_BLACK); if(lsc>1.0)sprintf (tempchar, "-%.0f", circleval); if(lsc<1.0)sprintf (tempchar, "-%.1f", circleval); x = (mean - circleval)*cos(pi/4); y = (mean - circleval)*sin(pi/4); PlotText (panelHandle, PANEL_ROUNDPLOT, x, y, tempchar, VAL_APP_META_FONT, VAL_BLACK, VAL_TRANSPARENT); if(lsc>1.0)sprintf (tempchar, "%.0f", circleval); if(lsc<1.0)sprintf (tempchar, "%.1f", circleval); x = (mean + circleval)*cos(pi/4); y = (mean + circleval)*sin(pi/4); PlotText (panelHandle, PANEL_ROUNDPLOT, x, y, tempchar, VAL_APP_META_FONT, VAL_BLACK, VAL_TRANSPARENT); break; } return 0; } //Change units on display int CVICALLBACK units (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: GetCtrlVal(panelHandle, PANEL_UNITS, &n); //metric units if(n == 1){ ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_6, 0, "nm"); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_8, 0, "nm"); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_10, 0, "nm"); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_14, 0, "nm"); ReplaceTextBoxLine (options, OPTIONS_TEXTBOX_2, 0, "nm"); } //english units else{ ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_6, 0, "in."); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_8, 0, "in."); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_10, 0, "in.");

108
ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_14, 0, "in."); ReplaceTextBoxLine (options, OPTIONS_TEXTBOX_2, 0, "in."); } break; } return 0; } //Change units on display int CVICALLBACK revunits (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: SetCtrlVal(panelHandle, PANEL_UNITS, n); //metric units if(n == 1){ ReplaceTextBoxLine (options, OPTIONS_TEXTBOX_2, 0, "nm"); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_6, 0, "nm"); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_8, 0, "nm"); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_10, 0, "nm"); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_14, 0, "nm"); } //english units else{ ReplaceTextBoxLine (options, OPTIONS_TEXTBOX_2, 0, "in."); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_6, 0, "in."); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_8, 0, "in."); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_10, 0, "in."); ReplaceTextBoxLine (panelHandle, PANEL_TEXTBOX_14, 0, "in."); } break; } return 0; } //Load Picture int CVICALLBACK picture (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_LEFT_CLICK: err = FileSelectPopup ("", "*.bmp","*.pcx;*.bmp;*.dib;*.rle;*.ico;*.wmf;*.emf", "", VAL_OK_BUTTON, 0, 0, 1, 0, &path[0]);

109
err = strlen (path); if(err == 0){break;} DisplayImageFile (panelHandle, PANEL_PICTURE, path); break; } return 0; } //Turn filter on/off int CVICALLBACK filttoggle (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: GetCtrlVal(panelHandle, PANEL_FILTTOGGLE, &n); //on, turn off if(n == 0){ SetCtrlAttribute (panelHandle, PANEL_FILTCUTOFF, ATTR_DIMMED, 1); break;} //off, turn on if(n == 1){ SetCtrlAttribute (panelHandle, PANEL_FILTCUTOFF, ATTR_DIMMED, 0); break;} break; } return 0; } //Precision of numbers shown int CVICALLBACK precision (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: GetCtrlVal(options, OPTIONS_PRECISION, &n); SetCtrlAttribute (panelHandle, PANEL_ESYNCH, ATTR_PRECISION, n); SetCtrlAttribute (panelHandle, PANEL_FIM, ATTR_PRECISION, n); SetCtrlAttribute (panelHandle, PANEL_MAXASYNCH, ATTR_PRECISION, n); SetCtrlAttribute (panelHandle, PANEL_MAXFFT, ATTR_PRECISION, n); SetCtrlAttribute (panelHandle, PANEL_UPRBOX, ATTR_PRECISION, n); break; } return 0; } //Quit Program

110
//triggers U500 to stop spindle, disable axes int CVICALLBACK quit (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: AOUpdateChannel (1, "1", 5.0); Delay(pulse); AOUpdateChannel (1, "1", 0.0); QuitUserInterface (0); break; } return 0; } //** //***********************MENU BARS ****************************** //** //MeasureMenu Bar void CVICALLBACK measure (int menuBar, int menuItem, void *callbackData, int panel) { switch(menuItem){ case ROUNDMENU_MEASUREMENT_SAVE: Clear1D (capsave, 2000000); Clear1D (stagesave, 2000000); Clear1D (tachsave, 2000000); if(datapresent == 0)break; //Write surfacecap and surfacestage matrices to vectors points = datapoints; // revert to stored value for(m=0;m<totalsteps;m++){ for(n=0;n<points;n++){ capsave[(m*points)+n] = surfacecap[n][m]; stagesave[(m*points)+n] = surfacestage[n][m]; tachsave[(m*points)+n] = surfacetach[n][m]; } } for(n=0;n<points;n++){ filtcap[n] = capsurfclean[n][1]; } //Put settings into vector settings[0]=encct; settings[1]=sense; settings[2]=totalsteps; settings[3]=stepsize; settings[4]=revnum; settings[5]=datapoints; err = DirSelectPopup ("", "Select Directory", 1, 1, &path[0]);

111
if(err < 1){break;} err = SetDir (path); //Long vectors from matrices ArrayToFile ("capsave", capsave, VAL_DOUBLE, (points*totalsteps), 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_CONST_WIDTH, 10, VAL_ASCII, VAL_OPEN_AS_IS); ArrayToFile ("stagesave", stagesave, VAL_DOUBLE, (points*totalsteps), 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_CONST_WIDTH, 10, VAL_ASCII, VAL_OPEN_AS_IS); ArrayToFile ("tachsave", tachsave, VAL_DOUBLE, (points*totalsteps), 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_CONST_WIDTH, 10, VAL_ASCII, VAL_OPEN_AS_IS); ArrayToFile ("settings", settings, VAL_DOUBLE, (6), 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_CONST_WIDTH, 10, VAL_ASCII, VAL_OPEN_AS_IS); ArrayToFile ("astore", astore, VAL_DOUBLE, (100), 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_CONST_WIDTH, 10, VAL_ASCII, VAL_OPEN_AS_IS); ArrayToFile ("bstore", bstore, VAL_DOUBLE, (100), 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_CONST_WIDTH, 10, VAL_ASCII, VAL_OPEN_AS_IS); ArrayToFile ("filtcap", filtcap, VAL_DOUBLE, (points), 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_CONST_WIDTH, 10, VAL_ASCII, VAL_OPEN_AS_IS); MessagePopup ("Save Complete", "Save has completed. Vectors\n" "have been created in the selected directory.\n" "\n"); break; case ROUNDMENU_MEASUREMENT_PRINT: SetPrintAttribute (ATTR_ORIENTATION, VAL_LANDSCAPE); SetPrintAttribute (ATTR_COLOR_MODE, VAL_GRAYSCALE); SetPrintAttribute (ATTR_PRINT_AREA_HEIGHT, VAL_USE_ENTIRE_PAPER); SetPrintAttribute (ATTR_PRINT_AREA_WIDTH, VAL_INTEGRAL_SCALE); SetPrintAttribute (ATTR_BITMAP_PRINTING, 1); PrintPanel (panelHandle, "", 1, VAL_FULL_PANEL, 1);

112
break; case ROUNDMENU_MEASUREMENT_LOAD: //Set Path err = DirSelectPopup ("", "Select Directory", 1, 1, &path[0]); if(err < 1){break;} err = SetDir (path); err = FileToArray ("settings", settings, VAL_DOUBLE, 6, 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_ASCII); //Put settings into vector encct = settings[0]; sense = settings[1]; totalsteps = settings[2]; stepsize = settings[3]; revnum = settings[4]; datapoints = settings[5]; points = datapoints; //Get Encoder Value perrev = encct; SetCtrlVal (panelHandle, PANEL_REVNUM, revnum); SetCtrlVal(options, OPTIONS_ENCCOUNT, encct); SetCtrlVal(options, OPTIONS_GAGESENSE, sense); SetCtrlVal(options, OPTIONS_TOTALSTEPS, totalsteps); SetCtrlVal(options, OPTIONS_STEPSIZE, stepsize); err = FileToArray ("capsave", capsave, VAL_DOUBLE, (points*totalsteps), 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_ASCII); err = FileToArray ("stagesave", stagesave, VAL_DOUBLE, (points*totalsteps), 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_ASCII); err = FileToArray ("tachsave", tachsave, VAL_DOUBLE, (points*totalsteps), 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_ASCII); if(err<0){break;} //Stored settings recovery for(m=0;m<totalsteps;m++){ for(n=0;n<points;n++){ surfacecap[n][m] = capsave[(m*points)+n]; surfacestage[n][m] = stagesave[(m*points)+n]; surfacetach[n][m] = tachsave[(m*points)+n]; tach[n] = surfacetach[n][m]; }

113
//find once-around vector indicies MaxMin1D (tach, points, &tachmax, &imax, &min, &imin); j=0; for(n=0;n<points;n++){ if(tach[n] > .5){ mark[j][m] = n; j++; tach[n+1] = 0; tach[n+2] = 0; tach[n+3] = 0; tach[n+4] = 0; tach[n+5] = 0; if(j>999){ break;} } } j = j-1; //No tach pulse error if(j<0){ MessagePopup("DAQ Error", "The last test could not resolve a\n" "once-per-rev pulse. Please change\n" "direction of rotation or side of\n" "square wave logic."); live = 0; datapresent = 0; break; } //point per rev check n = 0; for(i=0;i<j;i++){ sqcount[i] = mark[i+1][step] - mark[i][step]; if(sqcount[i] != encct){ n = 1; k = sqcount[i]; } } } datapoints = points; loaded = 1; some operations later

// revert to stored value //indicates that data is from file: bypasses

//Use "Reload" button MessagePopup ("Load Complete", "Load has completed. Select 'MEASUREMENT>Reload'\n"

114
"to view data.\n" "\n"); //points = points - 2 revs datapresent = 1; break; case ROUNDMENU_MEASUREMENT_RELOAD: //if no data, break if(datapresent == 0){break;} //revert to 'analyze' function call up top analyze(); break; case ROUNDMENU_WINDOW_OPTIONS: InstallPopup (options); SetPanelAttribute (panelHandle, ATTR_DIMMED, 1); break; case ROUNDMENU_WINDOW_REVERSAL: GetCtrlVal(options, OPTIONS_ENCCOUNT, &encct); break; case ROUNDMENU_WINDOW_TIR_IND: SuspendTimerCallbacks(); //Initialize Board Init_DA_Brds (1, &brdcode); indon = 1; liverev = 0; live = 0; InstallPopup(tirpanel); SetPanelAttribute (panelHandle, ATTR_DIMMED, 1); nidaqAICreateTask ("daq::1!(0,2)", kNidaqPointByPoint, &channum, &taskIDtir); nidaqAIStart (taskIDtir); ResumeTimerCallbacks(); break; case ROUNDMENU_MEASUREMENT_MENUQUIT: QuitUserInterface (0); break; }

115
} /******************************************************/ /* TIR INDICATOR /******************************************************/ int tirdiv; double datum, vcap, vcapin, tirscl; //Timer int CVICALLBACK timetick (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_TIMER_TICK: if (indon == 0){ break;} if (indon == 1){ SuspendTimerCallbacks(); GetCtrlVal (tirpanel, TIRPANEL_CAPSWITCH, &capswitch); if(capswitch==1){ nidaqAIRead (taskIDtir, "daq::1!(2)", 1, -1.0, &datum);} if(capswitch==0){ nidaqAIRead (taskIDtir, "daq::1!(0)", 1, -1.0, &datum);} GetCtrlVal (tirpanel, TIRPANEL_TIRSCALE, &tirdiv); if(tirdiv == 0){tirscl = 100; SetCtrlAttribute (tirpanel, TIRPANEL_DIAL_IND, ATTR_MIN_VALUE, -1000.0); SetCtrlAttribute (tirpanel, TIRPANEL_DIAL_IND, ATTR_MAX_VALUE, 1000.0);} //2000 div if(tirdiv == 1){tirscl = 10; SetCtrlAttribute (tirpanel, TIRPANEL_DIAL_IND, ATTR_MIN_VALUE, -100.0); SetCtrlAttribute (tirpanel, TIRPANEL_DIAL_IND, ATTR_MAX_VALUE, 100.0);} //200 div if(tirdiv == 2){ tirscl = 1; SetCtrlAttribute (tirpanel, TIRPANEL_DIAL_IND, ATTR_MIN_VALUE, -10.0); SetCtrlAttribute (tirpanel, TIRPANEL_DIAL_IND, ATTR_MAX_VALUE, 10.0);} //20 div GetCtrlVal(options, OPTIONS_GAGESENSE, &sense); vcap = datum*sense/tirscl; //scaled vcapin = datum*sense; //microinches SetCtrlVal (tirpanel, TIRPANEL_LEDR, 0); SetCtrlVal (tirpanel, TIRPANEL_LEDL, 0); if(vcap > 10 | vcap == 10){ vcap = 10;

*/

116
SetCtrlVal (tirpanel, TIRPANEL_LEDR, 1); } if(vcap < -10 | vcap == -10){ vcap = -10; SetCtrlVal (tirpanel, TIRPANEL_LEDL, 1); } SetCtrlVal (tirpanel, TIRPANEL_DIAL_IND, vcapin); SetCtrlVal (tirpanel, TIRPANEL_DIGIT_IND, vcapin); } if (indon == 1){ ResumeTimerCallbacks();} break; } return 0; } //TIR Close int CVICALLBACK close_tir (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: SuspendTimerCallbacks(); indon = 0; nidaqAIStop (taskIDtir); nidaqAIDestroyTask (taskIDtir); RemovePopup(0); SetPanelAttribute (panelHandle, ATTR_DIMMED, 0); //RPM Task/Scan Clock/Buffer nidaqAICreateTask ("daq::1!(0,3)", kNidaqWaveformCapture, &channum, &rpmID); nidaqAIConfigBuffer (rpmID, buffersize, kNidaqContinuous); nidaqAIConfigExternalScanClock (rpmID, "daq::1!(PFILowtoHigh1)"); // Ch B, High to Low nidaqAIStart (rpmID); t1 = Timer(); ResumeTimerCallbacks(); break; } return 0; } int CVICALLBACK clear (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)

117
{ switch (event) { case EVENT_COMMIT: Clear1D(cap, points); Clear1D(tach, points); Clear1D(stage, points); Clear1D(dddzarray, 200000); Clear1D(dddmag, 200000); Clear1D(dddphase, 200000); for(step=0;step<totalsteps;step++){ for(i=0;i<points;i++){ surfacecap[i][step] = cap[i]; surfacestage[i][step] = stage[i]; surfacetach[i][step] = tach[i]; } } step=0; nextstep(); break; } return 0; }

S-ar putea să vă placă și