Metalic pipe wall thickness is determined by the "Code of Record" used for the design. This is frequently determined by the local laws and statutes.
For systems over 15 psig that are not specifically designated as plumbing, fuel gas, drainage or fire protection, ASME B31.1 Piping Code typically is invoked by local laws and statutes. B31.1 provides formulae and rules for determining "minimum wall" thickness for a particular pipe diameter, material and design temperature. (Section 104.1)
A corrosion allowance, typically 1/16 inch, must be determined by the piping system designer and included in the calculation. If the pipe is to be threaded, an allowance must also be made for this.
The minimum wall thickness is compared against standard schedule piping and one "piping schedule" (wall thickness)is selected for the entire system.
Flanges and valves of compatable materials are selected based on temperature-pressure tables. (see ANSI B16.5 and B16.34)