Topological Analysis of Two-Phase Microstructures


Language: GWBasic.

Objective: This program is part of a Quantitative Metallography Package. Given a set of data about the number of intercepts between a test line and grain boundaries of two phases in a two-phase microstructure, it makes the necessary calculations requerired for the determination of its grain sizes and other topological parameters like mean free path, contiguity volume, and so on. Of course, it is included a simple statistical analysis of the results.


***** Begin of Program Listing *****

10  REM
12  REM  ***          QUANTITATIVE METALLOGRAPHY PACKAGE
14  REM  ***
16  REM  ***  Calculation of the Topological Parameters of a Two-Phase
18  REM  ***  Microstructure, Including the Grain Size of Both Constituents.
20  REM  ***
22  REM  ***       References:
24  REM  ***
26  REM  ***     - HORNBOGEN, E. et alii. Zeitschrift fuer Metallkunde,
28  REM  ***       Januar 1980, 27-31.
30  REM  ***
32  REM  ***     - CRIBB, W.R. Scripta Metallurgica, 1978, 892-898.
34  REM  ***
36  REM  ***     - MAID, O. et alii. Stahl und Eisen, 18 April 1988,
37  REM  ***       355-364.
38  REM  ***
40  REM  ***     - UNDERWOOD, N. Quantitative Stereology. Addison-
42  REM  ***       Wesley, Reading, 1970.
44  REM  ***
46  REM  ***     - UGGOWITZER, P. et alii. Zeitschrift fuer
48  REM  ***       Metallkunde, Mai 1977, 277-285.
50  REM  ***
52  REM  ***
54  REM  ***
56  REM  ***       Authors: Antonio Gorni & Osvaldo Branchini
57  REM  ***                COSIPA - I.ME - C.P. 11
58  REM  ***                11573-900    Cubatao SP    Brazil
59  REM  ***
60  REM  ***                   April 17, 1989
62  REM  ***
100  SCREEN 1: SCREEN 0: KEY OFF: OPTION BASE 1: DIM NI(100, 3), DG(100, 8), NV(100, 8), VS(50): B$ = CHR$(7): ON ERROR GOTO 2040
110  FOR I = 1 TO 8: READ MS$(I): NEXT I
120  VIEW PRINT 1 TO 24: CLS : BF$ = "TOPOLOGICAL ANALYSIS OF TWO-PHASE MICROSTRUCTURES": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: PRINT : PRINT : LOCATE 5
130  LOCATE , 10: PRINT "<1> Data Input": PRINT
140  LOCATE , 10: PRINT "<2> Data Correction": PRINT
150  LOCATE , 10: PRINT "<3> Data Suppression": PRINT
160  LOCATE , 10: PRINT "<4> Data Output": PRINT
170  LOCATE , 10: PRINT "<5> Data Saving": PRINT
180  LOCATE , 10: PRINT "<6> Results Output"
190  PRINT : LOCATE , 10: PRINT "<7> End"
200  LOCATE 23: BF$ = "(c) 1989, by": PRINT TAB((40 - LEN(BF$)) / 2 + 1); BF$: LOCATE 24: BF$ = "ANTONIO GORNI & OSVALDO BRANCHINI": PRINT TAB((40 - LEN(BF$)) / 2 + 1); BF$;
210  LOCATE 20: LOCATE , 10: INPUT "Your Option"; RR
220  IF RR > 7 OR RR < 1 THEN PRINT B$: GOTO 120
230  ON RR GOTO 240, 640, 730, 830, 1210, 1330, 1830
240  CLS : BF$ = "DATA INPUT": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0
250 VIEW PRINT 4 TO 24: LOCATE 8, 13: PRINT "<1> New Data": LOCATE 13, 13: PRINT "<2> More Data": LOCATE 22, 13: INPUT "Your Choice"; RF: IF RF < 1 OR RF > 2 THEN PRINT B$: GOTO 250
260 R$ = ""
270  IF FS <> 0 AND RF = 1 THEN CLS : LOCATE 8: BF$ = "DATA NOT SAVED YET!": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 31, 0: PRINT B$; BF$: COLOR 7, 0 ELSE 290
280 LOCATE 20: INPUT "Do You Really Want to Enter New Data (Y/N)"; R$: IF R$ <> "Y" AND R$ <> "N" THEN PRINT B$: GOTO 270
290  IF R$ = "N" THEN 120
300  IF RF = 1 THEN NP = 0: FS = 0: AQ$ = ""
310  IF RF = 2 THEN FS = -1
320 VIEW PRINT 1 TO 24: CLS : BF$ = "INPUT OPTION": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0
330 LOCATE 8, 14: PRINT "<1> Keyboard": LOCATE 13, 14: PRINT "<2> Disk": LOCATE 20, 14: INPUT "Your Choice"; RE: IF RE < 1 OR RE > 2 THEN PRINT B$: GOTO 320
340  ON RE GOTO 350, 550
350  CLS : BF$ = "INPUT VIA KEYBOARD": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: VIEW PRINT 2 TO 24: LOCATE 7: FS = -1
360  IF RF = 2 THEN PRINT "Length of Line Test: "; LT; " microns": PRINT : PRINT "Magnification: "; M; "x": PRINT : PRINT "Volumetric Fraction of Second Phase [Fv], (%): "; VV * 100; "%"
365  PRINT : PRINT "Statistical Percentual Error Associated with Fv: "; PE; "%": GOTO 410
370  INPUT "Length of Test Line (microns)"; LT
380  PRINT : INPUT "Magnification (x)"; M
390  PRINT : INPUT "Volumetric Fraction of Second Phase [Fv], (%)"; VV: VV = VV / 100
400  PRINT : INPUT "Statistical Percentual Error Associated with Fv"; PE
410  PRINT : PRINT
420  PRINT "Now Enter the Number of Intercepts;"; : PRINT "Enter END to Finish."
430 NP = NP + 1: PRINT : PRINT "----------------------------------------"
440 PRINT "A-A ("; NP; ")? ";
450 INPUT "", B1$: IF B1$ = "END" THEN NP = NP - 1: GOTO 120
460 PRINT "B-B ("; NP; ")? ";
470 INPUT "", B2$: IF B2$ = "END" THEN NP = NP - 1: GOTO 120
480 PRINT "A-B ("; NP; ")? ";
490 INPUT "", B3$: IF B3$ = "END" THEN NP = NP - 1: GOTO 120
500 NI(NP, 1) = VAL(B1$): NI(NP, 2) = VAL(B2$): NI(NP, 3) = VAL(B3$)
510 N1 = (2 * NI(NP, 1) + NI(NP, 3)) / 2: N2 = (2 * NI(NP, 2) + NI(NP, 3)) / 2: DG(NP, 1) = ((1 - VV) * LT) / (N1 * M): DG(NP, 2) = (VV * LT) / (N2 * M)
520 DG(NP, 3) = 4 * NI(NP, 1) / (4 * NI(NP, 1) + 2 * NI(NP, 3)): DG(NP, 4) = 4 * NI(NP, 2) / (4 * NI(NP, 2) + 2 * NI(NP, 3))
530 DG(NP, 5) = DG(NP, 1) / (1 - DG(NP, 3)): DG(NP, 6) = DG(NP, 2) / (1 - DG(NP, 4)): DG(NP, 7) = NI(NP, 2) / NI(NP, 1): DG(NP, 8) = NI(NP, 3) / NI(NP, 1)
540  GOTO 430
550  CLS : BF$ = "INPUT VIA DISK": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0
560 VIEW PRINT 2 TO 24: LOCATE 10: PRINT "Input File (? to List Directory)?": PRINT : INPUT "", AQ$
570 IF AQ$ = "?" THEN CLS : LOCATE 6: INPUT "Directory"; DD$: PRINT : FILES DD$ + "*.TGB": PRINT : INPUT "Press  to Continue...", R$: CLS : GOTO 560
580 AQ$ = AQ$ + ".TGB": LOCATE 20: COLOR 31, 0: PRINT "READING "; AQ$: COLOR 7, 0
590 OPEN "I", #1, AQ$: INPUT #1, NR: INPUT #1, LT: INPUT #1, M: INPUT #1, VV: INPUT #1, PE: FOR I = NP + 1 TO NR + NP: FOR J = 1 TO 3: INPUT #1, NI(I, J): NEXT J, I
600  FOR I = NP + 1 TO NP + NR: N1 = (2 * NI(I, 1) + NI(I, 3)) / 2: N2 = (2 * NI(I, 2) + NI(I, 3)) / 2: DG(I, 1) = ((1 - VV) * LT) / (N1 * M): DG(I, 2) = (VV * LT) / (N2 * M)
610 DG(I, 3) = 4 * NI(I, 1) / (4 * NI(I, 1) + 2 * NI(I, 3)): DG(I, 4) = 4 * NI(I, 2) / (4 * NI(I, 2) + 2 * NI(I, 3))
620 DG(I, 5) = DG(I, 1) / (1 - DG(I, 3)): DG(I, 6) = DG(I, 2) / (1 - DG(I, 4)): DG(I, 7) = NI(I, 2) / NI(I, 1): DG(I, 8) = NI(I, 3) / NI(I, 1): NEXT I
630  CLOSE #1: NP = NP + NR: GOTO 120
640  CLS : BF$ = "DATA CORRECTION": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: PRINT : PRINT
650 VIEW PRINT 2 TO 24: LOCATE 6: PRINT "Length of Test Line: "; LT; " microns": PRINT : PRINT "Magnification: "; M; "x": PRINT : PRINT "Volumetric Fraction of Second Phase [Fv]: "; VV * 100; "%"
660  PRINT : PRINT "----------------------------------------": INPUT "Index of the Point to be Corrected (END to finish)"; BF$: IF BF$ = "END" THEN FS = -1: GOTO 120
670 IC = VAL(BF$): PRINT : PRINT "A-A="; : PRINT " "; NI(IC, 1); TAB(20); : INPUT ""; NI(IC, 1)
680  PRINT "B-B="; : PRINT " "; NI(IC, 2); TAB(20); : INPUT ""; NI(IC, 2)
690  PRINT "A-B="; : PRINT " "; NI(IC, 3); TAB(20); : INPUT ""; NI(IC, 3)
700 N1 = (2 * NI(IC, 1) + NI(IC, 3)) / 2: N2 = (2 * NI(IC, 2) + NI(IC, 3)) / 2: DG(IC, 1) = ((1 - VV) * LT) / (N1 * M): DG(IC, 2) = (VV * LT) / (N2 * M)
710 DG(IC, 3) = 4 * NI(IC, 1) / (4 * NI(IC, 1) + 2 * NI(IC, 3)): DG(IC, 4) = 4 * NI(IC, 2) / (4 * NI(IC, 2) + 2 * NI(IC, 3))
720 DG(IC, 5) = DG(IC, 1) / (1 - DG(IC, 3)): DG(IC, 6) = DG(IC, 2) / (1 - DG(IC, 4)): DG(IC, 7) = NI(IC, 2) / NI(IC, 1): DG(IC, 8) = NI(IC, 3) / NI(IC, 1): GOTO 660
730  CLS : BF$ = "DATA SUPPRESSION": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: LOCATE 10: VIEW PRINT 2 TO 24: ISA = 0
740  LOCATE 7: INPUT "Index of the Point to be Suppressed (END to finish)"; BF$: IF BF$ = "END" THEN 790
750 IC = VAL(BF$): PRINT : PRINT : PRINT NI(IC, 1); TAB(14); NI(IC, 2); TAB(28); NI(IC, 3): PRINT DG(IC, 1); TAB(14); DG(IC, 2)
760  LOCATE 14: PRINT B$; : INPUT "Confirm (Y/N)! ", BF$: IF BF$ = "N" THEN CLS : GOTO 740
770  IF BF$ <> "Y" THEN 760
780  CLS : ISA = ISA + 1: VS(ISA) = IC: GOTO 740
790  IF ISA = 0 THEN 120
800  LOCATE 16: COLOR 31, 0: PRINT "PROCEEDING SUPPRESSIONS...": COLOR 7, 0: FOR I = 1 TO ISA - 1: FOR J = I + 1 TO ISA: IF VS(J) > VS(I) THEN IA = VS(J): VS(J) = VS(I): VS(I) = IA
810  NEXT J, I: FS = -1
820  FOR J = 1 TO ISA: FOR I = VS(J) TO NP - 1: FOR K = 1 TO 3: NI(I, K) = NI(I + 1, K): NEXT K: FOR K = 1 TO 8: DG(I, K) = DG(I + 1, K): NEXT K: NEXT I: NP = NP - 1: NEXT J: CLS : GOTO 120
830  CLS : BF$ = "DATA OUTPUT": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: VIEW PRINT 2 TO 24: CL = 0
840  VIEW PRINT 2 TO 24: LOCATE 8, 13: PRINT "<1> Screen": LOCATE 13, 13: PRINT "<2> Printer": LOCATE 22, 13: INPUT "Your Choice"; RE: IF RE < 1 OR RE > 2 THEN PRINT B$: GOTO 840
850 CLS
860 IF RE = 2 THEN 2080
870 LOCATE 8: PRINT "Data were determined with:": PRINT : PRINT
880 PRINT "Length of Test Line: "; LT; " microns": PRINT
890 PRINT "Magnification: "; M; " x": PRINT
900 PRINT "Volumetric Fraction of Second Phase [Fv]: "; VV * 100; "%": PRINT
910 PRINT "Statistical Error Associated with Fv: "; PE; "%": LOCATE 22
920 INPUT "Press  to Start Data Output.", BF$: CLS
930 FOR I = 1 TO NP
940  PRINT : PRINT : PRINT "Point #"; I: PRINT : PRINT "A-A = "; NI(I, 1); TAB(14); "B-B = "; NI(I, 2); TAB(28); "A-B = "; NI(I, 3): PRINT "TG ALPHA = "; DG(I, 1): PRINT "TG BETA = "; DG(I, 2): CL = CL + 1
950  IF CL >= 3 AND I < NP THEN PRINT : PRINT "Press  to Continue... "; : CL = 0: INPUT "", R$: CLS
960  GOTO 970
970  NEXT
980  PRINT : INPUT "Press  to Continue...", BF$
990  FOR NK = 1 TO 2
1000  CLS : LOCATE 12: PRINT "Crunching Numbers... Please Wait for a While!"
1010  FOR I = 1 TO 5: VM(I) = 0: VI(I) = 2000: NEXT I
1020  FOR I = 1 TO NP: IF DG(I, NK) > VM(5) THEN GOSUB 1050
1030  IF DG(I, NK) < VI(5) THEN GOSUB 1070
1040  NEXT I: GOTO 1090
1050 VM(5) = DG(I, NK): V1(5) = I: FOR K = 1 TO 4: FOR J = K + 1 TO 5: IF VM(J) > VM(K) THEN IA = VM(K): VM(K) = VM(J): VM(J) = IA: IA = V1(K): V1(K) = V1(J): V1(J) = IA
1060  NEXT J, K: RETURN
1070 VI(5) = DG(I, NK): V2(5) = I: FOR K = 1 TO 4: FOR J = K + 1 TO 5: IF VI(J) < VI(K) THEN IA = VI(K): VI(K) = VI(J): VI(J) = IA: IA = V2(K): V2(K) = V2(J): V2(J) = IA
1080  NEXT J, K: RETURN
1090  FOR I = 1 TO 5: IF VM(I) = 0 THEN VM(I) = -1
1100  IF VI(I) = 2000 THEN VI(I) = -1
1110  NEXT I
1120 BF$ = MS$(NK)
1130  CLS : PRINT : PRINT TAB((40 - LEN(BF$)) / 2 + 1); : PRINT BF$: LOCATE 8: PRINT "The 5 Lowest Points Are:": PRINT
1140 PRINT USING "###.#"; VI(1); : PRINT TAB(8); : PRINT USING "###.#"; VI(2); : PRINT TAB(16); : PRINT USING "###.#"; VI(3); : PRINT TAB(24); : PRINT USING "###.#"; VI(4); : PRINT TAB(32); : PRINT USING "###.#"; VI(5)
1150  PRINT "("; V2(1); ")"; TAB(8); "("; V2(2); ")"; TAB(16); "("; V2(3); ")"; TAB(24); "("; V2(4); ")"; TAB(32); "("; V2(5); ")": PRINT : PRINT : PRINT
1160  PRINT "The 5 Highest Points Are:": PRINT
1170 PRINT USING "###.#"; VM(1); : PRINT TAB(8); : PRINT USING "###.#"; VM(2); : PRINT TAB(16); : PRINT USING "###.#"; VM(3); : PRINT TAB(24); : PRINT USING "###.#"; VM(4); : PRINT TAB(32); : PRINT USING "###.#"; VM(5)
1180 PRINT "("; V1(1); ")"; TAB(8); "("; V1(2); ")"; TAB(16); "("; V1(3); ")"; TAB(24); "("; V1(4); ")"; TAB(32); "("; V1(5); ")"
1190 LOCATE 22: INPUT "Press  to Continue...", BF$
1200  NEXT NK: GOTO 120
1210  CLS : BF$ = "DATA SAVING ON DISK": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: VIEW PRINT 2 TO 24
1220  IF AQ$ = "" THEN 1270
1230  LOCATE 10: PRINT "Current File is "; LEFT$(AQ$, LEN(AQ$) - 4)
1240  LOCATE 12: INPUT "Keep it (Y/N)"; R$: IF R$ <> "Y" AND R$ <> "N" THEN PRINT B$: GOTO 1240
1250  IF R$ = "Y" THEN 1300
1260  CLS
1270  LOCATE 10: PRINT "File Name  (? for Directory Listing)? ": PRINT : INPUT "", AQ$
1280  IF AQ$ = "?" THEN CLS : LOCATE 6: INPUT "Directory"; DD$: PRINT : FILES DD$ + "*.TGB": PRINT : PRINT : INPUT "Press  to Continue...", R$: CLS : GOTO 1270
1290 AQ$ = AQ$ + ".TGB"
1300  LOCATE 20: COLOR 31, 0: PRINT "SAVING IN "; AQ$: COLOR 7, 0
1310  OPEN "O", #1, AQ$: PRINT #1, NP: PRINT #1, LT: PRINT #1, M: PRINT #1, VV: PRINT #1, PE: FOR I = 1 TO NP: FOR J = 1 TO 3: PRINT #1, NI(I, J): NEXT J, I: CLOSE #1: FS = 0
1320  GOTO 120
1330  CLS : B2$ = "OUTPUT OF RESULTS": PRINT TAB((40 - LEN(B2$)) / 2 + 1); : COLOR 0, 7: PRINT B2$: COLOR 7, 0: VIEW PRINT 2 TO 24
1340  LOCATE 8: LOCATE , 14: PRINT "<1> Screen": LOCATE 14: LOCATE , 14: PRINT "<2> Printer": LOCATE 21: LOCATE , 14: INPUT "Your Choice"; RE: IF RE < 1 OR RE > 2 THEN PRINT B$: GOTO 1340
1350  FOR I = 1 TO NP: FOR J = 1 TO 8
1360 IF DG(I, J) >= 100 THEN NV(I, J) = DG(I, J): MASC$(J) = "###": GOTO 1390
1370 IF J = 3 OR J = 4 OR J = 7 OR J = 8 THEN NV(I, J) = DG(I, J): MASC$(J) = "#.##": GOTO 1390
1380 NV(I, J) = DG(I, J): MASC$(J) = "##.#"
1390 NEXT J, I
1400 IF RE = 2 THEN 2190
1410 FOR NK = 1 TO 8
1420 B1$ = MS$(NK): IF NK > 1 THEN 1500
1430 VIEW PRINT 1 TO 24: CLS : BF$ = "MEASURING CONDITIONS": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0
1440 LOCATE 6: PRINT "Number of Points: "; NP: PRINT : PRINT
1450 PRINT "Manigication: "; M; "x": PRINT : PRINT
1460 PRINT "Length of Test Line: "; LT; " microns": PRINT : PRINT
1470 PRINT "Volumetric Fraction of Second Phase [Fv]: "; VV * 100; "%": PRINT : PRINT
1480 PRINT "Statistical Error Associated with Fv: "; PE; "%"
1490 LOCATE 22: INPUT "Press  to Continue...", BF$: CLS
1500 CL = 6: VIEW PRINT 1 TO 24: CLS : PRINT TAB((40 - LEN(B1$)) / 2 + 1); : COLOR 0, 7: PRINT B1$: COLOR 7, 0: VIEW PRINT 4 TO 24: LOCATE 6
1510 PRINT "Data Collected:"
1520 FOR I = 1 TO NP STEP 6: FOR J = 0 TO 5: IF I + J > NP THEN 1570
1530 PRINT USING MASC$(NK); NV(I + J, NK); : IF J < 5 THEN PRINT TAB(J * 6 + 7);
1540 NEXT J: PRINT : CL = CL + 1
1550 IF CL >= 22 AND I < NP - 5 THEN PRINT : INPUT "Press  to Continue...", R$: CLS : PRINT : PRINT "Data Collected:"
1560 NEXT
1570 PRINT : PRINT
1580 INPUT "Press  to Continue...", R$: CLS
1590 GOSUB 1870
1600 PRINT : BF$ = "=> Statistical Analysis <=": PRINT TAB((40 - LEN(BF$)) / 2 + 1); BF$: PRINT : LOCATE 10
1610  PRINT "Average = "; MD
1620 IF NK = 1 OR NK = 2 THEN TA(NK) = -10 - 6.64 * LOG(MD / 10000) / 2.30258409#: PRINT "ASTM Grain Size = "; : PRINT USING "##.##"; TA(NK): D(NK) = MD
1630 IF NK = 3 THEN VC = INT(MD * (1 - VV) * 100) / 100: PRINT "Contiguity Volume  = "; VC
1640 IF NK = 4 THEN VC = INT(MD * VV * 100) / 100: PRINT "Contiguity Volume = "; VC
1650 PRINT "Standard Deviation = "; INT(DP * 100) / 100
1660 PRINT : PRINT "N(1%)= "; INT(NM(1) + .5); TAB(14); "N(3%) = "; INT(NM(3) + .5); TAB(28); "N(5%) = "; INT(NM(5) + .5): PRINT
1670 PRINT "Real Precision = "; INT(PRE * 100) / 100; " %"
1680 PRINT "Precision of the Mean = "; INT((MD * PRE / 100) * 100) / 100
1690 PB = MD * PRE / 100: PRINT "Mean Amplitude = "; INT(MD * 100) / 100; "+/-"; INT(PB * 100) / 100
1700 IF NK = 1 THEN P1 = PRE
1710 IF NK = 2 THEN P2 = PRE: P4 = PB
1720 LOCATE 22: INPUT "Press  to Continue...", BF$
1730  NEXT NK
1740 VIEW PRINT 1 TO 24: CLS : COLOR 0, 7: PRINT "GENERAL PARAMETERS OF THE TWO-PHASE MICROSTRUCTURE": COLOR 7, 0: LOCATE 7
1750 PRINT "Global ASTM Grain Size: ": PRINT TA(1) * (1 - VV) + TA(2) * VV: PRINT : AX = VV / (1 - VV): P3 = PE * VV / 100: PA = P3 * 100 / (1 - VV): PX = (PA + PE) / 100 * AX
1760 PRINT "Volumetric Fraction Ratio between the Two Phases: ": PRINT INT(AX * 1000) / 1000; " +/- "; : PRINT INT(PX * 1000) / 1000: PRINT
1770 R1 = P1 * D(1) / 100: R2 = P2 * D(2) / 100: AX = (D(2) / D(1)) ^ 3: PX = SQR((3 * D(2) ^ 2 / D(1) ^ 3 * R2) ^ 2 + (3 * D(2) ^ 3 / D(1) ^ 4 * R1) ^ 2)
1780 PRINT "Grain Size Ratio between the Two Phases:": PRINT INT(AX * 1000) / 1000; " +/- "; INT(PX * 1000) / 1000: PRINT
1790 AX = .98 * D(2) * (.885 / SQR(VV) - 1): PX = SQR((.867 / SQR(VV) - .98) ^ 2 * P4 * P4 + (-.867 * D(2) / (2 * (VV) ^ 1.5)) ^ 2 * P3 * P3)
1800  PRINT "Spacing between the Grains of the Second Phase:": PRINT INT(AX * 1000) / 1000; " +/- "; INT(PX * 1000) / 1000
1810 LOCATE 22: INPUT "Press  to Continue...", BF$
1820  GOTO 120
1830  CLS : BF$ = "END OF PROGRAM RUN ": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: VIEW PRINT 2 TO 24: IF FS = 0 THEN 1860
1840  LOCATE 8: BF$ = "DATA NOT SAVED YET!": PRINT TAB((40 - LEN(BF$)) / 2 + 1); : COLOR 31, 0: PRINT B$; BF$: COLOR 7, 0: LOCATE 20: INPUT "Do Your Really Want to Quit (Y/N)"; R$: IF R$ <> "Y" AND R$ <> "N" THEN PRINT B$: GOTO 1840
1850  IF R$ = "N" THEN 120
1860 VIEW PRINT 1 TO 24: SCREEN 0: SCREEN 2: SCREEN 0: CLS : KEY ON: END
1870 REM  SUB-ROTINA PARA CALCULAR MEDIA, DESVIO PADRAO E ERRO DA MEDIA
1880 HP = 0: TX = 0
1890  REM  HP- SOMATORIA DE DG; TX- SOMATORIA DE DG^2; MD- MEDIA DE DG; DP- DESVIO PADRAO DE DG.
1900  FOR I = 1 TO NP
1910 HP = HP + DG(I, NK)
1920 TX = TX + (DG(I, NK) ^ 2)
1930  NEXT I
1940 MD = HP / NP
1950 DP = ((TX - (HP ^ 2 / NP)) / (NP - 1))
1960 DP = SQR(DP)
1970  IF MD = 0 THEN FOR KJ = 1 TO 5 STEP 2: NM(KJ) = 0: NEXT KJ: PRE = 0: RETURN
1980  IF NK = 1 OR NK = 2 OR NK = 5 OR NK = 6 THEN DP = DP + PE * MD * SQR(NP) / 200
1990  FOR KJ = 1 TO 5 STEP 2
2000 NM(KJ) = (200 * DP / (KJ * MD)) ^ 2
2010  NEXT KJ
2020 PRE = 200 * DP / MD / SQR(NP)
2030  RETURN
2040 CLS : LOCATE 12: COLOR 31, 0: IF ERR = 53 THEN PRINT "File Not Found!" ELSE PRINT B$; "ERROR #"; ERR; " IN LINE "; ERL; "!"
2050 COLOR 7, 0: LOCATE 22: INPUT "Pressione  para continuar...", BF$: GOTO 120
2060 DATA  "GRAIN SIZE, ALPHA PHASE","GRAIN SIZE, BETA PHASE","CONTIGUITY, ALPHA PHASE","CONTIGUITY, BETA PHASE"
2070  DATA  "MEAN PATH, ALPHA PHASE","MEAN PATH, BETA PHASE","GRAIN SIZE DENSITY RATIO","GRAIN BOUNDARIES/PHASE BOUNDARIES RATIO"
2080 LOCATE 10: PRINT "Prepare Printer;": PRINT "Mark Start of Report.": PRINT : PRINT : PRINT
2090 PRINT "Identification Message to be Printed? ": PRINT : LINE INPUT "", BF$: LPRINT "COLLECTED DATA OF THE TWO-PHASE MICROSTRUCTURE - "; BF$: CL = 6: LPRINT DATE$, TIME$: LPRINT : LPRINT
2100 LPRINT "Length of the Test Line: "; LT; " microns"
2110 LPRINT "Magnification: "; M; " x"
2120 LPRINT "Volumetric Fraction of Second Phase [Fv]: "; VV * 100; "%"
2130 LPRINT "Statistical Error Associated with Fv: "; PE; "%"
2140 LPRINT : LPRINT
2150 FOR I = 1 TO NP
2160 LPRINT "#"; I; TAB(10); NI(I, 1); TAB(20); NI(I, 2); TAB(30); NI(I, 3): CL = CL + 1
2170  IF CL >= 57 THEN LPRINT CHR$(12): CL = 0
2180  NEXT: LPRINT CHR$(12): GOTO 120
2190 CLS : LOCATE 8: PRINT "Prepare Printer!": PRINT : PRINT "Now enter with the Identification Message "; : PRINT "to be Printed in the Report.": PRINT : LINE INPUT "", BF$:
2200 LPRINT "TOPOLOGICAL ANALYSIS OF TWO-PHASE MICROSTRUCTURES - "; BF$: LPRINT DATE$, TIME$: LPRINT : LPRINT
2210  FOR NK = 1 TO 8
2220 B1$ = MS$(NK): IF NK > 1 THEN 2300
2230 LPRINT "MEASURING CONDITIONS:": LPRINT
2240 LPRINT "Number of Points: "; NP
2250 LPRINT "Magnification: "; M; "x"
2260 LPRINT "Length of Test Line: "; LT; " microns"
2270 LPRINT "Volumetric Fraction of Second Phase [Fv]: "; VV * 100; "%"
2280 LPRINT "Statistical Error Associated with Fv: "; PE; "%"
2290 LPRINT : LPRINT : LPRINT
2300 LPRINT B1$: LPRINT : LPRINT
2310 LPRINT "Data Collected:"
2320  FOR I = 1 TO NP STEP 11: FOR J = 0 TO 10: IF I + J > NP THEN 2360
2330  LPRINT USING MASC$(NK); NV(I + J, NK); : IF J < 10 THEN LPRINT TAB(J * 6 + 7);
2340  NEXT J: LPRINT : CL = CL + 1
2350  NEXT
2360 LPRINT : LPRINT
2370  GOSUB 1870
2380 LPRINT : BF$ = "=> Statistical Analysis <=": LPRINT TAB((40 - LEN(BF$)) / 2 + 1); BF$: LPRINT : LOCATE 10
2390  LPRINT "Average = "; MD
2400  IF NK = 1 OR NK = 2 THEN TA(NK) = INT(((-10 - 6.64 * LOG(MD / 10000) / 2.30258409#) + .5) * 100) / 100: LPRINT "ASTM Grain Size = "; TA(NK): D(NK) = MD
2410  IF NK = 3 THEN VC = INT(MD * (1 - VV) * 100) / 100: LPRINT "Contiguity Volume = "; VC
2420  IF NK = 4 THEN VC = INT(MD * VV * 100) / 100: LPRINT "Contiguity Volume = "; VC
2430  LPRINT "Standard Deviation = "; INT(DP * 100) / 100
2440  LPRINT : LPRINT "N(1%)= "; INT(NM(1) + .5); TAB(14); "N(3%) = "; INT(NM(3) + .5); TAB(28); "N(5%) = "; INT(NM(5) + .5): LPRINT
2450  LPRINT "Real Precision = "; INT(PRE * 100) / 100; " %"
2460 LPRINT "Precision of the Mean = "; INT((MD * PRE / 100) * 100) / 100
2470 PB = MD * PRE / 100: LPRINT "Mean Amplitude = "; INT(MD * 100) / 100; " +/- "; INT(PB * 100) / 100
2480  IF NK = 1 THEN P1 = PRE
2490  IF NK = 2 THEN P2 = PRE: P4 = PB
2500  LPRINT : LPRINT : LPRINT
2510  NEXT NK
2520 LPRINT "GENERAL PARAMETERS OF THE TWO-PHASE MICROSTRUCTURE ": LPRINT : LPRINT
2530 LPRINT "Global ASTM Grain Size: "; TA(1) * (1 - VV) + TA(2) * VV: LPRINT : AX = VV / (1 - VV): P3 = PE * VV / 100: PA = P3 * 100 / (1 - VV): PX = (PA + PE) / 100 * AX
2540 LPRINT "Volumetric Fraction Ratio between the Two Phases: "; : LPRINT USING "##.##"; AX; : LPRINT " +/- "; : LPRINT USING "##.##"; PX: LPRINT
2550 R1 = P1 * D(1) / 100: R2 = P2 * D(2) / 100: AX = (D(2) / D(1)) ^ 3: PX = SQR((3 * D(2) ^ 2 / D(1) ^ 3 * R2) ^ 2 + (3 * D(2) ^ 3 / D(1) ^ 4 * R1) ^ 2)
2560 LPRINT "Grain Size Ratio between the Two Phases: "; : LPRINT USING "##.##"; AX; : LPRINT " +/- "; : LPRINT USING "##.##"; PX: LPRINT
2570 AX = .98 * D(2) * (.885 / SQR(VV) - 1): PX = SQR((.867 / SQR(VV) - .98) ^ 2 * P4 * P4 + (-.867 * D(2) / (2 * (VV) ^ 1.5)) ^ 2 * P3 * P3)
2580 LPRINT "Spacing between the Second Phase Grains: "; : LPRINT USING "###.##"; AX; : LPRINT " +/- "; : LPRINT USING "###.##"; PX
2590  LPRINT CHR$(12): GOTO 120

***** End of Program Listing ******

Return to the Software Menu.

Last Update: 25 June 1996
© Antonio Augusto Gorni