Top Banner
Part 3. Description of a function code 1
69

Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

Mar 29, 2015

Download

Documents

Aryan Dewing
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

Part 3. Description of a function code

1

Page 2: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

Part 3. Description of a function code

2

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.

Page 3: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

Part 3. Description of a function code

3

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

Page 4: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

Part 3. Description of a function code

4

"Pipe_Imp_CS_Dext_dn_sch"

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

Page 5: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

Part 3. Description of a function code

5

"Pipe_Imp_CS_Dext_dn_sch"

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

This function is based on outside diameters defined in ASME B36.10M

Page 6: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

Part 3. Description of a function code

6

"Pipe_Imp_CS_Dext_dn_sch"

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

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.

Page 7: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

7

The following table shows outside diameters and thicknesses for carbon steel pipes of different nominal diameters and schedules, according to the standardASME B36. 10

Page 8: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

8

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.10M4

5

6 Size dext 5 10 20 30 40 60 80 100 120 140 160 STD XS XXS

7 1/2 21.3 1.65 2.11 - 2.41 2.77 - 3.73 - 0 - 4.78 2.77 3.73 7.478 3/4 26.7 1.65 2.11 - 2.41 2.87 - 3.91 - 0 - 5.56 2.87 3.91 7.829 1 33.4 1.65 2.77 - 2.9 3.38 - 4.55 - 0 - 6.35 3.38 4.55 9.09

10 1 1/2 48.3 1.65 2.77 - 3.18 3.68 - 5.08 - 0 - 7.14 3.68 5.08 10.1511 2 60.3 1.65 2.77 - 3.18 3.91 - 5.54 - 0 - 8.74 3.91 5.54 11.0712 3 88.9 2.11 3.05 - 4.78 5.49 - 7.62 - 0 - 11.13 5.49 7.62 15.2413 4 114.3 2.11 3.05 - 4.78 6.02 - 8.56 - 11.13 - 13.49 6.02 8.56 17.1214 5 141.3 2.77 3.4 - - 6.55 - 9.53 - 12.7 - 15.88 6.55 9.53 19.0515 6 168.3 2.77 3.4 - - 7.11 - 10.97 - 14.27 - 18.26 7.11 10.97 21.9516 8 219.1 2.77 3.76 6.35 7.04 8.18 10.31 12.7 15.09 18.26 20.62 23.01 8.18 12.7 22.2317 10 273 3.4 4.19 6.35 7.8 9.27 12.7 15.09 18.26 21.44 25.4 28.58 9.27 12.7 25.418 12 323.8 3.96 4.57 6.35 8.38 10.31 14.27 17.48 21.44 25.4 28.58 33.32 9.53 12.7 25.419 14 355.6 3.96 6.35 7.92 9.53 11.13 15.09 19.05 23.83 27.79 31.75 35.71 9.53 12.7 - 20 16 406.4 4.19 6.35 7.92 9.53 12.7 16.66 21.44 26.19 30.96 36.53 40.49 9.53 12.7 - 21 18 457 4.19 6.35 7.92 11.13 14.27 19.05 23.83 29.36 34.93 39.67 45.24 9.53 12.7 - 22 20 508 4.78 6.35 9.53 12.7 15.09 20.62 26.19 32.54 38.1 44.45 50.01 9.53 12.7 - 23 22 559 4.78 6.35 9.53 12.7 - 22.23 28.58 34.93 41.28 47.63 53.98 9.53 12.7 - 24 24 610 5.54 6.35 9.53 14.27 17.48 24.61 30.96 38.89 46.02 52.37 59.54 9.53 12.7 - 25 26 660 - 7.92 12.7 15.88 - - - - - - - 9.53 12.7 - 26 28 711 - 7.92 12.7 - - - - - - - - 9.53 12.7 - 27 30 762 6.35 7.92 12.7 15.88 - - - - - - - 9.53 12.7 - 28 32 813 - 7.92 12.7 15.88 17.48 - - - - - - 9.53 12.7 - 29 34 864 - 7.92 12.7 15.88 17.48 - - - - - - 9.53 12.7 - 30 36 914 - 7.92 12.7 15.88 19.05 - - - - - - 9.53 12.7 - 31 38 965 - - - - - - - - - - - 9.53 12.7 - 32 40 1016 - - - - - - - - - - - 9.53 12.7 - 33 42 1067 - - - - - - - - - - - 9.53 12.7 - 34 44 1118 - - - - - - - - - - - 9.53 12.7 - 35 46 1168 - - - - - - - - - - - 9.53 12.7 - 36 48 1219 - - - - - - - - - - - 9.53 12.7 -

ASME B36.10M SCHEDULE / IDENTIFICATION

Page 9: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

9

Function code for the exterior diameter

Page 10: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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".

Page 11: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

11

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

Page 12: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

12

The exterior diameter depends only on the nominal diameter (Dn) and is in the third column of the table.

Page 13: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

13

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.10M4

5

6 Size dext 5 10 20 30 40 60 80 100 120 140 160 STD XS XXS

7 1/2 21.3 1.65 2.11 - 2.41 2.77 - 3.73 - 0 - 4.78 2.77 3.73 7.478 3/4 26.7 1.65 2.11 - 2.41 2.87 - 3.91 - 0 - 5.56 2.87 3.91 7.829 1 33.4 1.65 2.77 - 2.9 3.38 - 4.55 - 0 - 6.35 3.38 4.55 9.0910 1 1/2 48.3 1.65 2.77 - 3.18 3.68 - 5.08 - 0 - 7.14 3.68 5.08 10.1511 2 60.3 1.65 2.77 - 3.18 3.91 - 5.54 - 0 - 8.74 3.91 5.54 11.0712 3 88.9 2.11 3.05 - 4.78 5.49 - 7.62 - 0 - 11.13 5.49 7.62 15.2413 4 114.3 2.11 3.05 - 4.78 6.02 - 8.56 - 11.13 - 13.49 6.02 8.56 17.1214 5 141.3 2.77 3.4 - - 6.55 - 9.53 - 12.7 - 15.88 6.55 9.53 19.0515 6 168.3 2.77 3.4 - - 7.11 - 10.97 - 14.27 - 18.26 7.11 10.97 21.9516 8 219.1 2.77 3.76 6.35 7.04 8.18 10.31 12.7 15.09 18.26 20.62 23.01 8.18 12.7 22.2317 10 273 3.4 4.19 6.35 7.8 9.27 12.7 15.09 18.26 21.44 25.4 28.58 9.27 12.7 25.418 12 323.8 3.96 4.57 6.35 8.38 10.31 14.27 17.48 21.44 25.4 28.58 33.32 9.53 12.7 25.419 14 355.6 3.96 6.35 7.92 9.53 11.13 15.09 19.05 23.83 27.79 31.75 35.71 9.53 12.7 - 20 16 406.4 4.19 6.35 7.92 9.53 12.7 16.66 21.44 26.19 30.96 36.53 40.49 9.53 12.7 - 21 18 457 4.19 6.35 7.92 11.13 14.27 19.05 23.83 29.36 34.93 39.67 45.24 9.53 12.7 - 22 20 508 4.78 6.35 9.53 12.7 15.09 20.62 26.19 32.54 38.1 44.45 50.01 9.53 12.7 - 23 22 559 4.78 6.35 9.53 12.7 - 22.23 28.58 34.93 41.28 47.63 53.98 9.53 12.7 - 24 24 610 5.54 6.35 9.53 14.27 17.48 24.61 30.96 38.89 46.02 52.37 59.54 9.53 12.7 - 25 26 660 - 7.92 12.7 15.88 - - - - - - - 9.53 12.7 - 26 28 711 - 7.92 12.7 - - - - - - - - 9.53 12.7 - 27 30 762 6.35 7.92 12.7 15.88 - - - - - - - 9.53 12.7 - 28 32 813 - 7.92 12.7 15.88 17.48 - - - - - - 9.53 12.7 - 29 34 864 - 7.92 12.7 15.88 17.48 - - - - - - 9.53 12.7 - 30 36 914 - 7.92 12.7 15.88 19.05 - - - - - - 9.53 12.7 - 31 38 965 - - - - - - - - - - - 9.53 12.7 - 32 40 1016 - - - - - - - - - - - 9.53 12.7 - 33 42 1067 - - - - - - - - - - - 9.53 12.7 - 34 44 1118 - - - - - - - - - - - 9.53 12.7 - 35 46 1168 - - - - - - - - - - - 9.53 12.7 - 36 48 1219 - - - - - - - - - - - 9.53 12.7 -

ASME B36.10M SCHEDULE / IDENTIFICATION

Page 14: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

14

The code begins by defining the matrix "C" containing rows 1 through 36 and columns 1 through 3.

Page 15: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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.10M4

5

6 Size dext 5 10 20 30 40 60 80 100 120 140 160 STD XS XXS

7 1/2 21.3 1.65 2.11 - 2.41 2.77 - 3.73 - 0 - 4.78 2.77 3.73 7.478 3/4 26.7 1.65 2.11 - 2.41 2.87 - 3.91 - 0 - 5.56 2.87 3.91 7.829 1 33.4 1.65 2.77 - 2.9 3.38 - 4.55 - 0 - 6.35 3.38 4.55 9.0910 1 1/2 48.3 1.65 2.77 - 3.18 3.68 - 5.08 - 0 - 7.14 3.68 5.08 10.1511 2 60.3 1.65 2.77 - 3.18 3.91 - 5.54 - 0 - 8.74 3.91 5.54 11.0712 3 88.9 2.11 3.05 - 4.78 5.49 - 7.62 - 0 - 11.13 5.49 7.62 15.2413 4 114.3 2.11 3.05 - 4.78 6.02 - 8.56 - 11.13 - 13.49 6.02 8.56 17.1214 5 141.3 2.77 3.4 - - 6.55 - 9.53 - 12.7 - 15.88 6.55 9.53 19.0515 6 168.3 2.77 3.4 - - 7.11 - 10.97 - 14.27 - 18.26 7.11 10.97 21.9516 8 219.1 2.77 3.76 6.35 7.04 8.18 10.31 12.7 15.09 18.26 20.62 23.01 8.18 12.7 22.2317 10 273 3.4 4.19 6.35 7.8 9.27 12.7 15.09 18.26 21.44 25.4 28.58 9.27 12.7 25.418 12 323.8 3.96 4.57 6.35 8.38 10.31 14.27 17.48 21.44 25.4 28.58 33.32 9.53 12.7 25.419 14 355.6 3.96 6.35 7.92 9.53 11.13 15.09 19.05 23.83 27.79 31.75 35.71 9.53 12.7 - 20 16 406.4 4.19 6.35 7.92 9.53 12.7 16.66 21.44 26.19 30.96 36.53 40.49 9.53 12.7 - 21 18 457 4.19 6.35 7.92 11.13 14.27 19.05 23.83 29.36 34.93 39.67 45.24 9.53 12.7 - 22 20 508 4.78 6.35 9.53 12.7 15.09 20.62 26.19 32.54 38.1 44.45 50.01 9.53 12.7 - 23 22 559 4.78 6.35 9.53 12.7 - 22.23 28.58 34.93 41.28 47.63 53.98 9.53 12.7 - 24 24 610 5.54 6.35 9.53 14.27 17.48 24.61 30.96 38.89 46.02 52.37 59.54 9.53 12.7 - 25 26 660 - 7.92 12.7 15.88 - - - - - - - 9.53 12.7 - 26 28 711 - 7.92 12.7 - - - - - - - - 9.53 12.7 - 27 30 762 6.35 7.92 12.7 15.88 - - - - - - - 9.53 12.7 - 28 32 813 - 7.92 12.7 15.88 17.48 - - - - - - 9.53 12.7 - 29 34 864 - 7.92 12.7 15.88 17.48 - - - - - - 9.53 12.7 - 30 36 914 - 7.92 12.7 15.88 19.05 - - - - - - 9.53 12.7 - 31 38 965 - - - - - - - - - - - 9.53 12.7 - 32 40 1016 - - - - - - - - - - - 9.53 12.7 - 33 42 1067 - - - - - - - - - - - 9.53 12.7 - 34 44 1118 - - - - - - - - - - - 9.53 12.7 - 35 46 1168 - - - - - - - - - - - 9.53 12.7 - 36 48 1219 - - - - - - - - - - - 9.53 12.7 -

ASME B36.10M SCHEDULE / IDENTIFICATION

Page 16: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

16

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.10M4

5

6 Size dext 5 10 20 30 40 60 80 100 120 140 160 STD XS XXS

7 1/2 21.3 1.65 2.11 - 2.41 2.77 - 3.73 - 0 - 4.78 2.77 3.73 7.478 3/4 26.7 1.65 2.11 - 2.41 2.87 - 3.91 - 0 - 5.56 2.87 3.91 7.829 1 33.4 1.65 2.77 - 2.9 3.38 - 4.55 - 0 - 6.35 3.38 4.55 9.0910 1 1/2 48.3 1.65 2.77 - 3.18 3.68 - 5.08 - 0 - 7.14 3.68 5.08 10.1511 2 60.3 1.65 2.77 - 3.18 3.91 - 5.54 - 0 - 8.74 3.91 5.54 11.0712 3 88.9 2.11 3.05 - 4.78 5.49 - 7.62 - 0 - 11.13 5.49 7.62 15.2413 4 114.3 2.11 3.05 - 4.78 6.02 - 8.56 - 11.13 - 13.49 6.02 8.56 17.1214 5 141.3 2.77 3.4 - - 6.55 - 9.53 - 12.7 - 15.88 6.55 9.53 19.0515 6 168.3 2.77 3.4 - - 7.11 - 10.97 - 14.27 - 18.26 7.11 10.97 21.9516 8 219.1 2.77 3.76 6.35 7.04 8.18 10.31 12.7 15.09 18.26 20.62 23.01 8.18 12.7 22.2317 10 273 3.4 4.19 6.35 7.8 9.27 12.7 15.09 18.26 21.44 25.4 28.58 9.27 12.7 25.418 12 323.8 3.96 4.57 6.35 8.38 10.31 14.27 17.48 21.44 25.4 28.58 33.32 9.53 12.7 25.419 14 355.6 3.96 6.35 7.92 9.53 11.13 15.09 19.05 23.83 27.79 31.75 35.71 9.53 12.7 - 20 16 406.4 4.19 6.35 7.92 9.53 12.7 16.66 21.44 26.19 30.96 36.53 40.49 9.53 12.7 - 21 18 457 4.19 6.35 7.92 11.13 14.27 19.05 23.83 29.36 34.93 39.67 45.24 9.53 12.7 - 22 20 508 4.78 6.35 9.53 12.7 15.09 20.62 26.19 32.54 38.1 44.45 50.01 9.53 12.7 - 23 22 559 4.78 6.35 9.53 12.7 - 22.23 28.58 34.93 41.28 47.63 53.98 9.53 12.7 - 24 24 610 5.54 6.35 9.53 14.27 17.48 24.61 30.96 38.89 46.02 52.37 59.54 9.53 12.7 - 25 26 660 - 7.92 12.7 15.88 - - - - - - - 9.53 12.7 - 26 28 711 - 7.92 12.7 - - - - - - - - 9.53 12.7 - 27 30 762 6.35 7.92 12.7 15.88 - - - - - - - 9.53 12.7 - 28 32 813 - 7.92 12.7 15.88 17.48 - - - - - - 9.53 12.7 - 29 34 864 - 7.92 12.7 15.88 17.48 - - - - - - 9.53 12.7 - 30 36 914 - 7.92 12.7 15.88 19.05 - - - - - - 9.53 12.7 - 31 38 965 - - - - - - - - - - - 9.53 12.7 - 32 40 1016 - - - - - - - - - - - 9.53 12.7 - 33 42 1067 - - - - - - - - - - - 9.53 12.7 - 34 44 1118 - - - - - - - - - - - 9.53 12.7 - 35 46 1168 - - - - - - - - - - - 9.53 12.7 - 36 48 1219 - - - - - - - - - - - 9.53 12.7 -

ASME B36.10M SCHEDULE / IDENTIFICATION

Matrix "C" in whose third column from rows 7 to 36 are the exterior diameters "OD [mm]"

Page 17: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

17

Next, it will be defined in the code, the array dimension of "C"

Page 18: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

18

Dim C(36, 3)

Function Pipe_Imp_CS_Dext_dn(Dn)

End Function

Page 19: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

19

Dim C(36, 3)

Function Pipe_Imp_CS_Dext_dn(Dn)

End Function

The matrix C is defined with 36 columns and 3 rows

Page 20: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

20

Reading of the table

Page 21: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

21

Reading of the table

To read the information in the table, one uses a structure called For-next

Page 22: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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".

Page 23: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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

Page 24: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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"

Page 25: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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

Page 26: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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"

Next m

The operations with the index "m" end with

Page 27: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

27

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"

Next m

The operations with the index "m" end with

The loop ends after the operation with index "m = 36" is performed.

Page 28: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

28

The “ For-next” is programed as follows

Page 29: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

29

The “ For-next” is programed as follows

Page 30: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

30

The “ For-next” is programed as follows

This indicates that cells in column 3, from row 1 to 36, shall be read

Page 31: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

31

The “ For-next” is programed as follows

This indicates that cells in column 3, from row 1 to 36, shall be read

Page 32: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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"

Page 33: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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"

Page 34: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

34

The “ For-next” is programed as follows

This indicates that cells in column 3, from row 1 to 36, shall be read

The reading is done in the sheet that has been named 6.CS_Imp

The read value is assigned to the element (m, 3) of the matrix "C"

Page 35: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

35

The “ For-next” is programed as follows

This indicates that cells in column 3, from row 1 to 36, shall be read

The reading is done in the sheet that has been named 6.CS_Imp

The read value is assigned to the element (m, 3) of the matrix "C"

Page 36: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

36

The “ For-next” is programed as follows

This indicates that cells in column 3, from row 1 to 36, shall be read

The reading is done in the sheet that has been named 6.CS_Imp

The read value is assigned to the element (m, 3) of the matrix "C"

On sheet "6.CS_Imp" it must be read the contents of the cell (m, 3)

Page 37: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

37

Summary of programming steps

Page 38: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

38

Summary of programming steps

Function

Page 39: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

39

Summary of programming steps

Function Pipe_Imp_CS_Dext_dn(Dn)

End Function

Page 40: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

40

Summary of programming steps

Function Pipe_Imp_CS_Dext_dn(Dn)

End Function

Dim C(36, 3)

Page 41: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

41

Summary of programming steps

Function Pipe_Imp_CS_Dext_dn(Dn)

End Function

Dim C(36, 3)

For m = 1 To 36

Page 42: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

42

Summary of programming steps

Function Pipe_Imp_CS_Dext_dn(Dn)

End Function

Dim C(36, 3)

For m = 1 To 36

C(m, 3) = thisWorkbook.Worksheets("6.CS_Imp").Cells(m, 3).Value

Page 43: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

43

Summary of programming steps

Function Pipe_Imp_CS_Dext_dn(Dn)

End Function

Dim C(36, 3)

For m = 1 To 36

C(m, 3) = thisWorkbook.Worksheets("6.CS_Imp").Cells(m, 3).Value

Next m

Page 44: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

44

Identification of the row in which each nominal diameter is found

Page 45: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

45

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.

Page 46: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

46

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.10M4

5

6 Size dext 5 10 20 30 40 60 80 100 120 140 160 STD XS XXS

7 1/2 21.3 1.65 2.11 - 2.41 2.77 - 3.73 - 0 - 4.78 2.77 3.73 7.478 3/4 26.7 1.65 2.11 - 2.41 2.87 - 3.91 - 0 - 5.56 2.87 3.91 7.829 1 33.4 1.65 2.77 - 2.9 3.38 - 4.55 - 0 - 6.35 3.38 4.55 9.0910 1 1/2 48.3 1.65 2.77 - 3.18 3.68 - 5.08 - 0 - 7.14 3.68 5.08 10.1511 2 60.3 1.65 2.77 - 3.18 3.91 - 5.54 - 0 - 8.74 3.91 5.54 11.0712 3 88.9 2.11 3.05 - 4.78 5.49 - 7.62 - 0 - 11.13 5.49 7.62 15.2413 4 114.3 2.11 3.05 - 4.78 6.02 - 8.56 - 11.13 - 13.49 6.02 8.56 17.1214 5 141.3 2.77 3.4 - - 6.55 - 9.53 - 12.7 - 15.88 6.55 9.53 19.0515 6 168.3 2.77 3.4 - - 7.11 - 10.97 - 14.27 - 18.26 7.11 10.97 21.9516 8 219.1 2.77 3.76 6.35 7.04 8.18 10.31 12.7 15.09 18.26 20.62 23.01 8.18 12.7 22.2317 10 273 3.4 4.19 6.35 7.8 9.27 12.7 15.09 18.26 21.44 25.4 28.58 9.27 12.7 25.418 12 323.8 3.96 4.57 6.35 8.38 10.31 14.27 17.48 21.44 25.4 28.58 33.32 9.53 12.7 25.419 14 355.6 3.96 6.35 7.92 9.53 11.13 15.09 19.05 23.83 27.79 31.75 35.71 9.53 12.7 - 20 16 406.4 4.19 6.35 7.92 9.53 12.7 16.66 21.44 26.19 30.96 36.53 40.49 9.53 12.7 - 21 18 457 4.19 6.35 7.92 11.13 14.27 19.05 23.83 29.36 34.93 39.67 45.24 9.53 12.7 - 22 20 508 4.78 6.35 9.53 12.7 15.09 20.62 26.19 32.54 38.1 44.45 50.01 9.53 12.7 - 23 22 559 4.78 6.35 9.53 12.7 - 22.23 28.58 34.93 41.28 47.63 53.98 9.53 12.7 - 24 24 610 5.54 6.35 9.53 14.27 17.48 24.61 30.96 38.89 46.02 52.37 59.54 9.53 12.7 - 25 26 660 - 7.92 12.7 15.88 - - - - - - - 9.53 12.7 - 26 28 711 - 7.92 12.7 - - - - - - - - 9.53 12.7 - 27 30 762 6.35 7.92 12.7 15.88 - - - - - - - 9.53 12.7 - 28 32 813 - 7.92 12.7 15.88 17.48 - - - - - - 9.53 12.7 - 29 34 864 - 7.92 12.7 15.88 17.48 - - - - - - 9.53 12.7 - 30 36 914 - 7.92 12.7 15.88 19.05 - - - - - - 9.53 12.7 - 31 38 965 - - - - - - - - - - - 9.53 12.7 - 32 40 1016 - - - - - - - - - - - 9.53 12.7 - 33 42 1067 - - - - - - - - - - - 9.53 12.7 - 34 44 1118 - - - - - - - - - - - 9.53 12.7 - 35 46 1168 - - - - - - - - - - - 9.53 12.7 - 36 48 1219 - - - - - - - - - - - 9.53 12.7 -

ASME B36.10M SCHEDULE / IDENTIFICATION

Page 47: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

47

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

Page 48: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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 losdatos correspondientes a ese diámetro”.

En el código se agrega la siguiente línea

If Dn = 0.5 Then x = 7

Page 49: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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 losdatos 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

Page 50: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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 losdatos 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

Page 51: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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 losdatos correspondientes a ese diámetro”.

En el código se agrega la siguiente línea

ElseIf Dn = 0.75 Then x = 8

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

Page 52: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

52

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 losdatos correspondientes a ese diámetro”.

En el código se agrega la siguiente línea

Cuyo significado es O Si Dn tiene el valor 0.75 [in] , se trata de la fila 8

ElseIf Dn = 0.75 Then x = 8

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

Page 53: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

53

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

Cuyo significado es O Si Dn tiene el valor 0.75 [in] , se trata de la fila 8

ElseIf Dn = 0.75 Then x = 8

If Dn = 0.5 Then x = 7

Y así sucesivamente hasta identificar todas las filas

Cuyo significado es Si Dn tiene el valo 0.5 [in] entonces se trata de la fila 7

La siguiente línea es

Page 54: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

54

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

Whose meaning is Or if Dn has the value 0.75 [in] , then it is row 8

ElseIf Dn = 0.75 Then x = 8

If Dn = 0.5 Then x = 7

And so on until all all rows are identified

With these two new lines, the code looks like

Whose meaning isIf Dn has the values 0.5 [in] then the row is row 7

The next line is

Page 55: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

55

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

Page 56: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

56

And with all the rows identified, this part of the code looks like

Page 57: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

57

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

Page 58: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

58

A resume of the code is

Page 59: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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 Thenx = 7ElseIf Dn = 0.75 Then x = 8ElseIf Dn = 1 Then x = 9ElseIf Dn = 1.5 Then x = 10ElseIf Dn = 2 Then x = 11

ElseIf Dn = 44 Then x = 34ElseIf Dn = 46 Then x = 35ElseIf 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 FunctionEnd If

Page 60: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

60

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 Thenx = 7ElseIf Dn = 0.75 Then x = 8ElseIf Dn = 1 Then x = 9ElseIf Dn = 1.5 Then x = 10ElseIf Dn = 2 Then x = 11

ElseIf Dn = 44 Then x = 34ElseIf Dn = 46 Then x = 35ElseIf 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 FunctionEnd 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)

Page 61: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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.

Page 62: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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

Page 63: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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.

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 “x” is a known value

Page 64: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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.

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

Thus, the value of “x” is a known value

Page 65: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

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.

Pipe_Imp_CS_Dext_dn = C(x, 3)

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

Thus, the value of “x” is a known value

Page 66: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

66

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.

Pipe_Imp_CS_Dext_dn = C(x, 3)

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

With this, the function is finished

Thus, the value of “x” is a known value

Page 67: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

67

The complete code is

Page 68: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

68

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

Page 69: Part 3. Description of a function code 1. Part 3. Description of a function code 2 As an example we will write a function code to find the outside diameter.

69

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.