Presentación de PowerPoint - Piping Tools and Thermodynamic

Part 3. Description of a function code
1
Part 3. Description of a function code
As an example we will write a function code to find
the outside diameter of a carbon steel pipe, with
input nominal diameter in inches.
2
Part 3. Description of a function code
As an example we will write a function code to find
the outside diameter of a carbon steel pipe, with
input nominal diameter in inches.
The name of the function will be
3
Part 3. Description of a function code
As an example we will write a function code to find
the outside diameter of a carbon steel pipe, with
input nominal diameter in inches.
The name of the function will be
"Pipe_Imp_CS_Dext_dn_sch"
4
Part 3. Description of a function code
As an example we will write a function code to find
the outside diameter of a carbon steel pipe, with
input nominal diameter in inches.
The name of the function will be
"Pipe_Imp_CS_Dext_dn_sch"
This function is based on outside diameters defined
in ASME B36.10M
5
Part 3. Description of a function code
As an example we will write a function code to find
the outside diameter of a carbon steel pipe, with
input nominal diameter in inches.
The name of the function will be
"Pipe_Imp_CS_Dext_dn_sch"
This function is based on outside diameters defined
in ASME B36.10M
A table with the outside diameters "dext [mm]",
corresponding to the nominal diameters "dn [in]",
should be included on a sheet in the Excel file. The
function will read the information from this sheet.
6
The following table shows outside diameters and
thicknesses for carbon steel pipes of different nominal
diameters and schedules, according to the standard
ASME B36. 10
7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
Pipe Thickness [mm], according ASME B36.10M
4
5
6
ASME B36.10M SCHEDULE / IDENTIFICATION
Size
dext
5
10
20
30
40
60
80
100
120
140
160
STD
XS
XXS
21.3
1.65
2.11
-
2.41
2.77
-
3.73
-
0
-
4.78
2.77
3.73
7.47
0
0
0
0
0
5.56
6.35
7.14
8.74
11.13
13.49
2.87
3.38
3.68
3.91
5.49
6.02
3.91
4.55
5.08
5.54
7.62
8.56
7.82
9.09
10.15
11.07
15.24
17.12
15.88
18.26
23.01
28.58
33.32
35.71
40.49
45.24
50.01
53.98
59.54
-
6.55
7.11
8.18
9.27
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
10.97
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
19.05
21.95
22.23
25.4
25.4
-
7
1/2
8
3/4
1
1 1/2
2
3
4
26.7
33.4
48.3
60.3
88.9
114.3
1.65
1.65
1.65
1.65
2.11
2.11
2.11
2.77
2.77
2.77
3.05
3.05
-
2.41
2.9
3.18
3.18
4.78
4.78
2.87
3.38
3.68
3.91
5.49
6.02
-
3.91
4.55
5.08
5.54
7.62
8.56
-
11.13
-
5
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
141.3
168.3
219.1
273
323.8
355.6
406.4
457
508
559
610
660
711
762
813
864
914
965
1016
1067
1118
1168
1219
2.77
2.77
2.77
3.4
3.96
3.96
4.19
4.19
4.78
4.78
5.54
6.35
-
3.4
3.4
3.76
4.19
4.57
6.35
6.35
6.35
6.35
6.35
6.35
7.92
7.92
7.92
7.92
7.92
7.92
-
6.35
6.35
6.35
7.92
7.92
7.92
9.53
9.53
9.53
12.7
12.7
12.7
12.7
12.7
12.7
-
7.04
7.8
8.38
9.53
9.53
11.13
12.7
12.7
14.27
15.88
15.88
15.88
15.88
15.88
-
6.55
7.11
8.18
9.27
10.31
11.13
12.7
14.27
15.09
17.48
17.48
17.48
19.05
-
10.31
12.7
14.27
15.09
16.66
19.05
20.62
22.23
24.61
-
9.53
10.97
12.7
15.09
17.48
19.05
21.44
23.83
26.19
28.58
30.96
-
15.09
18.26
21.44
23.83
26.19
29.36
32.54
34.93
38.89
-
12.7
14.27
18.26
21.44
25.4
27.79
30.96
34.93
38.1
41.28
46.02
-
20.62
25.4
28.58
31.75
36.53
39.67
44.45
47.63
52.37
-
9
10
11
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
8
Function code for the exterior diameter
9
Function code for the exterior diameter
As explained in Part 1, the code starts by defining the function
name and Visual Basic adds the "End Function".
10
Function code for the exterior diameter
As explained in Part 1, the code starts by defining the function
name and Visual Basic adds the "End Function".
Function Pipe_Imp_CS_Dext_dn(Dn)
End Function
11
The exterior diameter depends only on the nominal
diameter (Dn) and is in the third column of the table.
12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
Pipe Thickness [mm], according ASME B36.10M
4
5
6
7
8
9
10
11
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
ASME B36.10M SCHEDULE / IDENTIFICATION
Size
1/2
3/4
1
1 1/2
2
3
4
5
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
dext
5
10
20
30
40
60
80
100
120
140
160
STD
XS
XXS
21.3
26.7
33.4
48.3
60.3
88.9
114.3
141.3
168.3
219.1
273
323.8
355.6
406.4
457
508
559
610
660
711
762
813
864
914
965
1016
1067
1118
1168
1219
1.65
1.65
1.65
1.65
1.65
2.11
2.11
2.77
2.77
2.77
3.4
3.96
3.96
4.19
4.19
4.78
4.78
5.54
2.11
2.11
2.77
2.77
2.77
3.05
3.05
3.4
3.4
3.76
4.19
4.57
6.35
6.35
6.35
6.35
6.35
6.35
7.92
7.92
7.92
7.92
7.92
7.92
-
0
0
0
0
0
0
-
-
6.35
6.35
6.35
7.92
7.92
7.92
9.53
9.53
9.53
12.7
12.7
12.7
12.7
12.7
12.7
7.04
7.8
8.38
9.53
9.53
11.13
12.7
12.7
14.27
10.31
12.7
14.27
15.09
16.66
19.05
20.62
22.23
24.61
3.73
3.91
4.55
5.08
5.54
7.62
8.56
9.53
10.97
12.7
15.09
17.48
19.05
21.44
23.83
26.19
28.58
30.96
-
-
2.77
2.87
3.38
3.68
3.91
5.49
6.02
6.55
7.11
8.18
9.27
10.31
11.13
12.7
14.27
15.09
-
-
2.41
2.41
2.9
3.18
3.18
4.78
4.78
-
15.88
15.88
15.88
15.88
17.48
17.48
19.05
-
-
-
-
-
3.73
3.91
4.55
5.08
5.54
7.62
8.56
9.53
10.97
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
7.47
7.82
9.09
10.15
11.07
15.24
17.12
19.05
21.95
22.23
25.4
25.4
-
2.77
2.87
3.38
3.68
3.91
5.49
6.02
6.55
7.11
8.18
9.27
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
6.35
-
15.88
-
17.48
-
-
-
15.09
18.26
21.44
23.83
26.19
29.36
32.54
34.93
38.89
11.13
12.7
14.27
18.26
21.44
25.4
27.79
30.96
34.93
38.1
41.28
46.02
20.62
25.4
28.58
31.75
36.53
39.67
44.45
47.63
52.37
4.78
5.56
6.35
7.14
8.74
11.13
13.49
15.88
18.26
23.01
28.58
33.32
35.71
40.49
45.24
50.01
53.98
59.54
-
-
-
-
-
-
-
-
-
13
The code begins by defining the matrix "C" containing rows 1
through 36 and columns 1 through 3.
14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
Pipe Thickness [mm], according ASME B36.10M
4
5
6
7
8
9
10
11
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
ASME B36.10M SCHEDULE / IDENTIFICATION
Size
1/2
3/4
1
1 1/2
2
3
4
5
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
dext
5
10
20
30
40
60
80
100
120
140
160
STD
XS
XXS
21.3
26.7
33.4
48.3
60.3
88.9
114.3
141.3
168.3
219.1
273
323.8
355.6
406.4
457
508
559
610
660
711
762
813
864
914
965
1016
1067
1118
1168
1219
1.65
1.65
1.65
1.65
1.65
2.11
2.11
2.77
2.77
2.77
3.4
3.96
3.96
4.19
4.19
4.78
4.78
5.54
2.11
2.11
2.77
2.77
2.77
3.05
3.05
3.4
3.4
3.76
4.19
4.57
6.35
6.35
6.35
6.35
6.35
6.35
7.92
7.92
7.92
7.92
7.92
7.92
-
0
0
0
0
0
0
-
-
6.35
6.35
6.35
7.92
7.92
7.92
9.53
9.53
9.53
12.7
12.7
12.7
12.7
12.7
12.7
7.04
7.8
8.38
9.53
9.53
11.13
12.7
12.7
14.27
10.31
12.7
14.27
15.09
16.66
19.05
20.62
22.23
24.61
3.73
3.91
4.55
5.08
5.54
7.62
8.56
9.53
10.97
12.7
15.09
17.48
19.05
21.44
23.83
26.19
28.58
30.96
-
-
2.77
2.87
3.38
3.68
3.91
5.49
6.02
6.55
7.11
8.18
9.27
10.31
11.13
12.7
14.27
15.09
-
-
2.41
2.41
2.9
3.18
3.18
4.78
4.78
-
15.88
15.88
15.88
15.88
17.48
17.48
19.05
-
-
-
-
-
3.73
3.91
4.55
5.08
5.54
7.62
8.56
9.53
10.97
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
7.47
7.82
9.09
10.15
11.07
15.24
17.12
19.05
21.95
22.23
25.4
25.4
-
2.77
2.87
3.38
3.68
3.91
5.49
6.02
6.55
7.11
8.18
9.27
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
6.35
-
15.88
-
17.48
-
-
-
15.09
18.26
21.44
23.83
26.19
29.36
32.54
34.93
38.89
11.13
12.7
14.27
18.26
21.44
25.4
27.79
30.96
34.93
38.1
41.28
46.02
20.62
25.4
28.58
31.75
36.53
39.67
44.45
47.63
52.37
4.78
5.56
6.35
7.14
8.74
11.13
13.49
15.88
18.26
23.01
28.58
33.32
35.71
40.49
45.24
50.01
53.98
59.54
-
-
-
-
-
-
-
-
-
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
Pipe Thickness [mm], according ASME B36.10M
4
5
6
7
8
9
10
11
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
ASME B36.10M SCHEDULE / IDENTIFICATION
Size
1/2
3/4
1
1 1/2
2
3
4
5
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
dext
5
10
20
30
40
60
80
100
120
140
160
STD
XS
XXS
21.3
26.7
33.4
48.3
60.3
88.9
114.3
141.3
168.3
219.1
273
323.8
355.6
406.4
457
508
559
610
660
711
762
813
864
914
965
1016
1067
1118
1168
1219
1.65
1.65
1.65
1.65
1.65
2.11
2.11
2.77
2.77
2.77
3.4
3.96
3.96
4.19
4.19
4.78
4.78
5.54
2.11
2.11
2.77
2.77
2.77
3.05
3.05
3.4
3.4
3.76
4.19
4.57
6.35
6.35
6.35
6.35
6.35
6.35
7.92
7.92
7.92
7.92
7.92
7.92
-
0
0
0
0
0
0
-
-
6.35
6.35
6.35
7.92
7.92
7.92
9.53
9.53
9.53
12.7
12.7
12.7
12.7
12.7
12.7
7.04
7.8
8.38
9.53
9.53
11.13
12.7
12.7
14.27
10.31
12.7
14.27
15.09
16.66
19.05
20.62
22.23
24.61
3.73
3.91
4.55
5.08
5.54
7.62
8.56
9.53
10.97
12.7
15.09
17.48
19.05
21.44
23.83
26.19
28.58
30.96
-
-
2.77
2.87
3.38
3.68
3.91
5.49
6.02
6.55
7.11
8.18
9.27
10.31
11.13
12.7
14.27
15.09
-
-
2.41
2.41
2.9
3.18
3.18
4.78
4.78
-
15.88
15.88
15.88
15.88
17.48
17.48
19.05
-
-
-
-
-
3.73
3.91
4.55
5.08
5.54
7.62
8.56
9.53
10.97
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
7.47
7.82
9.09
10.15
11.07
15.24
17.12
19.05
21.95
22.23
25.4
25.4
-
2.77
2.87
3.38
3.68
3.91
5.49
6.02
6.55
7.11
8.18
9.27
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
6.35
-
15.88
-
17.48
-
-
-
15.09
18.26
21.44
23.83
26.19
29.36
32.54
34.93
38.89
11.13
12.7
14.27
18.26
21.44
25.4
27.79
30.96
34.93
38.1
41.28
46.02
20.62
25.4
28.58
31.75
36.53
39.67
44.45
47.63
52.37
4.78
5.56
6.35
7.14
8.74
11.13
13.49
15.88
18.26
23.01
28.58
33.32
35.71
40.49
45.24
50.01
53.98
59.54
-
-
-
-
-
-
-
-
-
Matrix "C" in whose third column from rows 7 to 36 are the
exterior diameters "OD [mm]"
16
Next, it will be defined in the code, the array
dimension of "C"
17
Function
Pipe_Imp_CS_Dext_dn(Dn)
Dim C(36, 3)
End Function
18
Function
Pipe_Imp_CS_Dext_dn(Dn)
Dim C(36, 3)
End Function
The matrix C is defined with 36 columns and 3 rows
19
Reading of the table
20
Reading of the table
To read the information in the table, one uses a structure
called For-next
21
Reading of the table
To read the information in the table, one uses a structure
called For-next
The For-next indicates to repeat an operation that
depends on an index "m" and indicates the start and end
values of "m".
22
Reading of the table
To read the information in the table, one uses a structure
called For-next
The For-next indicates to repeat an operation that
depends on an index "m" and indicates the start and end
values of "m".
For m = 1 To 36
23
Reading of the table
To read the information in the table, one uses a structure
called For-next
The For-next indicates to repeat an operation that
depends on an index "m" and indicates the start and end
values of "m".
For m = 1 To 36
In this space are introduced the operations to be
performed, which depend on the temporal value of
the index "m"
24
Reading of the table
To read the information in the table, one uses a structure
called For-next
The For-next indicates to repeat an operation that
depends on an index "m" and indicates the start and end
values of "m".
For m = 1 To 36
In this space are introduced the operations to be
performed, which depend on the temporal value of
the index "m"
The operations with the index "m" end with
25
Reading of the table
To read the information in the table, one uses a structure
called For-next
The For-next indicates to repeat an operation that
depends on an index "m" and indicates the start and end
values of "m".
For m = 1 To 36
In this space are introduced the operations to be
performed, which depend on the temporal value of
the index "m"
The operations with the index "m" end with
Next m
26
Reading of the table
To read the information in the table, one uses a structure
called For-next
The For-next indicates to repeat an operation that
depends on an index "m" and indicates the start and end
values of "m".
For m = 1 To 36
In this space are introduced the operations to be
performed, which depend on the temporal value of
the index "m"
The operations with the index "m" end with
Next m
The loop ends after the operation with index "m =
36" is performed.
27
The “ For-next” is programed as follows
28
The “ For-next” is programed as follows
29
The “ For-next” is programed as follows
This indicates that cells in column 3, from row 1 to 36, shall
be read
30
The “ For-next” is programed as follows
This indicates that cells in column 3, from row 1 to 36, shall
be read
31
The “ For-next” is programed as follows
This indicates that cells in column 3, from row 1 to 36, shall
be read
The read value is assigned to the element (m, 3) of the
matrix "C"
32
The “ For-next” is programed as follows
This indicates that cells in column 3, from row 1 to 36, shall
be read
The read value is assigned to the element (m, 3) of the
matrix "C"
33
The “ For-next” is programed as follows
This indicates that cells in column 3, from row 1 to 36, shall
be read
The read value is assigned to the element (m, 3) of the
matrix "C"
The reading is done in the sheet that has been named 6.CS_Imp
34
The “ For-next” is programed as follows
This indicates that cells in column 3, from row 1 to 36, shall
be read
The read value is assigned to the element (m, 3) of the
matrix "C"
The reading is done in the sheet that has been named 6.CS_Imp
35
The “ For-next” is programed as follows
This indicates that cells in column 3, from row 1 to 36, shall
be read
The read value is assigned to the element (m, 3) of the
matrix "C"
The reading is done in the sheet that has been named 6.CS_Imp
On sheet "6.CS_Imp" it must be read the contents of the cell (m, 3)
36
Summary of programming steps
37
Summary of programming steps
Function
38
Summary of programming steps
Function Pipe_Imp_CS_Dext_dn(Dn)
End Function
39
Summary of programming steps
Function Pipe_Imp_CS_Dext_dn(Dn)
Dim C(36, 3)
End Function
40
Summary of programming steps
Function Pipe_Imp_CS_Dext_dn(Dn)
Dim C(36, 3)
For m = 1 To 36
End Function
41
Summary of programming steps
Function Pipe_Imp_CS_Dext_dn(Dn)
Dim C(36, 3)
For m = 1 To 36
C(m, 3) = thisWorkbook.Worksheets("6.CS_Imp").Cells(m, 3).Value
End Function
42
Summary of programming steps
Function Pipe_Imp_CS_Dext_dn(Dn)
Dim C(36, 3)
For m = 1 To 36
C(m, 3) = thisWorkbook.Worksheets("6.CS_Imp").Cells(m, 3).Value
Next m
End Function
43
Identification of the row in which each nominal diameter is
found
44
Identification of the row in which each nominal diameter is
found
By associating the nominal diameter to its row in the
matrix, one knows the row where the rest of the data
related to this diameter is located in the matrix.
45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
Pipe Thickness [mm], according ASME B36.10M
4
5
6
7
8
9
10
11
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
ASME B36.10M SCHEDULE / IDENTIFICATION
Size
1/2
3/4
1
1 1/2
2
3
4
5
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
dext
5
10
20
30
40
60
80
100
120
140
160
STD
XS
XXS
21.3
26.7
33.4
48.3
60.3
88.9
114.3
141.3
168.3
219.1
273
323.8
355.6
406.4
457
508
559
610
660
711
762
813
864
914
965
1016
1067
1118
1168
1219
1.65
1.65
1.65
1.65
1.65
2.11
2.11
2.77
2.77
2.77
3.4
3.96
3.96
4.19
4.19
4.78
4.78
5.54
2.11
2.11
2.77
2.77
2.77
3.05
3.05
3.4
3.4
3.76
4.19
4.57
6.35
6.35
6.35
6.35
6.35
6.35
7.92
7.92
7.92
7.92
7.92
7.92
-
0
0
0
0
0
0
-
-
6.35
6.35
6.35
7.92
7.92
7.92
9.53
9.53
9.53
12.7
12.7
12.7
12.7
12.7
12.7
7.04
7.8
8.38
9.53
9.53
11.13
12.7
12.7
14.27
10.31
12.7
14.27
15.09
16.66
19.05
20.62
22.23
24.61
3.73
3.91
4.55
5.08
5.54
7.62
8.56
9.53
10.97
12.7
15.09
17.48
19.05
21.44
23.83
26.19
28.58
30.96
-
-
2.77
2.87
3.38
3.68
3.91
5.49
6.02
6.55
7.11
8.18
9.27
10.31
11.13
12.7
14.27
15.09
-
-
2.41
2.41
2.9
3.18
3.18
4.78
4.78
-
15.88
15.88
15.88
15.88
17.48
17.48
19.05
-
-
-
-
-
3.73
3.91
4.55
5.08
5.54
7.62
8.56
9.53
10.97
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
12.7
7.47
7.82
9.09
10.15
11.07
15.24
17.12
19.05
21.95
22.23
25.4
25.4
-
2.77
2.87
3.38
3.68
3.91
5.49
6.02
6.55
7.11
8.18
9.27
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
9.53
6.35
-
15.88
-
17.48
-
-
-
15.09
18.26
21.44
23.83
26.19
29.36
32.54
34.93
38.89
11.13
12.7
14.27
18.26
21.44
25.4
27.79
30.96
34.93
38.1
41.28
46.02
20.62
25.4
28.58
31.75
36.53
39.67
44.45
47.63
52.37
4.78
5.56
6.35
7.14
8.74
11.13
13.49
15.88
18.26
23.01
28.58
33.32
35.71
40.49
45.24
50.01
53.98
59.54
-
-
-
-
-
-
-
-
-
46
Identification of the row in which each nominal diameter is
found
By associating the nominal diameter to its row in the
matrix, one knows the row where the rest of the data
related to this diameter is located in the matrix.
En el código se agrega la siguiente línea
47
Identificación de la fila en que se encuentra cada diámetro
nominal
Al asociar el diámetro nominal del caso a su fila en la
matriz, se conoce la ubicación de la fila de ”todos los
datos correspondientes a ese diámetro”.
En el código se agrega la siguiente línea
If Dn = 0.5 Then x = 7
48
Identificación de la fila en que se encuentra cada diámetro
nominal
Al asociar el diámetro nominal del caso a su fila en la
matriz, se conoce la ubicación de la fila de ”todos los
datos correspondientes a ese diámetro”.
En el código se agrega la siguiente línea
If Dn = 0.5 Then x = 7
Cuyo significado es
Si Dn tiene el valo 0.5 [in] entonces se trata de la fila 7
49
Identificación de la fila en que se encuentra cada diámetro
nominal
Al asociar el diámetro nominal del caso a su fila en la
matriz, se conoce la ubicación de la fila de ”todos los
datos correspondientes a ese diámetro”.
En el código se agrega la siguiente línea
If Dn = 0.5 Then x = 7
Cuyo significado es
Si Dn tiene el valo 0.5 [in] entonces se trata de la fila 7
La siguiente línea es
50
Identificación de la fila en que se encuentra cada diámetro
nominal
Al asociar el diámetro nominal del caso a su fila en la
matriz, se conoce la ubicación de la fila de ”todos los
datos correspondientes a ese diámetro”.
En el código se agrega la siguiente línea
If Dn = 0.5 Then x = 7
Cuyo significado es
Si Dn tiene el valo 0.5 [in] entonces se trata de la fila 7
La siguiente línea es
ElseIf Dn = 0.75 Then x = 8
51
Identificación de la fila en que se encuentra cada diámetro
nominal
Al asociar el diámetro nominal del caso a su fila en la
matriz, se conoce la ubicación de la fila de ”todos los
datos correspondientes a ese diámetro”.
En el código se agrega la siguiente línea
If Dn = 0.5 Then x = 7
Cuyo significado es
Si Dn tiene el valo 0.5 [in] entonces se trata de la fila 7
La siguiente línea es
ElseIf Dn = 0.75 Then x = 8
Cuyo significado es
O Si Dn tiene el valor 0.75 [in] , se trata de la fila 8
52
Identificación de la fila en que se encuentra cada diámetro
nominal
By associating the nominal diameter to its row in the
matrix, one knows the row where the rest of the data
related to this diameter is located in the matrix.
En el código se agrega la siguiente línea
If Dn = 0.5 Then x = 7
Cuyo significado es
Si Dn tiene el valo 0.5 [in] entonces se trata de la fila 7
La siguiente línea es
ElseIf Dn = 0.75 Then x = 8
Cuyo significado es
O Si Dn tiene el valor 0.75 [in] , se trata de la fila 8
Y así sucesivamente hasta identificar todas las filas
53
Identification of the row in which each nominal diameter is
found
By associating the nominal diameter to its row in the
matrix, one knows the row where the rest of the data
related to this diameter is located in the matrix.
In the code we add the following line
If Dn = 0.5 Then x = 7
Whose meaning is
If Dn has the values 0.5 [in] then the row is row 7
The next line is
ElseIf Dn = 0.75 Then x = 8
Whose meaning is
Or if Dn has the value 0.75 [in] , then it is row 8
And so on until all all rows are identified
With these two new lines, the code looks like
54
Function Pipe_Imp_CS_Dext_dn(Dn)
Dim C(36, 3)
For m = 1 To 36
C(m, 3) = ThisWorkbook.Worksheets("6.CS_Imp").Cells(m, 3).Value
Next m
If Dn = 0.5 Then
x=7
ElseIf Dn = 0.75 Then x = 8
End Function
55
And with all the rows identified, this part of the code
looks like
56
Function Pipe_Imp_CS_Dext_dn(Dn)
Dim C(36, 3)
For m = 1 To 36
C(m, 3) = ThisWorkbook.Worksheets("6.CS_Imp").Cells(m, 3).Value
Next m
If Dn = 0.5 Then
x=7
ElseIf Dn = 0.75 Then x = 8
ElseIf Dn = 1 Then x = 9
ElseIf Dn = 1.5 Then x = 10
ElseIf Dn = 2 Then x = 11
ElseIf Dn = 3 Then x = 12
ElseIf Dn = 4 Then x = 13
ElseIf Dn = 5 Then x = 14
ElseIf Dn = 6 Then x = 15
ElseIf Dn = 8 Then x = 16
ElseIf Dn = 10 Then x = 17
ElseIf Dn = 12 Then x = 18
ElseIf Dn = 14 Then x = 19
ElseIf Dn = 16 Then x = 20
ElseIf Dn = 18 Then x = 21
ElseIf Dn = 20 Then x = 22
ElseIf Dn = 22 Then x = 23
ElseIf Dn = 24 Then x = 24
ElseIf Dn = 26 Then x = 26
ElseIf Dn = 28 Then x = 26
ElseIf Dn = 30 Then x = 27
ElseIf Dn = 32 Then x = 28
ElseIf Dn = 34 Then x = 29
ElseIf Dn = 36 Then x = 30
ElseIf Dn = 38 Then x = 31
ElseIf Dn = 40 Then x = 32
ElseIf Dn = 42 Then x = 33
ElseIf Dn = 44 Then x = 34
ElseIf Dn = 46 Then x = 35
ElseIf Dn = 48 Then x = 36
' If the Dn-value is not within the given values,
' The function returns Dext = "N/A"
Else
Pipe_Imp_CS_Dext_dn = "N/A"
Exit Function
End If
57
A resume of the code is
58
Function Pipe_Imp_CS_Dext_dn(Dn)
Dim C(36, 3)
For m = 1 To 36
C(m, 3) =
ThisWorkbook.Worksheets("6.CS_Imp").Cells(m, 3).Value
Next m
If Dn = 0.5
x=7
ElseIf Dn =
ElseIf Dn =
ElseIf Dn =
ElseIf Dn =
Then
0.75 Then x = 8
1 Then x = 9
1.5 Then x = 10
2 Then x = 11
ElseIf Dn = 44 Then x = 34
ElseIf Dn = 46 Then x = 35
ElseIf Dn = 48 Then x = 36
' If the Dn-value is not within the given values,
' The function returns Dext = "N/A"
Else
Pipe_Imp_CS_Dext_dn = "N/A"
Exit Function
End If
59
Function Pipe_Imp_CS_Dext_dn(Dn)
Dim C(36, 3)
For m = 1 To 36
C(m, 3) =
ThisWorkbook.Worksheets("6.CS_Imp").Cells(m, 3).Value
Next m
If Dn = 0.5
x=7
ElseIf Dn =
ElseIf Dn =
ElseIf Dn =
ElseIf Dn =
Then
0.75 Then x = 8
1 Then x = 9
1.5 Then x = 10
2 Then x = 11
ElseIf Dn = 44 Then x = 34
ElseIf Dn = 46 Then x = 35
ElseIf Dn = 48 Then x = 36
' If the Dn-value is not within the given values,
' The function returns Dext = "N/A"
Else
Pipe_Imp_CS_Dext_dn = "N/A"
Exit Function
End If
This part of the function concludes saying, "Else" that is, in another case,
if the nominal diameter received as input is not one of those reviewed,
then the input is wrong. The function finish giving the answer Not
Applicable (N / A)
60
If the input value of the nominal diameter corresponds to
one of the values defined in the standard, it means that in
the recently made review, the "x value" of the line
corresponding to the nominal diameter has been identified.
61
If the input value of the nominal diameter corresponds to
one of the values defined in the standard, it means that in
the recently made review, the "x value" of the line
corresponding to the nominal diameter has been identified.
Thus, the value of “x” is a known value
62
If the input value of the nominal diameter corresponds to
one of the values defined in the standard, it means that in
the recently made review, the "x value" of the line
corresponding to the nominal diameter has been identified.
Thus, the value of “x” is a known value
Known the matrix row in which the required exterior
diameter is (row "x"), and as it is also known that this
diameter is in column "3", the element of array with the
desired value is the element (x, 3)
63
If the input value of the nominal diameter corresponds to
one of the values defined in the standard, it means that in
the recently made review, the "x value" of the line
corresponding to the nominal diameter has been identified.
Thus, the value of “x” is a known value
Known the matrix row in which the required exterior
diameter is (row "x"), and as it is also known that this
diameter is in column "3", the element of array with the
desired value is the element (x, 3)
Thus, the value of the desired function is
64
If the input value of the nominal diameter corresponds to
one of the values defined in the standard, it means that in
the recently made review, the "x value" of the line
corresponding to the nominal diameter has been identified.
Thus, the value of “x” is a known value
Known the matrix row in which the required exterior
diameter is (row "x"), and as it is also known that this
diameter is in column "3", the element of array with the
desired value is the element (x, 3)
Thus, the value of the desired function is
Pipe_Imp_CS_Dext_dn = C(x, 3)
65
If the input value of the nominal diameter corresponds to
one of the values defined in the standard, it means that in
the recently made review, the "x value" of the line
corresponding to the nominal diameter has been identified.
Thus, the value of “x” is a known value
Known the matrix row in which the required exterior
diameter is (row "x"), and as it is also known that this
diameter is in column "3", the element of array with the
desired value is the element (x, 3)
Thus, the value of the desired function is
Pipe_Imp_CS_Dext_dn = C(x, 3)
With this, the function is finished
66
The complete code is
67
Function Pipe_Imp_CS_Dext_dn(Dn)
Dim C(36, 3) As Variant
For m = 1 To 36
C(m, 3) = ThisWorkbook.Worksheets("6.CS_Imp").Cells(m, 3).Value
Next m
x=7
ElseIf Dn = 0.75 Then x = 8
ElseIf Dn = 1 Then x = 9
ElseIf Dn = 1.5 Then x = 10
ElseIf Dn = 2 Then x = 11
ElseIf Dn = 3 Then x = 12
ElseIf Dn = 4 Then x = 13
ElseIf Dn = 5 Then x = 14
ElseIf Dn = 6 Then x = 15
ElseIf Dn = 8 Then x = 16
ElseIf Dn = 10 Then x = 17
ElseIf Dn = 12 Then x = 18
ElseIf Dn = 14 Then x = 19
ElseIf Dn = 16 Then x = 20
ElseIf Dn = 18 Then x = 21
ElseIf Dn = 20 Then x = 22
ElseIf Dn = 22 Then x = 23
ElseIf Dn = 24 Then x = 24
ElseIf Dn = 26 Then x = 26
ElseIf Dn = 28 Then x = 26
ElseIf Dn = 30 Then x = 27
ElseIf Dn = 32 Then x = 28
ElseIf Dn = 34 Then x = 29
ElseIf Dn = 36 Then x = 30
ElseIf Dn = 38 Then x = 31
ElseIf Dn = 40 Then x = 32
ElseIf Dn = 42 Then x = 33
ElseIf Dn = 44 Then x = 34
ElseIf Dn = 46 Then x = 35
ElseIf Dn = 48 Then x = 36
Else
Pipe_Imp_CS_Dext_dn = "N/A"
Exit Function
End If
Pipe_Imp_CS_Dext_dn = C(x, 3)
End Function
68
End of Part 3
Note.
In the web page "piping-tools.net", in the file Pipe
dimensions and friction factor.xlsm, there are three
functions (outside diameter, inside diameter and
thickness) with complete code.
69