You are on page 1of 124

The Pennsylvania State University The Graduate School College of Engineering

DESIGN OF A PRECISION PARALLEL AXIS FLATNESS INSPECTION MACHINE

A Thesis in Mechanical Engineering by David C. Schalcosky 2002 David C. Schalcosky

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

I grant The Pennsylvania State University the non-exclusive right to use this work for the Universitys 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.

________________________ David C. Schalcosky

We approve the thesis of David C. Schalcosky.

Date of Signature ___________________________ Eric R. Marsh Associate Professor of Mechanical Engineering Thesis Adviser __________________

___________________________ H. Joseph Sommer III Professor of Mechanical Engineering

__________________

___________________________ Richard C. Benson Professor of Mechanical Engineering Head of the Department of Mechanical and Nuclear Engineering

__________________

iii

ABSTRACT
In this work, a precision flatness inspection machine is designed and fabricated. The instrument is designed to measure the surface form of precision machined workpieces to a high level of accuracy and repeatability. Two Professional Instruments 4R BLOCK-

HEAD air bearing spindles are used as the axes of the machine. The workpiece is rotated by one spindle while the probe arm is stepped across the part under test via a stepper motor friction drive. Rotary encoders track the workpiece and probe-arm positions. A high resolution capacitance gage is used as the displacement indicator. A custom

LabWindows/CVI designed software interface acquires high-bandwidth surface form data, performs data analysis, and displays the results in a custom user interface. The machine is designed using precision machine design techniques to have superior static and dynamic stiffness, a high resolution control system, and low machine error motions. The machine is fully characterized to assess its capabilities to perform accurate measurements. Results indicated that the machine is capable of measuring a variety of precision workpieces to sub-micrometer accuracy.

iv

TABLE OF CONTENTS

List of Figures ......................................................................................................................................vi List of Tables.........................................................................................................................................x Acknowledgements .............................................................................................................................xi CHAPTER 1: OVERVIEW...............................................................................................................1 1.1 Introduction....................................................................................................................1 1.2 Surface Form Metrology ...............................................................................................2 1.2.1 Mechanical Flatness Inspection...............................................................................2 1.2.1.1 Creating a Reference Plane .............................................................................2 1.2.1.2 Using a Reference Plane for Flatness Measurement...................................4 1.2.2 Optical Inspection Techniques ...............................................................................5 1.2.2.1 Measurement With Optical Flats ...................................................................5 1.2.2.2 Laser Interferometry ........................................................................................9 1.2.3 Current State of the Art in Flatness Metrology Instruments........................... 12 1.2.3.1 Coordinate Measuring Machines................................................................. 12 1.2.3.2 Surface Form Interferometers..................................................................... 13 1.2.4 Surface Analysis Techniques................................................................................. 15 1.2.4.1 Least-Squares Plane....................................................................................... 15 1.2.4.2 Minimum Zone Flatness .............................................................................. 16 1.3 Research Objective ..................................................................................................... 18 1.3.1 Linear-Rotary Configuration................................................................................. 18 1.3.2 Parallel Axis Configuration ................................................................................... 23 CHAPTER 2: MACHINE DESIGN AND ANALYSIS........................................................... 26 2.1 Hardware Design and Selection................................................................................ 26 2.1.1 Machine Base Design............................................................................................. 26 2.1.2 Spindle Selection..................................................................................................... 28 2.1.3 Workpiece Chuck and Probe Arm Design......................................................... 30 2.2 Electrical System Design............................................................................................ 33 2.2.1 Data Acquisition Card ........................................................................................... 33 2.2.2 Displacement Indicator ......................................................................................... 33 2.2.3 Anti-Alias Filter ...................................................................................................... 35 2.2.4 Encoders and Stepper Drive ................................................................................ 37 2.3 Machine Analysis......................................................................................................... 38 2.3.1 Spindle Misalignment............................................................................................. 38 2.3.2 Experimental Modal Analysis............................................................................... 40 2.3.3 Machine Static Stiffness......................................................................................... 45 2.3.4 Electrical System Noise Tests............................................................................... 46 2.3.5 Measurement Repeatability ................................................................................... 48

v CHAPTER 3: SOFTWARE DESIGN.......................................................................................... 49 3.1 Data Acquisition.......................................................................................................... 49 3.2 Data Processing........................................................................................................... 51 3.2.1 Data Manipulations................................................................................................ 51 3.2.2 Data Filtering .......................................................................................................... 52 3.3 User Interface .............................................................................................................. 52 3.3.1 Polar Plots ............................................................................................................... 54 3.3.2 3D Surface Plot....................................................................................................... 55 CHAPTER 4: EXPERIMENTAL RESULTS ............................................................................. 57 CHAPTER 5: CONCLUSIONS AND FUTURE WORK ....................................................... 61 References........................................................................................................................................... 62 Appendix............................................................................................................................................. 65

vi

LIST OF F IGURES
Figure 1.1: The three plate matching method creates three flat plates whose accuracy is unrelated to the initial accuracy of the plates. The plates must be rotated 90 with respect to each other to remove twist in the surfaces (After Moore [1]). ................. 3 Figure 1.2: Surface plates are commonly used as a reference plane for a flatness measurement. The indicator shown is a capacitance probe, but any displacement indicator may be used. ....................................................................................... 5 Figure 1.3: Interference fringes are formed by certain light waves that fall where the air wedge gap is half-wavelengths of the monochromatic light source (After Moore [1]). ....................................................................................................................... 6 Figure 1.4: Typical interference patterns seen when using an optical flat. Pattern (a) is part wedge, (b) indicates that the part is concave or convex, (c) is astigmatism (saddle), (d) has a curved surface to the bottom of the pattern, and (e) shows a cylindrical part. ............................................................................................................................ 8 Figure 1.5: The basic configuration of a Michelson interferometer. The light source is often a Helium Neon laser, striking a precision beam splitter. The reference leg reflects off the reference surface while the measurement beam reflects off the test surface (after Badami [11]). ....................................................................................... 10 Figure 1.6: Schematic of a grazing incidence interferometer. The test beam strikes the test surface at a very shallow angle to increase the surfaces reflectance. The interferometer uses a precision prism as the reference surface. ........................................ 11 Figure 1.7: Solidworks model of the preliminary design for the linear-rotary flatness measuring machine..................................................................................................... 18 Figure 1.8: The principle of straightedge reversal. Two measurements made with different straightedge orientations are sufficient to separate the straightedge form error and to determine the machine carriage error motion M (x) (after Estler [20]). ................................................................................................................................ 20 Figure 1.9: The setup for the measurement of vertical straightness of the machine carriage. Gravitational sag must be accounted for in this type of measurement (after Estler [20])....................................................................................................................... 22 Figure 1.10: Solidworks model of the parallel axis flatness measuring machine. ................. 23 Figure 1.11: The parallel axis flatness measuring machine shown measuring a diamond turned flat.................................................................................................................. 24

vii Figure 1.12: Close-up view of the capacitance probe targeting the mirror surface. ............... 24 Figure 1.13: Bottom view of the parallel axis flatness measuring machine. The sides of the machine are removed to aid the view......................................................................... 25 Figure 2.1: The machine base design is composed of a precision ground stainless steel mounting plate supported by aluminum side plates. Rubber isolation mounts are used to minimize effects of environmental vibration..................................... 27 Figure 2.2: Axial and face error motions are in the sensitive direction for flatness measurements. These spindle error motions are described in ANSI/ASME B89.3.4M [25]. ........................................................................................................................... 29 Figure 2.3: The workpiece chuck is constructed of a precision ground piece of mild steel with wiper grooves added to facilitate workpiece mounting..................................... 30 Figure 2.4: Two polar plots showing the circular flatness of the workpiece chuck. Plot (a) is the circular flatness at a radius of 10 mm and plot (b) is the circular flatness at a radius of 72 mm. The chucks parallelism is less than 0.500 micrometers. ................................................................................................................... 31 Figure 2.5: Solid model of the probe arm carrying a capacitance probe. The arm is designed to be lightweight and stiff to minimize structural error motion. ...................... 32 Figure 2.6: The Lion Precision C1-C probe and DMT 12 dual sensitivity driver have excellent resolution and linearity. ........................................................................................... 34 Figure 2.7: The Krohn-Hite 4 pole Butterworth low pass filter module is used as an anti-alias filter. Its cutoff of 200 Hz was chosen to provide the proper attenuation of aliased frequencies. ......................................................................................... 35 Figure 2.8: The filter provides good attenuation in the stop band with minimal attenuation in the pass band. The filter performs well at removing frequencies that could be aliased based on typical machine sample rates. ............................................ 36 Figure 2.9: An artifact is first characterized on a rotary air bearing inspection stage before use. Once calibrated, it is used to determine the amount of spindle misalignment. ............................................................................................................................ 39 Figure 2.10: 42-point undeformed experimental modal test grid of the parallel axis flatness measuring machine..................................................................................................... 40 Figure 2.11: Drive point frequency response function for the experimental modal analysis........................................................................................................................................ 41 Figure 2.12: The most prominent rigid body mode of the machine occurs at 33 Hz............ 41

viii Figure 2.13: The first structural mode of the machine occurs at 535 Hz with 5% damping............................................................................................................................... 42 Figure 2.14: The second structural mode of the machine occurs at 665 Hz with 0.5% damping. This mode also occurs in the sensitive direction for flatness tests. ............................................................................................................................................ 43 Figure 2.15: The third structural mode of the machine occurs at 770 Hz............................... 43 Figure 2.16: Cross point compliance measurement in the sensitive (Z) direction between the probe holder and workpiece chuck. ................................................................ 44 Figure 2.17: The static stiffness of the parallel axis flatness measuring machine is 2.1 N/meter. Most of the compliance is due to the probe arm..................................... 45 Figure 2.18: The capacitance probe is shown with the cover for the noise measurement tests. The small cover affords a small structural loop to minimize external effects. ......................................................................................................................... 46 Figure 2.19: At a bandwidth of 12800 Hz the measurement system has noise levels of 4.56 nm peak to valley, and 0.64 nm rms......................................................................... 47 Figure 2.20: The repeatability of 10 consecutive circular flatness measurements is examined. The measurements have a standard deviation of 1.1 nm. .............................. 48 Figure 3.1: Flow chart for the data acquisition and control software....................................... 50 Figure 3.2: The user interface main screen contains test setup information and graphical displays of test data. Test data is displayed in both polar plot and 3D surface plot forms..................................................................................................................... 53 Figure 3.3: The Acquire and Stop buttons are used to begin or halt data acquisition. An information bar and progress meter are shown to inform the user of test conditions. Real-time spindle speed is displayed to ensure tests are conducted at the desired speeds. ............................................................................................ 54 Figure 3.4: The circular flatness data is displayed in polar plot format. The ring to be plotted is selectable to allow the user to examine any desired radial locations on the part under test............................................................................................................... 55 Figure 3.5: The surface form plot provides the user a 3D representation of the surface form. The plot is created using OpenGL commands, and can be rotated, panned, and zoomed. ................................................................................................ 56 Figure 4.1: This single point diamond turned artifact has a highly mirror surface with exceptionally low surface roughness...................................................................................... 58

ix Figure 4.2: The form of the artifact from Figure 4.1 as measured with the parallel axis flatness measuring machine. The artifact nominally has a flatness of 1 micrometer, which is mostly due to cone. ............................................................................ 58 Figure 4.3: This diamond turned artifact has not mounting holes, and is measured in an unfixtured state with the parallel axis flatness measuring machine.............................. 59 Figure 4.4: When the cone of the diamond turned flat shown in Figure 4.3 is removed, it is shown to have a surface form of 40 nm. ..................................................... 60

LIST OF TABLES
Table 2.1: Specifications for the model 4R BLOCK-HEAD air bearing (at 1Mpa) [24]. ........................................................................................................................... 28

xi

ACKNOWLEDGEMENTS
I would like to thank my advisor, Dr. Eric Marsh, for giving me the opportunity to learn so much from him. He is an incredibly gifted teacher who has taught me so much over the last couple of years. I would like to thank Professional Instruments Company, Lion Precision, and Kistler for their supply of equipment, without which, this thesis would not have been completed. I want to thank Dave Arneson, Mel Liebers, and Phil Gerber of Professional Instruments for teaching me so much about precision machining and metrology. Working at PI was one of the best learning experiences of my life. I also would like to thank Dave McCloskey, Larry Horner, and Ron Gathagan of the Mechanical Engineering machine shop for their donation of shop time and advice. I also want to thank Bob Grejda and Byron Knapp for their help in all my MDRL projects, and for keeping the scene alive. I am grateful to all the current and past students of the MDRL for their help and friendship: Jeremiah Couey, Mark Glauner, Steve Henry, Brian OConnor, and Vincent Vigliano. I would also like to thank my parents, brother, and sister for their support throughout my academic career. I also would like to thank Bridget Malia, for her love and support during my graduate school career. I would have never made it through without her.

CHAPTER 1: OVERVIEW
An overview of precision surface form metrology is given. The current state of the art in available metrology techniques and instruments is discussed. The motivation for creating a new flatness metrology instrument is outlined and the instrument design approach is presented. 1.1 INTRODUCTION

In the past century increased demands for high precision components for energy, electronic, and defense applications has forced the manufacturing community to work at levels of accuracy previously thought unachievable. For example, in the 1940s, Moore Special Tool Companys jig grinder provided toolmakers an extremely stiff machine with sub-micrometer slideway error motions [1]. At that time, machines of this level of accuracy had the ability to machine workpieces to tolerances that approached or exceeded the capabilities of some inspection departments. In order to machine a part to high accuracies one must also be able to measure to high accuracies. Ideally, one would like to have the ability to perform a measurement with an uncertainty and resolution an order of magnitude less than minimum increment to be measured. Ultraprecision metrology instruments have much in common with ultraprecision machine tools. Metrology instruments used for high precision measurements require high static and dynamic structural loop stiffness, high-resolution control systems, and low machine error motions. The design of precision machines is similar to the design of most other systems, however, additional care and effort is needed to design a precision machine. This effort emphasizes concern for certain aspects of design (i.e. thermal effects, self-

2 checking capability, deterministic design) that must be thoroughly explored by a precision engineer [2]. The objective of this research is to determine some of the key requirements of a flatness measuring machine and incorporate them into the design of a robust instrument. To appreciate the capabilities and considerations required for a precision flatness measuring machine, some surface form metrology techniques and instruments will be examined in the following sections. These techniques and instruments will aid in the comprehension of the design considerations for a machine of this level of accuracy. 1.2 SURFACE FORM METROLOGY The

Flatness is the condition of a surface having all elements in one plane [3].

determination of a specimens flatness may nominally be determined via either by mechanical or optical inspection. The selection of the most appropriate method of flatness measurement is governed by several factors, such as part size and shape, the area accessibility, and the desired degree of accuracy [4]. First, some of the classical mechanical inspection techniques will be presented, followed by some of the common modern optical techniques. 1.2.1 MECHANICAL FLATNESS INSPECTION

This section will discuss some of the more common techniques for creating a flat reference plane and its use in mechanical flatness inspection. There are other techniques that are not discussed, but are based on the same principles described here. 1.2.1.1 CREATING A REFERENCE PLANE

One of the oldest, but most widely used techniques for determining flatness, is direct contact with a reference plane of known flatness. This technique is a shop method commonly used

3 by toolmakers for production of hand scraped flat surfaces and in the manufacture of surface plates [4]. The reference surface may be covered in blue dye that transfers to the contact of the reference plate to the measured surface to locate high regions on the surface. To attain a high level of flatness using this technique requires that the master surface must be extremely flat. This may be achieved using the classical Whitworth three plate matching method. In this method, three plates of arbitrary flatness are used together to obtain three plates of a high level of flatness. The benefit of this technique is that the accuracy of the plates generated is unrelated to the initial accuracy of the plates. First plates B and C are scraped (or lapped) to match plate A. At this point plates B and C are compared and the error of plate A is revealed as shown in Figure 1.1. Plates B and C are then scrapped together by removing material in equal quantities from corresponding locations on each plate. Plate A is then scrapped to match plates B and C, which brings it closer to absolute flatness.

Figure 1.1: The three plate matching method creates three flat plates whose accuracy is unrelated to the initial accuracy of the plates. The plates must be rotated 90 with respect to each other to remove twist in the surfaces (After Moore [1]).

4 By continuing to scrape or lap all three plates until all three show perfect bearing when intercompared, three flat plates are created. It is important to note that the plates should be successively turned 90 to one another during the process to remove the chance of twist errors on the surfaces [1][5]. Using this technique, along with some auxiliary

inspection, a talented craftsman can create a (1200x1200mm) cast iron surface plate that is flat to 0.5 micrometers [1]. The three plate method is self-checking, that is, it does not require the use of a master to validate the results. The creation of surface plates of this level of precision is a fundamental stepping-stone in the measurement of high precision parts. 1.2.1.2 USING A REFERENCE PLANE FOR FLATNESS MEASUREMENT

High accuracy surface plates give the precision engineer a quality reference plane on which to perform measurements as illustrated in Figure 1.2. In this type of manual measurement, the indicator stand is positioned at various locations on the part and the indicator output is recorded. In measurements of this nature, the indicated reading is a combination of the surface plate flatness, the part flatness, and the part parallelism. In measurements where the parts parallelism is irrelevant, leveling screws, a wobble plate, or a tip-tilt table may be used as an intermediate leveling device between the surface plate and the part [6].

Figure 1.2: Surface plates are commonly used as a reference plane for a flatness measurement. The indicator shown is a capacitance probe, but any displacement indicator may be used. Mechanical flatness measurements using reference planes assume many other forms. All use the principle of comparing the part under test to flatness of the reference. It is important to note that the highest quality laboratory grade surface plates have a flatness tolerance of 0.64 micrometers [5]. 1.2.2 OPTICAL INSPECTION TECHNIQUES

The value of light for use in metrology applications has long been known [6]. A wealth of research has been done in the use of light, more specifically interferometry, for metrology applications. The basic use of optical flats and interferometers for flatness metrology will be presented, along with some of the limitations and conditions of use will be discussed. 1.2.2.1 MEASUREMENT WITH OPTICAL FLATS

Small optical flats are usually made of circular disks of clear fused quartz; occasionally some types of borosilicate glass are used [4]. For larger (>75 mm) optical flats, low thermal expansion materials such as CerVit and ULE glass are often desired [7]. Both faces of the

6 flat are lapped and polished to a high degree of flatness. The measuring surface commonly has one of three degrees of flatness: Working flats are flat to 0.10 micrometers, Master flats are flat to 0.05 micrometers, and Reference flats are flat to 0.025 micrometers [8]. The face of the optical flat acts as a reference surface against which the flatness of the part under test may be determined from the shape of the fringe pattern produced [9]. Optical flats are used in several different configurations when measuring flatness; the most common method is basic air-wedge. In the air-wedge configuration the optical flat is placed on top of a clean workpiece leaving a small air wedge between the flat and the part as seen in Figure 1.3. Normal incidence monochromatic light illuminates the optical flat and the part. The

interaction of the monochromatic light with the optical flat and the part via the air wedge creates interference fringes on the surface of the optical flat.

Optical Flat
Light Dark Dark Light Dark Light

1 2 3 Half-W avelengths

Workpiece

Figure 1.3: Interference fringes are formed by certain light waves that fall where the air wedge gap is half-wavelengths of the monochromatic light source (After Moore [1]). If the distance the light travels through the air wedge is equal to a multiple of the lights wavelength constructive interference will occur and a light fringe will be produced. However, if that distance is equal to a half multiple of the lights wavelength destructive

7 interference will occur resulting in a dark fringe. If both the reference optic and the workpiece are truly flat, the interference fringes will be formed as parallel straight lines. Variations in the form of the workpiece will result in a change of the fringe pattern, which when properly interpreted yields the form and magnitude of the workpieces flatness. The form of the workpiece can be useful to the manufacturer to aid in determining the root cause of flatness errors. An experienced user can reliably read these patterns to within 0.1 to 0.2 of a fringe spacing (depending on the severity of the form error). Different types of monochromatic light sources are used to illuminate the optical flat; helium light sources are often used that have a half-wavelength of 0.2794 micrometers. The wavelength of the light source dictates the resolution of the measurement. One disadvantage of using an optical flat for surface form metrology is that the surface under test must be sufficiently well finished (low surface roughness) to reflect the monochromatic light. If the surface is too rough it is difficult to see the fringe patterns, thus a highly reflective surface makes the contrast from light to dark much easier to see. In addition to flatness measurements, optical flats, in conjunction with additional equipment (gage blocks or slip gages), can be used to measure parallelism, small height differences, and perform comparative measurements [9]. Figure 1.4 shows some typical interference patterns obtained with an optical flat.

(a)

(b)

(c)

(d)

(e)

Figure 1.4: Typical interference patterns seen when using an optical flat. Pattern (a) is part tilt, (b) indicates that the part is concave or convex, (c) is astigmatism (saddle), (d) has a curved surface to the bottom of the pattern, and (e) shows a cylindrical part. Pattern (a) shows a perfectly flat surface shown by the parallel straight lines. The surface in pattern (b) is either convex or concave. The amount of curvature is determined by counting the number of fringes out from the center. The sense of the curvature (convex or concave) is determined by applying light pressure to the high or low spot in the center of the flat. If the fringes move away from the point of pressure, the surface is convex, and if they move towards it, the part is concave. Pattern (c) shows a surface that has a saddle shape (astigmatism). The surface in pattern (d) has approximately three quarters of a fringe of curvature, which under a helium light source is 0.21 micrometers. Pattern (e) shows the interference pattern obtained from a cylindrical surface [9]. Being able to determine both the amount and type of deviation from flatness is important in determining the overall quality of the surface under test.

9 1.2.2.2 LASER INTERFEROMETRY

One of the most successful applications of the laser has been its use as a monochromatic light source in an interferometric system. All sensor systems have to be traceable to a standard, and possibly no standard can be more stable than the wavelength of light [10]. The key advantages of using lasers in interferometry is that fringes may be produced over extended distances, and may be detected and counted automatically using CCD cameras and computers. The light emitted from lasers is coherent and highly monochromatic. It has enough intensity for the fringes to be easily detected by photoarrays with an excellent signalto-noise ratio. This enables computers to quickly perform automated counting of fringes for rapid testing. The most common laser used is a Helium Neon type, with a wavelength () of 0.6328 micrometers, which when properly stabilized can have reproducibility better than 1 part in 108 [9]. Laser interferometers can be assembled in a variety of configurations to perform various types of measurements. A full discussion of laser interferometers is beyond the scope of this thesis, so only some basics will be presented here. Normal incidence Michelson interferometers have been used for many years for surface form and distance measurements. A normal incidence interferometer illuminates the test surface at an angle close to 90. The beam is split into two legs, the reference leg, and the measurement leg. When the legs recombine, their interference produces fringes. Figure 1.5 illustrates the basic principle of a normal incidence interferometer. Normal incidence interferometers do have the limitations of requiring specular reflection; the test surface must have low surface roughness (R<), and large surface slopes cause problems [11].

10

Reference Surface Beam Splitter Test Surface

Light Source

Observer
Figure 1.5: The basic configuration of a Michelson interferometer. The light source is often a Helium Neon laser, striking a precision beam splitter. The reference leg reflects off the reference surface while the measurement beam reflects off the test surface (after Badami [11]). To make use of the benefits of interferometric surface metrology for a wider variety of precision surfaces, grazing incidence interferometers have be devised. A grazing

incidence interferometer shares the same basic characteristics as the interferometer shown in Figure 1.5. The main difference is the angle at which the measurement beam strikes the test surface. Grazing incidence interferometers have beams that strike the test surface at very shallow angles. They use a precision prism for the reference surface. As the beam hits the reference surface, it is divided into two beams. The reference beam reflects off the reference surface of the prism, while the test beam passes through the reference surface and strikes the test surface at a shallow angle. The test beam then reflects off the part and passes back through the prism to recombine with the reference beam. When the two beams recombine, they interfere with each other creating the fringes. A schematic of a grazing incidence interferometer is shown in Figure 1.6. The use of grazing incidence has several benefits. First, since the measurement beam strikes the test surface at a shallow angle it significantly

11 increases the surfaces reflectance. This allows test surfaces that are not highly reflective and do not have low roughness to be measured. Secondly, the use of grazing incidence allows surfaces with larger form errors to be measured. Additionally, very little part alignment is required in this configuration. Grazing incidence interferometers can have fringe

sensitivities ranging from 1.5 to 10 micrometers per fringe with accuracies down to 0.1 micrometer, depending on the angle of incidence. As the angle becomes shallower, the resolution proportionally decreases [11].
Test Part Air Gap

Prism Co llim ated Laser Light

Test Beam Referen ce Beam

Figure 1.6: Schematic of a grazing incidence interferometer. The test beam strikes the test surface at a very shallow angle to increase the surfaces reflectance. The interferometer uses a precision prism as the reference surface. In addition to grazing incidence interferometers, many other configurations have been used to perform a variety of surface form measurements. Scanning white light and phase shifting interferometers are available as commercial systems to perform a range of surface measurements.

12 1.2.3 CURRENT STATE OF THE ART IN FLATNESS METROLOGY INSTRUMENTS

Before the advent of modern inspection equipment, flatness was manually measured in the ways described earlier in this thesis. Using surface plates, mechanical indicators, and optical flats can often be tedious and they do not produce a record of the surface form. Modern inspection equipment powered by computers and high resolution control and/or imaging systems provide a more efficient, accurate means to perform flatness measurements. A variety of commercial instruments are available to perform flatness inspection to varying degrees of accuracy. A brief introduction to some of these instruments and their capabilities are discussed in the following sections. 1.2.3.1 COORDINATE MEASURING MACHINES

Coordinate measuring machines (CMMs) are a main staple of many metrology labs. CMMs are designed to be versatile measuring machines that perform a variety of measurements to a reasonable accuracy. CMMs can be configured to measure almost any type of part desired, including complex contours. CMMs are produced in an array of configurations including gantry type, fixed bridge, moving bridge, column type, and as well as other unique configurations [10]. CMMs have many slideway designs, but air bearing slides are the most prevalent. They are commonly configured with a touch probe to perform the measurement of the surface under test. Since CMMs are designed to perform such a broad spectrum of measurements, their application to precision flatness measurement is limited. Most CMMs do not posses the accuracy to properly characterize the flatness of a high quality diamond turned surface, or an optical artifact. CMMs are available in varying grades depending on size and probe type. Typically a high quality commercial CMM can have a resolution of 0.1 micrometer, but only

13 have a repeatability of 1.5 micrometers and a volumetric accuracy on the order of 5 micrometers. Measurements to this level of accuracy are quite good for standard

machining, but precision surfaces would register in the noise floor on these machines. 1.2.3.2 SURFACE FORM INTERFEROMETERS

The interferometric techniques discussed in Section 1.2.2.2 provide a high accuracy means to perform flatness measurements. Several different laser interferometer equipped machines exist to perform computer controlled flatness measurements. These machines have better accuracy and repeatability than CMMs due to their specialized nature. The two major interferometric flatness measuring machine manufacturers are Corning Tropel and Zygo. Corning Tropel Corporation produces the line of FlatMaster measuring machines; using grazing incidence interferometry to measure the flatness, line profile, or spherical radius of a variety of precision parts and surfaces. Additionally, these machines can be configured to measure angularity, parallelism, or perpendicularity. The FlatMaster is

available in configurations that have a maximum part size from 40 mm to 200 mm. The FlatMaster has a claimed accuracy of 0.1 micrometer with a repeatability of 0.05 micrometers. The resolution of the interferometer is 0.01 micrometers with a standard dynamic range of 30 micrometers. Measurements can be completed in as little as 5 seconds. Any material can be measured, but require precision ground, honed, polished, or superfinished surfaces. The surfaces reflectivity must be a minimum of 10% at 85

incidence. In addition, the surface must have a maximum roughness of 1.0 micrometer Ra. The FlatMaster is capable of performing rapid accurate flatness measurements, though restrictions on reflectivity and roughness do limit its application in some areas [12].

14 The Zygo Corporation offers interferometer based surface form measuring machines that measure surfaces using white light interferometers or geometrically desensitized optical phase shifting interferometers. The Zygo NewView series of machines use scanning white light interferometers to perform surface measurements. The field of view for the

NewView 5000 ranges from 0.04 mm to 17.5 mm, with a lateral resolution of 0.1 nanometers. The NewView can be upgraded to perform measurement stitching to combine multiple measurements to examine surface form up to 100 mm in diameter [13]. The stitching feature does extend the measurement time up to 15 minutes per measurement. The NewView series of machines are designed for surface roughness and texture measurements rather than form. Zygo also offers the MESA LU and LD measuring machines. These machines use Zygos geometrically desensitized optical phase shifting interferometers to perform surface form measurements on samples up to 96 mm in diameter. These machines have a vertical resolution of 0.002 micrometers and a system repeatability of 0.2 micrometers (over 100 consecutive measurements). Measurements and data processing take on the order of 10 seconds. The MESA machines require samples that have precision surfaces with a roughness less than 2.5 micrometers Ra. In addition, the samples form error must be less than 0.15 mm, with a maximum slope of 0.03 mm/cm [14]. These examples show that many options exist for computer controlled surface form measurement instruments. Each instrument has specific capabilities and limitations on the types of samples that can be measured.

15 1.2.4 SURFACE ANALYSIS TECHNIQUES

Many options are available to interpret flatness data. Some of the common plane fitting and tolerancing techniques are presented in the following sections. 1.2.4.1 LEAST-SQUARES PLANE

Most flatness measurements result in data for various points on a surface in any number of sampling patterns. With this data, it is often desired to determine a plane that best fits the data as an evaluation of the surface. The equation of a plane is shown in Equation 1.1, where x and y are the location variables and z is the observable variable.

z = c + m1 x + m2 y

(1.1)

One of the most common fitting methods is the least-squares plane method [15]. In this method variables of minimization are determined from making the sum of deviation squared a minimum. This is shown in Equation 1.2 where S is the sum of deviation squared.
S = [z i (c + m1 xi + m2 y i )]
i =1 n 2

(1.2)

Leaving off the limits and the subscripts, Equation 1.2 becomes Equation 1.3.

z = cN + m x + m y xz = c x + m x + m xy yz = c y + m xy + m y
1 2 2 1 2 1 2

(1.3)

It can be shown that the best-fit plane always passes through the centroid of the measured points. Referring all measurements to the centroid as the origin eliminates the term c in Equation 1.3. If uniform increments are taken in orthogonal directions it is possible to

16 simplify the equations yielding a plane with the form of Equation 1.4, where m1 and m2 are given by Equations 1.5 and 1.6.

z = m1 x + m2 y
m1

(1.4) (1.5)

y xz xy yz = x y ( xy )
2 2 2 2

m2

x yz xy xz = x y ( xy )
2 2 2 2

(1.6)

The error from the established plane can be expressed as a standard deviation, F , shown in Equation 1.7.

m1 x + m2 y z 2 = (n 2)(m 2 + m 2 + 1) 1 2

(1.7)

1.2.4.2

MINIMUM ZONE FLATNESS

It is becoming more common in the manufacturing community to use geometric dimension and tolerancing concepts to specify surface form. A flatness tolerance defines a tolerance zone bounded by two parallel planes inside which the surface must lie. The minimum zone flatness (MZF) concept characterizes the minimum distance between parallel planes that separate the data set from a flatness measurement. The concept and techniques for

obtaining the MZF have been well researched; Kaiser and Krishnan provide a sound overview of the concept and algorithm for obtaining the MZF functional that is described in this thesis [16]. Additional information on MZF techniques may be obtained from the following references [17], [18], and [19].

17 Let S m = ( A1 , Am ) represent a data set of points in space. A plane in polar coordinates is given by Equation 1.8.
F , = a sin cos + b sin sin + c cos + , = 0

(1.8)

A plane L , is chosen to bound the data set from below such that it touches the lowest data

point of the set. Let d , be the shortest distance to a plane parallel to F , , F , , so that F , bounds the data set from above. Solving the minimization of d , results in the MZF
quantity. To calculate the minimum distance between parallel planes for a given orientation ( , ), compute d ( Ai , F , ), i = 1,  m for the entire data set and choose the minimum ( d l ) and maximum ( d u ) values from the data set. The distance from any given point Ai = ( xi , y i , z i ) to the plane F : ax + by + cz + d = 0 is given by Equation 1.9.

d ( Ai , F ) =

axi + by i + cz i + d a2 + b2 + c2

(1.9)

The minimum zone distance for the orientation given orientation ( , ) is given by Equation 1.10.
d , = d u d l

(1.10)

The angles defining the orientation of the plane, ( , ), are then changed incrementally to cover a continuous half portion of the unit sphere, and the distance between the bounding planes is calculated for each orientation. With the iterations complete, the calculated

distances are examined and the minimum distance is the MZF.

18 1.3 RESEARCH OBJECTIVE

The objective of this research is to design and fabricate a precision flatness measuring machine. The machine will be capable of measuring the surface form of precision machined parts to a high accuracy. High measurement accuracy will be achieved though the use of precision components and rigorous machine design practices. In the preliminary design phase of this machine, two configurations are evaluated; both designs are presented and the merits of each are evaluated. 1.3.1 LINEAR-ROTARY CONFIGURATION

The first machine configuration evaluated combines a precision air bearing spindle with a linear air bearing slide as the machine axes. The preliminary design of the linear-rotary flatness measuring machine is shown in Figure 1.7.

Figure 1.7: Solidworks model of the preliminary design for the linear-rotary flatness measuring machine.

19 The linear-rotary design consists of a 450x300 mm granite surface plate supporting the machine hardware. The workpiece spindle is a Professional Instruments model 4R BLOCK-HEAD air bearing spindle. The probe axis is a lead screw driven linear air bearing box slide. The lead screw is driven in an open loop configuration by a stepper motor. A capacitance probe is mounted to a rigid probe holder and is scanned across the workpiece by the air bearing stage. This design uses feedback from a rotary encoder mounted on the workpiece spindle and the capacitance gage to obtain the flatness measurement. This design has the advantage of being very straightforward and easy to construct. A major concern in the design is the accuracy of the linear air bearing slide. The slide has vertical error motions on the order of 1 micrometer, which is well above the desired accuracy of the complete machine. It is possible to use straightedge reversal techniques to map the vertical errors of the slide and correct for them in software [20][21]. Reversal techniques are elegant techniques that should be used to calibrate measurements whenever possible. Due to their importance to precision machine analysis, the concept of basic straightedge reversal is presented. The basic crux of mechanical straightness measurement is that the form error of the straightedge is combined with the error motion of the machine carriage during measurement. The straightedge reversal technique allows the separation of the straightedge form errors from the machine error motions. Figure 1.8 illustrates the two measurements required for a straightedge reversal; note that an interferometer is used as the measuring device, but any displacement indicator may be used.

20

Normal Configura tion

Straightedge: S(x)

y x

Laser
Machine Ca rriage: M(x)

Fixed Interferometer

+
Fixed Interferometer

Reversed Configuration

Machine Ca rriage: M(x)

Laser
Straightedge: S(x)

Figure 1.8: The principle of straightedge reversal. Two measurements made with different straightedge orientations are sufficient to separate the straightedge form error and to determine the machine carriage error motion M (x) (after Estler [20]).

The straightedge is first oriented in what is called the normal configuration and a measurement is taken along the straightedge length, N (x) . S (x) is the form error of the straightedge, and M (x) is the error motion of the machine carriage. This measurement is shown in Equation 1.11.
N ( x) = M ( x) S ( x)

(1.11)

In the second setup, the straightedge is flipped along its long axis and the interferometer optic is rearranged to target the same surface of the reoriented straightedge. This setup is called the reversed configuration. With this configuration another measurement, R (x) , is performed. The form of this measurement is shown in Equation 1.12. Note that the sign of the machine straightness has changed due to the reversal of the straightedge [20][22].

21
R ( x) = M ( x ) S ( x )

(1.12)

Adding Equations 1.11 and 1.12 yields the straightedge form error, shown in Equation 1.13.
S ( x) = [ N ( x) + R( x)] 2

(1.13)

Subtracting Equations 1.11 and 1.12 yields the machine straightness, shown in Equation 1.14.
M ( x) = N ( x ) R ( x) 2

(1.14)

The method described above is shown for the measurement of the machines horizontal straightness, but in the linear-rotary measuring machines case vertical straightness is of importance. The same method can be used to measure the machines vertical

straightness with some additional difficulty. In the measurement of vertical straightness, the straightedge would experience some amount of gravitational sag. This sag will influence the measurement, and is not reversible. To account for the gravitational sag, beam theory or finite element modeling may be used to predict the effect of gravity and it may be subtracted from the measurements. Additionally, in this setup for vertical straightness measurements it is difficult to reverse the straightedge and measure the reversed surface, which will then be facing the machine carriage. The setup for the measurement of vertical straightness is shown in Figure 1.9.

22
Fixed Interferometer

Laser

Straightedge: S(x) Machine Carriage: M(x)

z x

Figure 1.9: The setup for the measurement of vertical straightness of the machine carriage. Gravitational sag must be accounted for in this type of measurement (after Estler [20]).

Due to the difficulty in properly calibrating it to a high level of accuracy the linearrotary configuration is not used this thesis. To achieve the desired machine accuracy a new parallel axis design is created. This design is introduced in the next section.

23
1.3.2 PARALLEL AXIS CONFIGURATION

As an alternative to the linear-rotary configuration, a machine is evaluated that combines two precision air bearing spindles in a parallel axis configuration. The design of the parallel axis flatness measuring machine is shown in Figure 1.10.

Figure 1.10: Solidworks model of the parallel axis flatness measuring machine.

The parallel axis flatness measuring machine is a simple design, which combines two rotary axes to perform the workpiece rotation and the probe arm scan. Both spindles are Professional Instruments 4R BLOCK-HEAD air bearing spindles. These spindles are used for their high stiffness and exceptionally low error motions. The specifications of these spindles are discussed later in this thesis. The major advantage of this configuration is that the axes in motion have nanometer level errors; well below the desired accuracy of the machine.

24

Probe arm

Capacitance probe

Probe spindle Workpiece spind le

Figure 1.11: The parallel axis flatness measuring machine shown measuring a diamond turned flat.

Figure 1.12: Close-up view of the capacitance probe targeting the mirror surface.

25 Both spindles have high resolution encoders for position feedback. The probe spindle is motorized via a stepper motor drive, configured as a friction (capstan) drive on a plate attached to the bottom thrust plate. The friction drive offers a non-influencing low backlash means to motorize the probe spindle [10]. Additionally, the ratio of the size of the sheave on the stepper motor to the drive surface yields a reduction in the minimum step size for the probe arm. The locations of the encoders and stepper motor can be seen in Figure 1.13, note that the sides of the machine are removed to aid the view.
Workpiece spindle encoder Probe spindle encoder

Stepper motor drive

Figure 1.13: Bottom view of the parallel axis flatness measuring machine. The sides of the machine are removed to aid the view.

The parallel axis design is extremely simple yet functions as a stiff accurate machine to perform precision flatness measurements. The design considerations and selection criteria for the components of the machine are discussed in Chapter 2 of this thesis.

26

CHAPTER 2: MACHINE DESIGN AND ANALYSIS


In this chapter, the design and selection of the components for the parallel axis flatness measuring machine are discussed. In addition, some qualifying test results are presented that validate the machines high accuracy design.
2.1 HARDWARE DESIGN AND SELECTION

When designing a precision inspection machine both the accuracy of the components and their assembly must be carefully considered. High accuracy components poorly configured will yield an inaccurate machine. In this section, some of the mechanical components for the parallel axis flatness are presented along with the rationale for their design and/or selection.
2.1.1 MACHINE BASE DESIGN

The goal of the design of the machine base is to provide a stiff structure with precision mounting surfaces. The base also needs to be well isolated from environmental vibrations and inexpensive to manufacture. Additionally, several precision engineering principles are kept in mind during the base design, including symmetry, alignment, minimizing structural loop, and thermal management [23]. The main structural member of the machine base is a (330x203x2.54 mm) section of 416 stainless steel. With one spindle mounted to the top and the other to the bottom of the base plate, a high degree of flatness and parallelism is required. Failure to keep both sides of the base plate parallel causes relative tilt between the spindles, which is undesirable. To achieve the flatness and parallelism requirements, the base plate is precision ground on both sides with a surface grinder. The base plate is ground flat to better than 2 micrometers and parallel to approximately 5 micrometers. This amount of

27 parallelism can be calibrated and removed from the data as described later in this thesis. The parallel axis configuration allows the base to be designed in a symmetric manner to help evenly distribute and manage the distortion effects from the mounted hardware. To

adequately support the base plate 12.7 mm thick aluminum side plates are rigidly mounted to the base using socket head cap screws. To keep the base isolated from environmental vibrations four rubber isolation mounts are installed. Figure 2.1 shows a Solidworks model of the machines base structure. An additional level of isolation is obtained when the machine base is placed on an air isolated granite surface plate. This double isolated

configuration attempts to mitigate any external vibrations. The study of the machines vibration characteristics can be found in Section 2.3 of this thesis.

Figure 2.1: The machine base design is composed of a precision ground stainless steel mounting plate supported by aluminum side plates. Rubber isolation mounts are used to minimize effects of environmental vibration.

28
2.1.2 SPINDLE SELECTION

In view of the fact that the spindles of the parallel axis flatness measuring machine serve as the reference for the measurements, their selection is of paramount importance. Poor spindle performance would have a detrimental effect on the measurements. The machines design requires a compact, stiff, accurate spindle with good thermal characteristics. Additionally, a low friction spindle is desirable to allow the machine to be motorized with noninfluencing drives. Based on these specifications the Professional Instruments 4R

BLOCK-HEAD air bearing spindle is selected. The 4R combines rotational accuracy with extremely high stiffness comparable with that of some ball bearing headstocks [24]. The 4R is operated with 1 MPa clean, dry air; its specifications are shown in Table 2.1.
Table 2.1: Specifications for the model 4R BLOCK-HEAD air bearing (at 1Mpa) [24].
WORKING LOAD CAPACITY STIFFNESS TOTAL WEIGHT ROTOR INERTIA MAXIMUM SPEED AIR CONSUMPTION 222 N Radial 890 N Axial 23 N-m Tilt 120 N/meter Radial 350 N/meter Axial 0.45 N-m/radian Tilt 85 N 0.0052 kg-m2 10000 rpm <55 L/min

The 4Rs accuracy is also of great importance to the total accuracy of the machine. The manufacturer quotes them as having radial and axial error motions that are less than 25 nanometers, and a tilt error motion of less than 0.1 microradian. The model 4R BLOCKHEADs used in the parallel axis flatness measuring machine are oriented such that their axial and tilt error motions are in the sensitive direction of measurement. Axial error motion is the rotors motion collinear with the axis of rotation. Face error motion is the rotors

29 motion parallel with the axis of rotation at a specified radial location, and is a combination of axial and tilt error motions [25]. Figure 2.2 graphically illustrates the possible error motions of an axis of rotation. BLOCK-HEAD spindles have been shown by other researchers to have error motions much smaller than the manufacturer specifications. The model 4R routinely demonstrates synchronous axial error motions of less than one nanometer fundamental and 3 nanometers residual. Additionally the 4R exhibits synchronous face error motions less than 10 nanometers out to a radius of 150 mm [26].
radial location

Displacement Indicator

axial motion axial location

face motion

radial motion

tilt motion

Figure 2.2: Axial and face error motions are in the sensitive direction for flatness measurements. These spindle error motions are described in ANSI/ASME B89.3.4M [25].

30
2.1.3 WORKPIECE CHUCK AND PROBE ARM DESIGN

The workpiece chuck is one on the most important features of the parallel axis flatness measuring machine. The chuck needs to be flat and parallel to a high degree to provide an adequate mounting surface for parts to be tested. The chuck also needs to have a surface that can support a variety of workpieces securely and accurately. A photograph of the unmounted workpiece chuck is shown in Figure 2.3.

Figure 2.3: The workpiece chuck is constructed of a precision ground piece of mild steel with wiper grooves added to facilitate workpiece mounting.

The workpiece chuck is constructed from a solid section of mild steel machined to approximately 150 mm in diameter and 35 mm in height. These dimensions are chosen based on the desired range of workpiece sizes to be measured on this machine. The chuck is machined with a 127 mm diameter counterbored bolt circle to allow it to be properly mounted to the air bearing spindle. Additionally, six tapped holes are placed on a 127 mm diameter to allow workpieces to be rigidly mounted to the chuck. This enables the

measurement of parts that are to be mounted with this configuration in the same state as they are to be used. The chuck is also equipped with a set of concentric wiper grooves to trap particulate during cleaning and stoning of the chuck before workpieces are mounted.

31 The final machining process was to rotary grind the chuck on both sides. This process consists of mounting the chuck on a precision air bearing spindle. This assembly is then placed on a surface grinder, and the part is ground while it rotates. The part is flipped repeatedly to gain a high degree of flatness and parallelism. Proper chuck flatness and parallelism is required as to not influence the part when it is mounted. Figure 2.4 shows polar plots of the circular flatness of the workpiece chuck at a radius of 10 mm and 72 mm. Its circular flatness is 0.09 micrometers at a radius of 10 mm, and 0.25 micrometers at a radius of 72 mm; additionally the chucks parallelism is less than 0.50 micrometers. These measurements were taken using a custom designed roundness tester created by the Machine Dynamics Research Lab. A capacitance probe targets the chuck while it rotates on a precision air bearing spindle. The roundness tester has been shown to have nanometer level repeatability and therefore is extremely accurate for this type of measurement.

(a)

(b)

Figure 2.4: Two polar plots showing the circular flatness of the workpiece chuck. Plot (a) is the circular flatness at a radius of 10 mm and plot (b) is the circular flatness at a radius of 72 mm. The chucks parallelism is less than 0.500 micrometers.

32 Another important component of the parallel axis flatness measuring machine is the probe arm. The probe arm acts as an indicator holder, keeping the indicator rigidly

supported during tests. The design must be lightweight and stiff to minimize structural error motion. Additionally, the probe arm must be designed so that it can be properly mounted to the air bearing spindle. The arm is constructed from a stainless steel 38.1 mm square crossection tube with a 15.8 mm wall thickness. Two aluminum end caps are added to increase torsional stiffness as well as incorporating the probe holder. The entire probe arm structure is 150 mm in length. The performance of the probe arms design is easily seen in the high frequencies of the natural modes of vibration of the flatness measuring machine. A full discussion of the experimental modal analysis of the machine is discussed in Section 2.3.2 of this thesis. Figure 2.5 shows a solid model of the probe arm with a capacitance probe in the probe holder.

Figure 2.5: Solid model of the probe arm carrying a capacitance probe. The arm is designed to be lightweight and stiff to minimize structural error motion.

33
2.2 ELECTRICAL SYSTEM DESIGN

To complement the mechanical design of the parallel axis flatness measuring machine a robust measurement and control system was design and constructed. The system performs the data acquisition and control of the machine, and is based around a National Instruments (NI) 6110E data acquisition card.
2.2.1 DATA ACQUISITION CARD

The main component of the data acquisition and control system is the NI 6110E multifunction data acquisition card. This is a 12-bit simultaneous sampling card that can sample up to 5 megasamples per second. The card has four analog inputs and two 16-bit analog outputs. The card also has eight digital I/O lines, two 24-bit counters, and analog or digital triggering. A CB68LP break out card is used to connect the external circuits to the data acquisition card via a SCSI cable.
2.2.2 DISPLACEMENT INDICATOR

The displacement indicator of choice for the parallel axis flatness measuring machine is a Lion Precision capacitance probe. The probe used is the C1-C style, which has a 9.525 mm diameter body, is 40.6 mm long, and has a sensor size of 1.7 mm. The probe is powered by a dual sensitivity DMT 12 driver; the probe and driver are shown in Figure 2.6. The driver, probe combination can be set to sensitivities of 2540 nm/Volt or 508 nm/Volt. The probes have a resolution of 1.8 nm at 20 kHz bandwidth on high sensitivity. The probes are highly linear, and easily connected to standard data acquisition systems [27]. An evaluation of the noise floor of the probes when combined with the custom electrical system is discussed in Section 2.3.4.

34

Figure 2.6: The Lion Precision C1-C probe and DMT 12 dual sensitivity driver have excellent resolution and linearity.

The limitation of use a capacitance probe as the displacement indicator is that the target surface must be conductive. Nonconductive surfaces or surfaces with poor Since the parallel axis flatness

conductivity pose a problem for capacitance sensors.

measuring machine is designed to measure mostly standard metallic parts this is not of major concern. Though, to measure these nonconductive surfaces a LVDT or the Lion Precision air bearing Contact Adapter Probe (CAP) may be used. The CAP holds a conventional capacitance probe, and consists of an air bearing gage with a contact stylus. The capacitance probe targets the rear of an air bearing slide to perform the actual measurement.

35
2.2.3 ANTI-ALIAS FILTER

Aliasing occurs when an input signal has frequency content at or higher than half the sampling frequency. If the signal is not properly filtered to eliminate these frequencies, they will be sampled as a lower frequency that cannot be separated from valid data. The best approach to eliminate these aliased signals is to use an analog low pass filter to filter the signal before sampling. The low pass filter is chosen to limit the input signal bandwidth to below half the sample rate. Knowing that 4096 count encoders are used and the expected spindle speeds, sample rates of 2600 to 5000 Hz are typical for the parallel axis flatness measuring machine. For these sample rates it is desired that frequencies above 1300 Hz be significantly attenuated. An additional consideration is that the parallel axis flatness measuring machine was designed to have a bandwidth of 50 cycles per revolution (cpr). For the expected sample rates the desired 50 cpr bandwidth corresponds to 30 to 65 Hz. The anti-alias filter must adequately attenuate the signals above 1300 Hz while not altering the signals below 65 Hz. To achieve this a Krohn-Hite 4 pole low pass Butterworth filter with a cutoff of 200 Hz is chosen. The filter module chosen comes in a 24 pin DIP package and is shown in Figure 2.7. The filter module has a 10 Volt range with 0.003% harmonic distortion [28].

Figure 2.7: The Krohn-Hite 4 pole Butterworth low pass filter module is used as an antialias filter. Its cutoff of 200 Hz was chosen to provide the proper attenuation of aliased frequencies.

36 Tests are performed to examine the filters characteristics. The filter is supplied a
5 Volt random noise signal while examining the time and frequency response. The input

signal and the filters response were sampled at a bandwidth of 1600 Hz. The input to output transmissibility characterstics of the filter are shown in Figure 2.8. The filter

performs very well, attenuating the components above the expected alias frequencies with minimal phase distortion in the desired measurement bandwidth.

Figure 2.8: The filter provides good attenuation in the stop band with minimal attenuation in the pass band. The filter performs well at removing frequencies that could be aliased based on typical machine sample rates.

37
2.2.4 ENCODERS AND STEPPER DRIVE

To perform feedback of the position of the two rotary axes, and data acquisition triggering, rotary encoders are chosen. Heidenhain ERO 1324 quadrature capable rotary encoders with 4096 counts per revolution are chosen for both axes. These encoders provide TTL output and may be used up to 16000 rpm. These encoders are easy to incorporate into the data acquisition system, and only require a +5 V external power supply. The use of the encoders for triggering and data capture is discussed in Section 3.1. To drive the stepper motor used to position the probe arm a drive circuit consisting of an Allegro MicroSystems UCN 5804 stepper motor driver integrated circuit. The UCN 5804 comes in a 16-pin DIP package, and has four built in transistors to drive the stepper motor. The circuit is set up to drive in half-step mode and is controlled in direction and step command by TTL outputs from the NI 6110E card.

38
2.3 MACHINE ANALYSIS

A precision machine must be carefully scrutinized to determine its errors and limitations. In this section the parallel axis flatness measuring machines characteristics are examined and corrected for where appropriate.
2.3.1 SPINDLE MISALIGNMENT

Due to the parallel axis flatness measuring machines unique configuration the alignment of the spindles is of concern. Due to the fact that one spindle is mounted on the bottom surface of the base plate while the other is mounted to the top surface, any spindle misalignment (tilt) will manifest itself as errors in the measurements. The best possible alignment of the spindles was achieved by grinding both sides of the base plate to have the top and bottom as parallel as possible. The spindle mounting surfaces themselves are of the highest level of precision, therefore when mounted to the base plate, the plates parallelism dominates. The spindle misalignment is determined by sweeping the probe arm across an artifact of know flatness and parallelism. The artifact is first characterized by placing it on a rotary air bearing inspection stage. A fixed capacitance probe targets the artifact while the stage moves the artifact, as shown in Figure 2.9. The artifact is located off-center on the stage to ensure the capacitance probe targets a specific trajectory across the part.

39

Figure 2.9: An artifact is first characterized on a rotary air bearing inspection stage before use. Once calibrated, it is used to determine the amount of spindle misalignment.

Once the artifact is calibrated for this specific trajectory, it is placed on the workpiece spindle of the parallel axis flatness measuring machine. The artifact is held stationary while the probe arm sweeps across the same trajectory that was previously calibrated. The indicated reading from this measurement is compared to the calibrated trajectory to determine the spindle misalignment. This technique determines that the spindle misalignment is 5 micrometers. To improve the misalignment, selective torquing of the mounting screws for the machine spindles is performed. Selectively torquing the mounting screws yields an alignment improvement to 2.5 micrometers. The results from these

measurements are used to subtract the spindle misalignment from the data taken during a flatness measurement.

40
2.3.2 EXPERIMENTAL MODAL ANALYSIS

In order to understand the dynamics of the parallel axis flatness measuring machine and the limitations of the instrument, an experimental modal analysis is conducted. The machine is excited using a 500 N Kistler modal hammer (Model #9722A500), while the response is measured at 42 points using a 5 g Kistler tri-axial accelerometer (Model #8690C5). A Hewlett Packard dynamic signal analyzer (Model #35670A) with a Uniform window and 800 Hz bandwidth is used to collect the frequency response functions at the modal test points. The data are post-processed using STAR Modal software to obtain the natural modes of vibration. Figure 2.10 shows the undeformed experimental modal grid of the machine.

Figure 2.10: 42-point undeformed experimental modal test grid of the parallel axis flatness measuring machine.

To perform a quality experimental modal analysis, an extensive test planning phase is required before the actual test data is taken [29]. This modal pretest is preformed to determine the best excitation location, signal analyzer settings, and data processing techniques. After the modal pretest is performed, the signal analyzers settings are

41 established, and the drive point is chosen to be on the rear corner of the machine base behind the probe spindle. Figure 2.11 shows the drive point frequency response function for the experimental modal analysis.

Figure 2.11: Drive point frequency response function for the experimental modal analysis.

The highest rigid body mode of the machine occurs at 33 Hz. This mode occurs due to the rocking of the machine on its rubber isolators and the air isolators of the granite table that it resides on. Figure 2.12 shows a picture of the machine moving rigidly on its isolators.

Figure 2.12: The most prominent rigid body mode of the machine occurs at 33 Hz

42 The first structural mode of the machine is the first torsional mode of the base plate at 535 Hz. This mode has some motion in the sensitive direction for flatness tests, and as a result, limits the bandwidth of measurements made with the machine. It is important to note that this mode has 5% damping, which is reasonably high for a machine structure. Figure 2.13 shows 535 Hz mode shape.

Figure 2.13: The first structural mode of the machine occurs at 535 Hz with 5% damping.

The second structural mode of the machine occurs at 665 Hz. This mode is primarily due to the bending of the probe arm. This frequency is relatively high for the amount of overhang the probe arm has, and can be attributed to the design effort that went into stiffening the arm. The 665 Hz mode also occurs in the sensitive direction for the flatness measurements. Figure 2.14 shows the 665 Hz probe arm bending mode.

43

Figure 2.14: The second structural mode of the machine occurs at 665 Hz with 0.5% damping. This mode also occurs in the sensitive direction for flatness tests.

The third structural mode of the machine occurs at 770 Hz. This mode is due to the shearing of the probe arm. The top of the probe arm moves laterally with respect to the rigidly connected bottom. Figure 2.15 shows the 770 Hz probe arm shearing mode.

Figure 2.15: The third structural mode of the machine occurs at 770 Hz.

In addition to determining the natural modes of vibration of the parallel axis flatness measuring machine, the dynamic compliance between the probe holder and workpiece chuck

44 is measured. The dynamic compliance of the machine plays a large role in its ability to collect accurate data in the presence of external dynamic forcing. For this test, the dynamic compliance between the probe holder and the workpiece chuck is measured in the sensitive (Z) direction. A compliance frequency response function is directly measured between the probe holder and workpiece chuck. The probe arm is excited at the probe tip by an impact hammer and the response is measured with a capacitance probe targeting a gage block on the workpiece chuck. The resulting cross point compliance between the probe holder and the workpiece chuck is shown in Figure 2.16.

Figure 2.16: Cross point compliance measurement in the sensitive (Z) direction between the probe holder and workpiece chuck.

The second structural mode of the machine (665 Hz) occurs in the sensitive (Z) direction. As a result, it shows up as a prominent source of compliance in the structural loop. The results of the experimental modal analysis and cross point compliance indicate that the bandwidth of measurements taken with this machine should be well below the first structural mode at 535 Hz.

45
2.3.3 MACHINE STATIC STIFFNESS

In addition to dynamic machine stiffness, it is important to evaluate a machines static stiffness. This gives insight into how the machine reacts to static loads via the compliance in the probe arm and spindle. To evaluate the machines static stiffness a test is performed in which a capacitance probe positioned in the probe holder targeting a gage block on the workpiece chuck. Increasing loads are applied to the probe holder and the resulting Loads from 8 to 250 grams are applied that result in

displacement is measured.

displacements from 0.5 to 1.2 micrometers. A least squares fit of the data indicates that the stiffness of the probe arm and spindle configuration is 2.1 N/m. Based on the

manufacturers specifications for the tilt stiffness of the 4R BLOCK-HEAD, the stiffness at the probe holder radius calculated to be 20 N/m. This suggests that the major source of compliance in the system is probe arm. The results of these tests are shown in Figure 2.17.

Figure 2.17: The static stiffness of the parallel axis flatness measuring machine is 2.1 N/meter. Most of the compliance is due to the probe arm.

46
2.3.4 ELECTRICAL SYSTEM NOISE TESTS

A capped gage test is performed to determine the noise floor of the gages. The capacitance gage is covered with small cap, affording a very small structural loop to minimize vibration, temperature, and grounding effects. The capacitance gage and cover are shown in Figure 2.18. The capped gage is then placed inside a temperature-insulated environment for the duration of the test. Data are collected for 20 seconds at a bandwidth of 12800 Hz. The bandwidth was chosen to be similar to expected sample rates during flatness measurements. The results of the sampled data are shown in Figure 2.19. The gage and measurement system has peak to valley noise of 4.56 nanometers and rms noise of 0.64 nanometers at this bandwidth. It is important to note that the data for this test was taken down stream of the anti-aliasing filter and control system circuits. This was to ensure a measurement that was representative of actual test conditions. Grejda has shown that the noise floor for these gages in a stand alone configuration can be on the order of 1 nm, depending on bandwidth [30]. The addition of the anti-aliasing filter and motor control circuits in the measurement loop adds approximately 4 nm of noise to the system.

Figure 2.18: The capacitance probe is shown with the cover for the noise measurement tests. The small cover affords a small structural loop to minimize external effects.

47

Figure 2.19: At a bandwidth of 12800 Hz the measurement system has noise levels of 4.56 nm peak to valley, and 0.64 nm rms.

48
2.3.5 MEASUREMENT REPEATABILITY

To further examine the capabilities of this machine a circular flatness repeatability test is conducted. In this test, 10 consecutive circular flatness measurements are performed on a diamond turned artifact. Four revolutions of data are taken for each of the 10

measurements that are conducted at a fixed radius of 60 mm. Figure 2.20 shows the repeatability of the synchronous portion of the circular flatness of the artifact. Each x indicates the measured value. The mean line and 2 standard deviation lines are shown. The standard deviation for these tests is 1.1 nm. The maximum asynchronous portion for each test is also recorded; asynchronous values range from 3 to 12 nm.

Figure 2.20: The repeatability of 10 consecutive circular flatness measurements is examined. The measurements have a standard deviation of 1.1 nm.

49

CHAPTER 3: SOFTWARE DESIGN


To complete the parallel axis flatness measuring machine a custom designed software package is created. The software performs data acquisition and control of the machine. Additionally the software processes the data and displays the test results in a custom user interface. The software is designed to be easy to use, while remaining robust for a variety of test conditions. The software is written in C in the National Instruments LabWindows/CVI programming environment. The program includes various setup and plotting controls, along with a real time rpm readout and an indicator screen for examining the capacitance probe signal. The code borrows on some of the data acquisition concepts created for previous metrology instruments designed by the Machine Dynamics Research Lab [31]. The source code for the software package is included in the Appendix.
3.1 DATA ACQUISITION

The main function of the software is to perform the data acquisition and control of the machine during a flatness measurement. The data acquisition is described by the flowchart shown in Figure 3.1. When the user clicks the Acquire button, the acquisition loop is started. Data sampling is triggered by the workpiece spindle encoder index pulse, and the data are sampled based on the workpiece spindle encoder square wave. A sample of the capacitance gage voltage is acquired each time the workpiece spindle encoder square wave makes a logic high-to-low transition. A sample is taken evenly spaced in position 4096 times per revolution of the workpiece spindle. During these acquisitions, the probe spindle encoder is also being monitored. The probe spindles encoder is being monitored for both its index pulse and square wave. The probe spindles index pulse is monitored to ensure that

50 every test taken has an absolute reference for the location of the probe arm. The probe arm spindles square wave allows the exact calculation for the location of the capacitance gage at every step across the part under test.
Acquire Clear Previous Results

Prepare Acquisition and Control Channels

Wait for Workpiece Spindle Index to Trigger

Index Pulse Trigger Acquire data: Sample Based on Workpiece Spindle Square Wave Step the Probe a rm Has the Desired Number of Steps been Completed? Yes Perform Data Ma nipulation and Calculations, then Plot Results No

Figure 3.1: Flow chart for the data acquisition and control software.

51
3.2 DATA PROCESSING

Once the entire data set for a flatness measurement is collected, the data is manipulated and processed before being displayed. The data manipulation and processing consists of several steps including filtering, conversion to desired units, circular flatness calculations, and position calculations. Once the data is completely processed, the results are visually

displayed in both circular flatness polar plots and a 3D surface plot.


3.2.1 DATA MANIPULATIONS

Initially after data acquisition, the buffer used for raw data storage is checked for overloaded signals. If the Overload Reject button is ON, and signals are beyond the voltage range limits, the test is aborted and the user is prompted to retest. If the Overload Reject is off the data processing is continued even if the signal is outside of the set range. The next operation is to remove the DC offset of acquired signals. The DC offset is determined from the first circular flatness ring, and that offset is removed from each subsequent ring. This ensures that the DC offset is removed without altering any features of the measured part. After the DC offset is removed, the data is filtered if desired. The filtering technique is discussed in Section 3.2.2. After the DC offset is removed the signal is filtered, it is converted to the desired units. The conversion uses the user entered gage sensitivity to realize the unit from the voltage data. A raw data vector is retained for use when the data are saved or reloaded to ensure the integrity of saved data.

52
3.2.2 DATA FILTERING

The capacitance gage data are sampled for each revolutions triggered by the digital output of the rotary encoder on the workpiece spindle. The sampled data are easily analyzed in the Fourier domain. For these discrete signals, the Discrete Fourier Transform (DFT) is used to convert the data from the spatial domain to the frequency domain. Since the data is collected in the spatial domain, the frequency is in terms of cycles per revolution (cpr). Low pass filtering of the data is now performed in the Fourier domain by removing the content from the appropriate bins of the frequency vector. Low pass filtering of the data now in the frequency domain is accomplished by assigning zero to the appropriate bins. This type of filtering imposes a brick wall cutoff without distorting the phase of the components in the pass band. The inverse DFT is used to return the data to the original sampled spatial domain.
3.3 USER INTERFACE

To adequately display the results of a flatness measurement the user interface must provide a large amount of information in an efficient manner. The manner in which the information is displayed can have a large impact on the usability and quality of the instrument. The interface attempts to show a large data set coherently without distorting what the data actually has to say [32]. The user interface contains test setup information, data plots, and various plotting and data acquisition controls. Figure 3.2 shows the main user interface screen that is displayed when the software is opened.

53

Figure 3.2: The user interface main screen contains test setup information and graphical displays of test data. Test data is displayed in both polar plot and 3D surface plot forms.

The first element of the user interface is the test setup panel. This panel contains the controls to allow the user to properly set up a flatness measurement. Additionally, this panel contains controls to alter the format in which the data is plotted. The test setup controls include selection of the number of revolutions or data to be taken per step, the number of steps, analog to digital range, encoder counts, and gage sensitivity. Buttons are available to activate thermal compensation, overload rejection and digital low pass filtering. The final set of controls in the test setup panel control the precision, ranges, and properties of the polar and 3D surface form plots. The next section of the main screen of the user interface contains the Acquire and Stop buttons to begin or halt data acquisition. An information bar and progress meter are

54 shown to inform the user of test conditions. The information bar notifies the user of errors and acquisition messages. The progress bar fills as the test proceeds to notify the user of the percentage of data that has been acquired. Real-time spindle speed is displayed to ensure tests are conducted at the desired speeds. Below the real-time speed indicator is a Load Picture button. This allows the user to load a picture (in bitmap format) to be displayed on the user interface. This gives the user the capability to graphically document the actual part being measured. Finally, a Quit button allows the user to close the data acquisition program after test completion.

Information bar Progress Meter

Figure 3.3: The Acquire and Stop buttons are used to begin or halt data acquisition. An information bar and progress meter are shown to inform the user of test conditions. Real-time spindle speed is displayed to ensure tests are conducted at the desired speeds.

3.3.1

POLAR PLOTS

The circular flatness data captured by the capacitance gage is plotted in a polar plot format. An example of typical circular flatness polar plot is shown in Figure 3.4. The light blue traces are the results from each revolution around the part, and the black trace is the synchronous result from the all the revolutions. The synchronous value for the circular flatness measurement is displayed in the center of the polar plot. Also at the center of the

55 polar plot is a selectable box to choose the circular flatness ring to plot. Two polar plotting regions exist on the main user interface screen. This arrangement allows the user to examine the data from any two radial locations to aid in comprehending the surface form.

Figure 3.4: The circular flatness data is displayed in polar plot format. The ring to be plotted is selectable to allow the user to examine any desired radial locations on the part under test.

3.3.2

3D SURFACE PLOT

The circular flatness data captured by the capacitance gage is also plotted in a 3D surface plot. The 3D surface plot is created in software using OpenGL commands created in the custom software package. The 3D surface plot gives the user the ability to pan, tilt, and zoom to fully examine the test results. To create the 3D plot data must first be formatted properly to make use of the OpenGL commands. The data in polar coordinates from each circular flatness

measurement is transformed into rectangular coordinates and placed in a surface array. The surface array is plotted as concentric rings in the XY plane with Z values of the circular flatness. An example of data plotted in the 3D surface plot is shown in Figure 3.5.

56

Figure 3.5: The surface form plot provides the user a 3D representation of the surface form. The plot is created using OpenGL commands, and can be rotated, panned, and zoomed.

57

CHAPTER 4: EXPERIMENTAL RESULTS


To examine how the performance of the parallel axis flatness measuring machine, a number of tests are performed on several precision machined parts. These tests attempt to explore the utility and ultimate accuracy of the measuring machine. Single point diamond turned artifacts, and precision ground surfaces are examined. High precision diamond turning machines can create artifacts with extremely high form and finish tolerances. Most diamond turning work focuses on soft materials such as aluminum, copper, electroless nickel, and some polymers. Soft metallic materials such as aluminum and copper are common elements in reflective optics, and their diamond machining characteristics are well understood. The diamond turned artifacts examined in this thesis are produced on a Moore Tool Company No. 3 machine base modified into a precision diamond turning machine. The machine base is equipped with a Professional Instruments Twin Mount DC motorized air bearing spindle. An Edge Technologies single point monocrystalline diamond tool is used in the machining. An example of an aluminum artifact generated by this machining setup is shown in Figure 4.1. This artifact is measured on the parallel axis flatness measuring machine, and the resulting form is shown in Figure 4.2. The test was performed at approximately 100 rpm without digital filtering. By examining the data, it is apparent that the cone of the workpiece is the main component of its form.

58

Figure 4.1: This single point diamond turned artifact has a highly mirror surface with exceptionally low surface roughness.

Figure 4.2: The form of the artifact from Figure 4.1 as measured with the parallel axis flatness measuring machine. The artifact nominally has a flatness of 1 micrometer, which is mostly due to cone.

59 Another example of a diamond turned flat is shown in Figure 4.3. This artifact is measured at approximately 100 rpm with a digital filter set at 25 cpr. This artifact has approximately 2 micrometers of cone that is digitally removed for the results shown in Figure 4.4. With the cone removed, it is shown to have a surface form of 40 nm

Figure 4.3: This diamond turned artifact has not mounting holes, and is measured in an unfixtured state with the parallel axis flatness measuring machine.

60

Figure 4.4: When the cone of the diamond turned flat shown in Figure 4.3 is removed, it is shown to have a surface form of 40 nm peak to valley.

61

CHAPTER 5: CONCLUSIONS AND FUTURE WORK


From this work, the parallel axis flatness measuring machine has been built, and proven as a viable flatness measuring tool. The machine hardware and software are capable of

performing automated flatness measurements to sub-micrometer accuracy. Rigorous design and assembly practices yield a high-quality machine with excellent performance. The machine hardware is assembled to tight tolerances, resulting in a rigid structure as proven by the experimental modal analysis. The spindles chosen provide extremely accurate motion to ensure accurate, repeatable measurements. The electrical system design including anti-alias filtering, capacitance gages, stepper motor drive, and data acquisition card allow unadulterated data to be collected. The custom designed software package provides the user an intuitive, easy to use interface for flatness measurements. The display of data in polar plot, and 3D plot form aids the user in understanding the nature of a surfaces form. Future work based on this thesis will consist of improvements to the software package. Surface fitting capabilities will be added to more accurately describe the form of the surfaces measured. Additionally, the software will be made more robust for a larger variety of surfaces to be measured. The spindle alignment will also be more accurately characterized to reduce the uncertainty in its removal from the data taken with this machine. Additional work will be pursued on the advancement of the linear-rotary measuring machine design. Hardware has been constructed, and the software and data acquisition system will be modified to make use of this configuration to measure parts not fit for the parallel axis design.

62

R EFERENCES

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Moore, W., Foundations of Mechanical Accuracy, Bridgeport, CT, Moore Special Tool Company, 1970. Evans, C.J., Precision Engineering: an Evolutionary View, Bedford: Cranfield Press, 1989. ASME Y14.5M-1994, Dimensioning and Tolerancing. New York, NY: ASME, 1994. Farago, F.T., Handbook of Dimensional Measurement. New York, NY, Industrial Press, 1982.
Questions and Answers about Surface Plates, Rahn Granite Surface Plate Co.

Griffith, G.K., Geometric Dimensioning and Tolerancing. New Jersey, Prentice Hall, 2002. Malacara, D., Optical Shop Testing, New York, NY, John Wiley & Sons Inc., 1992. Busch, T., Fundamentals of Dimensional Metrology, New York, Delmar Publishers, 1989. Scarr, A..J.T., Metrology and Precision Engineering, London, McGraw-Hill Publishing Inc., 1967. Slocum, A.H., Precision Machine Design, Dearborn, MI, Society of Manufacturing Engineers, 1992. Badami, V.G., Interferometric Form Metrology for Precision Machined Surfaces, Center For Optics Manufacture: Summer School, 2001. Corning Tropel Corporation, FlatMaster 200 Product Sheet, Fairport, NY. Zygo Corporation, NewView 5000 Specification Sheet, Middlefield, CT. Zygo Corporation, Vertical MESA LU Specification Sheet, Middlefield, CT. Whitehouse, D.J., Handbook of Surface Metrology, Philadelphia, PA, Institute of Physics Publishing, 1994. Kaiser, M.J., Krishna, K.K., Geometry of the Minimum Zone Flatness Functional: Planar and Spatial Case. Precision Engineering, v 22 n 3, 1998, pp 174-183.

63 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Treband, M.T., et al, Evaluation of Straightness and Flatness Tolerance using Minimum Zone. Manufacturing Review, v 2, n 3, 1989, pp. 189-195. Cheraghi, S.H., et al, Straightness and Flatness Tolerance Evaluation: an Optimization Approach. Precision Engineering, v 18, n 1, 1996, pp. 30-37. Damodarasamy, S., Anand, S., Evaluation of Minimum Zone for Flatness by Normal Plane Method and Simplex Search. IIE Transactions, v 31, n 7, pp. 617-626. Estler, W.T., Calibration and use of optical straightedges in the metrology of precision machines. Optical Engineering, v 24, n 3, 1996, pp. 372-379. Evans, Hocken, Estler, Self-Calibration: reversal, redundancy, error separation, and absolute testing. Annals of the CIRP, v 45, n 2, 1996, pp. 617-634. ANSI/ASME B5.54-1992, Methods for Performance Evaluation of Computer Numerically Controlled Machining Centers. New York: ASME, 1992. Hale, L.C., Principles and Techniques for Designing Precision Machines. Ph.D. Thesis, M.I.T. Cambridge Massachusetts, 1999. Professional Instruments Company, BLOCK-HEAD Operators Manual, Minneapolis, MN. ANSI/ASME B89.3.4M-1985, Axes of Rotation: Methods for Specifying and Testing. New York: ASME, 1985. Grejda, R.D., Marsh E.R., Nanometer Level Spindle Calibration. Submitted to Precision Engineering, December 2001, In Review. Lion Precision, When Precision Matters, 2000 Catalog, St. Paul, MN: Lion Precision, 2000. Krohn-Hite Corporation, Continuous Time Fixed Frequency Active Filter Modules, 1997. Ewins, D.J., Modal Testing, theory, practice and application: Second Edition, Philadelphia, PA, Research Studies Press LTD., 2000. Grejda, R.D., On the use of Ultraprecision Axes of Rotation in Nanometer Level Metrology, Ph.D. Thesis, The Pennsylvania State University, 2002. Vigliano, V.C., Computer Control for Precision Bearing Analysis, M.S. Thesis, The Pennsylvania State University, 2001.

64 32 Tufte, E.R., The Visual Display of Quantitative Information, Cheshire, CT, Graphics Press, 1983.

65

APPENDIX
////////////////////////////////////////// // // // Flatest V.3.0 // // Written by: D.C. Schalcosky // // // ////////////////////////////////////////// //Created 10/29/01 //Last Modified 6/27/02 //Analog Channels //CH0: Cap 1 //Trigger and Counter Channels //PFI0/TRIG: Probe Spindle Encoder Index //PFI1: Work Spindle Encoder Channel A //PFI5: Work Spindle Encoder Index //PFI3: Probe Spindle Encoder Channel A //Digital channels //DIO0: Stepper output CW/CCW //DIO1: Stepper output steps #include #include #Include #include #include #include #include #include #include #include #include #define #define #define #define #define #define #define <Dataacq.h> <utility.h> <formatio.h> <ansi_c.h> <easyio.h> <analysis.h> <cvirte.h> <userint.h> "flatest.h" "ba_functions.h" "cviogl.h" pi PI RAD(x) TRUE 1 FALSE 0 XPOINTS YPOINTS 3.1415926535897932384626433832795028841971 3.1415926535897932384626433832795028841971 ((x)*PI/180.0)

100000 100000

static int panelHandle; static int tirpanel; static int surfaceControl; //Prototypes static int SetControlAttributes(void); static int CreatePlot(void);

66
//Variables static char msgBuf[256]; int begin,error; int err, month,day,year,hour,minute,minutens, secs; double sense; long buffersize; int m, maxi,mini; long channum, rpmID, buffersize; int rpmchans, probeperrev, probencct, workperrev, workencct; int revnum, step, totalsteps, done; int indon, scanstatus; short brdcode, scanstate; short gainlist[1]={1}, chanlist[1]={0}; double surfacearray[50000][100], surfacearrayraw[50000][100], cap[70000], capfilt[70000]; double angle[70000], xtemp[100000], capplot[70000], vecx[70000], vecy[70000]; double asynch[5000], capmean[70000], cappoints[5000], rlsc[5000], thetalsc[5000], R[5000]; double dddvecx[200000], dddvecy[200000]; double backlog[1000], captemp[150000], capthermal[128], coef[100]; double polycoefs[10], xvec[10], yvec[10], nullx[10], nully[10]; double null[150000]; double capring[150000]; double partradius; double dddzarray[200000], dddmag[200000], dddphase[200000]; double bobert[900000]; double surfacecolumn[600000]; double mean, max, min, asymax, capmin, capmax, cpr, upr; double a1,b1,t1,t2; double mserr, deg, bcircle, a,b; double lsc; double rmin, rmax, thetamin, thetamax; double revs, maxrevs, datapoints, maxpoints, pt2; double range; double delta, wait,del,xcoor,ycoor,maxupr,xupr; double order2, circleval,x,y,max2,min2; double t, delt,rpm,rpm2,backlogval,var,var2; unsigned long probecntbuf[150000], probeindexcntbuf[150000]; short piBuffer[150000]= {0}, pitemp[150000]; short int trigger, live, datapresent; int orderpoly; int perrev, points, pt, logind; int i,j,k,l,n,p,r,w,revnum,inc; int order, cutoff; int scale; int imax, imin; int color; int amode; int test; int rgb, superlightgray, backcolor; int rangeval, ovldrej, ovld; int off[100]; int polarring;

67
int ovalcolor; int polarring2; double dcoffset; unsigned long scanbacklog; long chanum, taskID, rpmID, scannum, scanbklg, taskIDtir; short brdcode; char path[300], tempchar[3000]; char filename; int stepdigital; int direction; double mag; int probeindex,location,probemin,probemax, stepstart; int probearmposition[100]; //*********************// //Main Program Callback// //*********************// 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, "flatest.uir", MAINPANEL)) < 0) return -1; if ((tirpanel = LoadPanel (0, "flatest.uir", TIRPANEL)) < 0) return -1; //Set the main panel controls SetPanelAttribute (panelHandle, 1); SetPanelAttribute (panelHandle, ATTR_WINDOW_ZOOM, VAL_MAXIMIZE); DisplayPanel (panelHandle); SuspendTimerCallbacks(); //initialize the DAQ Board Init_DA_Brds (1, &brdcode); // Create OpenGL control for the 3D plot on CVI panel surfaceControl = OGLConvertCtrl(panelHandle,MAINPANEL_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); //Default values buffersize = 200000;

ATTR_SCALE_CONTENTS_ON_RESIZE,

68
//Calibrate the DAQ Board begin = ConfirmPopup ("PCI-6110E Board Calibration", "Do you want to calibrate the DAQ board?"); if (begin) { MessagePopup ("PCI-6110E 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-6110E Board Calibration", " Calibration Complete!"); } //Start the Real time RPM nidaqAICreateTask ("daq::1!(0,3)", kNidaqWaveformCapture, &rpmchans, &rpmID); nidaqAIConfigBuffer (rpmID, buffersize, kNidaqContinuous); nidaqAIConfigExternalScanClock (rpmID, "daq::1!(PFIHightoLow1)"); // Work spindle square wave nidaqAIStart (rpmID); t1 = Timer(); //Initialize the stepper //Set stepper CW/CCW GetCtrlVal (panelHandle, if (direction = 0) { AOUpdateChannel (1, "0", } else { AOUpdateChannel (1, "0", } ResumeTimerCallbacks(); //Run the user interface RunUserInterface (); // Dicard CVIOGL control OGLDiscardCtrl(panelHandle,surfaceControl); Error : return error; } direction MAINPANEL_PROBEDIRECTION, & direction);

0.0);

5.0);

//*****************************************************// // When the user clicks "Acquire" // // Initiate Data Acquisition // //*****************************************************// int CVICALLBACK acquire (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event)

69
{ case EVENT_COMMIT: SuspendTimerCallbacks(); //Turn off the RPM display if (step<1) { //Destroy RPM task nidaqAIStop(rpmID); nidaqAIDestroyTask(rpmID); } Init_DA_Brds (1, &brdcode); live = 1; //taking data in process pt = 0; //'data' vector indice logind = 0; //'backlog' vector indice ovld = 0; //no overload yet //Clear Clear1D Clear1D Clear1D Clear1D data (capmean, 50000); (cap, 50000); (captemp, 50000); (capplot, 50000);

//Delete plots DeleteGraphPlot VAL_IMMEDIATE_DRAW); DeleteGraphPlot VAL_IMMEDIATE_DRAW);

(panelHandle, (panelHandle,

MAINPANEL_ROUNDPLOT, MAINPANEL_ROUNDPLOT_2,

-1, -1,

//Clear results DefaultCtrl (panelHandle, MAINPANEL_ESYNCH); //Get the encoder counts for each encoder GetCtrlVal (panelHandle, MAINPANEL_PROBEENCCOUNT, &probencct); GetCtrlVal &workencct); probeperrev = probencct; workperrev = workencct; //Find out the number of data points //Get number of revs to evaluate for error GetCtrlVal (panelHandle, MAINPANEL_REVNUM, &revnum); if(revnum == 0){points = 1*workperrev; revs =1;} if(revnum == 1){points = 4*workperrev; revs=4;} if(revnum == 2){points = 8*workperrev; revs=8;} if(revnum == 3){points = 16*workperrev;revs=16;} if(revnum == 4){points = 32*workperrev;revs=32;} //find out how many steps to do GetCtrlVal(panelHandle, MAINPANEL_TOTALSTEPS, &totalsteps); (panelHandle, MAINPANEL_WORKENCCOUNT,

70
if (step > 0 & done == 0) { //Use the Work Index as the start Trigger Select_Signal (1, ND_IN_START_TRIGGER, ND_LOW_TO_HIGH); //Begin acquisition on Workpiece encoder Select_Signal (1, ND_IN_SCAN_START, ND_HIGH_TO_LOW); //Set the Workpiece encoder pulse to be the scanclock Select_Signal (1, ND_IN_SCAN_CLOCK_TIMEBASE, ND_HIGH_TO_LOW); } else { //Use the Work Index as the start Trigger Select_Signal (1, ND_IN_START_TRIGGER, ND_LOW_TO_HIGH); //Begin acquisition on Workpiece encoder Select_Signal (1, ND_IN_SCAN_START, ND_HIGH_TO_LOW); //Set the Workpiece encoder pulse to be the scanclock Select_Signal (1, ND_IN_SCAN_CLOCK_TIMEBASE, ND_HIGH_TO_LOW); }

ND_PFI_5,

ND_PFI_1, external ND_PFI_1,

ND_PFI_5,

ND_PFI_1, external ND_PFI_1,

//Setup a Counter to keep track of Probe position //the couter gets reset after each step GPCTR_Control (1, ND_COUNTER_1, ND_RESET); GPCTR_Set_Application (1, ND_COUNTER_1, ND_BUFFERED_EVENT_CNT); GPCTR_Change_Parameter (1, ND_COUNTER_1, ND_SOURCE, ND_PFI_3); GPCTR_Change_Parameter (1, ND_COUNTER_1, ND_SOURCE_POLARITY, ND_LOW_TO_HIGH); GPCTR_Change_Parameter (1, ND_COUNTER_1, ND_GATE, ND_PFI_1); GPCTR_Change_Parameter (1, ND_COUNTER_1, ND_GATE_POLARITY, ND_NEGATIVE); GPCTR_Change_Parameter (1, ND_COUNTER_1, ND_UP_DOWN, ND_HARDWARE); //Count up (CW?) Count down (CCW?) GPCTR_Config_Buffer (1, ND_COUNTER_1, 0, points, probecntbuf); GPCTR_Control (1, ND_COUNTER_1, ND_PROGRAM); //Setup a Counter to keep track of Probe index GPCTR_Control (1, ND_COUNTER_0, ND_RESET); GPCTR_Set_Application (1, ND_COUNTER_0, ND_BUFFERED_EVENT_CNT); GPCTR_Change_Parameter (1, ND_COUNTER_0, ND_SOURCE, ND_PFI_0); GPCTR_Change_Parameter (1, ND_COUNTER_0, ND_SOURCE_POLARITY, ND_LOW_TO_HIGH);

71
GPCTR_Change_Parameter (1, ND_COUNTER_0, ND_GATE, ND_PFI_3); //??????? GPCTR_Change_Parameter (1, ND_COUNTER_0, ND_GATE_POLARITY, ND_NEGATIVE); GPCTR_Change_Parameter (1, ND_COUNTER_0, ND_UP_DOWN, ND_HARDWARE); //Count up (CW?) Count down (CCW?) GPCTR_Config_Buffer (1, ND_COUNTER_0, 0, points, probeindexcntbuf); GPCTR_Control (1, ND_COUNTER_0, ND_PROGRAM); if (step == 0) { probeindex=0; } //Set the channel Range GetCtrlVal (panelHandle, MAINPANEL_ADRANGE, &rangeval); channum = 1; if(rangeval == 0){for(i=0;i<channum;i++){gainlist[i] 50;}} // 0.2 if(rangeval 20;}} // 0.5 if(rangeval 10;}} // 1.0 if(rangeval == 3){for(i=0;i<channum;i++){gainlist[i] = 5;}} // 2.0 if(rangeval == 4){for(i=0;i<channum;i++){gainlist[i] = 2;}} // 5.0 if(rangeval == 5){for(i=0;i<channum;i++){gainlist[i] = 1;}} //Set stepper CW/CCW GetCtrlVal (panelHandle, &direction); if (direction == 0) { AOUpdateChannel (1, "0", 0.0); } else { AOUpdateChannel (1, "0", 5.0); } == 2){for(i=0;i<channum;i++){gainlist[i] = == 1){for(i=0;i<channum;i++){gainlist[i] =

MAINPANEL_PROBEDIRECTION,

//Set up the channels to run if (step>1) { DIG_Line_Config (1, 0, stepper control Delay (.25); DIG_Out_Line (1, 0, 1, Delay (.25); DIG_Out_Line (1, 0, 1, Delay (2.5); if (step<1)

the stepper motor

1, 1);

//Digital

line

1); 0);

72
{ wait = 0; step = 0; done = 0; SetCtrlVal(panelHandle, MAINPANEL_WAITBAR, wait); } //setup the acquisition DAQ_Config (1, 1, 2); SCAN_Setup (1, 1, chanlist, gainlist); SCAN_Start (1, piBuffer, points, 0, 2, 0, 0); ResumeTimerCallbacks(); t = Timer(); break; } return 0; } //***************************// // The Timer Callback // // Check acquisition status // //***************************// int CVICALLBACK timer (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_TIMER_TICK: if(indon == 1){break;} if(live == 0){ //Get Current RPM SuspendTimerCallbacks(); nidaqAICheck (rpmID, &scanstatus, &scannum); if(scannum>100000){break;} nidaqAIRead (rpmID, "daq::1!(0)", scannum, &xtemp[0]); //Elapsed Time Calculation t2 = Timer(); delt = t2 - t1; t1 = t2; GetCtrlVal(panelHandle, &workencct); cpr = workencct; rpm = (scannum/delt)*(60/cpr); //Live RPM SetCtrlVal(panelHandle, MAINPANEL_RPMBOX, rpm); ResumeTimerCallbacks(); break;} //****************************DATA LOOP********************************* //Wait for Square Wave ACQUISITION

-1.0,

MAINPANEL_WORKENCCOUNT,

73
ResetTextBox trigger"); (panelHandle, MAINPANEL_STATUSBOX, "Waiting for

if(live == 1)err = DAQ_Check (1, &scanstate, &scanbklg); //If the scanbacklog vector has data, //Read in data if(scanbklg>0){ SuspendTimerCallbacks(); ResetTextBox (panelHandle, MAINPANEL_STATUSBOX, "Scanning"); wait = scanbklg; wait = wait*100/(points*channum); SetCtrlVal(panelHandle, MAINPANEL_WAITBAR, wait); ResumeTimerCallbacks(); } //Data Full if(scanstate == 1){ SuspendTimerCallbacks; ResetTextBox (panelHandle, MAINPANEL_STATUSBOX, "Ring Complete"); wait = 0; SetCtrlVal(panelHandle, MAINPANEL_WAITBAR, wait); //******************************MANIPULATION*************************** ************** //* //*1. Read in data //* //Read in the counters for the probe spindle if(probeindex==0) { //Look to see if the index occured for the probe spindle j=0; for(i=0;i<points;i++){ if(probeindexcntbuf[i] == 1.0){ probeindex=1; //the index did occur on this step stepstart=step; j++; if(j>999){ break;} } } j = j-1; } j=0; //Find out where the probe arm is if the index has happened if(probeindex==1) { probemin=probecntbuf[0]; probemax=probecntbuf[points-1]; location=(probemax-probemin)/2; //the average postion

74
//put the location in the probearmpostion vector probearmposition[step]=location; } //Read in The Capacitance gage data for(i=0;i<points;i++){ pitemp[i] = piBuffer[i];} DAQ_VScale (1, 0, gainlist[0], 1.0, 0.0, points, pitemp, cap); //Update step if (step < totalsteps) { //Organize the data from this scan into the surface array for (i=0;i<workencct*revs;i++) { surfacearray[i][step] = cap[i]; surfacearrayraw[i][step] = cap[i]; } //clear the cap vector Clear1D (cap, 50000); //Update the step step++; //Run the acquire callback for the next ring if (step <totalsteps) { acquire(panelHandle, 0, EVENT_COMMIT, 0, 0, 0); } } //If all the steps have been completed the acquisition is over if (step == totalsteps) { //Acquisition Done done = 1; wait = 0; live = 0; datapresent = 1; SetCtrlVal(panelHandle, MAINPANEL_WAITBAR, wait); ResetTextBox (panelHandle, MAINPANEL_STATUSBOX, "Surface Complete"); } if (step<totalsteps) { timer(panelHandle, 0, EVENT_TIMER_TICK, 0, 0, 0); } if (done == 1) { //calc/plot start //*********************data organization/calculations/plotting************************

Scan

75
//Loop through the manipulation for each ring for (l=0;l<totalsteps;l++) { //ring loop start points = workencct*revs; inc = (points/workencct); //pick off the current ring from the surface array for (w=0;w<points;w++) { captemp[w]=surfacearray[w][l]; } //Check to see if you are on the part MaxMin1D(captemp, points, &max, &imax, &min, &imin); if(max == min) { off[l] = 1; //this ring is off the part } else { off[l] = 0; //this ring is on the part } //if off, then remove the ring data //Find out the DC offset for the first measurement and use for all if (l == 0)Mean(captemp,points,&dcoffset); //Remove the DC offset for(i=0;i<points;i++)captemp[i] = captemp[i] - dcoffset; //angle vecy (rad) for(n=0;n<points;n++)angle[n] = 2*pi*inc*n/points; //If the Filter is on do it but don't remove once around GetCtrlVal (panelHandle, MAINPANEL_FILTCUTOFF, &cutoff); GetCtrlVal (panelHandle, MAINPANEL_FILTTOGGLE, &n); if(n==1){ Clear1D(null, points); FFTFilter(captemp,null,points,workencct,cutoff,&captemp[0], &mag); } if(n==0|cutoff==0){ Clear1D(null, points); cutoff = 0; FFTFilter(captemp,null,points,workencct,cutoff,&captemp[0], &mag); } //convert the magnitude to the correct units GetCtrlVal(panelHandle, MAINPANEL_GAGESENSE, &sense); mag = mag*sense;

76
//Cone Compensation for each individual measurement GetCtrlVal (panelHandle, MAINPANEL_THERMAL, &n); orderpoly = 2; if(n == 1)RemoveThermalDrift(captemp,xtemp,points,orderpoly, &polycoefs[0], &captemp[0]); //Convert to units GetCtrlVal(panelHandle, MAINPANEL_GAGESENSE, &sense); for(i=0;i<points;i++){ captemp[i] = captemp[i]*sense; } //put the data back into the surface array for (w=0;w<points;w++) { surfacearray[w][l] = captemp[w]; } } //ring loop end

//*****************Data Plotting******************************************* //Plot the Polar plot of the ring //What ring to plot GetCtrlVal(panelHandle, MAINPANEL_POLARRING, &polarring); //pick off the current ring from the surface array for (w=0;w<points;w++) { capring[w]=surfacearray[w][polarring]; } //Measurements: // TIR // Asynch. Error // Circular Flatness //Maximum asynchronous error motion //Construct 'capmean' which is the mean of all revs if(inc>1) //only look at asynch if more than one rev was taken { for(i=0;i<workencct;i++){ for(n=0;n<inc;n++){ captemp[n] = capring[i + n*workencct]; } MaxMin1D (captemp, inc, &max, &imax, &min, &imin); asynch[i] = (max - min); Mean (captemp, inc-1, &mean); capmean[i] = mean; } MaxMin1D (asynch, workencct, &asymax, &imax, &min, &imin); deg = imax*360/(workencct-1); } if (inc==1) {

77
for (n=0;n<workencct;n++) { capmean[n]=capring[n]; } } //Roundness Measurement (LSC) //'capmean' is mean of all revs MaxMin1D (capmean, workencct, &capmax, &imax, &capmin, &imin); for(i=0;i<workencct;i++){ capplot[i] = capmean[i] + fabs(capmin); capplot[i] = capplot[i] + bcircle; } //find lsc center using 'capmean' ToRect1D (capplot, angle, workencct, &vecx[0], &vecy[0]); a=0; b=0; for(i=0;i<workencct;i++){ a = a + vecx[i]; b = b + vecy[i];} a = 2*a/workencct; b = 2*b/workencct; //create 'R' the radial values of the LSC for(i=0;i<workencct;i++){ rlsc[i] = vecx[i] - a; thetalsc[i] = vecy[i] - b;} for(i=0;i<workencct;i++){ R[i] = sqrt ((rlsc[i]*rlsc[i]) (thetalsc[i]*thetalsc[i]));} MaxMin1D (R, workencct, &max, &imax, &min, &imin); lsc = (max - min); //display polar plot results SetCtrlVal (panelHandle, MAINPANEL_ESYNCH, lsc); //Plot Error Motion GetCtrlVal(panelHandle, MAINPANEL_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 == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == bcircle 1)circleval = 1; 2)circleval = 2; 3)circleval = 5; 4)circleval = 10; 5)circleval = 25; 6)circleval = 50; 7)circleval = 100; 8)circleval = 150; 9)circleval = 200; 10)circleval = 500; = 3*circleval;

78
MaxMin1D (capring, points, &capmax, &imax, &capmin, &imin); Mean (capmean, workencct, &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, MAINPANEL_ROUNDPLOT, VAL_XAXIS, VAL_MANUAL, -max , max); SetAxisScalingMode (panelHandle, MAINPANEL_ROUNDPLOT, VAL_LEFT_YAXIS, VAL_MANUAL, -max, max); //Plot Total Error Motion for(i=0;i<points;i++)capplot[i] = capring[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, points, &vecx[0], &vecy[0]); rgb = MakeColor (57, 201, 232); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT, vecx, vecy, points, VAL_DOUBLE,VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, rgb); //Synchronous Error Motion circles MaxMin1D (capmean, workencct, &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, MAINPANEL_ROUNDPLOT, mean, mean, mean, -mean, VAL_LT_GRAY, VAL_TRANSPARENT);//mean x = circleval + mean; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //outer x = mean - circleval; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //inner PlotPoint (panelHandle, MAINPANEL_ROUNDPLOT, 0.0, 0.0, VAL_CROSS, VAL_BLACK); //center cross PlotPoint (panelHandle, MAINPANEL_ROUNDPLOT, a, b, VAL_CROSS, VAL_GREEN); //lsc center cross //Plot Synchronous; for(i=0;i<workencct;i++)capplot[i] = capmean[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, workencct, &vecx[0], &vecy[0]); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT, vecx, vecy, workencct, VAL_DOUBLE, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_BLACK); if(lsc>1.0)sprintf (tempchar, "-%.0f", circleval);

79
if(lsc<1.0)sprintf (tempchar, "-%.1f", circleval); x = (mean - circleval)*cos(pi/4); y = (mean - circleval)*sin(pi/4); PlotText (panelHandle, MAINPANEL_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, MAINPANEL_ROUNDPLOT, x, y, tempchar, VAL_APP_META_FONT, VAL_BLACK, VAL_TRANSPARENT); //************done with polar plot**************************** //Plot the Polar plot of the second ring //What ring to plot GetCtrlVal(panelHandle, MAINPANEL_POLARRING2, &polarring2); //pick off the current ring from the surface array for (w=0;w<points;w++) { capring[w]=surfacearray[w][polarring2]; } //Measurements: // TIR // Asynch. Error // Roundness //Maximum asynchronous error motion //Construct 'capmean' which is the mean of all revs if(inc>1) //only look at asynch if more than one rev was taken { for(i=0;i<workencct;i++){ for(n=0;n<inc;n++){ captemp[n] = capring[i + n*workencct]; } MaxMin1D (captemp, inc, &max, &imax, &min, &imin); asynch[i] = (max - min); Mean (captemp, inc-1, &mean); capmean[i] = mean; } MaxMin1D (asynch, workencct, &asymax, &imax, &min, &imin); deg = imax*360/(workencct-1); } if (inc==1) { for (n=0;n<workencct;n++) { capmean[n]=capring[n]; } } //Roundness Measurement (LSC) //'capmean' is mean of all revs

80
MaxMin1D &capmin, &imin); for(i=0;i<workencct;i++){ capplot[i] = capmean[i] + fabs(capmin); capplot[i] = capplot[i] + bcircle; } //find lsc center using 'capmean' ToRect1D (capplot, angle, workencct, &vecx[0], &vecy[0]); a=0; b=0; for(i=0;i<workencct;i++){ a = a + vecx[i]; b = b + vecy[i];} a = 2*a/workencct; b = 2*b/workencct; //create 'R' the radial values of the LSC for(i=0;i<workencct;i++){ rlsc[i] = vecx[i] - a; thetalsc[i] = vecy[i] - b;} for(i=0;i<workencct;i++){ R[i] = sqrt ((rlsc[i]*rlsc[i]) + (thetalsc[i]*thetalsc[i]));} MaxMin1D (R, workencct, &max, &imax, &min, &imin); lsc = (max - min); //display polar plot results SetCtrlVal (panelHandle, MAINPANEL_ESYNCH_2, lsc); //Plot Error Motion GetCtrlVal(panelHandle, MAINPANEL_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 == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == bcircle 1)circleval = 1; 2)circleval = 2; 3)circleval = 5; 4)circleval = 10; 5)circleval = 25; 6)circleval = 50; 7)circleval = 100; 8)circleval = 150; 9)circleval = 200; 10)circleval = 500; = 3*circleval; (capmean, workencct, &capmax, &imax,

MaxMin1D (capring, points, &capmax, &imax, &capmin, &imin); Mean (capmean, workencct, &mean); mean = mean + bcircle + fabs(capmin); //mean error circle radius

81
//Set Axes if(capmax>circleval)max = capmax + bcircle + fabs(capmin); if(circleval>capmax)max = circleval + bcircle + fabs(capmin); SetAxisScalingMode (panelHandle, MAINPANEL_ROUNDPLOT_2, VAL_XAXIS, VAL_MANUAL, -max , max); SetAxisScalingMode (panelHandle, MAINPANEL_ROUNDPLOT_2, VAL_LEFT_YAXIS, VAL_MANUAL, -max, max); //Plot Total Error Motion for(i=0;i<points;i++)capplot[i] = capring[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, points, &vecx[0], &vecy[0]); rgb = MakeColor (57, 201, 232); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT_2, vecx, vecy, points, VAL_DOUBLE,VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, rgb); //Synchronous Error Motion circles MaxMin1D (capmean, workencct, &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, MAINPANEL_ROUNDPLOT_2, mean, mean, mean, -mean, VAL_LT_GRAY, VAL_TRANSPARENT);//mean x = circleval + mean; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT_2, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //outer x = mean - circleval; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT_2, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //inner PlotPoint (panelHandle, MAINPANEL_ROUNDPLOT_2, 0.0, 0.0, VAL_CROSS, VAL_BLACK); //center cross PlotPoint (panelHandle, MAINPANEL_ROUNDPLOT_2, a, b, VAL_CROSS, VAL_GREEN); //lsc center cross //Plot Synchronous; for(i=0;i<workencct;i++)capplot[i] = capmean[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, workencct, &vecx[0], &vecy[0]); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT_2, vecx, vecy, workencct, 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, MAINPANEL_ROUNDPLOT_2, 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,

y,

82
x = (mean + circleval)*cos(pi/4); y = (mean + circleval)*sin(pi/4); PlotText (panelHandle, MAINPANEL_ROUNDPLOT_2, tempchar, VAL_APP_META_FONT, VAL_BLACK, VAL_TRANSPARENT); //done with polar plot*********************

x,

y,

//****************Plot the 3D plot****************** //format the data correctly //first clear a couple vectors Clear1D (capmean, 50000); Clear1D (capplot, 50000); Clear1D (capring, 50000); Clear1D (captemp, 50000); //For each ring get the synchronous for (m=0;m<totalsteps;m++) { //begin of all rings //pick off the current ring from the surface array for (w=0;w<points;w++) { capring[w]=surfacearray[w][m]; } if(inc>1) //only look at if more than one rev was taken { for(i=0;i<workencct;i++){ for(n=0;n<inc;n++){ captemp[n] = capring[i + n*workencct]; } Mean (captemp, inc-1, &mean); capmean[i] = mean; } } //put the synchronous in an array for (w=0;w<workencct;w++) { dddzarray[m*workencct+w]=capmean[w]; } //part radius in mm partradius = 58; //Put the radius of the ring in a vector for (w=0;w<workencct;w++) { dddmag[m*workencct+w] = 58-m*1.65; } //Put the angle of each point on the ring in a vector for (w=0;w<workencct;w++) { dddphase[m*workencct+w] = angle[w];

83
} }//end of all rings //take the mag and phase of the circles and convert to rect ToRect1D &dddvecx[0], &dddvecy[0]); (dddmag, dddphase, workencct*totalsteps,

//Assemble the vector for the 3d plot for (p=0;p<workencct*totalsteps/12;p++) { bobert[3*p]=dddvecx[p*12]; bobert[3*p+1]=dddvecy[p*12]; bobert[3*p+2]=dddzarray[p*12]; }

//Go to the OpenGL 3D plot callback CreatePlot(); //End of 3D plot //Turn reatime rpm back on //RPM Task/Scan Clock/Buffer nidaqAICreateTask ("daq::1!(0,3)", kNidaqWaveformCapture, &rpmchans, &rpmID); nidaqAIConfigBuffer (rpmID, buffersize, kNidaqContinuous); nidaqAIConfigExternalScanClock (rpmID, "daq::1!(PFILowtoHigh1)"); nidaqAIStart (rpmID); t = Timer(); //Done With Acq. step = 0; live = 0; datapresent = 1; ResumeTimerCallbacks(); done=0; } //calc/plot end }//end else break; } return 0; }

//--------------------------------------------------------------------------// SetControlAttributes For 3d plot //--------------------------------------------------------------------------static int SetControlAttributes(void)

84
{ int error = 0;

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_PERSPECTIVE); 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,"(mm)"); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_YNAME,"(mm)"); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_ZNAME,"Form Error (nm)"); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_XLABEL_VISIBLE,1 ); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_YLABEL_VISIBLE,1 ); OGLSetCtrlAttribute(panelHandle,surfaceControl,OGLATTR_ZLABEL_VISIBLE,1 ); 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);

85
OGLSetCtrlAttribute (panelHandle, OGLATTR_XNAME_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, OGLATTR_YNAME_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, OGLATTR_ZNAME_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, OGLATTR_XY_GRID_VISIBLE, 1); OGLSetCtrlAttribute (panelHandle, OGLATTR_YZ_GRID_VISIBLE, 1); OGLSetCtrlAttribute (panelHandle, OGLATTR_XZ_GRID_VISIBLE, 1); OGLSetCtrlAttribute (panelHandle, OGLATTR_XY_GRID_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, OGLATTR_YZ_GRID_COLOR, OGLVAL_LT_GRAY); OGLSetCtrlAttribute (panelHandle, OGLATTR_XZ_GRID_COLOR, OGLVAL_LT_GRAY); Error : return error; } surfaceControl, surfaceControl, surfaceControl, surfaceControl, surfaceControl, surfaceControl, surfaceControl, surfaceControl, surfaceControl,

//--------------------------------------------------------------------------// CreatePlot 3d plot //--------------------------------------------------------------------------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);

86
// Delete any existing plots for (i=0;i<numPlots;i++) { OGLGetCtrlAttribute(panelHandle,surfaceControl, OGLATTR_FIRST_PLOTHANDLE, &plot); OGLDeletePlot(panelHandle,surfaceControl,plot,0); } // Give plot data to control plot = OGLPlot3DScatter (panelHandle, surfaceControl, bobert, 1, 30719, OGLVAL_DOUBLE); // Setup plot attributes OGLSetPlotAttribute(panelHandle,surfaceControl,plot,OGLATTR_SURFACE_STY LE,OGLVAL_SMOOTH); OGLSetPlotAttribute(panelHandle,surfaceControl,plot,OGLATTR_SURFACE_COL OR,OGLVAL_RED); OGLSetPlotAttribute(panelHandle,surfaceControl,plot,OGLATTR_SURFACE_SPE CULAR_FACTOR,1.0); OGLSetPlotAttribute(panelHandle,surfaceControl,plot,OGLATTR_SURFACE_SHI NINESS,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); // free plot data memory because control copies it //free(pts); 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; }

87
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, &top); GetCtrlAttribute(panelHandle, &left); GetCtrlAttribute(panelHandle, &width); GetCtrlAttribute(panelHandle, &height); OGLSetCtrlAttribute top); OGLSetCtrlAttribute (panelHandle, surfaceControl, OGLATTR_LEFT, left); OGLSetCtrlAttribute OGLATTR_WIDTH, width); OGLSetCtrlAttribute OGLATTR_HEIGHT, height); (panelHandle, (panelHandle, surfaceControl, surfaceControl,

MAINPANEL_PICTURE, MAINPANEL_PICTURE, MAINPANEL_PICTURE, MAINPANEL_PICTURE,

ATTR_TOP, ATTR_LEFT, ATTR_WIDTH, ATTR_HEIGHT,

(panelHandle,

surfaceControl,

OGLATTR_TOP,

OGLRefreshGraph(panelHandle, surfaceControl); break; } return 0; } //--------------------------------------------------------------------------// Change 3d Plot Type //--------------------------------------------------------------------------int CVICALLBACK ChangePlotType (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event)

88
{ case EVENT_COMMIT: CreatePlot(); break; } return 0; } //Stop Acquisition int CVICALLBACK stop (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: if(live == 1 ){ SuspendTimerCallbacks(); DAQ_Clear (1); live = 0; datapresent = 0; wait = 0; SetCtrlVal(panelHandle, MAINPANEL_WAITBAR, wait); ResetTextBox (panelHandle, MAINPANEL_STATUSBOX, " "); if(test == 1)test = 0; if(test == 2)test = 1; //RPM Task/Scan Clock/Buffer nidaqAICreateTask ("daq::1!(0,3)", kNidaqWaveformCapture, &rpmchans, &rpmID); nidaqAIConfigBuffer (rpmID, buffersize, kNidaqContinuous); nidaqAIConfigExternalScanClock (rpmID, "daq::1!(PFILowtoHigh1)"); //Ch B, High to Low nidaqAIStart (rpmID); t = Timer(); //timelog[0] = t; ResumeTimerCallbacks(); } break; } return 0; }

//Turn filter on/off int CVICALLBACK filttoggle (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event)

89
{ case EVENT_COMMIT: GetCtrlVal(panelHandle, MAINPANEL_FILTTOGGLE, &n); //on, turn off if(n == 0){ //SetCtrlAttribute (panelHandle, MAINPANEL_FILTORDER, ATTR_DIMMED, 1); SetCtrlAttribute (panelHandle, MAINPANEL_FILTCUTOFF, ATTR_DIMMED, 1); break;} //off, turn on if(n == 1){ //SetCtrlAttribute (panelHandle, MAINPANEL_FILTORDER, ATTR_DIMMED, 0); SetCtrlAttribute (panelHandle, MAINPANEL_FILTCUTOFF, ATTR_DIMMED, 0); break;} break; } return 0; } //Quit Program int CVICALLBACK quit (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: QuitUserInterface (0); 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(panelHandle, MAINPANEL_PRECISION, &n); SetCtrlAttribute ATTR_PRECISION, n); SetCtrlAttribute ATTR_PRECISION, n); break; } return 0; } //Polar plot scale (panelHandle, (panelHandle, MAINPANEL_ESYNCH, MAINPANEL_ESYNCH_2,

90
int CVICALLBACK plotscale (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: //Clear the plot DeleteGraphPlot VAL_IMMEDIATE_DRAW);

(panelHandle,

MAINPANEL_ROUNDPLOT,

-1,

if (datapresent ==0)break; //Plot the Polar plot of the ring**********************************88 //What ring to plot GetCtrlVal(panelHandle, MAINPANEL_POLARRING, &polarring); //pick off the current ring from the surface array for (w=0;w<points;w++) { capring[w]=surfacearray[w][polarring]; } //Measurements: // TIR // Asynch. Error // Roundness //Maximum asynchronous error motion //Construct 'capmean' which is the mean of all revs if(inc>1) //only look at asynch if more than one rev was taken { for(i=0;i<workencct;i++){ for(n=0;n<inc;n++){ captemp[n] = capring[i + n*workencct]; } MaxMin1D (captemp, inc, &max, &imax, &min, &imin); asynch[i] = (max - min); Mean (captemp, inc-1, &mean); capmean[i] = mean; } MaxMin1D (asynch, workencct, &asymax, &imax, &min, &imin); deg = imax*360/(workencct-1); } if (inc==1) { for (n=0;n<workencct;n++) { capmean[n]=capring[n]; } } //Roundness Measurement (LSC) //'capmean' is mean of all revs

91
MaxMin1D &imin); for(i=0;i<workencct;i++){ capplot[i] = capmean[i] + fabs(capmin); capplot[i] = capplot[i] + bcircle; } //find lsc center using 'capmean' ToRect1D (capplot, angle, workencct, &vecx[0], &vecy[0]); a=0; b=0; for(i=0;i<workencct;i++){ a = a + vecx[i]; b = b + vecy[i];} a = 2*a/workencct; b = 2*b/workencct; //create 'R' the radial values of the LSC for(i=0;i<workencct;i++){ rlsc[i] = vecx[i] - a; thetalsc[i] = vecy[i] - b;} for(i=0;i<workencct;i++){ R[i] = sqrt ((rlsc[i]*rlsc[i]) + (thetalsc[i]*thetalsc[i]));} MaxMin1D (R, workencct, &max, &imax, &min, &imin); lsc = (max - min); //display polar plot results SetCtrlVal (panelHandle, MAINPANEL_ESYNCH, lsc); //Plot Error Motion GetCtrlVal(panelHandle, MAINPANEL_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 == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == bcircle 1)circleval = 1; 2)circleval = 2; 3)circleval = 5; 4)circleval = 10; 5)circleval = 25; 6)circleval = 50; 7)circleval = 100; 8)circleval = 150; 9)circleval = 200; 10)circleval = 500; = 3*circleval; (capmean, workencct, &capmax, &imax, &capmin,

MaxMin1D (capring, points, &capmax, &imax, &capmin, &imin); Mean (capmean, workencct, &mean); mean = mean + bcircle + fabs(capmin); //mean error circle radius

92
//Set Axes if(capmax>circleval)max = capmax + bcircle + fabs(capmin); if(circleval>capmax)max = circleval + bcircle + fabs(capmin); SetAxisScalingMode (panelHandle, MAINPANEL_ROUNDPLOT, VAL_XAXIS, VAL_MANUAL, -max , max); SetAxisScalingMode (panelHandle, MAINPANEL_ROUNDPLOT, VAL_LEFT_YAXIS, VAL_MANUAL, -max, max);

//Plot Total Error Motion for(i=0;i<points;i++)capplot[i] = capring[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, points, &vecx[0], &vecy[0]); rgb = MakeColor (57, 201, 232); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT, vecx, vecy, points, VAL_DOUBLE,VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, rgb); //Synchronous Error Motion circles MaxMin1D (capmean, workencct, &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, MAINPANEL_ROUNDPLOT, mean, mean, mean, -mean, VAL_LT_GRAY, VAL_TRANSPARENT);//mean x = circleval + mean; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //outer x = mean - circleval; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //inner PlotPoint (panelHandle, MAINPANEL_ROUNDPLOT, 0.0, 0.0, VAL_CROSS, VAL_BLACK); //center cross PlotPoint (panelHandle, MAINPANEL_ROUNDPLOT, a, b, VAL_CROSS, VAL_GREEN); //lsc center cross //Plot Synchronous; for(i=0;i<workencct;i++)capplot[i] = capmean[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, workencct, &vecx[0], &vecy[0]); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT, vecx, vecy, workencct, 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, MAINPANEL_ROUNDPLOT, x, y, tempchar, VAL_APP_META_FONT, VAL_BLACK, VAL_TRANSPARENT);

93
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, MAINPANEL_ROUNDPLOT, x, y, tempchar, VAL_APP_META_FONT, VAL_BLACK, VAL_TRANSPARENT); //done with polar plot******************************************************************* ******************* //Plot the Polar plot of the first ring**********************************88 //What ring to plot GetCtrlVal(panelHandle, MAINPANEL_POLARRING2, &polarring2); //pick off the current ring from the surface array for (w=0;w<points;w++) { capring[w]=surfacearray[w][polarring2]; } //Measurements: // TIR // Asynch. Error // Roundness //Maximum asynchronous error motion //Construct 'capmean' which is the mean of all revs if(inc>1) //only look at asynch if more than one rev was taken { for(i=0;i<workencct;i++){ for(n=0;n<inc;n++){ captemp[n] = capring[i + n*workencct]; } MaxMin1D (captemp, inc, &max, &imax, &min, &imin); asynch[i] = (max - min); Mean (captemp, inc-1, &mean); capmean[i] = mean; } MaxMin1D (asynch, workencct, &asymax, &imax, &min, &imin); deg = imax*360/(workencct-1); } if (inc==1) { for (n=0;n<workencct;n++) { capmean[n]=capring[n]; } } //Roundness Measurement (LSC) //'capmean' is mean of all revs MaxMin1D (capmean, workencct, &imin); for(i=0;i<workencct;i++){

&capmax,

&imax,

&capmin,

94
capplot[i] = capmean[i] + fabs(capmin); capplot[i] = capplot[i] + bcircle; } //find lsc center using 'capmean' ToRect1D (capplot, angle, workencct, &vecx[0], &vecy[0]); a=0; b=0; for(i=0;i<workencct;i++){ a = a + vecx[i]; b = b + vecy[i];} a = 2*a/workencct; b = 2*b/workencct; //create 'R' the radial values of the LSC for(i=0;i<workencct;i++){ rlsc[i] = vecx[i] - a; thetalsc[i] = vecy[i] - b;} for(i=0;i<workencct;i++){ R[i] = sqrt ((rlsc[i]*rlsc[i]) (thetalsc[i]*thetalsc[i]));} MaxMin1D (R, workencct, &max, &imax, &min, &imin); lsc = (max - min); //display polar plot results SetCtrlVal (panelHandle, MAINPANEL_ESYNCH_2, lsc); //Plot Error Motion GetCtrlVal(panelHandle, MAINPANEL_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 == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == bcircle 1)circleval = 1; 2)circleval = 2; 3)circleval = 5; 4)circleval = 10; 5)circleval = 25; 6)circleval = 50; 7)circleval = 100; 8)circleval = 150; 9)circleval = 200; 10)circleval = 500; = 3*circleval;

MaxMin1D (capring, points, &capmax, &imax, &capmin, &imin); Mean (capmean, workencct, &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);

95
SetAxisScalingMode (panelHandle, VAL_XAXIS, VAL_MANUAL, -max , max); SetAxisScalingMode (panelHandle, VAL_LEFT_YAXIS, VAL_MANUAL, -max, max); MAINPANEL_ROUNDPLOT_2, MAINPANEL_ROUNDPLOT_2,

//Plot Total Error Motion for(i=0;i<points;i++)capplot[i] = capring[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, points, &vecx[0], &vecy[0]); rgb = MakeColor (57, 201, 232); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT_2, vecx, vecy, points, VAL_DOUBLE,VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, rgb); //Synchronous Error Motion circles MaxMin1D (capmean, workencct, &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, MAINPANEL_ROUNDPLOT_2, mean, mean, mean, -mean, VAL_LT_GRAY, VAL_TRANSPARENT);//mean x = circleval + mean; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT_2, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //outer x = mean - circleval; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT_2, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //inner PlotPoint (panelHandle, MAINPANEL_ROUNDPLOT_2, 0.0, 0.0, VAL_CROSS, VAL_BLACK); //center cross PlotPoint (panelHandle, MAINPANEL_ROUNDPLOT_2, a, b, VAL_CROSS, VAL_GREEN); //lsc center cross //Plot Synchronous; for(i=0;i<workencct;i++)capplot[i] = capmean[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, workencct, &vecx[0], &vecy[0]); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT_2, vecx, vecy, workencct, 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, MAINPANEL_ROUNDPLOT_2, 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);

x,

y,

96
PlotText (panelHandle, MAINPANEL_ROUNDPLOT_2, x, y, tempchar, VAL_APP_META_FONT, VAL_BLACK, VAL_TRANSPARENT); //done with polar plot******************************************************************* *******************

break; } return 0; } /******************************************************/ /* 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(); 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(panelHandle, MAINPANEL_GAGESENSE, &sense); vcap = datum*sense/tirscl; //scaled

97
vcapin = datum*sense; //microinches SetCtrlVal (tirpanel, TIRPANEL_LEDR, 0); SetCtrlVal (tirpanel, TIRPANEL_LEDL, 0); if(vcap > 10 | vcap == 10){ vcap = 10; 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); //Turn real time rpm back on //RPM Task/Scan Clock/Buffer nidaqAICreateTask ("daq::1!(0,3)", kNidaqWaveformCapture, &rpmchans, &rpmID); nidaqAIConfigBuffer (rpmID, buffersize, kNidaqContinuous); nidaqAIConfigExternalScanClock (rpmID, "daq::1!(PFIHightoLow1)"); // Work spindle square wave nidaqAIStart (rpmID); t1 = Timer(); ResumeTimerCallbacks(); RemovePopup(0); SetPanelAttribute (panelHandle, ATTR_DIMMED, 0); break; } return 0; }

98
//** //*** //***********************MENU BARS ****************************** //*** //**

//MeasureMenu Bar void CVICALLBACK measure (int menuBar, *callbackData, int panel) { switch(menuItem){ case ROUNDMENU_MEASUREMENT_SAVE: if(datapresent == 0)break;

int

menuItem,

void

//put the surface array in a column vector for (i=0;i<totalsteps;i++) { for (j=0;j<points;j++) { surfacecolumn[i*j+j]=surfacearrayraw[j][i]; } } err &path[0]); if(err < 1){break;} err = SetDir (path); ArrayToFile ("surfacearrayraw", surfacecolumn, VAL_DOUBLE, points*totalsteps, 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_CONST_WIDTH, 10, VAL_ASCII, VAL_OPEN_AS_IS); = DirSelectPopup ("", "Select Directory", 1, 1,

MessagePopup Vectors\n"

("Save "have

Complete", been

"Save in

has the

completed. selected

created

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); break; case ROUNDMENU_MEASUREMENT_LOAD: //Set Path

99
err = DirSelectPopup ("", "Select Directory", 1, 1, &path[0]); if(err < 1){break;} err = SetDir (path); //Get Encoder Value GetCtrlVal(panelHandle, &workencct); //Check number of revs GetCtrlVal (panelHandle, MAINPANEL_REVNUM, &revnum); perrev = workencct; if(revnum == 0){points = 1*perrev;revs=1;} // 4 revs if(revnum == 1){points = 4*perrev;revs=4;} revs if(revnum == 2){points = 8*perrev;} if(revnum == 3){points = 16*perrev;} //get total steps GetCtrlVal (panelHandle, &totalsteps); //Get vectors: //'capraw' - raw data //'tach' - once around pulse err = FileToArray ("surfacearrayraw", surfacecolumn, VAL_DOUBLE, points*totalsteps, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_ASCII); err = FileToArray ("surfacearrayraw", surfacecolumn, VAL_DOUBLE, points, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_ASCII); //put the surface array in a column vector for (i=0;i<totalsteps;i++) { for (j=0;j<points;j++) { surfacearrayraw[j][i] = surfacecolumn[i*j+j]; //surfacecolumn[i*j]=surfacearrayraw[j][i]; } } if(err<0){break;} //Use "Reload" button MessagePopup ("Load Complete", "Load has completed. Select 'MEASUREMENT>Reload'\n" "to view data.\n" 30, 1, //16 revs //32 revs // 8

MAINPANEL_WORKENCCOUNT,

MAINPANEL_TOTALSTEPS,

100
"\n"); //points = points - 2 revs datapresent = 1; //points = points - 2*encct; break; case ROUNDMENU_MEASUREMENT_RELOAD: //if no data, break if(datapresent == 0){break;} //Delete plots DeleteGraphPlot 1, VAL_IMMEDIATE_DRAW); DeleteGraphPlot -1, VAL_IMMEDIATE_DRAW);

(panelHandle, (panelHandle,

MAINPANEL_ROUNDPLOT,

MAINPANEL_ROUNDPLOT_2,

//Clear results DefaultCtrl (panelHandle, MAINPANEL_ESYNCH); //Loop through the manipulation for each ring for (l=0;l<totalsteps;l++) { //ring loop start points = workencct*revs; inc = (points/workencct); //pick off the current ring from the surface array for (w=0;w<points;w++) { captemp[w]=surfacearrayraw[w][l]; } //Check to see if you are on the part MaxMin1D(captemp, points, &max, &imax, &min, &imin); if(max == min) { off[l] = 1; //this ring is off the part } else { off[l] = 0; //this ring is on the part } //if off, then remove the ring data //Remove Offset // RemoveOffset(captemp,points,&captemp[0]); //Find out the DC offset for the first measurement and use for all if (l == 0)Mean(captemp,points,&dcoffset); //Remove the DC offset

101
for(i=0;i<points;i++)captemp[i] dcoffset; //angle vecy (rad) for(n=0;n<points;n++)angle[n] = 2*pi*inc*n/points; //Filter but don't remove once around GetCtrlVal (panelHandle, MAINPANEL_FILTCUTOFF, &cutoff); GetCtrlVal (panelHandle, MAINPANEL_FILTTOGGLE, &n); if(n==1){ Clear1D(null, points); FFTFilter(captemp,null,points,workencct,cutoff,&captemp[0], &mag); } if(n==0|cutoff==0){ Clear1D(null, points); cutoff = 0; FFTFilter(captemp,null,points,workencct,cutoff,&captemp[0], &mag); } //convert the magnitude to muinches and stuff GetCtrlVal(panelHandle, MAINPANEL_GAGESENSE, &sense); mag = mag*sense; //SetCtrlVal (panelHandle, MAINPANEL_PARALLELISM, mag); //Temperature measurement GetCtrlVal (panelHandle, MAINPANEL_THERMAL, &n); orderpoly = 2; if(n == 1)RemoveThermalDrift(captemp,xtemp,points,orderpoly, &polycoefs[0], &captemp[0]); //Convert to units GetCtrlVal(panelHandle, MAINPANEL_GAGESENSE, &sense); for(i=0;i<points;i++){ captemp[i] = captemp[i]*sense; } //put the data back into the surface array for (w=0;w<points;w++) { surfacearray[w][l] = captemp[w]; } } //ring loop end plot of the Compensation for each individual = captemp[i] -

//Plot the Polar ring**********************************88

102
//What ring to plot GetCtrlVal(panelHandle, &polarring); //pick off the current ring from the surface array for (w=0;w<points;w++) { capring[w]=surfacearray[w][polarring]; } //Measurements: // TIR // Asynch. Error // Roundness //Maximum asynchronous error motion //Construct 'capmean' which is the mean of all revs if(inc>1) //only look at asynch if more than one rev was taken { for(i=0;i<workencct;i++){ for(n=0;n<inc;n++){ captemp[n] = capring[i + n*workencct]; } MaxMin1D (captemp, inc, &max, &imax, &imin); asynch[i] = (max - min); Mean (captemp, inc-1, &mean); capmean[i] = mean; } MaxMin1D &imin); deg = imax*360/(workencct-1); } if (inc==1) { for (n=0;n<workencct;n++) { capmean[n]=capring[n]; } } //Roundness Measurement (LSC) //'capmean' is mean of all revs MaxMin1D (capmean, workencct, &capmin, &imin); for(i=0;i<workencct;i++){ capplot[i] = capmean[i] + fabs(capmin); capplot[i] = capplot[i] + bcircle; } //find lsc center using 'capmean' ToRect1D (capplot, angle, workencct, &vecy[0]); a=0; b=0; (asynch, workencct, &asymax, &imax, &min, MAINPANEL_POLARRING,

&min,

&capmax,

&imax,

&vecx[0],

103
for(i=0;i<workencct;i++){ a = a + vecx[i]; b = b + vecy[i];} a = 2*a/workencct; b = 2*b/workencct; //create 'R' the radial values of the LSC for(i=0;i<workencct;i++){ rlsc[i] = vecx[i] - a; thetalsc[i] = vecy[i] - b;} for(i=0;i<workencct;i++){ R[i] = sqrt ((rlsc[i]*rlsc[i]) (thetalsc[i]*thetalsc[i]));} MaxMin1D (R, workencct, &max, &imax, &min, &imin); lsc = (max - min); //display polar plot results SetCtrlVal (panelHandle, MAINPANEL_ESYNCH, lsc); //Plot Error Motion GetCtrlVal(panelHandle, MAINPANEL_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 == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == bcircle 1)circleval = 1; 2)circleval = 2; 3)circleval = 5; 4)circleval = 10; 5)circleval = 25; 6)circleval = 50; 7)circleval = 100; 8)circleval = 150; 9)circleval = 200; 10)circleval = 500; = 3*circleval;

MaxMin1D (capring, points, &capmax, &imax, &capmin, &imin); Mean (capmean, workencct, &mean); mean = mean + bcircle + fabs(capmin); error circle radius //Set Axes if(capmax>circleval)max fabs(capmin); if(circleval>capmax)max fabs(capmin); SetAxisScalingMode (panelHandle, MAINPANEL_ROUNDPLOT, VAL_XAXIS, VAL_MANUAL, -max , max); SetAxisScalingMode (panelHandle, MAINPANEL_ROUNDPLOT, VAL_LEFT_YAXIS, VAL_MANUAL, -max, max); //Plot Total Error Motion = circleval + bcircle + //mean

capmax

bcircle

104
for(i=0;i<points;i++)capplot[i] = capring[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, points, &vecx[0], &vecy[0]); rgb = MakeColor (57, 201, 232); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT, vecx, vecy, points, VAL_DOUBLE,VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, rgb); //Synchronous Error Motion circles MaxMin1D (capmean, workencct, &capmax, &imax, &min, &imin); capmax = capmax + fabs(capmin) + bcircle; //new 'capmax' min = min + fabs(capmin) + bcircle; 'min' ovalcolor = MakeColor(0, 130, 0); PlotOval (panelHandle, MAINPANEL_ROUNDPLOT, mean, mean, -mean, -mean, VAL_LT_GRAY, VAL_TRANSPARENT);//mean x = circleval + mean; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //outer x = mean - circleval; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT, x, x, -x, -x, ovalcolor, VAL_TRANSPARENT); //inner PlotPoint 0.0, VAL_CROSS, VAL_BLACK); PlotPoint VAL_CROSS, VAL_GREEN); cross (panelHandle, (panelHandle, MAINPANEL_ROUNDPLOT, 0.0, //center cross MAINPANEL_ROUNDPLOT, a, b, //lsc center //new

//Plot Synchronous; for(i=0;i<workencct;i++)capplot[i] = capmean[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, workencct, &vecx[0], &vecy[0]); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT, vecx, vecy, workencct, 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, MAINPANEL_ROUNDPLOT, x, 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, MAINPANEL_ROUNDPLOT, x, tempchar, VAL_APP_META_FONT, VAL_BLACK, VAL_TRANSPARENT);

y,

y,

105
//done with polar plot******************************************************************* ******************* //Plot the Polar plot of the first ring**********************************88 //What ring to plot GetCtrlVal(panelHandle, MAINPANEL_POLARRING2, &polarring2); //pick off the current ring from the surface array for (w=0;w<points;w++) { capring[w]=surfacearray[w][polarring2]; } //Measurements: // TIR // Asynch. Error // Roundness //Maximum asynchronous error motion //Construct 'capmean' which is the mean of all revs if(inc>1) //only look at asynch if more than one rev was taken { for(i=0;i<workencct;i++){ for(n=0;n<inc;n++){ captemp[n] = capring[i + n*workencct]; } MaxMin1D (captemp, inc, &max, &imax, &min, &imin); asynch[i] = (max - min); Mean (captemp, inc-1, &mean); capmean[i] = mean; } MaxMin1D &imin); deg = imax*360/(workencct-1); } if (inc==1) { for (n=0;n<workencct;n++) { capmean[n]=capring[n]; } } //Roundness Measurement (LSC) //'capmean' is mean of all revs MaxMin1D (capmean, workencct, &capmin, &imin); for(i=0;i<workencct;i++){ capplot[i] = capmean[i] + fabs(capmin); capplot[i] = capplot[i] + bcircle; } (asynch, workencct, &asymax, &imax, &min,

&capmax,

&imax,

106
//find lsc center using 'capmean' ToRect1D (capplot, angle, workencct, &vecy[0]); a=0; b=0; for(i=0;i<workencct;i++){ a = a + vecx[i]; b = b + vecy[i];} a = 2*a/workencct; b = 2*b/workencct; //create 'R' the radial values of the LSC for(i=0;i<workencct;i++){ rlsc[i] = vecx[i] - a; thetalsc[i] = vecy[i] - b;} for(i=0;i<workencct;i++){ R[i] = sqrt ((rlsc[i]*rlsc[i]) + (thetalsc[i]*thetalsc[i]));} MaxMin1D (R, workencct, &max, &imax, &min, &imin); lsc = (max - min); //display polar plot results SetCtrlVal (panelHandle, MAINPANEL_ESYNCH_2, lsc); //Plot Error Motion GetCtrlVal(panelHandle, MAINPANEL_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 == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == if(n == bcircle 1)circleval = 1; 2)circleval = 2; 3)circleval = 5; 4)circleval = 10; 5)circleval = 25; 6)circleval = 50; 7)circleval = 100; 8)circleval = 150; 9)circleval = 200; 10)circleval = 500; = 3*circleval;

&vecx[0],

MaxMin1D (capring, points, &capmax, &imax, &capmin, &imin); Mean (capmean, workencct, &mean); mean = mean + bcircle + fabs(capmin); error circle radius //Set Axes if(capmax>circleval)max fabs(capmin); //mean

capmax

bcircle

107
if(circleval>capmax)max fabs(capmin); SetAxisScalingMode (panelHandle, MAINPANEL_ROUNDPLOT_2, VAL_XAXIS, VAL_MANUAL, -max , max); SetAxisScalingMode (panelHandle, MAINPANEL_ROUNDPLOT_2, VAL_LEFT_YAXIS, VAL_MANUAL, -max, max); = circleval + bcircle +

//Plot Total Error Motion for(i=0;i<points;i++)capplot[i] = capring[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, points, &vecx[0], &vecy[0]); rgb = MakeColor (57, 201, 232); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT_2, vecx, vecy, points, VAL_DOUBLE,VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, rgb); //Synchronous Error Motion circles MaxMin1D (capmean, workencct, &capmax, &imax, &min, &imin); capmax = capmax + fabs(capmin) + bcircle; //new 'capmax' min = min + fabs(capmin) + bcircle; 'min' ovalcolor = MakeColor(0, 130, 0); PlotOval (panelHandle, MAINPANEL_ROUNDPLOT_2, mean, mean, -mean, -mean, VAL_LT_GRAY, VAL_TRANSPARENT);//mean x = circleval + mean; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT_2, x, x, x, -x, ovalcolor, VAL_TRANSPARENT); //outer x = mean - circleval; PlotOval (panelHandle, MAINPANEL_ROUNDPLOT_2, x, x, x, -x, ovalcolor, VAL_TRANSPARENT); //inner PlotPoint (panelHandle, MAINPANEL_ROUNDPLOT_2, 0.0, 0.0, VAL_CROSS, VAL_BLACK); //center cross PlotPoint (panelHandle, MAINPANEL_ROUNDPLOT_2, a, b, VAL_CROSS, VAL_GREEN); //lsc center cross //Plot Synchronous; for(i=0;i<workencct;i++)capplot[i] = capmean[i] + fabs(capmin) + bcircle; ToRect1D (capplot, angle, workencct, &vecx[0], &vecy[0]); PlotXY (panelHandle, MAINPANEL_ROUNDPLOT_2, vecx, vecy, workencct, 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); //new

108
y = (mean - circleval)*sin(pi/4); PlotText (panelHandle, MAINPANEL_ROUNDPLOT_2, 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, MAINPANEL_ROUNDPLOT_2, x, y, tempchar, VAL_APP_META_FONT, VAL_BLACK, VAL_TRANSPARENT); //done with polar plot******************************************************************* ******************* //Plot the plot******************************************************** //format the data correctly //first clear a couple vectors Clear1D (capmean, 50000); Clear1D (capplot, 50000); Clear1D (capring, 50000); Clear1D (captemp, 50000); //For each ring get the synchronous for (m=0;m<totalsteps;m++) { //begin of all rings //pick off the current ring from the surface array for (w=0;w<points;w++) { capring[w]=surfacearray[w][m]; } 3D

if(inc>1) //only look at if more than one rev was taken { for(i=0;i<workencct;i++){ for(n=0;n<inc;n++){ captemp[n] = capring[i + n*workencct]; } //MaxMin1D (captemp, inc, &max, &imax, &min, &imin); //asynch[i] = (max - min); Mean (captemp, inc-1, &mean); capmean[i] = mean; } } //put the synchronous in an array for (w=0;w<workencct;w++) { //surfacearray3d[w][m] = capmean[w]; dddzarray[m*workencct+w]=capmean[w]; } //part radius

109
partradius = 58; //Put the radius of the ring in a vector for (w=0;w<workencct;w++) { dddmag[m*workencct+w] = 58-m*1.65; } //Put the angle of each point on the ring in a vector for (w=0;w<workencct;w++) { dddphase[m*workencct+w] = angle[w]; }

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

//plot CreatePlot(); //End of 3D plot

//Done With Acq. step = 0; live = 0; datapresent = 1; done=0;

break;

case ROUNDMENU_WINDOW_TIR_IND: SuspendTimerCallbacks(); //Initialize Board Init_DA_Brds (1, &brdcode); indon = 1; live = 0; InstallPopup(tirpanel); SetPanelAttribute (panelHandle, ATTR_DIMMED, 1);

110
nidaqAICreateTask ("daq::1!(0)", &taskIDtir); nidaqAIStart (taskIDtir); ResumeTimerCallbacks(); break; kNidaqPointByPoint, &channum,

case ROUNDMENU_MEASUREMENT_MENUQUIT: QuitUserInterface (0); break; } } //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]); err = strlen (path); if(err == 0){break;} DisplayImageFile (panelHandle, MAINPANEL_PICTURE, path); break; } return 0; }

111
/* ************************************************* FFTFilter ************************************************* Vincent C. Vigliano 2/7/01 "FFTFilter" Performs an FFT/IFFT Filter removes all data after cutoff and the once-around. ******************************************************************** VARIABLES ******************************************************************** real[] //real input vector imag[] //imaginary input vector (zeros) points //number of points in input vector encct //points per rev cutoff //cutoff (in upr) y[] //filtered output vector magnitude //magnitude of the once around ******************************************************************** */ #include #include #include #include #include #include #include #include #include <Dataacq.h> <utility.h> <formatio.h> <ansi_c.h> <easyio.h> <analysis.h> <cvirte.h> <userint.h> "ba_functions.h"

int i, rs; void FFTFilter(real,imag,points,encct,cutoff,y,mag) double real[],imag[],y[], *mag; { FFT (real, imag, points); rs = points/encct; if(cutoff>0){ for(i=cutoff*rs;i<points-cutoff*rs;i++) { real[i] = 0; imag[i] = 0; } } //find out the magnitude of the once around *mag = sqrt((real[rs]*real[rs]+imag[rs]*imag[rs])); *mag = *mag*2/points; real[rs] = 0.0; imag[rs] = 0.0; real[points-rs] = 0.0;

112
imag[points-rs] = 0.0; InvFFT (real, imag, points); for(i=0;i<points;i++){ y[i] = real[i]; } }

You might also like