Pipeline integrity calculation
Project description
PipelineIntegrity library
Free, open source PipelineIntegrity library designed to calculate the degree of danger of pipeline metal loss defects according to the ASME B31G method.
Installation
pip install pipeline-integrity
Usage
A pipe under pressure, with a length, diameter and wall thickness from specified material.
from pipeline_integrity.material import Material
from pipeline_integrity.pipe import Pipe
pipe = Pipe(
440, # length, inches
56, # diameter, inches
0.63, # wall thickness, inches
Material( # pipe material
"Steel",
52000 # SMYS, psi
),
900 # pressure, psi
)
)
Metal loss defect with a specified position on the pipe and a specified depth.
defect = pipe.add_metal_loss(
40, # the defect starts at a distance of 40 inches from the beginning of the pipe
4, # defect length 4 inches
10, # along the circumference of the pipe, the defect begins
# at 10 arc minutes from the top of the pipe
20, # the size of the defect along the circumference is 20 arc minutes
0.039 # defect depth 0.039 inches
)
SMTS for pipe material must be set.
pipe.material.smts = 70000
Context for calculating the degree of severity of the defect according to the ASME B31G method
from pipeline_integrity.method.asme.b31g_2012 import Context
asme = Context(defect)
Defect depth less than 10% wall thickness, no danger.
assert defect.depth == 0.039
assert pipe.wallthickness == 0.63
assert 0.7 < asme.erf() < 0.71
The depth of the defect is 50% of the pipe wall thickness.
defect.depth = 0.31
assert defect.length == 4
assert 0.74 < asme.erf() < 0.75
A defect with a length of 30 inches and a depth of 50% of the pipe wall thickness requires repair at the specified working pressure in the pipe.
defect.length = 30
assert asme.erf() > 1.3
When the operating pressure is reduced to a safe value, the defect does not require repair.
assert pipe.maop == 900
assert round(asme.safe_pressure, 2) == 653.71
pipe.maop = 650
assert asme.erf(is_explain=True) < 1
If you call pipe_state
method with parameter is_explain=True
,
then you can get explanation in text form.
asme.explain()
Calculate ERF by ASME B31G 2012 classic.
Calculate failure stress level by the classic way.
Parameter Sflow = 1.1 * material_smys.
Sflow = 1.1 * 52000 = 57200.0.
Parameter Z = length^2 / (diameter * wallthickness).
Z = 30^2 / (56 * 0.63) = 25.51.
Parameter Z = 25.51 > 20.
Failure stress level = Sflow * (1 - depth / wallthickness).
stress_fail = 57200.0 * (1 - 0.31 / 0.63) = 29053.968.
Failure pressure = 2 * stress_fail * wallthickness / diameter.
press_fail = 2 * 29053.968 * 0.63 / 56 = 653.714.
ERF = pipe_maop / press_fail.
ERF = 650 / 653.714 = 0.994
Development
$ git clone git@github.com:vb64/pipeline.integrity.git
$ cd pipeline.integrity
With Python 3:
$ make setup PYTHON_BIN=/path/to/python3
$ make tests
With Python 2:
$ make setup2 PYTHON_BIN=/path/to/python2
$ make tests2
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pipeline_integrity-1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d60516ef76a32bff0b8438ea0d6f78b8c9e8155cb71991bd4b25d34aac6e399 |
|
MD5 | 0a4afc0a6727b8d51b6ed265fe0052ab |
|
BLAKE2b-256 | b8a7034bb6a693e579a33530c56e88e603d9446c158b601a0877f40e4d330c02 |