NBSIR 83-2703

Programs for Analyzing Surface

Texture

U.S. DEPARTMENT OF COMMERCE

National Bureau of Standards

Center for Manufacturing Engineering

Washington, DC 20234

July 1 983

U.S. DEPARTMENT OF COMMERCE

NATIONAL BUREAU OF STANDARDS

N o

Tf°stanSdS

U

AV)r

rfl9B3

NBSIR 83-2703

FASTMENU: A SET OF FORTRAN

PROGRAMS FOR ANALYZING SURFACE

TEXTURE

T. V. Vorburger

U S. DEPARTMENT OF COMMERCE

National Bureau of Standards

Center for Manufacturing Engineering

Washington, DC 20234

July 1 983

U.S. DEPARTMENT OF COMMERCE, Malcolm Baldrige, Secretary

NATIONAL BUREAU OF STANDARDS, Ernest Ambler, Director
Ad
ABSTRACT

A set of FORTRAN programs for surface texture analysis is

described. These programs were developed for use with a minicomputer that is interfaced to stylus type instruments. The

programs 1) perform data acquisition from the stylus instruments,

2) store the data on magnetic disk, and 3) perform statistical

analyses for parameters such as the roughness average R«, rms

roughness R

q

, and for the autocorrelation function and amplitude

density function.

i
TABLE OF CONTENTS

1. Introduction 1

2. The Menu ij

3. ROUGHNES 8

3.1 Summary 8

3.2 Operating System Commands 9

3.3 ROUGHNES FORTRAN Program 10

3.4 Flowchart for ROUGHNES 22

3.5 Example of ROUGHNES Printout 28

4. STEPHGHT . . . . 29

4. 1 Summary ' 29

4.2 Operating System Commands . 30

4.3 STEPHGHT FORTRAN Program 31

4.4 Flowchart for STEPHGHT 39

4.5 Example of STEPHGHT Printout 45

5. WHATSON . 46

5.1 Summary ........... 46

5.2 Operating System Commands .... 47

5.3 WHATSON FORTRAN Program 48

5.4 Flowchart for WHATSON 5Q

5.5 Example of WHATSON Printout 51

6. AVRGRA 52

6.1 Summary . 52

6.2 Operating System Commands ....... 53

6.3 AVRGRA FORTRAN Program 54

6.4 Flowchart for AVRGRA ............... 57

6.5 Example of AVRGRA Printout 59

7. SMORGAS 60

7. 1 Summary 60

7.2 Operating System Commands 62

7.3 SMORGAS FORTRAN Program 63

7.4 Flowchart for SMORGAS ...... 69

7.5 Example of SMORGAS Printout ........... 72

8. PLOTSVIL 73

8.1 Summary 73

8.2 Operating System Commands 74

8.3 PLOTSVIL FORTRAN Program . 75

8.4 Flowchart for PLOTSVIL 78

8.5 Example of PLOTSVIL Plot ...... 79
9. ADF 80

9.1 Summary . 80

9.2 Operating System Commands ............ 81

9.3 ADF FORTRAN Program 82

9.4 Flowchart for ADF ................ 88

9.5 Example of ADF Plot 91

10. ACF 92

10.1 Summary ..................... 92

10.2 Operating System Commands ...... 93

10.3 ACF FORTRAN Program 94

10.4 Flowchart for ACF 98

10.5 Example of ACF Plot . 101

11. PSD 102

11.1 Summary ............. ... 102

11.2 Operating System Commands ....... 103

11.3 PSD FORTRAN Program ........ 104

11.4 Flowchart for PSD 116

11.5 Example of PSD Plot 119

12. References ................. 120

iii

1. Introduction

Surface texture needs are becoming better understood and more

carefully specified for a wide range of industrial parts like

ship hulls and propellers [1], automobiles [2], and x-ray mirrors

[3]. Consequently, the measurement of surface texture is

becoming more sophisticated as its importance for industrial

products increases. More and more, the measurement of surfaces

by stylus techniques involves digitization of the data and

statistical time-series analysis both of which require a computer

or microprocessor connected on line to the stylus instrument.

Important components of these systems are the programs or

software which direct the sequence of measurement operations.

At NBS, we have developed a system called FAST (Facility to

Analyze Surface Texture) [4], which includes two commercial

stylus instruments interfaced to a minicomputer that controls the

data acquisition and analysis through a set of nine FORTRAN

programs called FASTMENU. Each of these programs can be executed

with a command from the computer console. Their names and

functions are as follows:

ROUGHNES is used when measuring surface profiles for

characterizing and calibrating surface roughness. As the stylus

traverses the rough surface, the time varying electrical signal

is digitized under program control and stored in the computer

memory. The roughness average parameter R a is calculated and

printed for each profile, and the digitized profile data are

stored on magnetic disks for subsequent analysis.

STEPHGHT, like ROUGHNES, controls data acquisition and storage,

but this program is used for measurement and calibration of step

heights. The step heights are calculated and printed during the

execution of the program.

WHATSON is a utility program for examining the header information

of data files stored on a disk. This program is helpful for

keeping track of the various kinds of data and for determining

which files may be deleted.

AVRGRA is used primarily in calibration reports. It calculates

the average and the random uncertainty of a set of step height

values or R- values. The calibration uncertainty of the

instrument ana the resulting total uncertainty of the measurement

are also calculated and all of the results are printed.

SMORGAS is a program that calculates seven parameters from stored

profile data. These are R

a ; the rms roughness - R a ; the peakvalley roughness - R tm ; tJie average slope - S a ; the average

wavelength - D

a ; the peak count wavelength D pc ; and the skewness - Q. The operator has the options of fitting the data to a least squares mean line, of choosing the sample length for R tm , and of choosing the point to point spacing of the average slope

calculation.

1
PLOTSVIL generates plots of the surface profiles stored on disk.

ADF, ACF and PSD are used to calculate and plot the amplitude

density function, autocorrelation function, and power spectral

density respectively for any or all the profiles in a file.

These functions may also be printed as arrays of numbers if the

operator chooses.

These programs were written in FORTRAN 77 for use on a Perkin

Elmer-Interdata* 7/32 minicomputer with 256 Kbytes of memory

storage, and magnetic disk storage consisting of 4 disks each

with 5 Mbytes capacity. PSD is the largest by far of the nine

programs. It requires 111 Kbytes of memory storage. The next

largest module, ACF, requires 69 Kbytes.

The system also includes a system console, a printer, a Versatec

printer-plotter, and an Analog-to-digital converter (ADC) housed

in an interface (built at NBS) called the NBS Bus. The stylus

instruments, a Talystep and a Talysurf 4, track the undulations

of the surface profile and produce a time varying output voltage

which can be filtered using one of several high pass electronic

filters. A frequency generator interfaced to the NBS Bus

controls the rate at which the output signal is digitized and

hence the point-to-point spacing of the data.

The present arrangement is quite similar to one developed at NBS

several years ago [5] with a much smaller minicomputer system.

Whereas the previous software was written in machine code [6]

because of the limited memory size, the present system size

allows the use of the high level compiled language, FORTRAN 77.

It should be noted that a few of the commands to be shown here

are not part of the FORTRAN 77 language but come from run time

libraries supplied by Perkin Elmer and Versatec.

One convenience of the present storage system is that each of the

four disks serves a different function. The FORTRAN programs for

surface texture measurement are stored on a removable disk called

SRF, and the basic operating system programs are stored on the

fixed, system disk, SYS. A second removable disk contains the

surface profile data and, to date, approximately 12 disk

cartridges have been filled with close to 60 Mbytes of profile

information. The fourth disk is used as a scratch disk to hold

the large temporary files which are needed for plotting graphs.

The software works as follows. Each of the nine commands listed

above calls a file from the SYS disk. This file is a set of

operating system commands that loads the appropriate program from

* Certain commercial equipment are identified in this report to

specify adequately the experimental procedure. In no case does

such identification imply recommendation or endorsement by the

National Bureau of Standards, nor does it imply that the

equipment identified is necessarily the best available for the

purpose.

2
SRF, assigns various logical units and executes the program.

After the program is completed, the operating system shows the

menu again or refers the operator to it, so that the operator can

be reminded of the nine commands that are available in the set.

The remainder of this report is organized as follows. Chapter 2

discusses the three operating system files that introduce the

operator to the system. Chapters 3-11 describe the structure of

the programs for carrying out the nine commands. Each chapter

describes one command and consists of five parts:

1) a short summary of the program (what it does),

2) a copy of the operating system file which calls the program,

3) a copy of the FORTRAN program,

4) a flowchart of the FORTRAN program, and

5) a sample of the hardcopy output, i.e. printouts or plotted

graphs.

During this software development project I was greatly aided by

F. E. Scire, who thoroughly tested many aspects of the system and

made a number of valuable suggestions, and by E. C. Teague, who

wrote the data gathering subroutine ADCIO. I am also grateful to

D. E. Gilsinn for several enlightening discussions, to S. A.

Morris for preparation of the manuscri.pt, to L. Greenspan, M.

Cadoff, and B. Rust for reviewing it, and to the GAMS Support

Services Group for providing the portable FFT programs from the

Center for Applied Mathematics software library. The work was

supported in part by the David Taylor Naval Ship Research and

Development Center, Annapolis, Maryland.

3
2. The Menu

When the operator types the command "FAST", the text shown in

fig. 2.1 appears on the console screen. The instructions point

to two other commands, FASTMENU (fig. 2.2) and FASTNITE (fig.

2.3).

FASTMENU is the heart of the system. It lists the main programs

in the package along with a short description for each, which

operator about its function. FASTNITE is a set of instructions which explains how several of

programs may be run in a batch mode so that the

not have to sit at the console and choose options.

To do this correctly, the operator must know the sequence of

responses that are needed for each program and type these ahead

of time in a disk file. The text in FASTNITE simply explains how

to instruct the program to look for the disk file for input

parameters rather than the console.

reminds the

supplementary

the analysis

operator does
* FAST*-*#-**

WELCOME TO THE WORLD OF SURFACE TEXTURE MEASUREMENT!

USE THE COMMAND "FAETMENU" TO FIND OUT ABOUT PROFILE

MEASUREMENT, ROUGHNESS AND STEP HEIGHT CALIBRATIONS,

AND THE ASSOCIATED ANALYSIS PROGRAMS,

USE THE COMMAND "FASTNITE” TO FIND OUT HOW TO RUN SOME

OF THE ANALYSIS PROGRAMS IN A BATCH MODE, FOR EXAMPLE,

OVERNIGHT.

Figure 2.1
*-«r FAS I MENU **{•#*•#

-> HERE ARE THE COMMANDS FOR MEASURING AND ANALYZING SURFACE PROFILE DATA.

.x. C-TCDi

IS USED FOR MEASURING SURFACE ROUGHNESS, PARTICULARLY RA.

“OR MEASURING STEP HEIGHTS.

* wHATSON VOL : GIVES A RUNDOWN CF THE DMA FILES PRESENT ON A DISK < VCL

>. V : CT T -Tj..jrr pTpq-r T~KJ : Thirq CTA ^i-J CTT^Cr

_ frt • • V

YACF

-r- 4 r-LL” - PSD

~ a :

CALCULATES THE AVERAGE FOR A SET OF RA OR STEP HEIGH";' DATA AND

CALCULATES THE FOLLOWING SURFACE PARAMETERS: RA, RQ, RTM, AVE.

SLOP Ei AVE. WAVELENGTH, PEAK-COUNT WAVELENGTH, AND SKEWNESS.,

THESE COMMANDS YIELD PLOTS FOR THE AUTOCORRELATION FUNCTION,

AMPLITUDE DENSITY FUNCTION, AND POWER SPECTRAL DENSITY,.

CTSVIL FIELDS PLOTS OF SURFACE PROFILES.

* TO FIND OUT HOW TO USE "ACF", "ADF", AND " SMQRGAS " IN AN OVERNIGHT, BATCH

* MODE, TYPE "FASTNITE"

Figure 2.2

6
FA3T" N I XE •& $&

-r THE COMMANDS "SM0RGA5", "PLOTSVIL", " ACF" ; AND " ADF"

* ALLOW THE OPTION OF TYPING THE CONSOLE PARAMETERS INTO A

* FILE AHEAD OF TIME. THIS ENABLES YOU TO ANALYZE DATA OVER-

* NIGHT WITHOUT SITTING EY THE SYSTEM CONSOLE.

* IN THE CASE OF "SMGRGAS", THE COMMAND WOULD EE

a-* SMORGAS (FILENAME).

* LOGICAL UNIT 5 IS THEM ASSIGNED TO THE FILE SPECIFIED EY

* "FILENAME” RATHER THAN TO THE CONSOLE.

H- * "PLOTSVIL" , "ACF", AND "ADF" WORK THE SAME WAY.

Figure 2 .

3

7
3. ROUGHNES

3.1 Summary

The program ROUGHNES controls the data acquisition of roughness

profiles and calculates the roughness average R

a for each. The

file of operating system commands (sec. 3.2), loads the program,

assigns the logical units, and starts the execution. The program

has a main part and four subroutines - KCAL1, RA1, STPHGT, ADCIO.

The main program is used to create and assign the new file that

will hold the profile data. The program also calls for header

information to be entered into the file and used as a label

during printouts. The main program then calls two subprograms,

first KCAL1, then RA1

KCAL1 is used to calculate a calibration constant KCAL for the

apparatus. To do this, it calls the subroutine ADCIO, which

controls the digitization of a surface profile of a calibration

step [5] as the step is being measured in the stylus instrument.

KCAL1 then calls STPHGT which fits straight lines to the profile

and calculates a step in terms of quantization levels. Since the

true height of the calibration step is known in micrometers (um),

the subroutine is then able to calculate KCAL in units of

um/quantization level. This calibration procedure is performed

three times and the average KCAL is calculated and stored.

The subroutine KCAL1 also allows the option to read the

calibration constant from a previously created file instead of

recalibrating the instrument.

Control then passes to the RA1 subroutine which measures the

surface profiles and calculates R

a using both the raw data and

the calibration constant. To do this, RA1 calls ADCIO which

digitizes the roughness profile. Each profile consists of 4000

digitized points. It is measured three times, and the R

a value

is calculated for each time. Then an average of the three values

is calculated and stored, and the third profile is stored on

magnetic disk. The set of three profiles is called a position.

For all of the data-taking and calibration runs, the operator has

the option of rejecting the data profile if it seems incorrect or

of beginning an entire position over again.

1n

e.

3

4

5

6

7

e9

10

11

12

13

14

15

16

17

18

8
3.2 Operating System Commands

1 ROUGHNES -JHHHHt

2 *

3 LQ . BG, SRF: ROUGHNES. TSK

4 T .BG

5 CLOSE ALL

6 AS 4/ L4

:

7 AS 5, LI:

e AS 6, C

:

9 XDE SRF: SPILL. DAT

10 AL SRF: SPILL. DAT, IN, 80/5/5

11 AS 8, SRF: SPILL. DAT

12 $U* YOU SHOULD NOW BE RECEIVING INFORMATION ON THE SURFACE CONSOLE.

13 ST

14 * 15 * RETURN TO "FASTMENU”

16 *

17 FASTMENU

18 $EX IT

The above set of commands perform the following functions in the Perkin

Elmer 7/32 computer.

LO loads the machine code program, SRF: ROUGHNES .TSK, into the background

partition (.BG) of the memory.

T .BG is used to address the task in .BG for further information and

direction.

CLOSE ALL closes all the logical units of the task, just in case any were

still open.

The next three AS statements are used to assign logical units. L4 : is the

printer, LI: the surface console, and C: the system console.

XDE deletes the temporary print file, SRF: SPILL.DAT, which is left over

from the previous running of ROUGHNES.

AL creates SRF : SPILL .DAT again. AS assigns it as logical unit 8.

Note: The file that holds the profile data is created later on by

SRF: ROUGHNES. TSK itself.

$W prints a message to the system console.

ST begins execution of the program.

* in lines 14-16 allows uninterpreted comments, to be inserted ' into the

command stream.

After the execution of the program is finished, FASTMENU (Fig. 2.2) is

called and the main programs are listed on the system console again.

9
3-3 ROUGHNESS FORTRAN Program

12

3

4

5

6

7

S

9

10

1112

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

C ***** SRF : ROUGHNES . FTN CALLED BY "ROUGHNES" *****

C

C

C THIS PROGRAM BEGINS THE SERIES FOR SURFACE ROUGHNESS

C MEASUREMENTS. THE MAIN PROGRAM ALLOWS LABELING DATA CONC CERNING THE DATE, THE SPECIMEN, AND THE INSTRUMENT TO BE READ

C INTO A FILE LJITH THE FORMAT VOL : ADATE . DAT" . THIS FILE WILL

C EVENTUALLY CONTAIN ALL OF THE PROFILE DATA GENERATED DURING

C THE RUN AND IS CREATED BY THE OPERATOR IN THIS MAIN PROGRAM.

C T. VORBURGER 4/13/78 (REVISED 9/82)

C

C

INTEGER STAT1 , STAT2, STAT, FDBUS (2)

INTEGERS DATF IL (8) , BUFFER (4000)

COMMON /FUDGE/BUFFER

DIMENSION SPEC (20) , R INSTR (20)

DATA DATF I L (7) , DATF IL (8) /' .D','AT'/

DATA FDBUS/' BUS: '/

C

C

1 FORMAT ( ' ***** NBS COMPUTERIZED SURFACE ROUGHNESS FACILITY',

1' IS READY TO GO. *****'///

1' TYPE THE NAME OF THE DATA FILE FOR TODAY IN THE' /

2' FOLLOWING FORMAT: 11 VOL : ADATE " , WHERE VOL IS THE' /

3' THREE CHARACTER VOLUME NAME AND ADATE IS THE EIGHT' /

4' CHARACTER FILE NAME.' ) 2 FORMAT ( 1H ,20A4)

3 FORMAT (' NBS COMPUTERIZED SURFACE ROUGHNESS FACILITY' ) 4 FORMAT (

' TYPE THE SPECIMEN ID INFORMATION.' ) 5 FORMAT (20A4)

6 FORMAT (' I CAN n T OPEN THIS FILE. TRY AGAIN.')

7 FORMAT ( 1H ,9A2)

8 FORMAT (' TYPE "T.ALYSTEP " OR "TALYSURF" AND THE VERTICAL' /

1' AND HORIZONTAL MAGNIFICATIONS.' ) 9 FORMAT ( ' TYPE THE POINT-TO-POINT SPACING IN UM/PT. ' /

1' INCLUDE THE DECIMAL POINT EXPLICITLY.' ) 10 FORMAT (F 10 . 4)

11 FORMAT (

' THE FIRST FOUR RECORDS IN ' ,8A2/

1' ARE AS FOLLOWS:' ) 12 F0RMAT(8A2)

13 FORMATC' THE POINT-TO-POINT SPACING IS ' ,F8.4,

1' UM.' ) 17 FORMAT (' I CAN"T CREATE A FILE WITH THAT NAME. '/'COME ON TURKEY.',

1' DO IT OVER AND GET IT RIGHT THIS TIME!' ) 19 FORMAT (

' NBS BUS ASSIGN ERROR. STATUS WAS:' ,2X, 14)

C

C

C FIRST, THE OPERATOR IS ASKED TO TYPE THE FILENAME, THAT WILL

C BE CREATED TO HOLD THE DATA, AND THE SAMPLE IDENTIFICATION.

C

C

92 WRITE (5,1)

READ(5, 12) (DATFIL(J) , J-1,6)

CALL CF ILWCDATF IL, 2, 80,5, 5,0, 0, STAT1)

IF (STAT1.LT. 1) GO TO 90

WRITE(5, 17) STAT1

GO TO 92

90 CALL OPENW( 1 , DATF IL, 4, 0, 0, STAT2)

10
59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

1 10

111

112

113

114

115

116

IF (STAT2 .LT. 1) GO TO 93

URITE(5.6)

GO TO 92

C

C

C NOU, THE OPERATOR IS ASKED TO TYPE THE HEADER INFORC NATION CONCERNING THE SPECIMEN. THE INSTRUMENT. AND

C THE SPACING OF THE DATA POINTS.

C

C

93 URITE(5.4)

READ C 5. 5) SPEC

URITEC5.8)

READ (5. 5) RINSTR

URITE (5. 9)

READ (5. 10) PTTOPT

URITE(5, 11) DATFIL

UR I TE < 5 . 7 ) DATFIL

URITE (5.2) SPEC

URITE(5.2) RINSTR

URITE(5. 10) PTTOPT

URITE ( 1 . 12) DATFIL

URITE (1.5) SPEC

URITEC1.5) RINSTR

URITE (1.10) PTTOPT

UR I TE ( 8 . 3

)

URITE (8. 7) DATFIL

UR I TE ( 8 . 2 ) SPEC

URITE (8. 2) RINSTR

UR I TE ( 8 . 13) PTTOPT

C

C

C AT THIS POINT UE OPEN THE NBS BUS AS LU-3.

C

c50 CALL 0PENUC3. FDBUS, 4, 0, 0. STAT)

IF (STAT .EQ. 0) GO TO 105

URITE (5.19) STAT

PAUSE 1 GO TO 50

C

c

C FINALLY. THIS PROGRAM CALLS THE KCAL1 AND RA1

C SUBROUTINES ONE AT A TIME.

Cc

105 CALL KCAL1 (DATFIL)

CALL RA 1 (DATFIL)

CLOSE ( 1

)

CLOSE (3)

CLOSE (8)

STOP

END

Cc

c

cc

11
11 ?

1 18

1 19

120

121

122

123

124

125

126

12 ?

128

129

130

131

132

133

134

135

136

13?

138

139

148

141

142

143

144

145

146

14?

148

149

150

151

152

153

154

155

156

15?

158

159

160

161

162

163

164

165

166

16?

168

169

1?0

171

172

173

174

SUBROUTINE KCAL 1 (DATF IL)

C

C

C THIS ROUTINE CALCULATES THE CALIBRATION CONSTANT FOR THE

C SURFACE ROUGHNESS FACILITY. THERE ARE TUO OPTIONS.

C THE OPERATOR MAY USE THE INFORMATION AND CALIBRATION

C CONSTANTS ALREADY STORED IN A PREVIOUS * VOL : ADATE . DAT"

C FILE OR MAY CHOOSE TO RECALIBRATE THE INSTRUMENT.

C THE RESULTS ARE RECORDED IN THE CURRENT "VOL: ADATE.DAT" FILE.

C T. VORBURGER 4/17/78 (REVISED 9/82)

C

C

INTEGER*2 DATFILC8) , Q 1 , Q2, OLDF IL (8)

DIMENSION SPECC20) , R INSTR (20) , TALY(2)

DIMENSION NKCAL (3) , IE 1 (3) * IE2 (3) , H 1 (3) , H3 (3) , H5 (3)

DIMENSION H7(3),H4(3)

REAL KCAL (3)

INTEGER STAT2, FDBUS (2)

INTEGER *2 BUFFER (4000)

COMMON /FUDGE/BUFFER

DATA I6LANK/' '/

DATA FDBUS/' BUS: '/

DATA 0LDFIL(7),0LDFIL(8)/' .D','AT'/

C

1 FORMAT (' UE NOU BEGIN THE RECALIBRATION PROCEDURE.')

2 FORMAT ( 1H /' ADJUST THE FREQUENCY GENERATOR TIMING FOR'/

1' STEP MEASUREMENT ON THE *** '

, 2A4, ' ***.'/

1' AND SET THE FILTER FOR "STEPS" MODE.')

3 FORMAT (40A2)

4 FORMAT (

' BAD DATA? UE "LL START THE STEP CALIBRATION OVER.')

5 FORMAT (20A4)

6 FORMAT (

' UHAT IS THE HEIGHT OF THE CALIBRATING STEP IN UM?'/

2' INCLUDE THE DECIMAL POINT.')

7 FORMAT (F 10 . 4)

8 FORMAT ( ' CALIBRATING STEP = ',F10.4, ’ UM’ /////)

9 FORMAT (4X, ' H 1' , 8X, ' H3' , 8X, ' H5' , 8X, ' H7' /4F 10 . 4)

10 FORMAT (

' STEP HEIGHT = ',F10.4, ' UM'

)

11 FORMAT (

' KCAL = ',E13.6,' UM/QUANTIZATION LEVEL')

12 FORMAT (' LOOK OK? TYPE "YES", "NO", OR "ST"(FOR START OVER).')

13 FORMAT(3(/10X, 'TRACE', I3/10X, 'THE EXTREMA ARE', 13,' AND ',

113,' MM.'/10X,4X, 'H1',8X, 'H3',8X, 'H5',8X,'H?'/10X,4F10.4/10X,

2' STEP HEIGHT = ',F10.4,' UM' /10X, ' KCAL = ',E13.6,

3' UM/QUANTIZATION LEVEL'))

14 FORMAT (E 13 . 6)

15 F0RMAT(8A2)

16 FORMAT (//' THE FIRST SIX RECORDS IN TODAY" S DATA FILE ARE:'/

1 IX, BA2/1X, 20A4/1X, 20A4/F 10 . 4, ' UM/PT(SPAC ING) ' /F 10 . 4, ' UM =',

2' THE HEIGHT OF THE CALIBRATING STEP . ' /E 13 . 6,

3' UM/QUANTIZATION LEVEL = KCAL')

1 7 FORMAT ( 20A4/20A4/F 1 0 . 4/F 1 0 . 4/E 13 . 6

)

18 FORMAT (' DO YOU UISH TO RECALIBRATE THE INSTRUMENT?'/

1' "Y M OR "N"?')

19 FORMAT (

' ***** RESET STYLUS INSTRUMENT.'/

1' ***** THEN HIT RETURN KEY, UHEN YOU ARE READY TO TAKE DATA.')

22 FORMAT (' DATA READING COMPLETE .' /IX, 14, 2X, ' POINTS',

1' OVERFLOU.'/IX, 14, 2X, ' POINTS UNDERFLOW')

29 FORMAT (' UHAT IS THE NAME OF THE FILE THAT YOU',

1' UJANT THE KCAL FROM?'/' USE THE TUELVE CHARACTER',

12
175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

2' FORMAT "VOL: ADATE", '/' UHERE "VOL" IS THE THREE',

3' CHARACTER VOLUME NAME'/' AND "ADATE" IS THE',

4' EIGHT CHARACTER FILE NAME.')

30 FORMATC' ERROR CODE', 13/' SOMETH ING"S WRONG.',

1' I CAN"T OPEN THIS FILE.'/' TRY AGAIN.')

32 FORMAT (/////' THE CALIBRATION CONSTANT KCAL HAS ',

l'BEEN OBTAINED FROM THE FILE ',9A2)

C

C

C IN THE NEXT SEQUENCE, THE OPERATOR IS ASKED TO DECIDE

C WHETHER TO RECALIBRATE THE INSTRUMENT OR TO USE A

C CALIBRATION CONSTANT FROM ANOTHER FILE.

C

C

122 URITE(5, 18)

READ(5,3) Q

1

IF(Ql.EQ.'N') GO TO 120

GO TO 126

120 WRITE(5,29)

READ (5,3) (OLDFIL(J) , J=l,6)

CALL OPENU (2,OLDFIL,0,0, 0,STAT2)

IF (STAT2 .LT. 1) GO TO 121

WRITE (5,30) STAT2

GO TO 122

121 READ (2,7,REC=5) CALSTP

READ (2,14) AVKCAL

WRITE (8,32) (OLDFIL ( J) , J=l,6)

WR I TE ( 8 , 8 ) CALSTP

CALL CLOSE (2,STAT2)

WRITE (1,7, REC=5) CALSTP

WRITE (1,14) AVKCAL

GO TO 127

C

C

126 WRITE(5, 1)

READ( 1,5,REC=3)TALY

WRITE (5, 2) TALY

IF(TALY(2) .EQ.'SURF') GO TO 104

HORSPC = 10.

GO TO 105

104 HORSPC = 6.6667

C

C

C KCAL ROUTINE: THE DATA ARE READ INTO THE COMPUTER VIA

C THE ADCIO ROUTINE. THE RESULTING UNCALIBRATED STEP

C PROFILE IS FITTED BY TWO STRAIGHT LINES IN THE STEP

C FITTING SUBROUTINE, STEPHGT. THE RESULT IS PASSED BACK TO

C THE MAIN PROGRAM AS THE VARIABLE Y4, WHICH IS DIVIDED

C THE THE HEIGHT OF THE CALIBRATING STEP TO YIELD A VALUE

C FOR KCAL IN UM/QUANTIZATION LEVEL. THE AVERAGE VALUE OF KCAL

C IS STORED IN AVKCAL AND WRITTEN INTO THE FILE "VOL: ADATE. DAT".

C

C

105 WRITE(5,6)

READ (5, 7) CALSTP

WRITE ( 1,7,REC=5) CALSTP

C

106 SUM1 = 0.

13
233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

DO 102 K = l,3

NKCALCK) = K C

C

C AT THIS POINT LJE REMIND THE OPERATOR TO RESET THE INSTRUMENT.

C

103 WRITE (5* 19)

READ (5,5) JUNK

C

C

CALL ADC IOC 1000, Y' 2307' ,4,3,80)

C

C

C INFORM OPERATOR OF COMPLETION OF DATA READING AND AMOUNT

C OF UNDERFLOD AND OVERFLOW.

C

LI = 0

L2 = 0

DO 75 I = 1, 1000

IF CBUFFERC I) .EQ. 2047) LI = LI + 1 IF CBUFFERC I) .EQ. -2048) L2 = L2 + 1 75 CONTINUE

WRITE C5, 22) LI, L2

C

C

CALL STPHGTCY1,Y3,Y4,Y5,Y7, IE1 CK) , IE2CK) ,HORSPC)

KCALCK) = CALSTP/Y4

HICK) = KCALCK)*Y1

H3CK) = KCALCK)*Y3

H4CK) = KCALCK)*Y4

H5CK) = KCALCK) *Y5

H7CK) = KCALCK)*Y7

WRITE C5,9r*HlCK),H3CK),H5CK),H7CK)

URITEC5, 10) H4CK)

URITEC5, 11) KCALCK)

WRITEC5, 12)

READ C5, 3) Q2

IF C G2.EQ.'N0') GO TO 103

IF CQ2 . NE . ' ST' ) GO TO 102

WR ITE C5, 4)

GO TO 106

102 SUM1 = SUM1+KCAL CK)

AVKCAL = SUM1/3.

WRITE Cl, 14) AVKCAL

WRITE C8, 13) CNKCALCK), IE 1 CK) , IE2 CK) , H 1 CK) , H3 CK)

,

1H5CK),H7CK),H4CK) , KCALCK) ,K=1,3)

C

C

C THE LABELING INFORMATION CONTAINED IN THE FILE IS

C READ BACK AND PRINTED OUT FOR THE OPERATOR TO CHECK.

C THIS INCLUDES THE FILE NAME, THE SPECIMEN AND INSTRUMENT

C INFORMATION, THE POINT-TO-POINT SPACING, THE CALIBRATING

C STEP HEIGHT, AND KCALCK).

C

C

127 READC1, 15,REC=1)DATFIL

READ C 1 , 17) SPEC, R INSTR, PTTOPT, CALSTP, AVKCAL

WRITEC5, 16) DATFIL, SPEC, R INSTR, PTTOPT, CALSTP, AVKCAL

14
291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

WRITE (8, 16) DATFIL,SPEC,RINSTR,PTTOPT,CALSTP,AVKCAL

RETURN

END

C

C

cc SUBROUTINE STPHGTCZ 1 , Z3, Z4, Z5, Z7, E 1 , E2, HORSPC)

C

C

C STEP FITTING ROUTINE: THIS ROUTINE FITS A STRAIGHT

C LINE TO THE SAMPLE PROFILE ON EACH SIDE OF THE STEP

C WHICH IS RECORDED IN THE ARRAY BUFFER/STPDAT. THE

C OPERATOR MUST CHOOSE EXTREMA, El AND E2, WHICH ARE

C SYMMETRICAL ABOUT THE STEP LOCATION. THE RESULT IS

C THE STEP HEIGHT IN QUANTIZATION LEVELS WHICH IS

C STORED IN THE VARIABLE Z4. Z 1,3, 5, 7 STORE THE HEIGHT

C DIFFERENCE BETWEEN THE LINES AT OTHER PLACES THAN AT

C THE STEP LOCATION. HORSPC IS A CONVERSION FACTOR WHICH

C RELATES POSITION ON THE CHART RECORD IN MM TO POSITION

C IN THE DATA ARRAY, BUFFER.

C

INTEGERS BUFFER (1000)

COMMON /FUDGE/BUFFER

INTEGER E1,E2,E3,E4, X1,X2

DIMENSION Y1 (250) , Y2 (250)

1 FORMAT (' TYPE EXTREMUM FOR LEFT HAND LINE IN MM'/

1' USE 13 FORMAT.')

2 FORMAT( 13)

3 FORMAT (' TYPE EXTREMUM FOR RIGHT HAND LINE IN MM.'/

1' USE 13 FORMAT.')

4 FORMAT (' YOU CAN TYPE BETTER THAN THAT. TRY AGAIN.'/)

51 WR I TE ( 5 , 1

)

READ (5, 2) El

WRITE (5, 3)

READ (5, 2) E2

E3 = HORSPC*E

1

E4 = H0RSPC*E2

XI = E3-250

X2 =» E4-

1

IF (XI .LT. 5) GO TO 53

IF (X2 .GT. 751) GO TO 53

GO TO 52

53 WRITE (5, 4)

GO TO 51

C

52 DO 100 J= 1 ,250

J1 = Xl+J

Yl(J) = BUFFER (Jl)

J2 = X2+J

100 Y2(J) = BUFFER ( J2)

C

51 = 0.

52 = 0.

T1 = 0.

T2 = 0.

U1 * 0.

U2 = 0.

15
349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

U

(_)

CJ

CJ

uuuuuuuuuuuuuuu

VI = 0.

V2 = 0.

DO 101 J= 1*250

51 = si+(xi+j)**2

52 = S2+CX2+J)**2

II = Tl+YKJ)

T2 = T2+Y2CJ)

U1 = U1+CX1+J)

U2 = U2+CX2+J)

VI = V1+(X1+J)*Y1CJ)

101 V2 = V2+(X2+J)*Y2(J)

C

D3 = 250 . *S 1 - Ul**2

D4 = 250 . *S2 - U2**2

RM1 = (250.*V1-U1*T1)/D3

RM2 = (250.*V2-U2*T2)/D4

B 1 = (Sl*Tl-Ul*Vi)/D3

B2 = (S2*T2-U2*V2)/D4

B3 = B2-B

1

01 = 0. 125*E4+.875*E3

03 = 0.375*E4+.625*E3

04 = 0.5*(E4+E3)

05 = 0 . 625*E4+0 . 375*E3

07 = 0.875*E4+0. 125*E3

21 = (RM2-RM1)*01+B3

Z3 = (RM2-RM1)*03+B3

24 = (RM2-RM1)*04+B3

25 = (RM2-RM1)*05+B3

27 = (RM2-RM1)*07+B3

RETURN

END

SUBROUTINE RA1 (DATFIL)

THIS PROGRAM RECORDS THE AVERAGE ROUGHNESS RA FOR A 4000

POINT SURFACE PROFILE. THE DATA ARE READ INTO THE ARRAY

BUFFER VIA THE SUBROUTINE ADC 10. THE AVERAGE ROUGHNESS

FOR EACH OF THREE TRACES AT EACH POSITION IS CALCULATED

AND WRITTEN ONTO THE SURFACE CONSOLE AND THE PRINTER.

THE AVERAGE OF RA'S FOR EACH POSITION IS WRITTEN

ON THE FILE "SRF : ADATE . DAT" . THE LAST PROFILE FOR EACH

POSITION IS ALSO RECORDED IN "SRF : ADATE . DAT" ALONG WITH

THE TOTAL NUMBER OF POSITIONS MEASURED FOR THE DAY.

TVTV 4/22/78

INTEGERS BUFFER (4000) * DATFIL (8) *NTRACE(3) *NP0S*QUES1*

1QUES2

INTEGER SUM1 * COMENT (10)

DIMENSION RA (3) * REGURG (20)

REAL MEAN*KCAL

COMMON /FUDGE/BUFFER

16
407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

C

1 FORMATC//' SURFACE ROUGHNESS RA MEASUREMENTS' /

1' ***** adjust the timing and select THE APPROPRIATE FILTER.')

2 FORMATC40A2)

3 F0RMATCE13.6)

4 FORMATC' POSITION' , 13, ' TRACE', 13,' RA -',F10.4,' UM'

)

5 FORMATC' LOOK OK? n YES u , "NO", OR "ST" (START POSITION OVER).')

6 FORMATC 1615)

7 FORMATC/' POS. ' ,12,' AVERAGE RA -' ,F9.4,' UM; '

, 1 10A4, 3 (/' TRACE ' ,13,' RA =' ,F10.4,' UM' ))

8 FORMATC' DO ANOTHER POSITION?' ) 9 FORMATC' BAD DATA. YOU CHOOSE TO START THE POSITION' , r OVER.' ) 10 FORMATC I2,F10. 4, 10A4)

11 FORMATC' RA ROUTINE COMPLETED.' ) 12 FORMATC20A4)

13 FORMATC///' SURFACE ROUGHNESS RA MEASUREMENTS' ) 14 FORMATC 1H1)

15 FORMATC 1H ,40A2)

16 FORMATC 1H ,20A4)

17 FORMATC' DO YOU HAVE ANY COMMENTS FOR THIS POSITION?'/

r YOU ARE ALLOWED 40 CHARACTERS.'/

2' IF NOT, JUST HIT RETURN.')

18 FORMATC 10A4)

19 FORMATC' ***** RESET STYLUS INSTRUMENT.'/

1' ***** THEN HIT RETURN KEY, WHEN YOU ARE READY TO TAKE DATA.')

22 FORMATC' DATA READING COMPLETE .' /IX, 14, 2X, ' POINTS',

1' OVERFLOW. '/IX, 14, 2X, ' POINTS UNDERFLOW.')

C

C

C FIRST, THE PROGRAM OPENS THE DATA FILE FOR THE DAY. ITS NAME

C HAS THE FORMAT “VOL : ADATE . DAT" , AND IT IS STORED IN THE

C VARIABLE DATFIL. THEN THE VALUE OF THE CONSTANT KCAL

C IS READ FROM THE DATA FILE. THEN THE VARIABLE NPOS,

C GIVING THE NUMBER OF POSITIONS MEASURED, IS INDEXED AND

C RECORDED IN THE DATA FILE FOR THE DAY.

C

C

WRITE (5, 1)

WRITE (8, 13)

READ C 1, 3, REC=6) KCAL

NPOS = 1 WRITE ( 1, 15) NPOS

C

C NOW, WE BEGIN THE PROCESS OF READING PROFILE DATA AND

C CALCULATING RA. THIS IS DONE THREE TIMES FOR EACH

C POSITION. THE OPERATOR HAS THE OPTION OF ACCEPTING OR

C REJECTING EACH RA OR OF BEGINNING THE POSITION OVER.

C

105 SUM3 = 0.

DO 100 K® 1,3

NTRACE CK) = K

C

C

C AT THIS POINT WE REMIND THE OPERATOR TO RESET THE INSTRUMENT.

C

103 WRITE (5,19)

READ C5. 12) JUNK

17
465

466

46?

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

48?

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

50?

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

n

n

o

o

n

n

r> CALL ADC 10(4080, Y' 2307'’ * 4* 3* 40)

INFORM OPERATOR OF COMPLETION OF DATA READING AND AMOUNT

OF UNDERFLOW AND OVERFLOW.

LI = 0

L2 = 0

DO 75 I = 1, 4000

IF (BUFFER ( I ) .EQ. 2047) LI = LI + 1 IF (BUFFER (I) .EQ. -2048) L2 = L2 + 1 75 CONTINUE

WRITE (5* 22) LI, L2

C

C

SUM1 = 0.

DO 101 J= 1,4000

101 SUM1 = SUM1 + BUFFER (J)

MEAN = SUM 1/4000.

SUM2 = 0.

DO 102 J= 1 , 4000

DIFF = BUFFER ( J) - MEAN

102 SUM2 = SUM2 + ABS (D IFF)

RA (K) = KCAL*SUM2/4000.

WR ITE (5, 4) NPOS, NTRACE (K) ,RA (K)

WRITE(5,5)

READ (5,2) QUES1

IF (QUES1.EQ. 'NO' ) GO TO 103

IF (QUES 1 . NE . ' ST' ) GO TO 100

WRITE(5,9)

GO TO 105

100 SUM3 = SUM3 + RA (K)

C

C THE AVERAGE IS CALCULATED, AND THE RESULTS ARE WRITTEN

C ON THE SURFACE CONSOLE, THE PRINTER, AHD THE DATA FILE

C FOR THE DAY. THE PROFILE DATA FROM TRACE 3 FOR EACH

C POSITION ARE ALSO WRITTEN INTO THE DATA FILE. THE OPERC ATOR HAS THE OPTION OF GOING TO A NEW POSITION OR OF

C ENDING THE PROGRAM.

C

AVRA = SUM3/3.

WRITEC5, 17)

READ (5, 18) COMENT

WRITE (1,10) NPOS, AVRA, COMENT

WRITE (1,6) BUFFER

IF (NPOS . EQ . 6 .OR. NPOS. EQ. 16 .OR. NPOS. EQ. 26

1 .OR. NPOS. EQ. 36 .OR. NPOS. EQ. 46 .OR. NPOS. EQ. 56

2 .OR. NPOS. EQ. 66 .OR. NPOS. EQ. 76 .OR. NPOS. EQ. 86)

3 WR I TE ( 8 , 14)

WRITE (8, 7) NPOS, AVRA, COMENT, (NTRACE (K) , RA (K) , K = 1 , 3)

WR I TE ( 5 , 8

)

READ (5, 2) QUES2

IF (QUES2 . EQ . ' NO' ) GO TO 104

NPOS = NPOS + 1 GO TO 105

104 WRITE ( 1 , 10,REC=7) NPOS

18
523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

nnnnnoonnononnnnnnnnnnnooonnonooon

onnon

REWIND 8

WRITE (4, 14)

106 READ(8, 12,END=108) REGURG

IF (REGURG(l) .NE. '1 ' ) GO TO 107

WRITE (4, 14)

GO TO 106

107 WRITE(4, 16) REGURG

GO TO 106

108 WR ITE (5, 11)

RETURN

END

SUBROUTINE ADCIO (N, MDEADR, ADR, LU, TOC)

THIS ROUTINE SETS UP THE NBS BUS FOR ACQUIRING A RECORD OF N DATA

POINTS VIA THE A TO D CONVERTER (ADC). THE SETUP OF THE ADC

ASSUMES THAT IT WILL BE EXTERNALLY CLOCKED AT THE REQUIRED

RATE. THE PROGRAM IS BASED ON THE BUS DRIVER WRITTEN BY

CHARLES CODLING OF COMPUTER CONSULTANTS WHICH WAS IN TURN

A MODIFICATION OF THE MUXBUS DRIVER WRITTEN BY RICHARD

FREEMIRE OF NBS.

THE PROGRAM ALERTS THE OPERATOR OF ANY PROBLEM IN OPENING

THE BUS BY PROMPTS ON THE USER'S TERMINAL WHICH IS

ASSUMED TO BE ASSIGNED TO LOGICAL UNIT 5.

WRITTEN BY E. CLAYTON TEAGUE 4/10/78

REVISED 1/14/83

INPUT VARIABLE DEFINITIONS.

N - NUMBER OF DATA POINTS TO BE ACQUIRED. 2N BYTES WILL

BE ACQUIRED.

MDEADR- HEX CODE TO INDICATE WHICH CHANNEL OF THE ADC

WILL BE USED IN THE DATA ACQUISITION, WHAT TYPE

OF CONVERSION TO MAKE ETC. THE USER SHOULD CONSULT

A MANUAL ON THE NBS BUS TO DETERMINE WHAT THIS

CODE SHOULD BE.

ADR - SUBADDRESS OF THE ADC ON THE NBS BUS.

LU - LOGICAL UNIT ASSIGNMENT OF THE NBS BUS.

BUFFER - STARTING ADDRESS OF THE STORAGE AREA FOR

ACQUIRED DATA. IT IS THE USER'S RESPONSIBILITY

TO INSURE THAT 2N BYTES OF SPACE ARE ALLOTED.

TOC - TIME OUT CONSTANT TO BE USED FOR THE DATA ACQUISITON.

INTEGER DUMMY, ADR, TOC

INTEGER PBLK(8) , ISTAT

INTEGERS BUFFER (4000)

LOGICAL FLAG

COMMON /FUDGE/BUFFER

DATA PBLK/8H<0/

19
581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

. 616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

C SET UP BUS FOR I/O BY INITIALIZING BUSY BIT.

C

30 FLAG » .FALSE.

40 PBLKC6) = 0

C

C CLEAR BUS AND CHECK STATUS

C

CALL SYS 10 (PBLK, Y'C0', LU, DUMMY. 0. Y'C0')

CALL SYS 10 (PBLK, Y'C0', LU, DUMMY. 0, Y'B0')

CALL ILBYTE C ISTAT. PBLK. 2) IF ( ISTAT. EQ .2) GO TO 50

WRITE (5, 930) ISTAT

PAUSE 10

GO TO 40

C

C SELECT ADC SUBADDRESS ON BUS AND CHECK STATUS.

C

50 IADR = ADR + Y'C0'

CALL SYS 10 CPBLK. Y'C0', LU. DUMMY. 0. IADR)

C

CALL ILBYTE (ISTAT, PBLK, 2)

IF CISTAT.EQ. 136. OR. ISTAT. EQ.0)GO TO 60

WRITE (5, 940) ISTAT

PAUSE 11 GO TO 50

C

C SET UP MODE AND ADDRESS REGISTER OF ADC.

C

60 IMDE = MDEADR * Y' 10000'

CALL SYS 10 CPBLK, Y'38', LU, IMDE, 2, 0)

CALL ILBYTE (ISTAT, PBLK, 2)

IF C ISTAT .EQ. 0) GO TO 68

• WRITE (5, 950) ISTAT

PAUSE 12

GO TO 60

C

C LOAD TIME OUT CONSTANT(TOC) FOR READING. FIRST HALFWORD

C IS TOC, SECOND HALFWORD MUST BE NONZERO TO LOAD VALUE.

C DEFAULT TOC IS 10 SECONDS.

C

68 PBLK (6) = 0

PBLK (6) = 1 + TOC*Y' 10000'

M = 2 * N CALL SYSIOCPBLK, Y'C0', LU, DUMMY, 0, IADR)

CALL ILBYTE (ISTAT, PBLK, 2)

IF ( ISTAT .NE. Y'88') WRITE C5, 945) ISTAT

C

C READ 2N BYTES FROM CHANNEL SPECIFIED BY I MDEADR INTO

C BUFFER AND CHECK STATUS OF THE ADC CARD.

C

CALL SYS 10 (PBLK, Y'58', LU, BUFFER, M, 0)

CALL ILBYTE( ISTAT, PBLK, 2)

IF (ISTAT .EQ. 0) GO TO 70

FLAG = .TRUE.

WRITE (5, 960) ISTAT

GO TO 40

C

930 FORMAT (' STATUS DURING CLEAR OF BUS WAS:' ,2X,Z4)

20
639

640

641

642

643

644

645

646

647

648

Format <!

IN selecting bt>C 6U Imbs Bus.*/

1 9 CTOTI IQ 1.1DQ • ' 9V 7A)

945 FORMATC' STATUS JUST BEFORE READ OF A/D UAS:'/

1 .2X.Z4)

950 FORMATC' STATUS DURING LOADING MODE AND ADDRESS REG. UAS:' ,2X,Z4)

960 FORMATC' IN READ FROM ADC. STATUS UAS:' .2X.Z4)

70 CALL SYSIOCPBLK, Y'C0', LU. DUMMY. 0. Y'B0')

IF (FLAG) GO TO 30

RETURN

END

21
3.4 Flowchart for ROUGHNES

MAIN PROGRAM

The operator is prompted to type the name of the

file that will be created to hold the profile data.

The operator is prompted to type the I.D., the

type of stylus instrument and its magnification

settings, and the horizontal point spacing of

the data. These parameters are then output to

the console, the data file, and a print file.

The NBS Bus is opened as a logical Cinit to the

program. It functions as the interface between

the computer and the stylus instrument.

The subroutine to measure the instrument

calibration constant is called.

The subroutine to measure the roughness profiles

and calculate Ra is called.

* "1.52" means "line 52"; "11. 52-61" means

"lines 52-61".

22
KCAL1 SUBROUTINE

The operator is prompted to type the name

of a previously created data file that holds

the calibration data.

That file is read for the calibration constant

KCAL and the calibrating step height. The

values are then written into the current data

file and the print file.

Page 25

23
This constant depends on the chart

speed and the data rate.

The operator is prompted to type the

height of the calibrating step.

The calibrating step will be measured

three times.

24
Page 24

Calculate

Step Height

1. 258

\|ZSum KCALs

& Loop 3

Times

1. 274

V

Output

Results

11. 275-278/

Calculate

KCAL

11. 259-267

Page 24

Page 24

\/

Check

f Header Info

11. 288-291

4~©

Page 23

V

© Return

\

v i: 292 y

The subroutine STPHGT is called. It fits

straight lines to the low and high sides of

the step, extrapolates the lines to the middle

of the step, and calculates the height difference in quantization levels at the middle of

the step and at several other places along the

profile.

The calibration constant is calculated and

displayed. The height differences discussed

above are calculated and displayed in urn.

If the operator types "ST", the program

reinitializes the loop and begins the

calibration procedure over again.

The average of three KCALs is calculated and

written to the data file. KCAL and other

step height parameters are written to the

print file.

The first six lines of the data file are read

back in and output to the console, so the

operator can review the information, and to

the print file.

25
RA1 SUBROUTINE

Read the calibration constant from the

data file.

Each surface profile will be measured

three times in this loop.

Subroutine ADCIO is called here.

The result is output to the console.

26
Final

Output

11 . 522-531/

The average Ra is calculated*. The operator

may type in a label, which is then stored

in the data file along with the third profile

for each position. The measured Ra and other

relevant information is output to the data

file and the printer.

The final number of measurement positions

is written on the data file and the print

file is output to the printer.

27
3-5 Example of ROUGHNES Printout

NES COMPUTERIZED SURFACE ROUGHNESS FACILITY

SD8: E27SEPB2. DAT

TEST OF TALYSURF WITH 3 UM PROTOTYPE SRM

TALYSURF 2, OOOX VERT. 20X HORIZ.

THE POINT-TO-POINT SPACING IS 12.7300 UM.

TRACE 1 THE EXTREMA ARE 52 AND 62 MM.

HI H3 H5 H7

12. 7358 12.7319 12.7281 12.7242

STEP HEIGHT = 12.7300 UM

KCAL = 0. 664203E-02 UM/QUANTI ZATION LEVEL

TRACE 2

THE EXTREMA ARE 54 AND 60 MM.

HI H3 H5 H7

12.7321 12.7307 12.7293 12.7279

STEP HEIGHT = 12.7300 UM

KCAL = 0. 660992E-02 UM/QUANTI ZATION LEVEL

TRACE 3

THE EXTREMA ARE 52 AND 60 MM.

HI H3 H5 H7

12.7326 12.7309 12.7291 12.7274

STEP HEIGHT = 12.7300 UM

KCAL = 0. 660349E-02 UM/QUANTI ZATION LEVEL

THE FIRST SIX RECORDS IN TODAY"S DATA FILE ARE:

SD8: E27SEP82. DAT

TEST OF TALYSURF WITH 3 UM PROTOTYPE SRM

TALYSURF 2, OOOX VERT. 20X HORIZ.

12.7300 UM/PT ( SPAC ING

)

12.7300 UM = THE HEIGHT OF THE CALIBRATING STEP.

0. 66184SE-02 UM/QUANTI ZATION LEVEL = KCAL

SURFACE ROUGHNESS RA MEASUREMENTS

POS. 1 AVERAGE RA = 2. 9968 UM;

TRACE 1 RA = 3. 0215 UM

TRACE 2 RA = 2. 9616 UM

TRACE n RA = 3. 0074 UM

28
4. STEPHGHT

4.1 Summary

The program STEPHGHT serves an important function in

calibrations. It controls the data acquisition of stepped

profiles and calculates the step heights. The main program is

almost identical to the main program in ROUGHNES. It calls the

subroutine STEPCAL, the first part of which calculates a calibration constant KCAL by calling ADCIO and STPHGT. The last part of

STEPCAL then measures unknown steps. Each step position is

measured three times, an average is calculated, and the third

step profile is stored on the disk.

Nearly all of the procedures and options in STEPHGHT are similar

to those of ROUGHNES. A key difference is that the surface

profile consists of 1000 rather than 4000 data points. However,

the profiles are stored in a 4000 point array with 3000 trailing

zeros so that both kinds of profiles can be read by the same

programs.

29
4.2 Operating System Commands

b

.1 w'

> 1

i 4

i 5

16

a.i q—

STEPHGHT

LO .EG, SRF: STEPHGHT. T5K

T . EG

CLOSE ALL

AS 4, Li:

AS 5 i LI:

a c l. r • r » D > i w . vnp /\ a-' u— cor. —• is, i . cot; —1 . iu.uui hat L'ii i A ? CD D* • CD t I i T\£ T T }\\ OA / c= /

e;

r*«i— .Jin . _‘i a. u-i— t Xrf . *ji / 1 ! 'i i C1 w/ / w AS 8, SEP: SPILL. DAT

$W* YOU SHOULD NOW EE RECEIVING

ST

INFORMATION ON THE SURFACE CONSOLE.

* RETURN TO “FASTMENU".

FASTMENU

c>: rr V T “T

<• i__ /\ A i

30
4.3 STEPHGHT FORTRAN Program

12

3

4

5

6

7

3

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

23

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

C ***** SRF: STEPHGHT. FTN CALLED BY "STEPHGHT" *****

C

C THIS PROGRAM BEGINS THE SERIES FOR STEP HEIGHT

C MEASUREMENTS. THE MAIN PROGRAM ALLOWS LABELING DATA CONC CERNING THE DATE, THE SPECIMEN, AND THE INSTRUMENT TO BE READ

C INTO A FILE WITH THE FORMAT “VOL: ADATE.DAT" . THIS FILE IS

C CREATED BY THE OPERATOR AT THE BEGINNING OF THE MAIN

C PROGRAM AND WILL EVENTUALLY CONTAIN ALL OF THE PROFILE

C DATA GENERATED DURING THE RUN.

C T. VORBURGER 4/13/78 (REVISED 9/82)

C

C

C

INTEGER STAT1 , STAT2, STAT, FDBUS (2)

INTEGER*2 DATF IL (8) , Q 1 , BUFFER (4000)

COMMON /FUDGE/BUFFER

DIMENSION SPEC (20) ,RINSTR(20)

DATA DATFIL(7) , DATFIL(8)/' .D','AT'/

DATA FDBUS/' BUS: '/

C

C

1 FORMATS ***** NBS COMPUTERIZED SURFACE ROUGHNESS FACILITY',

1' IS READY TO GO. *****'///

1' TYPE THE NAME OF THE DATA FILE FOR TODAY IN THE' /

2' FOLLOWING FORMAT: "VOL: ADATE", WHERE VOL IS THE' /

3' THREE CHARACTER VOLUME NAME AND ADATE IS THE EIGHT' /

4' CHARACTER FILE NAME.' ) 2 FORMAT ( 1H ,20A4)

3 FORMATdHl/' NBS COMPUTERIZED SURFACE ROUGHNESS FACILITY,',

1' STEP HEIGHT MEASUREMENTS')

4 FORMAT (' TYPE THE SPECIMEN ID INFORMATION.' ) 5 FORMAT(20A4)

7 FORMAT ( 1H ,9A2)

8 FORMAT (' TYPE "TALYSTEP" OR "TALYSURF" AND THE VERTICAL' /

1' AND HORIZONTAL MAGNIFICATIONS.' ) 9 FORMAT (

' TYPE THE POINT-TO-POINT SPACING IN UM/PT.' /

1' INCLUDE THE DECIMAL POINT EXPLICITLY.' ) 10 FORMAT(F 10 . 4)

11 FORMAT (' THE FIRST FOUR RECORDS IN ' ,8A2/

1' ARE AS FOLLOWS:' ) 12 FQRMAT(8A2)

13 FORMAT (' THE POINT-TO-POINT SPACING IS ' ,F8.4,

1' UM.' ) 17 FORMAT (

' ERROR STATUS = ' ,12//' COME ON TURKEY.',

1' DO IT OVER AND GET IT RIGHT THIS TIME!' ) 19 FORMAT (

' NBS BUS ASSIGN ERROR. STATUS WAS:' ,2X, 14)

C

C

C FIRST, THE OPERATOR IS ASKED TO TYPE THE FILENAME, THAT WILL

C BE CREATED TO HOLD THE DATA, AND THE SAMPLE IDENTIFICATION.

C

C

92 WRITE (5,1)

READ (5, 12) (DATFIL(J) , J=l,6)

CALL CF ILW(DATF IL, 2, 80, 5, 5, 0, 0, STAT1)

IF (STAT1.LT. 1) GO TO 90

UR ITE (5, 17) STAT1

GO TO 92

31
59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

1 13

1 14

1 15

116

90 CALL OPENUd, DATFIL, 4, 0,0,STAT2)

C

C

C NOW, THE OPERATOR IS ASKED TO TYPE THE HEADER INFORC MATION CONCERNING THE SPECIMEN, THE INSTRUMENT, AND

C THE SPACING OF THE DATA POINTS.

C

C

WRITE (5, 4)

READ (5,5) SPEC

UR I TE ( 5 , 8

)

READ (5,5) RINSTR

UR I TE ( 5 , 9

READ (5, 10) PTTOPT

WRITE (5, 11) DATFIL

UR I TE ( 5 , 7 ) DATFIL

UR I TE ( 5 , 2 ) SPEC

UR I TE ( 5 , 2 ) RINSTR

WRITE (5, 10) PTTOPT

WRITE (1,12) DATFIL

WRITE (1,5) SPEC

UR I TE ( 1 , 5 ) RINSTR

URITE(1, 10) PTTOPT

UR I TE ( 8 , 3

)

UR I TE ( 8 , 7 ) DATFIL

UR I TE ( 8 , 2 ) SPEC

UR I TE ( 8 , 2 ) RINSTR

UR ITE (8, 13) PTTOPT

C

C

C AT THIS POINT UE OPEN THE NBS BUS AS LU-3.

C

c50 CALL 0PENU(3, FDBUS, 4, 0, 0,STAT)

IF (STAT .EQ. 0) GO TO 105

UR ITE (5,19) STAT

PAUSE 1 GO TO 50

C

C

C FINALLY, THIS PROGRAM CALLS THE STEPCAL SUBROUTINE.

C

C

105 CALL STEPCAL (DATFIL)

CLOSE (1)

CLOSE (3)

CLOSE (8)

STOP

END

C

C

C

C

C

SUBROUTINE STEPCAL (DATF IL)

C THIS ROUTINE CALCULATES THE CALIBRATION CONSTANT AND STEP

C HEIGHTS FROM THE PROFILE DATA. ALL RESULTS

C ARE RECORDED IN THE FILE " VOL : ADATE . DAT"

32
117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

<ugo-vj

cntn.fc.ui

ro

-* n

non TVTV 4/17/73

INTEGERS DATFIL (8) , OLDFIL (8) >QL Q2, Q3, Q4, Q5

DIMENSION SPECC20) , R INSTR (20) , TALYC2) , COMENK 10)

DIMENSION NKCAL(3), IE 1(3), IE2(3) ,H1 (3) ,H3(3) ,H5(3)

DIMENSION H7(3),H4(3),XSTEP(3),REGURG(20)

REAL KCAL(3)

INTEGERS BUFFER (4000)

INTEGER NTRACE(3)

INTEGER STAT, STAT2, STAT4, STATUS, FDBUS (2)

COMMON /FUDGE/BUFFER

DATA IBLANK/' '/

DATA OLDFIL (7) , OLDFIL (8)/' .D','AT'/

DATA FDBUS/'BUS: '/

FORMAT(' UE NOU BEGIN THE STEP MEASUREMENT OR RECALL

1'IBRATION PROCEDURE.')

FORMATS UE UILL NOU START THE RECALIBRATION PROCEDURE.'/

1' UHAT IS THE HEIGHT OF THE CALIBRATING STEP IN UM?'/

2' INCLUDE THE DECIMAL POINT EXPLICITLY.')

FORMAT(40A2)

FORMAT(' DO YOU UISH TO RECALIBRATE THE INSTRUMENT?'/

1' “Y" OR “N “?'

)

FORMAT (20A4)

FORMAT ( 1H1/' ADJUST THE FREQUENCY GENERATOR TIMING '/

1' FOR STEP MEASUREMENT ON THE ***** ',2A4,' *****,'/

2' AND SET THE FILTER FOR "STEPS" MODE.'///)

FORMAT(F 10 . 4)

FORMATdH , 20A4)

FORMAT (4X, 'HI', 8X, ' H3' , 8X, ' H5' , 8X, ' H7' /4F 10 . 4)

10 FORMAT(/' POSITION', 13,' TRACE', 13,

1' STEP HEIGHT =',F10.4,' UM'

)

11 FORMAT(' KCAL = ',E13.6,' UM/QUANTI2ATI0N LEVEL')

12 FORMATS LOOK OK?'/' TYPE "YES" IF IT LOOKS OK,'/

1' TYPE "NO" IF YOU UANT TO REDO THIS TRACE,'/

2' AND TYPE "ST" IF YOU UANT TO START THE KCAL SEQUENCE ',

3' OR THE POSITION OVER.')

13 FORMAT(3(/10X, 'TRACE', I3/10X, 'THE EXTREMA ARE', 13,' AND ',

113,' MM.'/10X,4X,'H1',8X,'H3',8X,'H5',3X,'H7'/10X,4F10.4/10X,

2'STEP HEIGHT = ',F10.4,' UM' /10X, ' KCAL = ',E13.6,

3' UM/QUANTIZATION LEVEL'))

14 F0RMAT(E13.6)

15 FORMAT (9A2)

16 FORMAT(//' THE FIRST SIX RECORDS IN TODAY"S FILE ARE:'/

1 IX, 8A2/1X, 20A4/1X, 20A4/F10.4, ' UM/PT(SPAC ING) '/F10.4, ' UM *',

2' THE HEIGHT OF THE CALIBRATING STEP. '/E13.6,

3' UM/QUANTIZATION LEVEL = KCAL')

17 FORMAT ( 20A4/20A4/F 1 0 . 4/F 1 0 . 4/E 1 3 . 6

)

18 FORMAT(//' STEP MEASUREMENT PROCEDURE:'/' UE UILL MEASURE THE'

1' STEP THREE TIMES AT EACH POSITION AND TAKE THE AVERAGE.'/

2' *****ADJUST THE TIMING.')

19 FORMAT (

' BAD DATA. YOU CHOOSE TO START THE POSITION ',

1' OR THE KCAL SEQUENCE OVER.')

21 FORMAT (/' POS. ' , 13, ' AVE. STEP HEIGHT =',F8.4,

1' UM; ' , 10A4,3(/' TRACE ',13,' STEP HEIGHT =',F10.4,' UM' )

)

22 FORMATS DO ANOTHER POSITION?')

23 FORMAT( 12, F 10. 4, 10A4)

33
175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

24 FORMAT C ' END OF STEF HEIGHT ROUTINE.')

25 FORMAT (

' ***** RESET STYLUS INSTRUMENT.'/

1' ***** THEN HIT RETURN KEY, WHEN YOU ARE READY TO TAKE DATA.')

26 FORMAT (1615)

28 FORMAT (/' KCAL ROUTINE TRACE', 13,

1' STEP HEIGHT = ',F10.3,' UM'

)

29 FORMAT C ' UHAT IS THE NAME OF THE FILE THAT YOU ',

l'UANT THE KCAL FROM?'/' USE THE TUELVE CHARACTER',

2' FORMAT "VOL: AD ATE",'/' UHERE "VOL" IS THE THREE',

3' CHARACTER VOLUME NAME'/' AND "ADATE" IS THE',

4' EIGHT CHARACTER FILE NAME.')

30 FORMAT (

' ERROR CODE' , 13/' SOMETH ING"S URONG.',

1' I CAN "T OPEN THIS FILE.'/' TRY AGAIN.')

31 FORMAT (' DATA READING COMPLETE .' /IX, 14, 2X, ' POINTS',

1' OVERFLOW. '/IX, 14, 2X, ' POINTS UNDERFLOW. '

)

32 FORMAT (/////' THE CALIBRATION CONSTANT KCAL HAS ',

1

' BEEN OBTAINED FROM THE FILE ',9A2)

33 FORMAT (/' UE NOW START THE RECALIBRATION PROCEDURE.')

34 FORMAT (' CALIBRATING STEP = ',F10.4, ' UM' /////)

35 FORMAT C

' DO YOU HAVE ANY COMMENTS FOR THIS POSITION?'/

1' YOU ARE ALLOWED 40 CHARACTERS.'/ ' IF NOT, JUST HIT "RETURN".')

36 FORMAT C 10A4)

3? FORMAT ( 1H 1

)

C

C

WRITE C5, 1)

READ ( 1 , 5, REC=3) TALY

WRITE (5, 6) TALY

IF (TALY C 2) . EQ . ' SURF' ) GO TO 104

HORSPC = 10.

GO TO 105

104 HORSPC = 6.6667

C

C

C IN THE NEXT SEQUENCE, THE OPERATOR IS ASKED TO DECIDE

C WHETHER TO RECALIBRATE THE INSTRUMENT OR TO USE A

C CALIBRATION CONSTANT FROM ANOTHER FILE.

C

C

105 WR ITE (5, 4)

READ (5,3) Q

IF(Ql.EQ.'N') GO TO 120

GO TO 126

120 WR ITE (5, 29)

READ (5,3) (OLDF IL (J),J=1,6)

CALL OPENW (2, OLDF I L, 0, 0, 0, STAT2)

IF (STAT2 .LT. 1) GO TO 121

WRITE (5,30) STAT2

GO TO 120

121 READ (2,7,REC=5) CALSTP

READ (2, 14) AVKCAL

WRITE (8,32) (OLDFIL(J) , J=l,6)

WRITE (8, 34) CALSTP

CALL CLOSE (2,STAT2)

WRITE (1,7, REC=5) CALSTP

WRITE (1,14) AVKCAL

GO TO 127

C

34
233 C

234 C KCAL ROUTINE: THE DATA ARE READ INTO THE COMPUTER VIA

235 C THE ADCIO ROUTINE. THE RESULTING UNCALIBRATED STEP

236 C PROFILE IS FITTED BY TUO STRAIGHT LINES IN THE STEP

237 c FITTING SUBROUTINE, STPHGT. THE RESULT IS PASSED BACK TO

238 c THE MAIN PROGRAM AS THE VARIABLE Y4, WHICH IS DIVIDED

239 c BY THE HEIGHT OF THE CALIBRATING STEP TO YIELD A VALUE

240 c FOR KCAL IN UM/QUANTIZATION LEVEL.

241 c 242 c 243 126 UR ITE (5, 2)

244 WRITE (8,33)

245 READ (5, 7) CALSTP

246 WRITEC 1,7,REC=5) CALSTP

247 C

248 110 SUM1 = 0.

249 DO 102 K=l,3

250 NKCAL(K) = K 251 C

252 C

253 C AT THIS POINT WE REMIND THE OPERATOR TO RESET THE INSTRUMENT

254 C

255 103 WRITE (5,25)

256 READ (5,5) JUNK

257 C

258 C

259 CALL ADC 10 ( 1000, Y' 2307' , 4,3, BUFFER, 40)

260 C

261 C

262 C INFORM OPERATOR OF COMPLETION OF DATA READING AND AMOUNT

263 C OF UNDERFLOW AND OVERFLOW.

264 C

265 LI = 0

266 L2 = 0

267 DO 75 I = 1, 1000

268 IF (BUFFER ( I) .EQ. 2047) LI - LI + 1 269 IF (BUFFER (I) .EQ. -2048) L2 = L2 + 1 270 75 CONTINUE

271 WRITE (5, 31) LI, L2

272 C

273 C

274 CALL STPHGT ( Y 1 , Y3 , Y4, Y5 , Y7 , IE1 (K) , IE2(K) ,HORSPC)

275 KCAL(K) = CALSTP/Y4

276 HI (K) = KCAL (K) *Y1

277 H3(K) = KCAL (K) *Y3

278 H4(K) = KCAL(K)*Y4

279 H5(K) = KCAL (K) *Y5

280 H7(K) = KCAL (K) *Y7

281 WRITE(5,9) H1(K),H3(K),H5(K),H7(K)

282 WRITE (5,28) K, H4(K)

283 WR ITE (5, 11) KCAL(K)

284 WR I TE ( 5 , 12)

285 READ(5,3) Q2

286 IF (Q2 .EQ. 'NO') GO TO 103

287 IF (Q2 .NE. 'ST') GO TO 102

288 WRITE (5,19)

289 GO TO 110

290 IF ( Q2.EQ. 'NO' ) GO TO 103

35
291

292

293

294

295

296

29?

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

33?

338

339

340

341

342

343

344

345

346

347

348

noon

hjnnnnnnnnnnnonn

onnonoon

—

nnnoonnnorir)

102 SUM1 = SUM1+KCAL (K)

THE AVERAGE VALUE FOR KCAL(K) IS STORED IN AVKCAL AND

URITTEN INTO THE FILE " VOL : ADATE . DAT" . THEN ALL OF

THE LABELING INFORMATION CONTAINED IN THE FILE IS

READ BACK AND PRINTED OUT FOR THE OPERATOR TO CHECK.

THIS INCLUDES THE FILE NAME, THE SPECIMEN AND INSTRUMENT

INFORMATION, THE POINT-TO-POINT SPACING, THE CALIBRATING

STEP HEIGHT, AND KCALCK).

AVKCAL = SUM1/3.

UR ITE ( 1 , 14) AVKCAL

URITEC8, 13) CNKCAL (K),IE1(K), IE2 (K) , H 1 CK) , H3 CK)

,

1H5CK) ,H?CK), H4CK), KCALCK), K= 1,3)

27 READ C 1 , 15, REC= 1 ) DATF IL READ C 1, 17) SPEC, R INSTR, PTTOPT, CALSTP, AVKCAL

UR ITE (5, 16) DATF IL, SPEC, R INSTR, PTTOPT, CALSTP, AVKCAL

URITEC8, 16) DATF IL, SPEC, R INSTR, PTTOPT, CALSTP, AVKCAL

STEP MEASUREMENT SEQUENCE: KCAL IS READ FROM THE FILE

"VOL: ADATE. DAT". THEN, THE VARIABLE NPOS, UHICH GIVES

THE NUMBER OF POSITIONS MEASURED IS INITIALIZED AND RECORDED

IN "VOL: ADATE. DAT".

URITEC5, 18)

READ C 1 , 14, REC=6) AVKCAL

NPOS = 1 UR ITE (1,3) NPOS

NOU THE STEP PROFILE DATA ARE READ INTO THE COMPUTER

VIA THE ADC 10 ROUTINE. THE RESULTING UNCALIBRATED

STEP PROFILE IS FITTED BY TUO STRAIGHT LINES IN THE

STEP FITTING SUBROUTINE, STPHGT. THE RESULT IS PASSED

BACKED TO THIS PROGRAM AS THE VARIABLE Y4, UHICH IS

MULTIPLIED BY AVKCAL TO YIELD A VALUE FOR THE STEP

HEIGHT, XSTEP, IN UM. THIS IS DONE THREE TIMES FOR

EACH POSITION. THE OPERATOR HAS THE OPTION OF

ACCEPTING OR REJECTING EACH XSTEP OR OF BEGINNING

THE POSITION OVER.

04 SUM3 = 0.

DO 201 K-1,3

NTRACE CK) = K

AT THIS POINT UE REMIND THE OPERATOR TO RESET THE INSTRUMENT.

202

C

C

UR ITE (5,25)

READ (5,5) JUNK

CALL ADC 10 ( 1000, Y' 2307' , 4, 3, BUFFER, 40)

36
349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

C

C

C INFORM OPERATOR OF COMPLETION OF DATA READING AND AMOUNT

C OF UNDERFLOU AND OVERFLOW.

C

LI = 0

L2 = 0

DO 76 I = 1, 1000

IF (BUFFER ( I) .EQ. 2047) LI = LI + 1 IF (BUFFER (I) .EQ. -2048) L2 = L2 + 1 76 CONTINUE

WRITE (5, 31) LI, L2

C

C

CALL STPHGT ( Y 1 , Y3 , Y4, Y5 , Y7 , IE1 (K) , IE2(K) ,HORSPC)

XSTEP(K) = AVKCAL*Y4

HI (K) = AVKCAL*Y1

H3 (K) = AVKCAL*Y3

H5 (K) = AVKCAL*Y5

H7 (K) = AVKCAL*Y7

WRITE(5,9) H1(K),H3(K),H5(K),H7(K)

WRITE (5, 10) NPOS,NTRACE(K) , XSTEP(K)

WRITE (5, 12)

READ(5,3) Q3

IF (Q3.EQ. 'NO' ) GO TO 202

IF (Q3.NE. 'ST' ) GO TO 201

WRITE (5. 19)

GO TO 204

201 SUM3 = SUM3+XSTEP (K)

C

c

C THE AVERAGE STEP HEIGHT IS NOW CALCULATED AND THE RESULTS

C ARE WRITTEN ON THE SURFACE CONSOLE, THE PRINTER, AND THE

C FILE "VOL: ADATE.DAT". THE PROFILE DATA FROM TRACE 3 FOR

C EACH POSITION ARE ALSO WRITTEN INTO THE DATA FILE. THE

C OPERATOR HAS THE OPTION OF GOING TO A NEW POSITION OR

C OF ENDING THE PROGRAM.

C

C

AVSTEP = SUM3/3.

WRITE(5,35)

READ (5, 36) COMENT

WRITE (1,23) NPOS, AVSTEP, COMENT

WRITE (1,26) BUFFER

IF (NP0S.EQ.6 .OR. NPOS. EQ. 16 .OR. NPOS. EQ. 26

l.OR. NPOS. EQ. 36 .OR. NPOS. EQ. 46 .OR. NPOS. EQ. 56

2. OR. NPOS. EQ. 66 .OR. NPOS. EQ. 76 .OR. NPOS. EQ. 86) WRITE(8,37)

WR ITE (8, 2 1 ) NPOS, AVSTEP, COMENT, (NTRACE (K) , XSTEP(K) , K= 1 , 3)

WR ITE (5, 22)

READ (5, 3) Q4

IF (Q4.EQ. 'NO' ) GO TO 206

NPOS = NPOS+1

GO TO 204

206 WR ITE ( 1 , 23, REC=7) NPOS

REWIND 8

207 READ (8, 5, END =208) REGURG

IF (REGURG ( 1 ) . NE . ' 1 ') GO TO 209

WRITE (4, 37)

37
40? GD TO 207

408 209 WRITE (4, S) REGURG

409 GO TO 207

410 208 UR ITE (5,24)

41! RETURN

412 END

The remaining subroutines, STPHGT and ADCIO,

ROUGHNES program.

are shown in the

38
4.4 Flowchart for STEPHGHT

MAIN PROGRAM

The operator is prompted to type the name of the

file that will be created to hold the profile

data.

\/

CALL

STEPCAL

1. 102

\ /

Close

Logical Units

11. 103-105

\/

Stop

1. 106 )

The operator is prompted to type the specimen I.D.,

the type of stylus instrument and its magnification

settings, and the horizontal point spacing of the

data. These parameters are then output to the

console, the data file, and a print file.

The NBS Bus is opened as a logical unit to the

program. It functions as the interface between

the computer and the stylus instrument.

The subroutine to determine the calibration constant

and measure step heights is now called.

39
STEPCAL SUBROUTINE

Page 42

This constant depends on the chart speed

and the data input rate.

The operator is prompted to make this

choice

.

The operator is then asked to type the

name of a previously created data file

that holds the calibration data.

That file is then read for the calibration

constant KCAL and calibrating step height.

The values are also written into the

current data file and the print file.

40
A Page 40

The operator is prompted to type in

the height of the calibrating step.

The calibrating step will be measured

three times.

Subroutine ADCIO is called here.

The subroutine STPHGT is called. It fits

straight lines to the low and high sides

of the step, extrapolates the lines to the

middle of the step, and calculates the

height difference in quantization levels

at the middle of the step and at several

other places along the profile.

The calibration constant KCAL is calculated

and displayed. The height differences

discussed above are calculated and displayed

in urn.

If the operator types "ST", the program

reinitializes the loop and begins the

calibration procedure over again.

Y

41
\ / . Sum KCALS

& Loop 3 Times

1. 291

X/

/

Output

Results

11. 303-306

V

Check

Header Inf cj

^

.

11. 307-310

Misc

.

'input /Output

11. 319-322/

<D

Page 40

X©

The average of 3 KCALs is calculated and

written to the data file. The calibration

constant and other step height parameters

are written to the print file.

The first six lines of the v data file are read back in and output to the console,

so the operator can review the information,

and to the printer.

File manipulation and instructions.

42
Each Step profile will be measured

three times.

Subroutine ADCIO is called.

The subroutine STPHGT is called again.

This time, the results are used to

calculate the height of the unknown

step under test. The results are

displayed on the. console.

43
The average step height is calculated. At

this point the operator -may type in a label,

which is then stored in the data file along

with the third profile for each position.

• The measured step height (and other relevant

information) is output to the data file and

to the print file.

The final number of measured profiles is

written on the data file, and the print

file is output to the printer.

44
4.5 Example Qf STEPKGHT Printout

NBS COMPUTERIZED SURFACE ROUGHNESS FACILITY, STEP HEIGHT MEASUREMENTS

SDS: C27SEP82. DAT

TALYSTEP SYSTEM CHECK USING THE 2. 993UM CALIBRATION STEP

TALYSTEP 10, OOOX VERT. 50X HORIZ.

THE POINT-TO-POINT SPACING IS 2.0000 UM.

WE NOW START THE RECALIBRATION PROCEDURE.

TRACE 1 THE EXTREMA ARE 32 AND 54 MM.

HI H3 H5 H7

2.9875 2.9912 2.9948 2.9985

STEP HEIGHT = 2.9930 UM

KCAL = 0. 127003E-02 UM/QUANTI ZATION LEVEL

TRACE 2

THE EXTREMA ARE 37 AND 60 MM.

HI H3 H5 H7

2. 9864 2. 9908 2. 9952 2. 9996

STEP HEIGHT = 2.9930 UM

KCAL = 0. 126280E-02 UM/QUANTI ZATION LEVEL

TRACE 3

THE EXTREMA ARE 37 AND 61 MM.

HI H3 H5 H7

2.9846 2.9902 2.9958 3.0014

STEP HEIGHT = 2.9930 UM

KCAL = 0. 126439E-02 UM/QUANTI ZATION LEVEL

THE FIRST SIX RECORDS IN TODAY "S FILE ARE:

SD8: C27SEP82. DAT

TALYSTEP SYSTEM CHECK USING THE 2. 993UM CALIBRATION STEP

TALYSTEP 10, OOOX VERT. 50X HORIZ.

2.0000 UM/PT (SPACING)

2.9930 UM = THE HEIGHT OF THE CALIBRATING STEP.

0. 126574E-02 UM/QUANTI ZATION LEVEL = KCAL

POS.

TRACE

TRACE

TRACE

AVE. STEP HEIGHT

1 STEP HEIGHT =

2 STEP HEIGHT = 3 STEP HEIGHT =

3.0002 UM; REMEASUREMENT OF 2.993 UM STEP

3.0000 UM

3.0085 UM

2.9922 UM

45
5. WHATSON

5.1 Summary

The operator can find out what kinds of data are stored on a disk

by typing WHATSON followed by the name of the disk. The disk

must first be in place in one of the drives and marked on by the

operating system. The program reads the disk directory into a file named S RF : WH ATS ON . DAT and reads each line in this file for

the names of the data files. Then it reads and prints the first

ten logical records of each data file so that the operator can

scan the information and learn the important parameters of each

data file.

46
5.2 Operating System Commands

L WHATSON

3 XDE SRF: WHATSON. DAT

4 AL SRF : WHATSON. DAT, IN, SO

5 D T, SRF: WHATSON. DAT

6 D F, @1, SRF: WHATSON. DAT

7 LO . BG, SRF: WHATSON. TSK

S T . BG

? AS 1, SRF: WHATSON. DAT

10 AS 3, L4

:

11 AS 6, C:

12 ST

13 * RETURN TO "FASTMENU"

14 *

15 FASTMENU

16 $EX IT

Notes

:

"D T" writes the time and date in the temporary file SRF : WHATSON. DAT

.

"D F" writes the file directory from the chosen disk in SRF: WHATSON. DAT.

47
5 . 3 WHATSON FORTRAN Program

1 C : 2 C

‘ 3 C ] 4 C 1 5 C ! 6 C 7 C 8 C 9

10

1

1

12

13 C 14 C 15 1 16 2

17 3

18 4

19

20 5

21 6

22 7

23 8

24 9

25 10

26 1

1

27 13

28 14

29 C 30 C 31

32

33

34

35

36

37 50

38

39

40 c. 41 C

42 C

43 C

44

45

46

47

48

49 20

50 C

51 C

52

53

54

55

56

57

58

***** SRF : UHATSON . FTN CALLED BY "UHATSON" *****

THIS PROGRAM IS USED TO FIND OUT UHAT KINDS OF

DATA ARE STORED ON A DISK . THE DISK IS SPECIFIED

BY THE OPERATOR IN THE "UHATSON " COMMAND THAT

STARTS THIS PROGRAM.

T. VORBURGER (8/82)

INTEGER LABELS (20) , STATUS, STAT2, UORDS (200) , TIME (20)

CHARACTER*80 HEADER

CHARACTER*16 FILNAM

HEADER (5 : 5) = ' :'

FORMAT (A75)

FORMAT (' ')

FORMAT (/)

FORMAT (/' AN ERROR UAS ENCOUNTERED UHILE READING'/

1' A LINE IN THE DIRECTORY. I "LL TRY ANOTHER.')

FORMAT (' END OF FILE DIRECTORY'/' THAT"S ALL.')

FORMAT (OX, A4)

FORMAT (' HERE "S UHAT"S ON DISK

FORMAT ( 1H 1

)

FORMAT (20A4)

FORMAT (/' I CAN"T OPEN THIS FILE:',A17/'

FORMAT (/' I CAN "T READ THIS FILE:',A17/'

FORMAT ( 1H , 20A4)

FORMAT (/IX, A75)

A5, ' TODAY.')

1

11 LL TRY ANOTHER.')

I "LL TRY ANOTHER.')

READ (1,9) TIME

READ (1,6) HEADER (1:4)

READ (1,9) LABELS

UR I TE ( 3 , B

)

UR I TE ( 3 , 9 ) TIME

UR I TE ( 3 , 7 ) HEADER (1:5)

READ(1, 1 , END= 102, ERR = 10 1 ) HEADER (6: 80)

IF (HEADER ( 15 : 17) .NE. 'DAT') GO TO 50

HEADER (14: 14) = ' .'

THIS LOOP STRIPS OUT THE BLANKS FROM THE FILE

NAME SO IT CAN BE ASSIGNED.

J 1 =0

DO 201 J= 1 , 17

IF (HEADER ( J : J) .EQ.

J1 = Jl+1

F ILNAM( J 1 : J 1 ) = HEADER (J : J)

1 CONTINUE

OPEN (2, F H..E=FILNAM( 1 : J 1 ) , STATUS 3 ' OLD' , ERR = 104)

READ (2,9, ERR= 105, END

105) UORDS

UR I TE ( 3 , 3

)

UR ITE (3, 14) HEADER

(

1 : 17)

UR I TE ( 3 , 2

)

UR ITE (3, 13) UORDS

CLOSE (2)

') GO TO 201

48
59

60

61

62

63

64

65

66

67

68

69

70

GO TO 50

101 URITEC3,4)

GO TO 50

104 URITEC3* 10) FILNftMC 1 : Jl)

CL0SEC2)

GO TO 50

105 URITEC3.il) FILNAMC 1 : Jl)

CL0SEC2)

GO TO 50

102 URITEC6.5)

STOP

END

49
5.4 Flowchart for WHATSON

«

Prior to executing the FORTRAN program,

the time of day and the directory of

disk file names are read into a temporary

file, SRF : WHATSON.DAT.

The time of day and the name of the disk

are read from SRF: WHATSON. DAT

Read a file name from SRF iWHATSON.DAT

and check to make sure that it is a data file.

Add punctuation and strip out the blanks

so that the file name can be read correctly

and opened as a logical unit

.

Open the data file as a logical unit and

read the first ten lines.

Print the file name and the first ten

lines, then go back to line 37 to read

the name of the next data file.

Statements for handling errors and the

encounter with an end of file.

50
5.5 Example of WHATSON Printout

9/27/82 12:54:38

HERE" S WHAT "S ON DISK 5D8 : TODAY.

SD8 : A07SEP82. DAT

SD8: A07SEP82. DAT

MCDONNELL DOUGLAS ASTRONAUTICS CO.; S/N EI2454S;

TALYSURF; 2, OOOX VERTICAL; 4X HORIZONTAL; 0.75 MM CUTOFF

0.9500

12. 7300

0. 648671E-02

11

1 3. 0520

85 113 141 170 200 229 257 297 318 350 383 418 453 487 519 54

573 599 625 651 676 702 729 754 778 800 816 824 824 815 801 78

SD8 : A24AUG82. DAT

SD8: A24AUG82. DAT

GAR ELECTROFORMING DIV. ; SPECIMENS #8, 10. 12

TALYSURF; 10, OOOX VERT.; 4X HOR. ; 7.5 MICRON RAD. STYLUS; 0.75 MM CUTOFF

0. 9500

2. 9930

0. 131316E-02

18

1 0. 2030

-116 75 196 211 163 117 98 104 129 163 190 197 182 144 79

-66 -55 0 44 44 28 35 66 95 104 96 81 65 67 96 14

SD8 rAHMAY82.DAT

SD8: A11MAYS2. DAT

ULTRA SONIC REFERENCE ELCCKS; CS-2; URB-1

TALYSURF; 10, OOOX VERTICAL; 4X HORIZONTAL; 7.5 U-M RADIUS STYLUS

0. 9500

2. 9930

0. 132030E-02

14

1 0. 2679

-82 -111 -145 -168 -169 -155 -138 -125 -115 -107 -99 -93 -93 -100 -114 -13

-161 -198 -243 -292 -339 -3S5 -442 -518 -609 -706 -801 -371 -SB1 -823 -733 -64

51
6. AVRGRA

6.1 Summary

AVRGRA is used in calibrations to calculate the average values of

the R a and step height data gathered by ROUGHNES and STEPHGHT.

The random uncertainty shown in the printout, sec. 6.5,

represents three standard deviations but includes a statistical

factor for finite samples. For a set of n values Xj_ the random

uncertainty (RU) is given by

where x is the average value and K(n) is the factor which depends

on the number of values n. K(n) has been tabulated by Natrella

[7] for a range of n values.

The calibration uncertainty is calculated from one of ten

formulas, the choice of which depends on 1) whether R a or step

height is being calculated and 2) the calibration step height.

Each formula depends explicitly on the measured step height.

Similar formulas have been given previously [8], but a few

changes have been made on them to yield the present ones. These

changes result from ongoing improvements and remeasurements of

the system including the introduction of a new calibration step,

the remeasurement of two others, remeasurement of the system

noise, and further analysis of the uncertainties of roughness

measurement for a highly smooth surface. The total uncertainty

(sec. 6.5) is the sum of ttje random and calibration

uncertainties

.

1/2

)

( 6 . 1 )

52
6.2 Operating System Commands

1 ***** AVRGRA *****

2 *

3 LO . BG, SRF: AVRGRA. TSK

4 T . BG

5 CLOSE ALL

6 AS 3/ L4

7 AS 5, C:

8 AS 6, C:

9 ST

10 *

11 * RETURN TO " FASTMENU "

.

12 #

13 FASTMENU

14 $EXIT

53
6.3 AVRGRA FORTRAN Program

12

3

4

5

6

7

8

9

10

1

1

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

C ***** SRF : AVRGRA . FTN CALLED BY 'AVRGRA' *****

C THIS PROGRAM DOES TUO THINGS:

C 1) IT CALCULATES THE AVERAGE, AND STANDARD DEVIATION

C FOR A SET OF M DATA POINTS, UHICH ARE ENTERED AT THE

C CONSOLE. THESE DATA POINTS ARE NORMALLY THE RESULTS

C FOR ROUGHNESS AVERAGE (RA) OR STEP HEIGHT MEASUREMENTS

C OBTAINED IN THE "PROFILE" PROGRAM. NOTE THAT THE FACTOR

C FOR SMALL STATISTICAL SAMPLES IS INCLUDED IN THE STANDARD

C DEVIATION (LINES 80-S2) .

' C 2) THE PROGRAM ALSO CALCULATES THE CALIBRATION UNCERTAINTY

C AND TOTAL UNCERTAINTY FOR RA AND STEP HEIGHT MEASUREMENTS.

C THEREFORE, IT MAINLY IS USED AS A SUMMARY IN CALIBRATION REPORTS.

C T. VORBURGER, 1978 CLAST REVISION 7/82)

C

C

DIMENSION RA (25) , STATK (25) , DATE ( 10) , SMPL ID (20)

1 FORMAT ( ' SOMETH ING"S URONG. UHAT"S THE CALIBRATING STEP?')

11 FORMAT ( 10X, 8(2X, F10.5)

)

12 FORMAT (F 10 . 4)

13 FORMAT (20A4)

14 FORMAT (

' NOU UE UILL CALCULATE THE AVERAGE ROUGHNESS',

T OR STEP HEIGHT OF'/' THE SURFACE, THE RANDOM',

1' UNCERTAINTY, THE CALIBRATION'/' UNCERTAINTY, 8,',

T THE TOTAL UNCERTAINTY.'/' UHAT IS THE DATE OF THE',

1' MEASUREMENTS?')

15 FORMAT (' STEP OR ROUGHNESS?')

16 FORMAT ( ' UHAT IS THE SAMPLE ID?')

17 FORMAT ( ' UHAT IS THE HEIGHT OF THE CALIBRATING '

1

, ' STEP IN UM?')

18 FORMAT (

' HOU MANY MEASUREMENTS? INCLUDE THE DECIMAL',

*1' POINT EXPLICITLY.')

19 FORMAT (' NOU PUNCH IN THE', 13,' DATA POINTS IN',

1' UM,'/' ONE ON EACH LINE.')

20 FORMAT ( 10X, F7 . 4, ' UM CALIBRATING STEP')

21 FORMAT (/10X, ' THE MEASURED POINTS IN UM ARE:')

22 FORMAT ( 10X, 5F 10 . 4)

23 FORMAT C//10X, 'THE FINAL RESULTS IN UM ARE:'/

1 18X, ' RA' , 8X, ' RANDOM CAL IBRATION' , 4X, ' TOTAL'

/

124X, 3

(

' UNCERTAINTY'))

24 FORMATC/10X, 'THE FINAL RESULTS IN UM ARE:'/

1 17X, ' STEP' , 7X, ' RANDOM CALIBRATION' , 4X, ' TOTAL'

/

1 16X, ' HE I GHT' , 2X, , 3

( ' UNCERTA I NTY' )

)

25 FORMAT ( 1H 1///10X, 20A4)

26 FORMAT ( 10X, 20A4)

27 FORMAT (IX, 20A4)

28 FORMAT (//' DO ANOTHER CALCULATION?'/' Y OR N?'

)

29 FORMAT (A2)

30 FORMAT (///' *** REMINDER! ***' /

1' THE CALIBRATION UNCERTAINTY IS GIVEN FOR THE TALYSTEP.' /

2' THE TALYSURF CU FOR A CALIBRATING STEP OF 0.301 UM' /

3' MUST BE CALCULATED BY HAND.' ///)

C

C

C FIRST, THE OPERATOR IS ASKED TO TYPE IN SEVERAL

C PARAMETERS NEEDED IN THE CALCULATIONS.

C

C

58 CALL CARCON (3,1)

54
59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

1 10

111

112

113

114

115

116

n

n

n

n

r»o

n

nn

n

on

100 WRITE(6. 14)

READ (5* 13) (DATE(I). 1 = 1. 10)

WRITE(6. 15)

READ(5. 13) HORR

WRITE (6, 16)

READ (5, 13) (SMPL ID ( I)* 1=1* 20)

WRITE(6. 17)

READ (5* 12) CALSTP

WRITE(6. 18)

READ (5* 12)RM

M = RM

URITEC6, 19) M

READ (5. 12) (RA(I). I=1.M)

WRITE (6, 27) (DATE (I), 1 = 1. 10)

WR ITE (6. 27) (SMPLID(I). 1=1.20)

WRITE (6, 20) CALSTP

WRITEC6.21)

WRITE (6. 22) CRA(I). 1 = 1. M)

WRITE (3. 25) (DATE ( I). 1 = 1. 10)

WRITE (3. 26) (SMPLID(I). 1=1.20)

WRITE (3. 20) CALSTP

WRITE (3. 21)

WR ITE (3. 22) ( RA ( I )

.

1 = 1. M)

DATA STATK/0.. .797. .886. .921. .940. .952. .959. .965. .969

1.

.

973. .975. .977. . 979. . 98 1 . . 982. .983. .984. .985. .986

2.

.

987. .987. .983. .988. .989.-989/

THE CALCULATION OF THE AVERAGES AND STANDARD

DEVIATIONS FOLLOWS NEXT.

SUM = 0.

DO 110 1=1.

M

110 SUM = SUM+RA ( I

)

FINLRA = SUM/RM

SUMDEV = 0.

DO 112 1=1.

M

DEVSQ = (RA(I)-FINLRA)**2

112 SUMDEV = SUMDEV+DEVSQ

VAR = SUMDEV/ (RM-1.)

SD = SORT (VAR) /STATK(M)

RU = 3.*SD

Q = FINLRA/CALSTP

IF (HORR .EQ. 'ROUG') GO TO 130

THE CALIBRATION UNCERTAINTY FOR STEP HEIGHTS IS

CALCULATED IN THIS SECTION.

WRITE (3.24)

WRITE (6.24)

IF (CALSTP .EQ. .025) GO TO 121

IF (CALSTP .EQ. .301) GO TO 122

IF (CALSTP .EQ. 2.993) GO TO 123

IF (CALSTP .EQ. 12.73) GO TO 123

IF (CALSTP .EQ. 22.9) GO TO 123

55
1

1

?

1 18

1 19

120

121

122

123

124

125

126

12?

128

129

130

131

132

133

134

135

136

13?

138

139

140

141

142

143

144

145

146

14?

148

149

150

151

152

153

WRITE (6, 1)

GO TO 200

121 CU = .B01*CSQRTC6. 1*Q**2 + 1.69) + 6.*Q)

GO TO 140

122 CU = .001*(SQRT(233.*Q**2 + 4.) + 12. *Q)

GO TO 140

123 CU = SQRT( C .02?*Q)**2 + ( . 0 1*F INLRA) **2 +( . 0 1*CALSTP) **2) +. 03*Q

GO TO 140

C

c

C THE CALIBRATION UNCERTAINTY FOR ROUGHNESS IS

C CALCULATED IN THIS SECTION, AND THE FINAL RESULTS ARE PRINTED.

C

C130 UJR ITE (3, 23)

WRITE (6, 23)

IF CCALSTP .EQ. .025) GO TO 131

IF (CALSTP .EQ. .301) GO TO 132

IF (CALSTP .EQ. 2.993) GO TO 133

IF (CALSTP .EQ. 12. ?3) GO TO 133

IF (CALSTP .EQ. 22.9) GO TO 133

WRITE (6,1)

GO TO 200

131

CU = .001*(2.?91*Q + SQRT(36.*Q*Q + .0881))

GO TO 140

132 CU= . 00 1*(SQRT(233 . *Q**2+4. ) +SQRT( 144. *Q**2+16 . 0256)

)

WR ITE (6, 30)

GO TO 140

133 CU=SQRT ( ( . 027*Q) **2+. 000296*F INLRA**2) +SQRT( ( . 03*Q|**2+3 . 6E-5)

140 TU = RU+CU

WR I TE ( 3 , 11) FINLRA,RU,CU,TU

WR ITE (6, 11) F INLRA, RU, CU, TU

200 WRITE (6,23)

READ (6,29) QUERY

IF (QUERY .EQ. ' Y '

) GO TO 100

STOP

END

56
6.4 Flowchart for AVRGRA

The operator is prompted to type the date, the

choice of whether these will be Ra or step data,

the sample I.D., the calibrating step height,

and the number of data points.

The operator now types in the data points.

The above data are now printed on the printer

and the console.

The statistical factors which figure in the

calculation of standard deviation for finite

data sets [7] are entered in this data statement.

Calculation of averages and standard deviations.

The branch to the calibration uncertainty

calculation depends on whether these are step

heights or roughness data.

57
Calculation of Calibration Uncertainty*

Total Uncertainty

= Random + Calibration Uncertainties

The average Ra or step height and

the uncertainties are printed on the

console and the printer

.

58
6.5 Example of AVRGRA Printout

JUNE 5i 1980

0.3 UM PROTOTYPE SRM

2.9930 UM CALIBRATING STEP

THE MEASURED POINTS IN UM ARE:

0.2953 0.2949 0.2949 0.2944

0.2950 0.2942 0.2950 0.2946

0.2946

0. 2928

THE FINAL RESULTS IN UM ARE:

RA RANDOM CALIBRATION TOTAL

UNCERTAINTY UNCERTAINTY UNCERTAINTY

0.29457 0.00216 0.01241 0.01457

i

59
7. SMORGAS

7.1 Summary

This program calculates seven surface texture parameters from

profile data. These are the roughness average - R a , rms

roughness - R

q

, peak-to-valley roughness - R tm , average slope -

S a , average wavelength - D a , a new parameter we call the peakcount wavelength - Dp C , and skewness - Q. The parameters are

calculated for each profile in a file as well as the averages and

standard deviations of the mean for the set of profiles. The key

elements in the program are the formulas used to calculate the

various parameters. They are summarized as follows:

N

R

a

= (1/N) £ ! y i I , (7.1)

i = 1

where the y^'s represent the set of digitized profile ordinates

measured with respect to the mean line. The total number of

points (N) in the profile is equal to 4000.

R

q = (1/N) E y^ 2

1 1/2

i = 1

N

Q

R

= (i/N) E yi 3 / R n 3 - i = 1 4

J

tm = (1/J) £ ( ymax”y min ) j

>

j = 1

(7.2)

(7.3)

(7.4)

where (y m a X -y m i n ) j is the height difference between the highest

peak and lowest valley in a given sampling length, a quantity

chosen by the operator. The sampling length is divided into the

total profile length to give the integral number of sampling

lengths J.

1+Pk

s

a

= (1/pkT) Y i y j +K-y J

i , (7.5)

j=1 , 1+k, 1+2k. .

.

where T is the horizontal point spacing of the digitized profile

and kT is the horizontal point spacing, chosen by the operator,

that determines the resolution of the calculation. The quantity

60
kT is equal to an integral number of point spacings in the

profile itself and P is the total number of these kT spacings in

the profile.

The wavelength parameters, D and D

pp , attempt to quantify the

average horizontal distance between adjacent irregularities of a surface profile. Since, for a random profile, this involves

judgement as to the definition of the irregularities themselves,

the parameters,

different ways.

and D pc» calculate the wavelength in two

The average wavelength, D uses the ratio of the height

parameter R a to the average slope [ 9 ],

D

a = 2 jc R a /S a

. (7.6)

Alternatively, the peak-count wavelength D pc relates the

irregularities to a definition of the significant peaks and

valleys of the profile.

D pc = 2 (N-1 )T/X, (7.7)

where (N-1)T is the total profile length and X is the number of

times that the profile crosses completely through amean band

with height equal to R-, that is centered around the profile mean

line [10], If the prorile were a perfect sine wave, D pc and D a would yield essentially the same value of wavelength. h ~

There are three important options which the operator must provide

SMORGAS:

calculation, and

3. the choice of calculating a mean line by taking the least

squares straight line fit to the data or by taking the

simple mean of the data points.
7.2 Operating System Commands

1nC- O

4

5

6

7

8

9

10

1

12

13

14

15

16

17

IS

19

20

21

24

25

K-K-K-K--#- SMORGAS

•j* LO .BO, SRF: SMORGAS. TSK

T. BG; CLOSE ALL

AS 3, L4 : ; AS 6, C:

$ I FNN 01

$IFNX 01

$W*; $W*

THE INPUT FILE YOU NAMED DOES NOT EXIST.

TRY AGAIN .

CA . BG

$EX IT

$ENDC

AS 5. 01

$ENDC

$IFNU 01

AS 5; C:

$ENDC

ST

#* RETURN TO "FASTMENU".

•H- FASTMENU

$EX IT

Notes

The statements on lines 6-18 direct the computer to read the input parameters either

from a data file or from the system console.

62
7-3 SMORGAS FORTRAN Program

1 C = 2 C

‘ 3 C 1 4 C 1 5 C 1 6 C 1 7 C

' 8 C

9 C ! 10 C

11 C

12 c

13

14

15

16

17

18

19

20 c

21 c 22 1 23 2

24 3

25 4

26

27

28

29 5

30 6

31 7

32 8

33 9

34 10

35 11 36

37 12

38 13

39 14

40 15

41

42

43 16

44

45 17

46 18

47 19

48

49 20

50

51

52

53 21

54

55 22

56

57 23

58 24

***** SRF : SMORGAS . FTN CALLED BY THE COMMAND 'SMORGAS' *****

THIS PROGRAM CALCULATES A SMORGASBORD OF SURFACE

ROUGHNESS PARAMETERS FOR SURFACE PROFILES. THESE ARE

ROUGHNESS AVERAGE-RA. RMS ROUGHNESS-RQ. PEAK-VALLEY ROUGHNESS-RTM.

AVERAGE SLOPE-SA. AVERAGE WAVELENGTH-DA.

PEAK-COUNT WAVELENGTH-DPC. AND SKEWNESS.

THE STANDARD DEVIATION CALCULATED AT THE END

INCLUDES THE STATISTICAL K FACTOR FOR FINITE

SAMPLES.

T. VORBURGER 3/79 (REVISED 2/26/82)

DIMENSION RA(75).RQ(75).SA(75).RTM(75).SKEW(75)

DIMENSION DPCC75) .PC(75)

INTEGER SUM1 , SPEC (20) .NRUN (75) . SUMRA.SUMSA. CUTOFF. UP2. L0U2

INTEGER*2 PROF IL (4000) . DATF IL (9) . A. B

REAL KCAL.NSUM. LAMBDA (75)

DATA PI.DATFIL(7).DATFIL(8).DATFIL(9)/

13. 14159. 2H.D.2HAT.2H /

FORMAT(F10.4)

FORMAT(40A2)

FORMAT (20A4)

FORMAT(' PRESENTING A SMORGASBORD OF SURFACE'/

T PARAMETERS FOR YOUR ANALYTICAL PLEASURE!'/

2' WHAT IS THE FILE NAME? FORMAT SHOULD'/

3' BE "VOL: NAME" WITH EXACTLY 12 CHARACTERS.')

FORMAT( 12)

FORMAT(/' POINT TO POINT SPACING ='.F8.4.' UM'

)

FORMAT(/' KCAL -'.E13.6. ' UM/QUANTI2ATI0N LEVEL')

FORMAT (/' THERE ARE ', 12.' PROFILES')

FORMAT ( 1615)

FORMAT ( IX. I2.3F10.4. E13.4.F9.3.F6. 1.2F9.3)

FORMAT!' ERROR STATUS = '.12.' ON OPENW ROUTINE'//

1' COME ON. TURKEY. DO IT OVER AND GET IT RIGHT THIS TIME!')

FORMATdX. I2.3F10.5.E13.4. F9.3.F6. 1.2F9.3)

FORMAT (3X. 3F 10 . 5. E 13 . 4. F9 . 3. 6X. 2F9 .3)

FORMAT!//' DO YOU WISH TO CONTINUE?'//' Y OR N?')

FORMAT (///IX. ' POS' . 4X. ' RA' . 8X. ' RQ' . 7X. ' RTM' . 9X. ' AVE'

.

1 7X. ' AVE' . 6X. ' PC ' . IX. ' PEAK-COUNT' . 3X. ' SKEW'

/

239X. ' SLOPE' . 2X, ' WAVELENGTH' . 6X. ' WAVELENGTH' /)

FORMAT(/10X. 'AVERAGES WITH THREE STANDARD DEVIATIONS'.

1' OF THE MEAN (UM)'/)

F0RMAT(3X. 3F 10 . 4. E 13 . 4. F9 . 3. 6X. 2F9 . 3)

F0RMAT(E13.6)

FORMAT (//' THE DATA ARE BEING FITTED TO A LEAST SQUARES'/

1' STRAIGHT LINE FOR THIS CALCULATION.')

FORMAT (' WHAT IS THE POINT-TO-POINT SPACING'/

1' FOR THE SLOPE CALCULATION? A GOOD CHOICE'/

2' IS THE STYLUS RADIUS OR. IF THE STYLUS IS FLAT'/

3' ON TOP. THE WIDTH OF THE STYLUS TIP.')

FORMAT!/ ' EXPRESS THE VALUE IN UM 8. INCLUDE'/

5' THE DECIMAL POINT EXPLICITLY.')

FORMAT ( ' SHOULD WE DO A LEAST SQUARES STRAIGHT LINE FIT'/

1' TO THE DATA? "Y" OR "N"?')

FORMAT ( ' I CAN"T READ THIS NAME. TRY AGAIN.')

FORMAT! 1H .40A2)

63
59

60

61

62

63

64

65

66

67

68

.69 70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

186

107

188

109

110

111

112

113

1 14

115

116

25 FORMATC 1H1)

26 FORMAT C

' UE ROUNDED OFF THE VALUE YOU SUGGESTED'/

1' TO', FIB. 4, ' SO THAT THE POINT-TO-POINT SPACING'/

2' FOR THE SLOPE CALCULATION IS EXACTLY ',12/

3' TIMES THE POINT-TO-POINT SPACING OF THE DATA.')

27 FORMAT C/F8 . 4, ' UM = POINT-TO-POINT SPACING',

1' FOR THE SLOPE CALCULATION.'/' THIS = ',13,

2' TIMES THE DATA POINT SPACING.')

28 FORMATC' UHAT IS THE SAMPLING LENGTH FOR THE RTM CALCULATION?'/

1' A GOOD CHOICE IS 800 UM.')

29 FORMAT C IX, 20A4)

30 FORMAT C/F9 .3, ' UM = SAMPLING LENGTH FOR THE RTM CALCULATION.'/

1' THIS = ',14,' TIMES THE DATA POINT SPACING.')

31 FORMATC//' A MEAN VALUE IS BEING SUBTRACTED FROM THE DATA.')

C

C FIRST, THE OPERATOR IS ASKED TO TYPE THE NAME OF THE DATA

C FILE. THIS FILE IS THEN ASSIGNED TO LU 10 AND SUBSEQUENT

C DATA ARE READ FROM IT. THE OPERATOR IS ALSO PROMPTED TO

C TYPE THE INTERVAL SPACING FOR THE SLOPE CALCULATION

C AND THE SAMPLE INTERVAL FOR RTM.

C

95 ITRY = 0

92 UR ITE C6, 4)

READ C5, 2, ERR=93, END= -Z) CDATFILCJ) , J=l,6)

UR I TE C 6 , 24) DATF I

L

GO TO 94

93 ITRY = ITRY + 1 IF CITRY .GT. 2) GO TO 703

UR ITE C6, 23)

GO TO 92

94 CALL OPENUC 10, DATF I L, 0,1-3, I3TAT)

IFCISTAT.LT. 1)G0 TO 90

URITEC6, 11) ISTAT

ITRY = ITRY + 1 IF CITRY .GT. 2) GO TO 7QZ

GO TO 92

90 READ C 10. 3, REC=2) SPEC

READC 10, 1 , REC=4) PTTOPT

READC 10, 18, REC=6) KCAL

READ C 10, 5) NTOT

URITE C3, 25)

UR ITE C3, 24) DATF I

L

UR ITE C3, 29) SPEC

UR ITE C3, 6) PTTOPT

UR ITE (3, 7) KCAL

URITE C3 . A) NTOT

URITE C6, 28)

URITE C6, 2 1

)

READ C5, 1) SAMLGT

RCUT = SAMLGT/PTTOPT

CUTOFF = NINTCRCUT)

IF CCUTOFF .GT. 4B00) CUTOFF = 4000

SAMLGT = CUTOFF>kPTTOPT

URITE C6.30) SAMLGT, CUTOFF

URITE C3, 30) SAMLGT, CUTOFF

UR ITE C 6, 20)

URITE C6.21)

READ C5, 1 ) RPT

64
117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

RSPACE = RPT/PTTOPT

NSPACE = NINT(RSPACE)

RPT = NSPACE*PTTOPT

WRITE (6,26) RPT, NSPACE

WRITE (3, 27) RPT, NSPACE

WRITE (6,22)

READ (5,2) QUERY1

IF (QUERY1 .EQ. 'Y ') WRITE (3. 19)

IF (QUERYl .EQ. 'N ') WRITE(3,31)

C

C NOW, WE START THE MAIN LOOP IN WHICH EACH SET OF

C PROFILE DATA IS READ AND ANALYZED TO FIND THE ABOVE QUANTITIES

C

DO 900 IRUN=l,NTOT

READ( 10,5)NRUN( IRUN)

READ( 10, 9) PROF I

C

C AT THIS POINT, WE SUBTRACT A MEAN VALUE

C FROM THE PROFILE DATA OR DO A LEAST SQUARES

C STRAIGHT LINE FIT.

C

IF (QUERYl .EQ. ' Y' ) GO TO 210

CALL MEAN (PROF IL, 4000)

GO TO 220

210 CALL LEASQ (PROF IL, 4000)

C

C NOW, WE CALCULATE RA, RQ, AND SKEWNESS.

C

220 SUMRA = 0

SUMRQ = 0.

SUMSKW = 0.

DO 200 I = 1,4000

SUMRA = SUMRA + ABS(PRQFIL( I)

)

SUMRQ = SUMRQ + PROF IL ( I ) *PROF IL ( I

)

RPRO = PROFIL(I)

SUMSKW = SUMSKW + RPRO*RPRO*RPRO

200 CONTINUE

RA(IRUN) = SUMRA*KCAL/4000.

RQ(IRUN) = SQRT (SUMRQ/4000 . ) *KCAL

SKEW(IRUN) = SUMSKW*SQRT(4000.)/(SUMRQ**1.5)

C

C AT THIS POINT, WE CALCULATE RTM.

C

PVSUM = 0.

NUMCUT = 4000/CUTOFF

DO 800 I = 1, NUMCUT

UP2 = -2048

L0W2 = 2048

DO 801 J-l, CUTOFF

K = ( I-l)*CUTOFF + J

IF (PROFIL(K) .GT. UP2) UP2 = PROFIL(K)

IF (PROF IL (K) .LT. LOW2) L0W2 = PROFIL(K)

801 CONTINUE

I WRITE = UP2-L0W2

800 PVSUM = UP2 - L0W2 + PVSUM

RCUT = NUMCUT

RTM (IRUN) = KCAL*PVSUM/RCUT

65
175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

C NOW, WE CALCULATE THE AVERAGE SLOPE,

C AND THE AVERAGE WAVELENGTH.

C

SUMSA = 0

NSUM = 0.

DO 300 1=1, 3999, NSPACE

IUP = I + NSPACE

IF (IUP .GT. 4000) GO TO 300

D IFF=PROF IL ( IUP) -PROF IL ( I

)

SUMSA = SUMSA + ABSCDIFF)

NSUM = NSUM + 1. 300 CONTINUE

C

SA ( I RUN) = SUMSA*KCAL/(NSUM*RPT)

LAMBDA ( IRUN) = 2 . *P I*RA ( IRUN) /SA ( IRUN)

C

C NOW UE COMPUTE THE PEAK-COUNT WAVELENGTH. IT IS DEFINED

C AS THE PROFILE LENGTH DIVIDED BY HALF THE NUMBER OF TIMES

C THAT THE PROFILE CROSSES A MEAN BAND CENTERED ABOUT THE

C MEAN LINE. THE WIDTH OF THE MEAN BAND IS EQUAL TO RA

.

C

UP = SUMRA/8000.

RLOU = -SUMRA/8000.

C

C NOW, WE DETECT AND COUNT THE BANDWIDTH CROSSINGS.

C

A=0

B=0

E=0.0

DO 500 1=1,4000

IF (PROF IL ( I ) . EQ . UP . OR . PROF IL ( I ) . EQ . RLOW) GO TO 500

410 IF(PROFIL(I) .LT.UP)GO TO 420

IFCA.EQ. l)GO TO 500

A=1

GO TO 450

420 IF (PROF IL ( I ) . LT. RLOW) GO TO 430

GO TO 450

430 IF (B.EQ. l)GO TO 500

B= 1 450 IF ( (A+B) .NE.2)G0 TO 500

E-E+1.0

A=0

B=0

GO TO 410

500 CONTINUE

PC (IRUN) = E/2.

DPC(IRUN) = 7998.*PTT0PT/E

900 CONTINUE

C

C THE RESULTS FOR EACH PROFILE ARE NOW PRINTED

C

WRITE (3, 15)

DO 600 K= 1 , NTOT

IF CRA(K) .LT. 0.001) GO TO 601

600 CONTINUE

GO TO 602

601 WR ITE (3, 12) (NRUN (K),RA(K),RQ(K), RTM(K) , SA (K)

,

lLAMBDA(K) ,PC(K) ,DPC(K) ,SKEW(K) ,K=l,NTOT)

66
233 GO TO 603

234 602 URITEC3, 10) (NRUN (K),RA(K),RQ(K), RTM(K) , SA GO , 235 1 LAMBDA (K),PC(K), DPC (K) , SKEU(K) , K = 1 , NTOT)

236 C

237 C THE MAIN LOOP IS COMPLETE.

238 C FINALLY UE CALCULATE THE AVERAGES AND STANDARD

239 C DEVIATIONS OF ALL THE ABOVE QUANTITIES AND PRINT THEM.

240 C

241 603 CALL AVSD (NTOT, RA, FNLRA, SDRA)

242 CALL AVSD (NTOT, RQ, FNLRQ, SDRQ)

243 CALL AVSD ( NTOT, RTM, FNLRTM, SDRTM)

244 CALL AVSD (NTOT, SA,FNLSA,SDSA)

245 CALL AVSD ( NTOT, LAMBDA, FNLLAM, SDLAM)

246 CALL AVSD (NTOT, DPC, FNLDPC, SDDPC)

247 CALL AVSD (NTOT, SKEU, FNLSKU, SDSKU)

248 URITE (3,16)

249 CALL CLOSE (10, ISTATE)

250 IF (FNLRA .LT. 0.001) GO TO 701

251 GO TO 702

252 701 URITE (3, 13) FNLRA, FNLRQ, FNLRTM, FNLSA, FNLLAM,

253 1FNLDPC, FNLSKU, SDRA, SDRQ, SDRTM, SDSA,

254 2SDLAM, SDDPC, SDSKU

255 GO TO 92

256 702 URITE (3,17) FNLRA, FNLRQ, FNLRTM, FNLSA, FNLLAM,

257 1FNLDPC, FNLSKU, SDRA, SDRQ, SDRTM, SDSA,

258 2SDLAM, SDDPC, SDSKU

259 URITE (6,14)

260 READ (5,2) QUERY2

261 IF (QUERY2 .EQ. ' Y ' ) GO TO 95

262 703 STOP

263 END

264 C

265 C

266 C THIS SUBROUTINE CALCULATES THE MEAN AND STAN267 C DARD DEVIATION OF THE MEAN OF A SET OF DATA VALUES.

268 C

269 C

270 SUBROUTINE AVSD (N, VALUE, FNL, SDM)

271 DIMENSION VALUE (75) , STATK (25)

272 DATA STATK/0 . , . 797, . 886, .921,. 940, . 952, . 959, . 965, .

:

273 1, .973, .975, .977, .979, .981, .982, .983, .984, .985, .986

274 2, .987, .987, .988, .988, .989, .989/

275 SUM1 = 0.

276 RN = N 277 SUM2 = 0.

278 DO 100 I = 1,

N

279 SUM1 = SUM1 + VALUE ( I)

280 100 CONTINUE

281 FNL = SUM1/RN

282 DO 200 I = 1 ,

N

283 DEV = VALUE ( I) - FNL

284 SUM2 = SUM2 + DEV**2

285 200 CONTINUE

286 SDM = 3. *SQRT (SUM2/(RN*(RN- 1 . ) ) ) /STATK (N)

287 RETURN

288 END

289 C

290 C NEXT, UE CALCULATE THE MEAN OF THE DATA AND SUBTRACT

‘ 67
23 1 292

293

294

295

296

29?

298

299

300

301

302

303

304

305

306

30?

308

309

310

311

312

313

314

315

316

31?

318

319

320

321

322

323

324

325

326

32?

328

329

330

331

332

333

334

335

336

33?

338

339

340

341

342

343

344

345

C IT FROM EACH POINT OF THE SURFACE PROFILE.

C

SUBROUTINE MEAN (PROF IL, N)

INTEGERS PROF IL (N)

INTEGER SUM1

SUM1 =0

DO 50 1=1,4000

SUM1 =SUMl+PROF IL ( I

)

50 CONTINUE

RMEAN = SUM1/4000.

MEEN = N INT(RMEAN)

DO 100 1=1,4000

PROFILCI) = PROFILCI) - MEEN

100 CONTINUE

RETURN

END

C

C

C THIS ROUTINE CALCULATES THE LEAST SQUARES STRAIGHT LINE FOR

C A SET OF 4000 EQUALLY SPACED DATA POINTS. IT CAN BE USED TO

C FILTER OUT ANY SLOPE IN A SET OF PROFILE DATA.

C

SUBROUTINE LEASQ (PROF IL, N)

INTEGERS PROFIL(N)

DOUBLE PRECISION SUMX2, SUMXY, DELTA, AZERO, AONE

RN = N

C

C IN THE LEAST SQUARES FIT, UE HAVE ALREADY

C CALCULATED THE SUM OF THE X' S AND X SQUARES,

C UHOSE VALUES NEVER CHANGE. THIS AVOIDS HAVING

C TO CALCULATE THEIR VALUES IN THE LOOP.

C

SUMX1 = 8002000.

SUMX2 = 2 . 1341334D 10

SUMY1 = 0.

SUMXY = 0.

DO 101 1=1,

N

SUMY1 = SUMY1 + PROF IL ( I

)

SUMXY = SUMXY + I*PROFIL(I)

101 CONTINUE

C

DELTA = RN*SUMX2 - SUMX1*SUMX1

AZERO = (SUMX2*SUMY1 - SUMX1*SUMXY) /DELTA

AONE = (RN*SUMXY - SUMX1*SUMY1 ) /DELTA

C

DO 102 1=1,

N

RI = I SUB = AZERO + AONE*RI

X = 0.5

IF (SUB .LT. 0.) X = -X

NSUB = SUB + X

PROF IL ( I ) = PROF IL ( I ) - NSUB

102 CONTINUE

RETURN

END

68
7.4 Flowchart for SMORGAS

Begin

1. 80

Input

File Name

11. 80-94

Input

Parameters

11. 95-104

Input

Sampling

Length

.1. 105-113

Input

Point

Spacing

/II . 114-121

Input

Choice of

Mean Line

/II . 122-125

©

The operator is prompted to type the name

of the data file to be examined. The file

is then opened as a logical unit.

The program reads the specimen I.D., the

horizontal spacing of the data points, the

instrument calibration constant, and the

total number of profiles in the file. The

information is then printed out.

The operator is prompted to input the

sampling length for the Rtm calculation.

The operator is prompted to input the

point-to-point spacing foi: the slope

calculation.

The operator is prompted to choose whether

or not to fit a least squares line to the

data to be used as the mean line

.

69
The loop to calculate the parameters

for each profile begins here.

A subroutine, either LEASQ or MEAN,

is called.

Ra , Rq, and the skewness are calculated.

70
©

Call AVSD

.

71
7.5 Example of SMORGAS Printout

The surface described here is a prototype calibration specimen

was specially machined to have a sinusoidal profile [11].

3: SRMS3MUM. DAT

SINUSOIDAL PROTOTYPES WITH 3 UM RA, 2SAPR7S

POINT TO POINT SPACING = 0.9500 UM

KCAL = 0. 672072E-02 UM/ QUANTIZATION LEVEL

THERE ARE S PROFILES

799.900 UM = SAMPLING LENGTH FOR THE RTM CALCULATION.

THIS = 842 TIMES THE DATA POINT SPACING.

7.6000 UM = POINT-TD-POINT SPACING FOR THE SLOPE CALCULATION.

THIS = 8 TIMES THE DATA POINT SPACING.

THE DATA ARE BEING FITTED TO A LEAST SQUARES

STRAIGHT LINE FOR THIS CALCULATION.

POS RA RQ RTM AVE AVE PC PEAK-COUI

SLOPE 1WAVELENGTH WAVELENC'

I 2. 961

1

3. 3075 9. 7921 0. 1B65E+00 99. 749 37. 5 101. 303

o 2.9737 3. 3164 9. 6644 0. 1 B57E+00 100. 623 37. 0 1C2. 677

3 2. 9786 3. 3171 9. 6896 0. 1859E+00 100. 676 37. 5 101. 308

4 2. 9675 3. 3096 9. 7417 0. 1861E+00 100. 174 37. 5 101. 308

5 2. 9388 3. 2879 9. 7299 0/1363E+00 99. 115 37. 5 101. 308

6 3. 0074 3. 3455 9. 7098 0. 1B61E+00 101. 539 37. 5 101. 308

7 2. 9701 3. 3107 9. 7047 0. 1861E+00 100. 289 37. 5 101 . 3oe

8 3.0121 3. 3441 9. 6476 0. 1B60E+00 101. 757 37. 5 101. 308

AVERAGES WITH THREE STANDARD DEVIATIONS OF THE MEAN (UM)

2. 9762 3. 3173 9. 7100 0. 1 S61E+00 100. 490 101. 479

0. 0263 0. 0211 0. 0501 0. 2761E-03 0. 960 0. 532

that

SKEW

-0. 093

-0. 114

-0. 091

-0 . 1

1

-0 . 11 -0. 091

-0. 084

-0. 059

-0. 098

0. 013

72

PJo
8. PLOTSVIL

8.1 Summary

PLOTSVIL provides plots of surface profiles. The operator first

chooses the name of the file that contains the desired data. Then

the operator has the option of choosing,

1. the number of profiles to plot and which ones to plot,

2. the beginning and ending data points to be plotted (ifthe

entire profile is to be plotted, the beginning point is 1 and the ending point is 4000), and

3. the length of the plot in cm.

73
8.2 Operating Systems Commands

t2

PLOTSVIL #• *•»••**

3

4

5

6

7

S

9

10

VPHSi SRF: PLOTSVIL, 01

VPHS2 SRF: PLOTSVIL, 3

TIJ*

TW*-

TW*

TW* THE PLOTTING PROGRAM HAS BEEN COMPLETED.

TW* THE RASTER FILE "S: RASDATA. RAS" HAS BEEN CREATED

TW* AND MAY BE PLOTTED ON THE 3230 SYSTEM USING THE COMMAND "PLOTFINI

It 11

12

13

14

15

TW#

TW* TO LOOK AT THE ENTIRE SET OF COMMANDS FOR

TUI*- MEASURING AND ANALYSING SURFACE PROFILE DATA,

$W* USE THE COMMAND "FASTMENU".

TEX IT

Notes

:

"VPHS1" and "VPHS2" are sets of operating system commands used when programs that

plot graphs are executed.

74
8.3 PLOTSVIL FORTRAN Program

12

3

4

5

6

7

8

9

10

1112

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

C ***** SRF: PLOTSVIL. FTN CALLED BY "PlOTSVIL" *****

C THIS ROUTINE IS USED TOGETHER UITH VERSATEC PLOTTING SOFTUARE

C TO PRODUCE PLOTS OF THE DIGITIZED SURFACE PROFILES.

C THE OPERATOR IS PROMPTED TO TYPE THE FILE NAME

C UHERE THE DATA CAN BE FOUND, THE NUMBERS OF THE

C PROFILES THAT ARE TO BE PLOTTED, THE NUMBER OF

C POINTS TO BE PLOTTED IN EACH ONE, AND THE

C LENGTH OF EACH PLOT ON THE OUTPUT PAGE.

C T. VORBURGER, 1978 (LAST REVISION 3/82)

C

C

DIMENSION X(4002) , YC4002) ,SPEC(20)

INTEGER*2 DATF IL (9) , PRONUMC50) , START

REAL KCAL, LENGTH

DATA DATFIL(7),DATFIL(8)

,

1DATFILC9)/' .D','AT',' '/

C

1 FORMATCF10.4)

2 FORMAT ( 16F5 . 0)

3 FORMATS UHAT IS THE DATA FILE? 12 CHARACTERS')

4 F0RMATCE13.6)

5 FORMATC40A2)

6 FORMAT ( 12)

7 FORMAT ( ' THERE ARE A TOTAL OF' , IX, 12, IX, 'PROFILES. '/

+' HOU MANY PROFILES DO YOU LJANT GRAPHED? 12 FORMAT')

8 FORMATC' INPUT THE NUMBER OF THE NEXT PROFILE DESIRED.'/

1' USE 12 FORMAT. THEN HIT RETURN.')

9 FORMATC IX, 10F6.0)

10 FORMATC' INPUT THE NUMBER OF THE FIRST PROFILE DESIRED.'/

1' USE 12 FORMAT. THEN HIT RETURN.')

11 FORMATC' THE AVERGE HEIGHT FOR PROFILE' , IX, 12, IX, ' IS'

,

+1X, F 10 . 4, IX, 'MICRONS'

)

12 FORMATC20A4)

13 FORMATC' AT UHAT POINT ON THE PROFILE UOULD YOU LIKE',

1' TO START THE PLOT?'/' ANSUER CAN BE BETUEEN 1 AND',

2' 4000 IN 14 FORMAT.')

14 FORMATC 14)

15 FORMATC' HOU MANY POINTS DO YOU UANT TO PLOT?',

1' 14 FORMAT AGAIN.')

16 FORMATC' HOU LONG SHOULD THE PLOT BE IN CM?',

1' USE 13 FORMAT.')

17 FORMATC 13)

18 FORMATC' THERE ARE ONLY 4000 POINTS IN THE UHOLE’

,

1' PROFILE, DUMMY. TRY AGAIN.')

C

C FIRST, THE OPERATOR TYPES IN THE DATA FILE NAME

C AND THE NECESSARY PARAMETERS.

C

URITE(6,3)

READ (5, 5) (DATFILCJ) , J=l,6)

C

C

CALL 0PENUC9, DATF IL, 0,0,0, STATUS)

READ (9, 12, REC=2) SPEC

READ (9, l,REC=4)PTTOPT

URITEC6, DPTTOPT

READ (9,4, REC=6) KCAL

URITEC6, DKCAL

75
59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

1 10

111

1 12

1 13

1 14

1 15

1 16

READ (9,6) ITOTAL

C

C

WRITE (6,7) ITOTAL

READ (5, 6) ITOPRO

URITEC6, 10)

READ (5,6) PRONUMd)

DO 50 M=2, ITOPRO

UR ITE (6, S)

50 READ (5, 6) PRONUN (M)

£5 -UR ITE (6, 13)

READ (5, 14) N0

UR I TE ( 6 , 15)

READ (5, 14) N

1

NCHECK = N1+N0

IF (NCHECK. LE. 4001) GO TO 60

UR I TE ( 6 , 18)

GO TO 65

60 UR I TE ( 6 , 16)

READ (5, 17) L

LENGTH = L/2

CALL PLOTS (0,0,0)

CALL FACTOR (.7874)

CALL PLOT ( 1 . , 3 . , -3)

C

C THEN, THE PROGRAM READS THE RELEVANT PROFILE DATA.

C

DO 300 M=l, ITOPRO

RNUMBR=PRONUM(M)

START=(PR0NUM(M)-l)*251+8

• READ (9, 6, REC=START) ITEST

READ (9,2) (Y(I), 1=1,4000)

URITE(6,9) (Y(I), 1 = 1, 10)

C

C THE AVERAGE MEAN HEIGHT OF THE PROFILE DATA IS

C CALCULATED HERE AS A CHECK.

C

SUM=0 .

0

DO 100 N= 1,4000

SUM=SUM+Y(N)

100 CONTINUE

AVE=KCAL*SUM/4000 .

0

UR ITE (3, 1 l)PRONUM(M),AVE

C

C FINALLY, THE DATA ARE SCALED AND PLOTTED.

C

DO 110 1=1, N1

R I = I X(I) = PTTOPT*RI

II = I+N0-1

110 Yd) = KCAL*Y(I1)

CALL SCALE (Y,4. ,N1,+1)

CALL SCALE (X, LENGTH, N 1 , +1

)

CALL NEUPEN (- 1

)

CALL LINE (X, Y, N 1 , 1,0,31)

CALL NEUPEN (1)

FIRST=Y(Nl+l)-2.0*Y(Nl+2)

CALL AXIS (0., -2., 'DISTANCE (MICROMETERS) -22, LENGTH, 0 .

,

76
11 ?

118

119

120

121

122

123

124

125

126

12?

128

129

130

131

132

1 X(Nl + l),X(Nl+2))

CALL AXISC0., -2., 'VERTICAL DISPLACEMENT (MICROMETERS)',

1 35, 8 . , 90 . , FIRST, Y(N 1+2)

)

CALL SYMBOL ( 1 . , ? . 5, . 2, SPEC, 0 . , +80)

CALL SYMBOL (1.,?., .2,' PROF NO = ',0.,+10)

CALL NUMBER (3.,?., .2,RNUMBR,0. ,-l)

RN0 = N0

RN2 = N0+N1-

1

CALL SYMBOL (4. , ? . , . 2, ' PTS TO',0.,+11)

CALL NUMBER (4. 8,?. , .2,RN0,0. ,-l)

CALL NUMBER (6. 5,?., . 2, RN2, 0 . , - 1

)

CALL PLOT (0 . , 0 . , +23)

300 CONTINUE

CALL PLOT (0 . , 0 . , 999)

STOP

END

77
8.4 Flowchart for PLOTSVIL

The operator is prompted to type in the name of

the data file to be examined.

The file is opened as a logical unit, and from

it the program reads the specimen information,

the point-to-point spacing, the calibration

constant, and the total number of profiles.

The operator is prompted to type the' total

number of profiles to be plotted, the position

of each one in the file and, for all the plots,

the beginning data point, the number of data

points, and the length of the plot output.

The Main Loop begins. Each profile is read.

The average height of the profile is calculated

as information for the operator.

The data points are scaled and plotted.

Close plot sequence and stop.

78
8.5 Example of PLOTSVXL Plot

The sinusoidal surface depicted here was also discussed in sec. 7.5.

The ADF,ACF, and PSD statistical functions for this profile are given in

secs. 9.5,10.5, and 11.5. Shown here is the first page of a graph which

spans several pages.

SINUSOIDAL PROTOTYPES WITH 3 UM RR, 28RPR7S

PROF NO = 4 PTS 1 TO 2000

€>

DISTANCE (MICROMETERS)
9. ADF

9 . 1 Summary

The ADF calculates and plots a histogram of the surface heights

y ^ for a profile. The 4000 data points, whose quantization

levels range from -2048 to 2047, are sorted into 256 boxes

containing 16 quantization levels each. The formula is

ADF ( j ) = Nj/(16x4000xKCAL), (9.1)

where Nj is the number of data points with height values falling

in the 3 th box. The height of the jth box y(j) is the abscissa

of this function. It is given by

y(j) = 16 KCAL (j-257/2). (9.2)

The operator has the following options:

1 . choosing whether to fit a least squares straight line or a mean line to the data,

2 . printing out the set of numbers which comprise the function,

3 . choosing which profiles to analyze in a given data file.

80
9.2 Operating System Commands

1 ADF *****

2 *

3 VPHS1 SRF: ADF, @1

4 VPHS2 SRF: ADF, 3

5 $W*

6 $W*

7

8 $W* THE PLOTTING PROGRAM HAS BEEN COMPLETED.

9 $W* THE RASTER FILE "S: RASDATA. RAS" HAS BEEN CREATED

10 $W* AND MAY BE PLOTTED ON THE 3230 SYSTEM USING THE COMMAND "PLOTFINI

II 11

12 $W* TO LOOK AT THE ENTIRE SET OF COMMANDS FOR

13 $W* MEASURING AND ANALYSING SURFACE PROFILE DATA,

14 USE THE COMMAND "FASTMENU".

15 $EXIT

81
9.3 ADF FORTRAN Program

12

3

4

5

6

7

e9

10

1112

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

C ***** SRF : RDF . FTN CALLED BY "ADF" *****

C THIS ROUTINE CALCULATES THE ADF FOR A SET OF N=4000 PROFILE

C DATA POINTS RANGING FROM -2048 TO +2047. THESE ARE SORTED

C INTO K=256 BOXES. THE NUMBER OF POINTS IN EACH BOX IS

C ACUMULATED INTO THE ARRAY ADF. THE ARRAY ORDNIT GIVES

C THE MIDPOOINT IN EACH BOX. THE PROCEDURE IS REPEATED FOR

C EACH SET OF PROFILE DATA. AN AVERAGE ADF, AVADF, IS ALSO

C CALCULATED AND PLOTTED.

C T. VORBURGER (5/24/78) REVISED (3/82)

C

C

C

DIMENSION ORDNIT (258) , ADF (258) , AVADF (258)

DIMENSION SPEC (15)

INTEGER START

REAL KCAL

INTEGER*2 PROF IL (4000) , DATF IL (9)

INTEGER*2 QUERY1 , QUERY2, QUERY3, PRONUM(50)

DATA DATFIL (7) , DATF IL (8) , DATF IL (9) /' .D'

,

' AT' , ' '/

C

1 FORMAT (//' SHOULD UE DO A LEAST SQUARES STRAIGHT LINE'/

T FIT TO THE DATA? "Y" OR "N"?')

2 FORMAT (40A2)

3 FORMAT(20A4)

4 FORMAT(E 13 . 6)

5 FORMAT (E 13 . 6, ' UM/QUANTIZATION LEVEL = KCAL')

6 FORMAT ( 1H ,20A4)

7 FORMAT ( ' *** ADF CALCULATIONS ***'/

1' UHAT IS THE FILE NAME?'/' THE FORMAT SHOULD',

2' BE "VOL: NAME" UITH EXACTLY 12 CHARACTERS.')

8 FORMAT (' THE FIRST 8, LAST PROFILE POINTS ARE ',15,' 8, ',15)

11 FORMAT (' POINT-TO-POINT SPACING (16 KCAL) = ',E13.6,' UM'

)

12 FORMAT ( ' TOTAL PROBABILITY = ',F8.4,' UM'

)

13 FORMAT (' RA CALCULATED FROM ADF = ',F9.5,' UM'

)

14 FORMAT (' RMS ROUGHNESS CALCULATED FROM ADF = ',

1F9 . 5, ' UM')

16 FORMAT (8E 12 . 4)

17 FORMAT (1615)

18 FORMAT ( 12)

19 FORMAT (' I CAN "T READ THIS NAME. TRY AGAIN.')

21 FORMAT ( 1H /'ADF DATA FOR POSITION ',12)

22 FORMAT ( 1H /'AVERAGE ADF FOR ALL ',12,' POSITIONS')

23 FORMAT ( ' ERROR ON OPENU ROUTINE'/

1' TYPE THE FILE NAME OVER AND GET IT RIGHT THIS TIME.')

24 FORMAT (//' THE DATA ARE BEING FITTED TO A'/

1' LEAST SQUARES STRAIGHT LINE FOR THIS'/

2' CALCULATION.')

25 FORMAT(//' A MEAN VALUE IS BEING SUBTRACTED',

1' FROM THE DATA.')

27 FORMAT ( 1H ,40A2)

28 FORMAT ( 1H 1 , 5X, ' ***** ADF CALCULATIONS *****'///)

29 FORMAT (//' DO YOU WANT A PRINTOUT OF THE '/

1' ADF NUMBERS? "Y" OR "N"?')

31 FORMAT ( 1H 1

,

' ***** WARNING! *****'/' SOME OF THE'

1' PROFILE POINTS ARE OUTSIDE THE USUAL RANGE'/

2' OF -2047 TO 2048. YOU WILL GET SOME ERRORS'/

3' FOR THE ADF OF PROFILE', 13,'.')

C

82
59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

S0

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

1 1

1

1 12

1 13

114

115

1 16

C

C FIRST, THE PROGRAM READS THE NAME OF THE DATA FILE TO BE

C ANALYZED FROM LU-5. THE NAME OF THE DATA FILE MUST HAVE

C THE FORMAT " VOL : ADATE " , WHERE "VOL" IS THE 3 CHARACTER

C VOLUME NAME AND "ADATE" IS THE 8 CHARACTER FILE NAME.

C THE DATA FILE IS ASSIGNED LU-10. THEN THE PROGRAM

C READS THE SPECIMEN INFO, THE VERTICAL KCAL, AND THE

C PROFILE DATA FROM THE FILE " VOL : ADATE . DAT"

.

C

C

ITRY = 0

92 UR ITE (6, 7)

READ (5, 2, ERR =93, END =502) (DATFILCJ) , J=l,6)

CALL CARCON (3,1)

GO TO 94

93 ITRY = ITRY + 1 IF (ITRY .GT. 2) GO TO 502

URITEC6, 19)

GO TO 92

94 CALL OPENUC 10, DATFIL, 0,0,0, ISTAT)

IFCISTAT.LT. l)GO TO 90

UR ITE (6, 23)

ITRY = ITRY + 1 IF (ITRY .GT. 2) GO TO 502

GO TO 92

C

C

90 READ (10,3, REC=2) SPEC

READ (10,4, REC=6) KCAL

K = 256

KPLUS = K+2

N = 4000

CONST = 16.*KCAL

IAVRG = 0

WRITE (6,1)

READ (5,2) QUERY1

UR ITE (3, 28)

UR ITE (3, 27) DATFIL

UR I TE ( 3 , 6 ) SPEC

UR I TE ( 3 , 5 ) KCAL

IF (QUERY1 .EQ. ' Y ' ) WRITE (3,24)

IF (QUERY1 -EQ . ' N ') WRITE (3,25)

UR ITE (6, 29)

READ (5, 2) QUERY3

C

DO 110 J= 1 ,

K

ORDNITCJ) = C0NST*(J-(K+l)/2.)

110 AVADF(J) =0.

C

CALL PLOTS (0,0,0)

CALL FACTOR (.7874)

CALL PLOT ( .5, .5,-3)

READ (10, 18, REC=7) NTOT

C

C

C NOW, THE OPERATOR IS ASKED TO CHOOSE WHETHER ALL

C THE PROFILES ARE TO BE ANALYZED AND, IF NOT, HOW MANY.

C

83
117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

C

CALL CHOICECNTOT, ITOPRO, PRONUM)

C

c

C THE MAIN LOOP TO CALCULATE AND PLOT THE ADF FOR EACH

C PROFILE BEGINS HERE

C

C

DO 300 M = 1, ITOPRO

RNUMBR = PRONUM CM)

START = CPRONUMCM) - 1)*251 + S

READ (10, 18,REC=START) NRUN

READ ( 10, 17) PROFIL

WRITE (6, 8) PROFILC 1) , PROF IL (4000)

C

IF ( QUERY 1 .EG. ' Y ') CALL LEASQ (PROF IL, 4000)

IF (QUERY1 .EQ. 'N ') CALL MEAN (PROF IL, 4000)

C

c

C NOU, UE CALCULATE THE NORMALIZED ADF AND THE CORRESPONDC ING ARRAY OF ORDINATE VALUES (IN UM) . THE RESULTS ARE

C CHECKED BY CALCULATING THE RA AND THE RMS ROUGHNESS

C FROM THE ADF RESULTS.

C

C

MESSG = 0

DO 101 J= 1 ,

K

101 ADF ( J) = 0.

C

DO 102 1= 1 ,

N

BOX = .5*K*(l.+CPROFIL(D/2048.))

IBOx = bqx+i

IF (IBOX .LE! K .AND. IBOX .GE. 1) GO TO 102

IF (MESSG .GT. 0) GO TO 105

MESSG = 1 UR ITE (3, 3 1 ) NRUN

105 IF (IBOX .GT. K) IBOX=K

IF (IBOX .LT. 1) IBOX=

1

102 ADF ( IBOX) = ADF ( IBOX) + 1. C

DO 103 J=1,K

ADF ( J) = ADF(J)/(CONST*4000.)

103 AVADF(J) = AVADF(J) + ADF (J) /ITOPRO

C

SUMO = 0.

SUM1 = 0.

SUM2 = 0.

DO 104 J= 1 ,

K

SUMO = SUMO + ADF ( J)

SUM1 = SUM1 +ADF ( J) *ABS (ORDN ITC J)

)

104 SUM2 = SUM2+ADFCJ)*C0RDNIT(J)**2)

C

UNITY = CONST*SUM0

RACHK = CONST*SUMl

RMSCHK = SQRT(C0NST*SUM2)

C

C

C NOU, UE UR ITE THE RESULTS ON THE PRINTER

84
175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

282

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

C IF CALLED FOR.

C

C

c

IF (QUERY3 .EQ. 'N ') GO TO 601

CALL CARCON (3*0)

CALL CARCON (3* 1

)

WRITE (3, 21) NRUN

WRITE (3, 12) UNITY

WRITEC3, 13) RACHK

WRITE (3, 14) RMSCHK

WRITE (3* 1 1) CONST

WRITE (3, 16) (ADF (I), 1=1,256)

C

C

C NOW, WE PLOT THE ADF

.

C

C

601 CALL PLOTMECORDNIT, ADF,KPLUS, 'ADF (INVERSE UM)',16,

r HEIGHT FROM MEAN LINE CUM) ', 26, SPEC, RMSCHK,

INRUN, IAVRG)

300 CONTINUE

CALL CLOSE (10, STATUS)

C

c

C THE MAIN LOOP IS COMPLETED. NOW, WE PRINT AND PLOT THE

C RESULTS FOR THE AVERAGE OF ALL RUNS.

C

C

IF ( ITOPRO .EQ. 1) GO TO 501

IAVRG = 1 SUMAV0 = 0.

SUMAV1 = 0.

SUMAV2 = 0.

DO 301 J=1,K

SUMAV0 = SUMAV0+AVADF ( J)

SUMAV1 = SUMAVl+AVADF(J)*AeS(ORDNIT(J))

301 SUMAV2 = SUMAV2+AVADF(J)*(0RDNITCJ)**2)

C

AVONE = CONST*SUMAV0

AVRA = CONST*SUMAVl

AVRMS = SORT (C0NST*SUMAV2)

CALL CARCON (3, 0)

CALL CARCON (3, 1)

WRITE (3, 22) ITOPRO

WR I TE ( 3 , 12) AVONE

WRITE (3, 13) AVRA

WRITE (3, 14) AVRMS

WR I TE ( 3 , 11) CONST

WR I TE ( 3 , 16) (AVADF ( J) , J= 1 , 256)

CALL PLOTMECORDN IT, AVADF, KPLUS, ' ADF (INVERSE UM) ' , 16,

1

' HEIGHT FROM MEAN LINE (UM) 26, SPEC, AVRMS, ITOPRO, IAVRG)

501 CALL PLOT (0 . , 0 . , 999)

502 STOP

END

C

C

C SUBROUTINE FOR PLOTTING

85
233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

C

C SUBROUTINE PLOTME (X, Y, KPLUS, YLABEL, NYCHAR, XLABEL

1NXCHAR, SPEC, RMS, NRUN, IAVRG)

C

C THE INPUT VARIABLES IN THIS SUBROUTINE ARE:

C X - THE ARRAY OF X VALUES,

C Y - THE ARRAY OF Y VALUES,

C KPLUS - THE SIZE OF THE ARRAYS PLUS 2 FOR STORAGE OF

C THE SCALE FACTOR AND INTI AL POINT IN THE PLOT,

C YLABEL, XLABEL - THE LABELS FOR THE X AND Y AXES,

C NXC-HAR, NYCHAR - THE NUMBER OF CHARACTERS IN EACH LABEL,

C SPEC - A TITLE LABEL FOR THE PLOT,

C RMS - THE VALUE FOR THE RMS ROUGHNESS CALCULATED FROM

C THE FUNCTION,

C NRUN - THE PROFILE'S NUMBER IN THE INPUT DATA FILE,

C IAVRG - A FLAG TO TELL THE PROGRAM WHETHER AN

C INDIVIDUAL FUNCTION OR THE AVERAGE IS BEING

C CALCULATED.

C

DIMENSION X( KPLUS) , Y( KPLUS) , XLABEL (20) , YLABEL (20)

DIMENSION SPEC (15)

RUN = NRUN

K = KPLUS-2

CALL SCALE (Y, 8 . , K, +1

)

CALL SCALE (X, 12.,K,+1)

CALL NEUPEN(-l)

YCK+2) = -YCK+2)

YCK+l) = YCK+l) - 8.*Y(K+2)

CALL L INE ( Y, X, K, 1,0,31)

CALL AXIS (0. ,0. , YLABEL, -NYCHAR, 9. ,0., YCK+l) , YCK+2)

)

CALL AXIS (9., 0. , XLABEL, -NXCHAR, 12. ,90 . , XCK+l) , XCK+2)

)

CALL SYMBOL (0., 0.2, . 2, SPEC, 90 ., 60)

CALL SYMBOL (0.5, .2, .2, 'RMS ROUGHNESS = ',90., 16)

IF ( RMS .LT. 0.01) GO TO 501

CALL NUMBER (0.5, 3. 4, . 2, RMS, 90 . , +3)

CALL SYMBOL (0 . 4, 4. 6, 0 . 2, 7, 90 . , - 1

)

CALL SYMBOL (0 . 4, 4. 8, 0 . 2, 109, 90 . , - 1)

GO TO 502

501 CALL NUMBER (0 . 5, 3 . 4, 0 . 2, RMS, 90 . , +5)

CALL SYMBOL (0 . 4, 5 . 0, 0 . 2, 7, 90 . , - 1

)

CALL SYMBOL (0.4, 5. 2, 0.2, 109, 90., -1)

502 IF (IAVRG.EQ.l) GO TO 400

CALL SYMBOL (1., .2, .2,'ADF FOR POSITION' ,90 ., 16)

CALL NUMBER (1., 3. 7, . 2, RUN, 90 . , - 1

)

GO TO 401

400 CALL SYMBOL (1., .2, .2, 'AVERAGE ADF FOR ALL ',90., 20)

CALL NUMBER( 1 . ,4.3, . 2, RUN, 90 . , - 1

)

CALL SYMBOL ( 1 . ,4.7, .2, ' POS ITIONS' , 90 . , 10)

401 CALL PLOT(0 . , 0 . , +23)

RETURN

END

C

C

C SUBROUTINE FOR DETERMINING WHICH PROFILES IN

C THE FILE ARE ANALYZED

C

C

86
291

292

293

294

295

296

29?

293

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

326

32?

328

329

330

331

SUBROUTINE CHOICE (NTOT, ITOPRO, PRONUM)

INTEGERS QUERY2,PRONUM(50)

C

c

C INPUT VARIABLES:

C NTOT - THE TOTAL NUMBER OF PROFILES IN THE FILE.

C OUTPUT VARIABLES:

C ITOPRO - THE NUMBER OF PROFILES THAT THE OPERATOR CHOOSES

C TO ANALYZE,

C PRONUM - THE ARRAY UHICH CONTAINS THE POSITIONS OF THE

C CHOSEN PROFILES IN THE DATA FILE.

C

1 FORMAT (' THERE ARE' , 13, ' PROFILES'//' DO YOU',

1' UANT TO ANALYZE ALL OF THEM?'/' "Y" OR "N"?')

2 FORMAT C 12)

3 FORMAT (//' HOU MANY PROFILES DO YOU UANT TO ANALYZE?'/

1' USE 12 FORMAT.')

4 FORMATC//' TYPE THE NUMBER OF THE FIRST PROFILE TO BE ANALYZED.'/

1' USE 12 FORMAT.')

5 F0RMATCA2)

6 FORMAT (//' TYPE THE NUMBER OF THE NEXT PROFILE TO BE ANALYZED.'/

1' USE 12 FORMAT.')

C

URITE (6,1) NTOT

READ (5,5) QUERY2

IF ( QUERY2 .EQ. 'N ') GO TO 131

C

ITOPRO = NTOT

DO 132 I = 1, ITOPRO

132 PRONUM(I) = I RETURN

C

131 URITE (6,3)

READ (5,2) ITOPRO

URITE (6,4)

READ (5,2) PRONUM(l)

DO 133 1=2, ITOPRO

URITE (6,6)

133 READ (5,2) PRONUM(I)

RETURN

END

The subroutines, MEAN and LEASQ, have already been listed

in the program SMORGAS

.

87
9.4 Flowchart for ADF

Begin

1. 69

Input

File Name

11. 69-83

Input

Parameters

11. 86-102

Calculate

Height Values

11. 104-106

'Preparation'

r for Plotting

11. 108-110

Input

Profiles

11. 111,118J

©

The operator is prompted to type the name of the

data file to be examined. The file is then opened

as a logical unit.

The program reads the data file for the specimen

I.D. and the instrument calibration constant and

prompts the operator to choose whether or not to

use a least squares fitted line as the mean line.

If not the mean line is simply the mean of the data

values. The operator much also choobe whether or not to print out the set of numbers which comprise

the ADF.

The set of height values, the independent variable

in the ADF, are calculated here.

Three subroutines are called to initialize the

plotting sequence.

The total number of profiles in the file is read.

Then the operator is asked to choose which of

these will be analyzed. The subroutine CHOICE is

called for this task.

88
The main loop to calculate and plot the

ADF begins.

A subroutine s either LEASQ or MEAN, is

called

.

This section includes a set of statements

(11. 150-154) to warn the operator and

massage the data when data points are out

of range. This can happen when using the

least squares fit with large amplitude data

An average ADF is being calculated by addin

each function to a summing array.

Three quantities are calculated to check

the accuracy of the ADF: Ra , Rq, and the

sum of the ADF values, which should equal

unity.

The subroutine PLOTME is called here.
R , R , and the sum of the ADF values are calculated for AVADF.

Calculate

Parameters

for AVADF

11. 204-216

Output

Results forj

AVADF

11. 217-224

Plot r

I

I AVADF

/ 11. 225-227/

Stop

1. 228

The AVADF function and the three parameters

are now printed.

PLOTME is called again.

90
SINUSOIDAL

PROTOTYPES

WITH

3

UM

RA

,

28APR78

9.5 Example of ADF Plot for Sinusoidal Surface

©

<u

©©

_©

OJ

©

©

s

=5. G>

II O

i—

i

CO I—

CO

^

UJ CO

z: o

X Q_

CD

ID QC O O

IX Li_

CO Li_ 21 O

G G

0764 0.56 0

'. 43

©

©

_cu

i

©

3" 0.40 0.32 0.24 nnc f TM\/CDOC I iMI

0.L6 0.C8 0.00 -0 .'08

91
10. ACF

10.1 Summary

The ACF calculates and plots the autocorrelation

the profile data. It is a quantitative measure of

between a laterally shifted and an unshifted version of the

profile and is given by

function from

the similarity

ACF(kT) = 1/[(N-k)R

q

2]

N-k

£

i = 1 y i^ i+k.» ( 10 . 1 )

where T is the point-to-point spacing of the profile,

4 . . . , and hence kT is the shift distance. The factor

the denominator normalizes the value of the ACF to unity at a shift distance of zero.

> i n

equals 0.

R, ^

The above formula is known as the unbiased estimator [12] of the

autocorrelation function because it divides the sum by N-k to

compensate for the decreasing number of terms in the sum as the

increases. This estimator is not as widely

the biased estimator which divides the sum by N,

be shown that the mean square error of the biased

generally smaller than that of the unbiased

These errors should be small for random surfaces

typically studied in surface metrology where the characteristic

spacings of 'surface features should be much smaller than the

length of the profile. Moreover, for calibration specimens with

highly periodic prof iles } such as the sinusoidal specimen already

discussed in secs. 8.5 and 9.5, the unbiased estimator (eq. 10.1)

is significantly better over the shift distance range shown in

fig. 10.5. The biased estimator incorrectly yields an ACF whose

shift index k

recommended as

because it can

estimator is

estimator [12].

oscillations

increases

.

would damp out significantly as the shift distance

The operator has the same options here as in the ADF program. The

function is calculated only for shift distances that are even

multiples of the point spacing in order to save calculation time.

With 501 points the calculation itself takes approximately 200 s.

92
10.2 Operating System Commands

L ACF

2 -* 3 VPHS1 SRF.ACF. @1

4 VPHS2 SR F: ACF. 3

5

6 $W*

7 $W*

8 $W* THE PLOTTING PROGRAM HAS BFEN COMPLETED.

? $W* THE RASTER FILE "S: RASDATA. RAS" HAS BEEN CREATED

10 $W* AND MAY BE PLOTTED ON THE 323C SYSTEM USING THE COMMAND

II

1

1

12 * W* TO LOOK AT THE ENTIRE SET OF COMMANDS FOR

13 $W* MEASURING AND ANALYSING SURFACE PROFILE DATA.

14 $W* USE THE COMMAND "FASTMENU"

.

15 $EX IT

"PLOTFINI

93
10.3 ACF FORTRAN Program

1 c ***** SRF :ACF.FTN CALLED BY "ACF" *****

2 C THIS ROUTINE CALCULATES THE ACF FOR A SET OF N=4000 PROFILE

3 C DATA POINTS . THE PROCEDURE IS REPEATED FOR EACH SET OF PROFILE

4 C DATA CHOSEN TO BE ANALYZED. AN AVERAGE ACF IS ALSO CALCULATED

5 C AND PLOTTED.

6 C T. VORBURGER (5/24/78) REVISED (7/82)

7 C

8 C

9 C

10 DIMENSION ACF (503) , AVACF (503)

1 1 DIMENSION SPEC ( 15) * X(503)

12 INTEGER START

13 REAL KCAL

14 INTEGER*2 PROF IL (4000) , DATF IL (9) , N, ISHIFT, JPLUS

15 INTEGER*2 QUERY1 , QUERY2, QUERY3, PRONUM(50)

16 DATA DATF IL (7) , DATF IL (8) , DATF IL (9) /' .D','AT',' '/

17 C

18 1 FORMAT(//' SHOULD UE DO A LEAST SQUARES STRAIGHT LINE'/

19 1' FIT TO THE DATA? "Y" OR "N "?'

)

20 2 FORMAT(40A2)

21 3 FORMAT(20A4)

22 4 FORMAT (E 13 . 6)

23 5 FORMAT (E 13 . 6* ' U M/QUANTIZATION LEVEL = KCAL')

24 6 FORMAT ( 1H ,20A4)

25 7 FORMAT (5X, '*** ACF CALCULATIONS ***' /

26 1' LJHAT IS THE FILE NAME?'/' THE FORMAT SHOULD',

27 2' BE "VOL: NAME" UITH EXACTLY 12 CHARACTERS.')

28 8 FORMAT ( 12, F 10 . 4)

29 9 FORMAT (' APPROX RMS SLOPE (FROM ACF) =',F6.4, '-' , F6 . 4)

30 10 FORMAT (F 10 . 4)

31 1

1

FORMAT (

' POINT-TO-POINT SPACING -',F9.4,' UM'

)

32 12 FORMAT ( ' POINT-TO-POINT SPACING OF ACF =',F10.4, ' UM')

33 13 FORMAT ( ' RA CALCULATED FROM ORIGINAL DATA = ',F9 .5,' UM

34 14 FORMAT (

' RMS ROUGHNESS CALCULATED FROM ACF = ',

35 1F9 . 5, ' UM')

36 15 FORMAT ( 13)

37 17 FORMAT ( 1615)

3S 18 FORMAT (12)

39 19 FORMAT (' I CAN "T READ THIS NAME. TRY AGAIN.')

40 20 FORMAT (

' START LOOP')

41 21 FORMAT ( 1H /' ACF DATA FOR POSITION ',12)

42 22 FORMAT ( 1H /' AVERAGE ACF FOR ALL ',12,' POSITIONS')

43 23 FORMAT (

' ERROR ON OPENU ROUTINE'/

44 T TYPE THE FILE NAME OVER AND GET IT RIGHT THIS TIME.')

45 24 FORMAT (//' THE DATA ARE BEING FITTED TO A'/

46 1' LEAST SQUARES STRAIGHT LINE FOR THIS'/

47 2' CALCULATION.')

48 25 FORMAT(//' A MEAN VALUE IS BEING SUBTRACTED',

49 1' FROM THE DATA.')

50 26 FORMAT ( ' COMPLETE LOOP')

51 27 FORMAT ( 1H , 40A2)

52 28 FORMAT ( 1H 1 , 5X, ' ***** ACF CALCULATIONS *****'///)

53 29 FORMAT (//' DO YOU UANT A PRINTOUT OF THE '/

54 1' ACF NUMBERS? "Y" OR "N"?')

55 30 FORMAT (

' HOU MANY LAG POINTS DO YOU UANT TO CALCULATE?'.

56 1' THE UPPER LIMIT IS 501.')

57 31 FORMAT (

' THE FIRST AND LAST PROFILE POINTS ARE', 15,' & 58 32 FORMAT (//' THE RMS SLOPE CANNOT BE CALCULATED FROM'/

94
59 1' THE ACF FOR THIS PROFILE BECAUSE SMALL ERRORS'/

60 2' IN THE CALCULATION LEAD TO A NEGATIVE SQUARE ROOT.

61 33 FORMAT ( 10F8.4)

62 C

63 C

64 C FIRST, THE PROGRAM READS THE NAME OF THE DATA FILE TO BE

65 C ANALYZED FROM LU-5. THE NAME OF THE DATA FILE MUST HAVE

66 C THE FORMAT "VOL : ADATE " , WHERE "VOL" IS THE 3 CHARACTER

67 C VOLUME NAME AND "ADATE" IS THE 3 CHARACTER FILE NAME.

63 C THE DATA FILE IS ASSIGNED LU-10. THEN THE PROGRAM

69 C READS THE SPECIMEN INFO, THE VERTICAL KCAL, AND THE

70 C PROFILE DATA FROM THE FILE 11 VOL : ADATE . DAT"

.

71 C

72 C

73 ITRY = 0

74 92 UR I TE ( 6 , 7

)

75 READ (5, 2, ERR =93, END =502) (DATFILCJ) , J=l,6)

76 GO TO 94

77 93 ITRY = ITRY + 1 78 IF (ITRY .GT. 2) GO TO 502

79 URITEC6, 19)

80 GO TO 92

81 94 CALL OPENUC 10, DATF IL, 0, 0, 0, ISTAT)

82 IFCISTAT.LT. DGO TO 90

83 UR I TE (6, 23)

84 ITRY = ITRY + 1 85 IF (ITRY .GT. 2) GO TO 502

86 GO TO 92

87 C

83 C

89 90 WRITE (6,30)

90 READ (5,15) K 91 READ ( 10, 3, REC=2) SPEC

92 READC 10, 10,REC=4) PTTOPT

93 READ (10,4, REC=6) KCAL

94 KPLUS = K+2

95 N = 4000

96 AVACF0=0

.

97 IAVRG = 0

98 WRITE (6,1)

99 READ (5,2) QUERY1

100 UR I TE (3, 28)

101 UR I TE (3, 27) DATFIL

102 WR I TE ( 3 , 6 ) SPEC

103 WRITE (6,11) PTTOPT

104 DUBLPT = 2 . *PTTOPT

105 UR I TE ( 3 , 12) DUBLPT

106 WRITE (3, 5) KCAL

107 IF (QUERY1 .EQ. 'Y ') WRITE (3,24)

108 IF (QUERY1 .EQ. 'N ') WRITE (3,25)

109 WR ITE (6, 29)

110 READ (5, 2) QUERY3

1 1

1

C

1 12 DO 113 1=1,

K

1 13 ISHIFT = 2*1 - 2

1 14 XCI) = PTTOPT* I SH I FT

1 15 AVACFCI) = 0.

116 113 CONTINUE

95
1 17

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

ononn

—

—

o

o

n

oo

o

oonnnnnnnnno

CALL PLOTS (0,0*0)

CALL FACTOR (.7874)

CALL PLOT ( . 5* .5,-3)

READC 10, 18,REC=7) NTOT

NOU, THE OPERATOR IS ASKED TO CHOOSE UHETHER ALL

THE PROFILES ARE TO BE ANALYZED AND, IF NOT, HOU MANY.

CALL CHOICECNTOT, ITOPRO, PRONUM)

THE MAIN LOOP TO CALCULATE AND PLOT THE ACF FOR EACH

PROFILE BEGINS HERE

DO 300 M = 1, ITOPRO

RNUMBR = PRONUMCM)

START = (PRONUMCM) - 1)*251 + 8

READ ( 10, 8, REC=START) NRUN,RA

READ (10,17) PROFIL

UR I TE ( 6 , 3 1 ) PROF IL ( 1), PROFIL (4000)

IF (QUERY1 .EQ. 'Y ') CALL LEASQ (PROF IL, 4000)

IF (QUERY1 .EQ. 'N ') CALL MEAN (PROF IL, 4000)

NOU UE DO THE DOUBLE LOOP IN THE AUTOCORRELATION CALCULATION.

URITE (6,20)

DO 115 1=1,

K

ISHIFT = 2*1 - 2

SMPROD = 0.

MTOP = N- ISHIFT

RM= MTOP

DO 112 J= 1 , MTOP

JPLUS = J+ISHIFT

12 SMPROD = SMPROD+PROFIL ( J) *PROFIL (JPLUS)

SMTEMP = SMPROD/RM

IF (I.GT. 1) GO TO 111

ACF0 = SMTEMP

AVACF0 = AVACF0 + ACF0/ITOPRO

11 ACF (I) = SMTEMP/ACF0

15 AVACF(I) = AVACF(I) + ACF ( I ) /ITOPRO

UR I TE (6, 26)

RMS = SQRT(ACF0)*KCAL

IF (ACF (2) . GT. 1 .OR. ACF (3) ./GT. 1) GO TO 117

SLOPE 1 = RMS*SQRT(2.*(1.-ACF(2)))/DUBLPT

SL0PE2 = 0.5*RMS*SQRT(2.*(1.-ACF(3)))/DUBLPT

NOU, UE URITE THE ACF VALUES ONTO THE PRINTER IF CALLED FOR.

117 UR ITE (3,21) NRUN

96
175 WRITE(3, 13) RA

176 WRITE (3, 14) RMS

177 IF (ACF (2) . GT. 1 .OR. ACF(3).GT.l) GO TO 116

178 WRITE (3* 9) SLOPE 1 * SL0PE2

179 GO TO 118

180 1 16 WRITE(3,32)

181 1 18 IF (QUERY3 .EQ. 'N') GO TO 601

182 WRITE(3,33) CACFC I) , 1=1, K)

183 C

184 C

185 C NOW, WE PLOT THE ACF.

186 C

187 C

188 601 CALL PLOTME (X, ACF, KPLUS, ' NORMALIZED ACF' , 14*

189 l'SHIFT DISTANCE (UM) ' , 19, SPEC, RMS,

190 INRUN, IAVRG)

191 300 CONTINUE

192 CALL CLOSE (10, STATUS)

193 C 194 C

195 C THE MAIN LOOP IS COMPLETED. NOW, WE PRINT AND PLOT THE

196 C RESULTS FOR THE AVERAGE OF ALL RUNS.

197 C

198 C

199 IF ( ITOPRO .EQ. 1) GO TO 501

200 IAVRG = 1. 201 AVRMS = SORT (AVACF0) *KCAL

202 AVSLP1 = AVRMS*SQRT (2 . *( 1

. -AVACF (2) ) ) /DUBLPT

203 AVSLP2 = 0.5*AVRMS*SQRT(2.*(1. -AVACF (3))) /DUBLPT

204 CALL CLOSE (9, STATUS)

205 WRITE (3, 22) ITOPRO

206 WRITE (3, 14) AVRMS

207 WRITE (3, 9) AVSLP 1 , AVSLP2

208 WR ITE (3, 33) (AVACF (I), 1=1, K)

209 CALL PLOTME (X, AVACF, KPLUS, 'NORMALIZED ACF', 14,

210 l'SHIFT DISTANCE (UM) ', 19, SPEC, AVRMS, ITOPRO, IAVRG)

211 501 CALL PLOT (0 . , 0 . , 999)

212 502 STOP

213 END

The subroutines, MEAN and LEASQ, have been listed already in

the SMORGAS program. CHOICE and PLOTME have been listed in

the ADF program. The PLOTME subroutine in ACF differs from

the other one by a single row of text in an output label.

97
10.4 Flowchart for ACF

Begin

1.73

Input

File Name

11. 73-86

Input

Parameters

11. 89-110

Calculate the

Lag Values

11. 112-116

The operator is prompted to type the name of the

data file to be examined. The file is then opened

as a logical unit.

The operator is prompted to type the number of

points in the ACF. This value must range from

1 to 501. Then the program reads the specimen

I.D., the horizontal spacing of the data points,

and the instrument calibration constant and prompts

the operator to choose whether or not to fit a least squares line to the data and whether to

print out the values of the ACF function.

The lag values comprise the independent variable

of the ACF.

Three subroutines are called to initialize the

plotting sequence.

The total number of profiles in the data file is

read. Then the operator is asked to choose which

of these will be analyzed. The subroutine CHOICE

is used for this task.

98
The main loop to calculate and plot the ACF

begins. In addition to the profile data,

the number of the profile and the stored value

of Ra are also read from the file.

A subroutine, either LEASQ or MEAN, is called.

The ACF is calculated and normalized and the

running average AVACF is built

.

Rq and the rms slope are calculated from the

ACF. In certain cases, a square root of a negative number may occur. If so, the calculation

of rms slope is skipped.

f Plot

ACF

11. 188-19L

The subroutine PLOTME is called here.
Rq and rms slope are calculated from AVACF

PLOTME is called again.

100
SINUSOIDAL

PROTOTYPES

WITH

3

UM

Rfi.

28RPR78

RMS

ROUGHNESS

=

3.310

«m

RCF

FOR

POSITION

4

10.5 Example of ACF Plot

s>

101
11 . PSD

11.1 Summary

The power spectral density resolves the surface profile into its

spatial frequency components. It is calculated by taking the

square of the absolute value of the Fourier transform of the

surface profile. The basic algorithm is given by

N 2

PSD (f) = (2T/N

)

£ y exp

[

— J2 jrf ( i — 1 )T

]

(11.1)

i = 1

where j = V- 1 and f is the spatial frequency with units

inverse length. The initial factor of 2 is included because we

calculate a one-sided power spectrum (0<f<°°) and ignore the

components having -°°<f<0. However, it is important to note that

there are other modifications of the basic algorithm due to our

requirements

.

The transform is calculated by a Fast Fourier Transform (FFT)

algorithm called EZFFT supplied by the NBS GAMS library [131. In

the present application, the use of this FFT algorithm speeds up

the calculation of the Fourier transform by at least a factor of

20 over the conventional approach. The EZFFT algorithm requires

a large storage array which depends on the number of profile

1 points to be transformed. In order to save user memory space,

the 4000 point profile is divided into two 2000 point halves.

The least squares fitted mean line is found for each section,

then the PSD is calculated for each. The 2000 point profile

yields a digitized PSD with 1000 digitized points, and this is

smoothed to 500 points in the present calculation with a Hanning

procedure [14], The smoothing formula is given by

PSD ( f = IA) 1/4 PSD ( [1-1/2 3A) + 1/2 PSD ( IA)

+ 1/4 PSD([I + 1/2 ]A), ( 11 . 2 )

where A(=2/NT) is the spacing in spatial frequency of the

digitized points and I is an integer between 1 and 499. The last

point in the PSD (I = 500) is left unsmoothed and is not plotted.

The final PSD is calculated as the average of the PSD's for the

two profile halves. The PSD calculation takes approximately 8 s on the present computer.

The operator has the option of choosing which profiles to analyze

in a given data file. The PSD is plotted for each, and the

operator has the option to print out the numbers for each PSD.

The average PSD is automatically calculated, plotted, and printed

as well.

102
11.2 Operating System Commands

\ a. •is pen .f<. -*> A -

SE SYS 14. C

4 VPHS1 SRF: PSD/ Si

5

qcr qyc qq. 6

wpLJC~> qnp- PSD.. 3

T $w*

o Tils

o

i r. •irM.x. TUC PI ~tr V V • i i i i.— i OTTING DDHAu '

i \ —* : \ ;

! 1 cc rj Jf. Tj-i ~ p

A q T p pr I ~ »q

•{ m* AND MAV R ~ p : nTTrri uJ » i < a-'

! ~

j JX 15

16

R

'

'! ' a u

$W* TD LCGK AT THE ENTIRE SET CF COMMANDS FOR

$W* MEASURING AND ANALYSING SURFACE PROFILE DATA..

$W* USE THE COMMAND " FASTMENU"

.

TEX IT

103
11.3 PSD FORTRAN Program

12

3

4

5

6

7

8

9

10

1112

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

C ***** SRF:PSD.FTN CALLED BY "PSD" *****

C THIS ROUTINE CALCULATES THE PSD FOR A SET OF 4000 PROFILE

C DATA POINTS. THIS IS DONE BY BREAKING THE PROFILE INTO

C 2000 POINT SECTIONS, FITTING A LEAST SQUARES STRAIGHT

C LINE TO EACH SECTION, AND CRANKING THROUGH AN FFT UHICH

C YIELDS A 1000 POINT TRANSFORM. THIS ARRAY IS SMOOTHED

C INTO A 500 POINT POWER SPECTRUM FOR EACH 2000 POINT

C PROFILE SECTION. THE TWO HALVES ARE THEN AVERAGED TO

C YIELD THE FINAL PSD.

C THE PROCEDURE IS REPEATED FOR EACH SET OF PROFILE

C DATA CHOSEN TO BE ANALYZED. AN AVERAGE PSD IS ALSO CALCULATED

C AND PLOTTED.

C THE FFT ROUTINES CAME VIA SALLY HOUE IN THE

C CENTER FOR APPLIED MATHEMATICS.

C T. VORBURGER (1/8/83)

C

C

DIMENSION PSDC500) ,PSD2(500) ,AVPSD(500) , USAVE (60 15)

DIMENSION SPEC ( 15) , F (50 1 ) , PSDLOG (50 1

)

INTEGER START

REP.L KCAL* LAMBDA

INTEGER*2 PROF IL (2000) , QUERY3, PRONUM(50)

CHARACTER*16 DATFIL

DATF IL ( 13 : 16) = ' .DAT'

C

1 FORMAT (' THE DC LEVEL IS',E12.4,' um')

2 FORMAT(40A2)

3 FORMAT(20A4)

4 FORMAT (E 13 . 6)

5 FORMAT (E 13 . 6, ' um/QUANTIZATION LEVEL = KCAL')

6 FORMAT ( 1H ,20A4)

7

• FORMAT (5X, ' *** PSD CALCULATIONS ***'

/

1' UHAT IS THE FILE NAME?' /' THE FORMAT SHOULD',

2' BE "VOL: NAME" WITH EXACTLY 12 CHARACTERS.')

8 FORMAT ( 12, F 10 . 4)

9 FORMAT ( ' HARMONIC PURITY IS', F 10. 4)

10 FORMAT (F 10 . 4)

11 FORMAT (' POINT-TO-POINT SPACING =',F9.4,' urn')

12 FORMAT ( ' POINT SPACING OF PSD =',F10.4,' INVERSE um'

)

13 FORMAT(//' PROFILE', 13)

14 FORMAT (5E 12 . 4)

15 FORMAT(A 12)

16 FORMAT (

' FREQUENCY RANGE IS FROM', F 10. 4, ' TO', F 10. 4,

1' INVERSE um')

17 FORMAT (1615)

18 FORMAT ( 12)

19 FORMAT (

' I CAN "T READ THIS NAME. TRY AGAIN.')

20 FORMAT (/' AVERAGE PSD FOR ALL ',12,' POSITIONS')

21 FORMAT C

' RMS ROUGHNESS CALCULATED FROM THE INTEGRAL ',

1

' OF THE PSD = '

, F 10 . 5, ' um'

)

23 FORMAT ( ' I CAN "T OPEN THIS FILE'/

1' TYPE THE FILE NAME OVER AND GET IT RIGHT THIS TIME.')

24 FORMAT (' PSD (um)**3')

26 FORMAT (

' AVE UAVELENGTH CALCULATED FROM PSD IS', F 10. 4,' um'

)

27 FORMAT ( 1H ,A16)

28 FORMAT ( 1H 1 , 5X, ' ***** PSD CALCULATIONS *****'///)

29 FORMAT(//' DO YOU UANT A PRINTOUT OF THE '/

1' PSD NUMBERS? "Y" OR "N"?')

104
59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

66

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

165

106

107

108

109

1 10

111

1 12

113

114

115

1 16

31 FORMAT (

' THE FIRST AND LAST PROFILE POINTS ARE', 15,' & ',15)

33 FORMAT (' BEGIN FFT'

)

34 FORMAT (' END FFT')

C

C

C FIRST, THE PROGRAM READS THE NAME OF THE DATA FILE TO BE

C ANALYZED FROM LU-5. THE NAME OF THE DATA FILE MUST HAVE

C THE FORMAT " VOL : ADATE " , WHERE "VOL" IS THE 3 CHARACTER

C VOLUME NAME AND "ADATE" IS THE 8 CHARACTER FILE NAME.

C THE DATA FILE IS ASSIGNED LU-10. THEN THE PROGRAM

C READS THE SPECIMEN INFO, THE VERTICAL KCAL, AND THE

C PROFILE DATA FROM THE FILE "VOL: ADATE. DAT".

C

C

ITRY = 0

92 UR ITE (6,7)

READ (5, 15, ERR =93, END =502) DATF IL ( 1 : 12)

GO TO 94

93 ITRY = ITRY + 1 IF (ITRY .GT. 2) GO TO 502

WRITE (6, 19)

GO TO 92

94 OPEN (UN I T= 10, ERR =9 1 , F ILE=DATF IL ( 1:16) , STATUS = ' OLD'

,

1 ACCESS = ' D IRECT' , FORM=' FORMATTED' , RECL=80, BLANK = ' ZERO'

)

GO TO 90

91 WR ITE (6, 23)

ITRY = ITRY + 1 IF (ITRY .GT. 2) GO TO 502

GO TO 92

C

C

90 N = 2000

RN = FLOAT (N)

K = 500

KPLUS = K+l

IAVRG = 0

C

CALL EZFFTI (N, USAVE)

C

READ( 10, 3, REC=2) SPEC

READ (10, 10, REC=4) DELTA*

READ (10,4, REC=6) KCAL

WR ITE (3, 23)

UR ITE (3, 27) DATF IL ( 1 : 16)

WR I TE ( 3 , 6 ) SPEC

WRITE (6,11) DELTA*

WRITE (3, 11) DELTA*

WRITE (3, 5) KCAL

WR ITE (6, 29)

READ (5, 2) QUERY3

C

DELTAF = 2 . /(RN*DELTA*)

WR I TE ( 3 , 12) DELTAF

DO 113 1=1, K-l

F ( I

)

= I*DELTAF

AVPSD(I) = 0.

113 CONTINUE

C

105
i 17

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

onnoo

oj

oj

onn

ooononnnnnon

CALL PLOTS(0,0,0)

CALL FACTOR (.7874)

CALL PLOT ( . 5* .5,-3)

READ( 10, 1S,REC=7) NTOT

NOU, THE OPERATOR IS ASKED TO CHOOSE WHETHER ALL

THE PROFILES ARE TO BE ANALYZED AND, IF NOT, HOW MANY.

CALL CHO ICE (NTOT, ITOPRC, PRONUM)

THE MAIN LOOP TO CALCULATE AND PLOT THE PSD FOR EACH

PROFILE BEGINS HERE

RTOPRO = ITOPRO

DO 300 M = 1, ITOPRO

RNUMBR = PRONUM(M)

START = (PRONUM(M) - 1)*251 +8

READ (10,8, REC=START) NRUN, RA

WRITE (3, 13) NRUN

DO 301 Ml = 1 ,

2

READ (10,17) PROFIL

WRITE (6,31) PROF IL ( 1), PROFIL (2000)

CALL LEASQ (PROF IL,2000)

WRITE (6, 33)

DO 310 I = 1 ,

N

WSAVE(I) = KCAL*PROFIL(I)

10 CONTINUE

IF (Ml .EQ. 1) CALL EZPSDF (DELTAX, N, DCLEV1 , PSD, WSAVE)

IF (Ml .EQ. 2) CALL EZPSDF (DELTAX, N, DCLEV2, PSD2, WSAVE)

WRITE (6, 34)

01 CONTINUE

SQCHK = 0.

FCHK = 0.

DO 110 L=i,K

PSD (L) = (PSD (L) + PSD2(L))/2.

FCHK = FCHK + F (L) *PSD (L)

SQCHK = SQCHK + PSD(L)

PSDLOG(L) = ALOG 10 (PSD (L)

)

AVPSD(L) = AVPSD(L) + PSD (L) /RTOPRO

10 CONTINUE

RMSCHK = 5QRT(SQCHK*DELTAF)

LAMBDA = SQCHK/FCHK

FUNDAM = PSD ( 16) + PSD(17) + PSDC18) + PSDC19) + PSD(20)

PURITY = FUNDAM/SQCHK

DCLEVL = (DCLEV1 + DCLEV2)/2.

NOW WE WRITE ALL THE RESULTS ON THE PRINTER.

WRITE (3,1) DCLEVL

106
175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

UR I TE ( 3 , 2 1 ) RMSCHK

UR ITE (3, 9) PURITY

UR ITE (3, 26) LAMBDA

IF (QUERY3 .EQ. ' N' ) GO TO 202

UR I TE (3* 24)

UR ITE (3, 14) (PSD(I), I=1,K)

202 URITE(3,16) F(1),F(K-1)

C

C

C THE PLOT ROUTINES ARE NOU CALLED AND THE LOG OF THE

C PSD IS PLOTTED.

C

C

CALL PLOTME(F,PSDLOG, KPLUS,

1'LOG OF [PSD Cum CUBED) ]' ,23,

2 ' FREQUENCY (INVERSE um) ', 22, SPEC, RMSCHK, NRUN, I AVRG)

300 CONTINUE

C

C

C THE MAIN LOOP IS COMPLETE. NOU, UE PLOT AND PRINT THE

C RESULTS FOR THE AVERAGE PSD OF ALL THE SETS IN THE

C FILE.

C

C

I AVRG = 1 AVSQCK = 0.

AVFCHK = 0.

DO 302 L = 1 , K

AVSQCK = AVSQCK+AVPSD (L)

AVFCHK = AVFCHK+F (L) *AVPSD(L)

PSDLOG(L) = ALOG 10 (AVPSD (L)

)

302 CONTINUE

AVRMS = SQRT(AVSQCK*DELTAF)

AVLMDA = AVSQCK/AVFCHK

UR I TE (3, 20) ITOPRO

URITE(3,21) AVRMS

UR I TE (3, 26) AVLMDA

UR ITE (3,24)

UR ITE (3, 14) (AVPSD ( I ) ,

I = 1 , K)

UR I TE ( 3 , 16) F ( 1 ) , F (K- 1

)

CALL PLOTME (F, PSDLOG, KPLUS,

1

' LOG OF [PSD (um CUBED) ]' ,23,

2 ' FREQUENCY (INVERSE um) ' , 22, SPEC, AVRMS, ITOPRO, I AVRG)

CALL PLOT (0 . , 0 . , 999)

502 STOP

END

C

C

c SUBROUTINE PLOTME (X, Y, KPLUS, YLABEL, NYCHAR, XLABEL,

1 NXCHAR, SPEC, RMS, NRUN, IAVRG)

DIMENSION X( KPLUS) , Y(KPLUS) , XLABEL (20) , YLAEEL (20)

,

1 SPEC (15)

RUN = NRUN

K = KPLUS-2

CALL SCALE (Y, 8 . , K, +1

)

CALL SCALE (X, 12. ,K,+1)

CALL NEUPEN(-l)

107
233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

n

o

oo

o

o

n

Y(K+2) = -YCK+2)

YCK+1) = Y(K+1) - 8 . *Y(K+2)

CALL LINE (Y, X, K, 1,0,31)

CALL AXIS (0.,0.,YLABEL,-NYCHAR, 9., 0., YCK+1), YCK+2))

CALL AXIS (9 . , 0 . , XLABEL, -NXCHAR, 12. , 90. , X(K+1) ,X(K+2)

)

CALL SYMBOL (0., .2, . 2, SPEC, 90 ., 60)

CALL SYMBOL ( .5, .2, .2, 'RMS ROUGHNESS = ',90., 16)

IF (RMS .LT. 0.01) GO TO 501

CALL NUMBER (.5, 3. 4, . 2, RMS, 90 . , +3)

CALL SYMBOL ( 0 . 4, 4. 6, 0 . 2, 7, 90 . , - 1

)

CALL SYMBOL ( .4,4.8, . 2, 109, 90 . , - 1

)

GO TO 502

501 CALL NUMBER (0 . 5, 3 . 4, 0 . 2, RMS, 90 . , +5)

CALL SYMBOL (0 . 4, 5 . 0, 0 . 2, 7, 90 . , - 1

)

CALL SYMBOL (0 . 4, 5 . 2, 0 . 2, 109, 90 . , - 1

)

502 IF (IAVRG.EQ.l) GO TO 400

CALL SYMBOL (1., .2, .2, 'PSD FOR POSITION' ,90. , 16)

CALL NUMBER ( 1 . ,3.7, . 2, RUN, 90 . , - 1

)

GO TO 401

400 CALL SYMBOL (1., .2, .2, 'AVERAGE PSD FOR ALL ',90., 20)

CALL NUMBER (1., 4. 3, . 2, RUN, 90 . , - 1

)

CALL SYMBOL (1., 4. 7, .2, 'POSITIONS' ,90. , 10)

401 CALL PLOT (0 . , 0 . , +23)

RETURN

END

THIS ROUTINE CALCULATES THE LEAST SQUARES STRAIGHT LINE FOR

A SET OF 2000 EQUALLY SPACED DATA POINTS. IT CAN BE USED TO

FILTER OUT ANY SLOPE IN A SET OF PROFILE DATA.

SUBROUTINE LEASQ (PROF IL, N)

INTEGERS PROF I L (N)

1 FORMAT (

' AZERO', 1 IX, ' AONE' /2E 15 . 7)

RN = N C

C IN THE LEAST SQUARES FIT, LJE HAVE ALREADY

C CALCULATED THE SUM OF THE X'S AND X SQUARES,

C UHOSE VALUES NEVER CHANGE. THIS AVOIDS HAVING

C TO CALCULATE THEIR VALUES IN THE LOOP.

C

SUMX1 = 2001000.

SUMX2 = 2 . 668667E9

SUMY1 = 0.

SUMXY = 0.

DO 101 1=1,

N

SUMY1 = SUMY1 + PROF IL ( I

)

SUMXY = SUMXY + I*PROFIL(I)

101 CONTINUE

C

DELTA = RN*SUMX2 - SUMX1*SUMX1

AZERO = (SUMX2*SUMY1 - SUMX 1 *SUMXY) /DELTA

AONE = (RN*SUMXY - SUMX 1 *SUMY 1 ) /DELTA

UR I TE ( 3 , 1 ) AZERO, AONE

C

DO 102 1=1,

N

R I = I

108
291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

3 17

3 IS

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

3 j>7

338

339

340

341

342

343

344

345

346

347

348

SUB = AZERO + AONE*R

I

X = 0.5

IF (SUB .LT. 0.) X = -X

NSUB = SUB + X

PROFIL(I) = PROFIL(I) - NSUB

102 CONTINUE

RETURN

END

C

C

C SUBROUTINE FOR DETERMINING WHICH PROFILES IN C THE FILE ARE ANALYZED

C

C

SUBROUTINE CHOICE (NTOT, ITOPRO, PRONUM)

INTEGERS QUERY2, PRONUM(50)

C

1 FORMAT (' THERE ARE', 13,' PROFILES'//' DO YOU',

1' WANT TO ANALYZE ALL OF THEM?'/' "Y" OR "N"?')

2 FORMAT (12)

3 FORMAT(//' HOU MANY PROFILES DO YOU WANT TO ANALYZE?'/

1' USE 12 FORMAT.')

4 FORMAT (//' TYPE THE NUMBER OF THE FIRST PROFILE TO BE ANALYZED.'/

1' USE 12 FORMAT.')

5 F0RMAT(A2)

6 FORMAT(//' TYPE THE NUMBER OF THE NEXT PROFILE TO BE ANALYZED.'/

1' USE 12 FORMAT.')

C

WRITE (6,1) NTOT

READ (5,5) QUERY2

IF ( QUERY2 .EQ. 'N ') GO TO 131

C

ITOPRO = NTOT

DO 132 I = 1, ITOPRO

132 PRONUM(I) = I RETURN

C

131 WRITE (6,3)

READ (5,2) ITOPRO

WRITE (6,4)

READ (5,2) PRONUM(l)

DO 133 1=2, ITOPRO

WRITE (6,6)

133 READ (5,2) PRONUM(I)

RETURN

END

C

C

C

c SUBROUTINE RFFTF (N,R,WSAVE)

DIMENSION R ( 1

)

,WSAVE(1)

CALL RFFTF 1 (N, R, WSAVE, WSAVE (N+l ) , WSAVE (2*N+1 )

)

RETURN

END

C

C

c

109
349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

C

C

SUBROUTINE RGDF5 C IDO, L 1 , CC, CH, Ufl 1 , Ufi2, UA3, UA4)

DIMENSION CCCID0,L1,5) ,CHCID0,5,L1)

1 UAl(l) ,UA2C1) ,IJA3C1) ,UA4C1)

DPTP) TR11,TI11,TR12,TI12 /. 3090 16994374947, . 95 10565 16295 154,

1- . 809016994374947, . 587785252292473/

DO 101 K= 1 , L

1

CR2 = CC(1,K,5)+CC(1,K,2)

C 15 = CC ( 1 , K, 5) -CC ( 1 , K, 2)

CR3 = CC ( 1 , K, 4) +CC C 1 , K, 3)

C 14 = CCC1,K,4)-CC(1,K,3)

CH ( 1 , 1 , K) = CC ( 1 , K, 1 ) +CR2+CR3

CH ( IDO, 2, K) = CCC1,K, 1)+TR11*CR2+TR12*CR3

CH C 1 , 3, K) = Til 1*C I5+TI 12*C 14

CH ( IDO, 4, K) = CCC1,K, 1)+TR12*CR2+TR11*CR3

CH C 1 , 5, K) = TI 12*C I5-TI 1 1*C 14

101 CONTINUE

IF C IDO .EQ. 1) RETURN

IDP2 = IDO+2

DO 103 K=1,L1

DO 102 1=3, IDO,

2

IC = IDP2-I

DR2 = UA 1 C

I -2 ) *CC CI - 1 , K , 2 ) +UA 1(1-1) *CC ( I , K , 2

)

D 12 = UfllCI-2)*CCCI,K,2)-tJAlCI-l)*CCCI-l,K,2)

DR3 = UA2CI-2)*CC(I-1,K,3)+UA2(I-1)*CCCI,K,3)

D 13 = UA2(I-2)*CC(I,K,3)-UA2CI-1)*CCCI-1,K,3)

DR4 = UA3CI-2)*CCCI-1,K,4)+UA3CI-1)*CC(I,K,4)

D 14 = UA3(I-2)>lCCn,K,4)-UA3(I-n*CCCI-l,K,4)

DR5 = UA4CI-2)*CCCI-l,K,5)+Ufl4CI-l)*CCU,K,5)

D 15 = UA4CI-2)*CCCI,K,5)-UA4CI-1)*CCCI-1,I<,5)

CR2 = DR2+DR5

CIS = DR5-DR2

CR5 = DI2-DI5

C 12 = DI2+DI5

CR3 = DR3+DR4

C 14 = DR4-DR3

CR4 = DI3-DI4

C 13 = DI3+DI4

CHCI-1, 1,10 = CCC I-1,K, D+CR2+CR3

CH C 1 , 1 , K) = CC(I,K, D+CI2+CI3

TR2 = CCCI-1,K, 1)+TR11*CR2+TR12*CR3

TI2 = CCCI,K, 1)+TR11*CI2+TR12*CI3

TR3 = CCCI-1,K, 1)+TR12*CR2+TR11*CR3

TI3 = CCCI,K, 1)+TR12*CI2+TR11*CI3

TR5 = Til 1*CR5+TI 12*CR4

TI5 = Til 1*C I5+TI 12*C 14

TR4 = TI 12*CR5-TI 1 1*CR4

TI4 = TI12*CI5-TI11*CI4

CHCI-1, 3, K) = TR2+TR5

CH C IC- 1 , 2, K) = TR2-TR5

CHCI,3,K) = TI2+TI5

CH C IC, 2, K) = TI5-TI2

CHCI-1, 5, K) = TR3+TR4

CH C IC- 1 , 4, K) = TR3-TR4

CHCI,5,K) = TI3+TI4

CH C IC, 4, K) = TI4-TI3

102 CONTINUE

110
103

CONTINUE

RETURN

END

407

403

409

410

411

412

413

414

415

416

417

413

419

423

421

422

423

424

425

426

427

42S

429

430

431

432

433

434

435

436

437

43S

439

440

441

442

443

444

445

446

447

443

449

450

451

452

453

454

455

456

457

45 S

459

460

461

462

463

464

C

c

c

cc SUBROUTINE EZFFT1 (N,UA,IFAC)

DIMENSION UA(1) , IFAC(l) , NTRYH (4)

DATA NTRYH ( 1 ) , NTRYH ( 2 ) , NTR'YH ( 3 ) , NTR'YH C 4) /4, 2 , 3 , 5/

1 , TP 1/6. 283 185307 17959/

NL = N NF = 0

J = 0

101 J = J+l

IF (J-4) 102,102,103

102 NTRY = NTRYH (J)

GO TO 104

103 NTRY = NTRY+2

104 NO = NL/NTRY

NR = NL-NTRY>KNQ

IF (NR) 101,105,101

105 NF = NF+1

IFAC(NF+2) = NTRY

NL = NQ

IF (NTRY .NE. 2) GO TO 107

IF (NF .EQ. 1) GO TO 107

DO 106 1=2, NF

IB = NF- 1+2 • IFAC ( IB+2) = IFAC ( IB+1

)

106 CONTINUE

IFAC (3) = 2

107 IF (NL .NE. 1) GO TO 104

IFAC ( 1 ) = N IFAC (2) = NF

ARGH = TP I /FLOAT (N)

IS = 0

NFM1 = NF1

LI = 1 IF (NFM1 .EQ. 0) RETURN

DO 111 K 1 = 1 , NFM1

IP = IFAC (K 1+2)

L2 = L1*IP

IDO = N/L2

IPM = IP-1

ARG 1 = FLOAT (LI ) *ARGH

CHI = 1. SHI =0.

DCH 1 = COS (ARG 1

)

DSH 1 = SIN (ARG 1

)

DO 110 J=l, IPM

CH1H = DCH 1*CH 1-DSH 1*SH

1

SHI = DCH 1 *i<SH 1 +DSH 1 *CH 1 CHI = CH1H

I = IS+2

LJA(I-l) = CHI

IJA(I) = SHI

111
465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

non

nnoonnoono

o

n

r>nn

IF (IDO .LT. 5) GO TO 109

DO 108 11=5, IDO,

2

I = 1+2

WA(I-l) = CH1*WA( I-3)-SHl*UA( 1-2)

WA(I) = CH1*WA( I-2)+SHl*WA(I-3)

i0S CONTINUE

109 IS = IS+IDO

110 CONTINUE

LI = L2

111 CONTINUE

RETURN

END

SUBROUTINE EZFFTI CN, WSAVE)

DIMENSION WSAVE(l)

CALL EZFFTI (N, USAVE C2*N+1) , USAVE C3*N+1)

)

RETURN

END

THE FOLLOWING SUBROUTINE IS MODIFIED FROM THE

EZFFTF SUBROUTINE SUPPLIED TO US. THIS ONE CALCULATES THE POWER DIRECTLY, NOT JUST THE FOURIER

AMPLITUDES.

SUBROUTINE EZPSDF (DELTAX, N, DCLEVL, PSD, USAVE)

VERSION 3 JUNE 1979

DIMENSION PSD(l) ,WSAVE(1)

CALL RFFTF CN, USAVE, USAVE CN+1 )

)

CF = l./FLOATCN)

CFM = -CF

DCLEVL = CF*USAVE ( 1

)

NS2 = (N+l)/2

NS2M = NS2-1

DO 105 I=2,NS2M,2

REAL = WSAVE (2*1)

RIMAG = WSAVE (2*1+1)

DNREAL = WSAVE (2*1-2)

DNIMAG = WSAVE (2*1-1)

UPREAL = WSAVE (2*1+2)

UP I MAG = WSAVE (2*1+3)

RMID = REAL*REAL + R IMAG*R I MAG

RDN = DNREAL*DNREAL + DN IMAG*DN IMAG

RUP = UPREAL*UPREAL + UP IMAG*UP IMAG

C

C THE FACTOR OF 2 IS NEEDED BECAUSE WE ARE COMPUTING A

C ONE-SIDED PSD. WHEN WE INTEGRATE TO GET POWER, WE SHOULD

C INCLUDE THE NEGATIVE FREQUENCY CONTRIBUTION. INSTEAD,

112
323

524

525

526

52?

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

5^8

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

nnnnn

00000

00000000

LIE MULTIPLY THE POSITIVE SIDE BY A FACTOR OF 2.

IN ADDITION, INSTEAD OF CALCULATING A 1000 POINT POWER

SPECTRUM FROM THE 2000 POINT PROFILE, UE CALULATE A SMOOTHED

500 POINT POWER SPECTRUM.

PSD (1/2) = 2.*DELTAX*CF*(.25*RDN + .5*RMID + .25*RUP)

105 CONTINUE

PSDCNS2/2) = 2.*DELTAX*CF*WSAVE(N)*WSAVE(N)

RETURN

END

SUBROUTINE RADF2 ( IDO, L 1 , CC, CH, WA 1

)

DIMENSION CH (IDO, 2, LI) , CC ( IDO, L 1 , 2)

1 WA 1 ( 1

)

DO 101 K=1,L1

CH ( 1 , 1 , K) = CC(1,K, 1)+CC(1,K,2)

CH ( IDO, 2, K) = CC(1,K, 1)-CC(1,K,2)

101 CONTINUE

IF (IDO-2) 107,105,102

102 IDP2 = IDO+2

DO 104 K = 1 , L

1

DO 103 1=3, IDO,

2

IC = IDP2-I

TR2 = WA 1 ( 1-2) *CC ( I — 1 , K, 2) +WA 1(1-1) *CC ( I , K, 2)

TI2 = WA1(I-2)*CC(I,K,2)-WA1(I-1)*CCCI-1,K,2)

CH ( 1 , 1 , K) = CC ( I , K, 1)+TI2

CH(IC,2,K) = TI2-CC ( I , K, 1)

CH(I-1, 1 , K) = CC ( I— 1 , K, 1)+TR2

CH(IC-1,2,K) = CC( I- 1 , K, D-TR2

103 CONTINUE

104 CONTINUE

IF (MOD ( IDO, 2) .EQ. 1) RETURN

105 DO 106 K= 1 , L

1

CH ( 1 , 2, K) = -CC ( IDO, K, 2)

CH( IDO, 1 , K) = CC( IDO,K, 1)

106 CONTINUE

10? RETURN

END

SUBROUTINE RADF4 ( IDO, L 1 , CC, CH, WA 1 , WA2, WA3)

DIMENSION CC ( IDO, L 1 , 4) , CH ( IDO, 4, L 1

)

1 WA 1 ( 1 ) , WA2( 1) , WA3 ( 1

)

DATA HSQT2 /. 707 10678 1 1865475/

DO 101 K= 1 , L

1

TR1 = CC ( 1 , K . 2 ) +CC ( 1 , K , 4)

TR2 = CC ( 1 , K, 1)+CC(1,K,3)

CH( 1, 1,K) = TR1+TR2

113
531

532

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

n

n

n

r»n

CH( IDO, 4,10 = TR2-TR1

CH(ID0,2,K) = CC( 1, K, 1 )-CC ( 1, K,3)

CHC1,3,K) = CC C 1 , K, 4) -CC ( 1 , K, 2)

101 CONTINUE

IF (IDO-2) 107,105,102

102 IDP2 = IDO+2

DO 104 K = 1 , L

1

DO 103 1=3, IDO,

2

IC = IDP2-I

CR2 = UP1(I-2)*CC(I-1,K,2)+UP1(I-1)*CC(I,K,2)

C 12 = UP 1 ( 1-2) *CC ( I , K, 2) -UP 1(1-1) *CC ( I- 1 , K, 2)

CR3 = UP2(I-2)*CC(I-1,K,3)+UP2(-I-1)*CC(I,K,3)

013 = UP2(I-2)*CC(I,K,3)-UP2(I-1)*CC(I-1,K,3)

CR4 = UP3 ( 1-2) *CC (I-1,K,4) +UP3 ( I- 1 ) *CC ( I , K, 4)

C 14 = UP3(I-2)*CC(I,K,4)-UP3(I-1)*CC(I-1,K,4)

TR1 = CR2+CR4

TR4 = CR4-CR2

Til = CI2+CI4

TI4 = CI2-CI4

TI2 = CC ( I , K, 1)+CI3

TI3 = CC(I,K, D-CI3

TR2 = CC(I-1,K, 1 ) +CR3

TR3 = CC ( I- 1 , K, 1)-CR3

CH ( I- 1 , 1 , K) = TR1+TR2

CH ( IC- 1 , 4, K) = TR2-TR1

CH ( 1 , 1,K) = TI1+TI2

CH ( IC, 4, K) = TI1-TI2

CH( I-1,3,K) = TI4+TR3

CH ( IC- 1 , 2, l<) = TR3-TI4

CH(I,3,K) = TR4+TI3

CH(IC,2,K) = TR4-TI3

CONTINUE

.CONTINUE

IF (MOD ( IDO, 2) .EQ. 1) RETURN

CONTINUE

DO 106 K= 1 , L

1

Til = -HSQT2*(CC ( ID0,K,2)+CC( ID0,K,4)

)

TR1 = HSQT2*(CC( ID0,K,2)-CC( ID0,K,4)

)

CH ( IDO, 1,10 = TR1+CC(ID0,K, 1)

CH ( IDO, 3, K) = CC( IDO,K, 1)-TR1

CH ( 1 , 2, K) = TI 1-CC ( IDO, K, 3)

CH ( 1 , 4, K) = TI 1+CC ( IDO, K, 3)

CONTINUE

RETURN

END

103

104

105

106

107

SUBROUTINE RFFTF 1 (N, C, CH, UP, IFPC)

DIMENSION CH ( 1 ) ,C(1) ,UP(1)

NF = IFPC (2)

NP = 1 L2 = N IU = N DO 111 K 1 = 1, NF

KH = NF-K1

IFPC ( 1

)

K

114
639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

IP = IFAC (KH+3)

LI = L2/IP

IDO = N/L2

IDL 1 = IDO>KLl

IU = IU-(IP-l)*IDO

NA = 1-NA

IF (IP .NE. 4) GO TO 102

1X2 = IU+IDO

1X3 = 1X2+ I DO

IF (NA .NE. 0) GO TO 101

CALL RADF4 ( IDO, L 1 , C, CH, UA ( IU) , IJA C 1X2) , UA ( 1X3) ) GO TO 110

101 CALL RADF4 < IDO, L 1 , CH, C, UA ( IU) , UA ( 1X2) , UA ( 1X3)

)

GO TO 110

102 IF (IP .NE. 2) GO TO 104

IF (NA .NE. 0) GO TO 103

CALL RADF2 ( IDO, L 1 , C, CH, UA ( IU)

)

GO TO 110

103 CALL RADF2 ( IDO, L 1 , CH, C, UA ( IU)

)

GO TO 110

104 1X2 = IU+IDO

1X3 = IX2+ID0

1X4 = IX3+ID0

IF (NA .NE. 0) GO TO 107

CALL RADF5 ( IDO,Ll,C,CH,UA( IU) ,UA( 1X2) ,UA( 1X3) ,UA( 1X4)

)

GO TO 110

107 CALL RADF5 (ID0.Ll,CH,C,UA(IU),Ufl(IX2),Ufl(IX3),UA(IX4))

110 L2 = Li

111 CONTINUE

IF (NA .EQ. 1) RETURN

DO 112 1=1,

N

C(I) = CH ( I

)

112 CONTINUE

RETURN

END

115
11.4 Flowchart for PSD

'Set Array

Sizes and

Flags

,11. 90-94

The operator is prompted to type the name of the

data file to be examined. The file is then opened

as a logical unit.

There are 2000 points to be analyzed for each

calculation of a 500 point PSD.

'Initialize

FFT Arrays

1. 96

The main program calls EZFFTI, which in turn

calls EZFFTI

.

Input

Parameters

11. 98-108

Calculate

the Frequency

Values

11. 110-115

Preparatioi

’for Plotting

11. 117-119

Select

Profiles

[11 . 120-134

The program reads the specimen I.D., the horizontal

spacing of the data points, and the instrument

calibration constant and prompts the operator to

choose whether or not to print the values of the PSD.

These frequency values comprise the independent

variable of the PSD.

Three subroutines are called to initialize the

plotting sequence.

The total number of profiles in the data file is

read. Then the operator is asked to choose which

of these will be analyzed. The subroutine CHOICE

is used for this task.

116
The main loop to calculate and plot the PSD

begins

.

The inner loop to calculate the PSD for 'each

half of the profile begins.

The subroutine EZPSDF is called and in turn

calls several others.

The mean PSD for the two halves is averaged

in this section. The PSD is used to calculate

values for Rq and a mean wavelength parameter.

The PSD values are also printed if called for.

PLOTME is called here.

117
<£>

Calcu

Paramet

AVI

11. 15

ilate ers for

’SD

9-208

/ Print /

/ Results /

/ for AVPSD

11. 209-214/

/ Plot /

/ AVPSD

11. 215-218/

f Stop

^

V. 1- J

Rq and the mean wavelength parameter are calculated

again

PLOTME is called again.

118
SINUSOIDAL

PROTOTYPES

WITH

3

UM

RA

,

28APR78

11.5 Example of PSD Plot

CD

« z

II O

i—

i

CO I—

CO 1-1 LU CO 2 O

X Q_

CD

IDO o

CL Ll

3.80 3.10 2.30 1.50 0.79 -0.10 -6.90 -1.70 -2.50

LOG OF [PSD Cum CUBED)]

- 3?3<3

119

.00

0.05

0.10

0.15

0.20

0.25

0.30

0.35

0.40

0.45

0.50

0.55

0.60

FREQUENCY

(INVERSE

urn)
12.

References

1. D. Byrne, P. A. Fitzsimmons, A. K. Brook, Paper E — 1 3 in

Pr oc. Sy m posiu m on Ship Costs and Energy 1 82 (Society of

Naval Architects and Marine Engineers, New York, To be

published )

2. B. Scheffer, Com parison de Dif f erentes Nor mes Nationales

(Rfegie Nationale des Usines Renault, Paris, 1969).

3. E. L. Church, M. R. Howells, and T. V. Vorburger in

Reflecting Optics for Synchrotron Radiation , Proc. SPIE 315 . 202 (1 981 ).

4. T. V. Vorburger, E. C. Teague, and F. E. Scire,

Dim ensi ons/NBS ££, No. 11, 18 (Nov. 1 978).

5. E. C. Teague, Evaluation. Revision, and Application of the

NBS Stvlus/C om outer S yste m for the M easure m ent of Surface

Roughness . NBS Tech. Note 902 (Dept, of Commerce, Wash., DC,

1976).

6. E. C. Teague, Evaluation, Revision, and Application of the

NBS Stxius Computer Sxs.te.rn fo r Surface JR.ou.ghne.ss

Measurement

M inicomputer Software , NBS Internal Report 75-

924 (Dept, of Commerce, Wash., DC, 1 975).

7. M. G. Natrella, Experi m ental Statistics , NBS Handbook 91

(Dept, of Commerce,- Wash., DC, 1963) p. 1-10.

8. Ref. 5, p. 15.

9. R. C. Spragg and D. J. Whitehouse, Proceedings of the

Institution of Mechanical Engineers, 1 85 , (47/71) 697 (1970-

71 ).

10. T. V. Vorburger, F. E. Scire, and E. C. Teague, Surface

Roughness Measurement^ o£ Circular Dis.k s. and Their

Correlation w ith H vdrodvna mic Drag , NBS Tech. Note 1151

(Dept, of Commerce, Wash., DC, 1 982).

11. E. C. Teague, F. E. Scire, and T. V. Vorburger, Wear £3, 61

( 1982 ).

12. G. M. Jenkins and D. G. Watts, Spectral Analysis and Its

Applications (Holden-Day, San Francisco, 1968) pp. 171 ff.

13. Guide to Available Mathematical Software . Center for Applied

Mathematics (Nat. Bur. Stds., Wash. DC, 1981).

14. J. S. Bendat and A. G. Piersol, Rando m Data : Analysis an d

Measurement Procedures (Wiley-Interscience, New York, 1971)

p. 318.

120
NBS-114A (REV. 2-80

U.S. DEPT. OF COMM.

BIBLIOGRAPHIC DATA

SHEET (See instructions)

1. PUBLICATION OR

REPORT NO.

NBSIR 83-2703

2. Performing Organ. Report No. 3. Publication Date

July 1983

4. TITLE AND SUBTITLE

FASTMENU: A Set of IORTRAN Programs for Analyzing Surface Texture

5. AUTHOR(S)

Theodore V. Vorburger

6. PERFORMING ORGANIZATION (If joint or other than N BS. see instructions)

national bureau of standards

DEPARTMENT OF COMMERCE

WASHINGTON, D.C. 20234

7. Contract/Grant No.

8. Type of Report & Period Covered

9.

SPONSORING ORGANIZATION NAME AND COMPLETE ADDRESS (Street. City. State, ZIP)

10

.

SUPPLEMENTARY NOTES

| | Document describes a computer program; SF-185, FIPS Software Summary, is attached.

11.

ABSTRACT (A 200-word or less factual summary of most significant information. If document includes a significant

bibliography or literature survey, mention it here)

A set of FORTRAN programs for surface texture analysis is described. These

programs were developed for use with a minicomputer that is interfaced to

stylus type instruments. The programs 1) perform data acquisition from the

stylus instruments, 2) store the data on magnetic disk, and 3) perform

statistical analyses for parameters such as the roughness average Ra , rms roughness Rq, and for the autocorrelation function and amplitude density

function.

3

12.

KEY WORDS (Six to twelve entries; alphabetical order; capitalize only proper names; and separate key words by semicolon s) amplitude density function; autocorrelation function; calibration; digitization;

metrology; minicomputer; roughness; statistics; stylus; surface metrology; surface

profile; surface texture

13. AVAILABILITY

l yj Unlimited

| | For Official Distribution. Do Not Release to NTIS

| Order From Superintendent of Documents, U.S. Government Printing Office, Washington, D.C. 20402.

QjC Order From National Technical Information Service (NTIS), Springfield, VA. 22161

14. NO. OF

PRINTED PAGES

123

15. Price

$13 -.00

Ir )
w

l

<