{"id":17543164,"url":"https://github.com/vb64/pipeline.integrity","last_synced_at":"2025-04-11T04:51:59.549Z","repository":{"id":210380704,"uuid":"726343376","full_name":"vb64/pipeline.integrity","owner":"vb64","description":"Calculate the degree of danger of pipeline defects","archived":false,"fork":false,"pushed_at":"2025-03-06T13:49:51.000Z","size":983,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T04:51:53.466Z","etag":null,"topics":["asme","b31g","integrity","pipeline"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vb64.png","metadata":{"files":{"readme":"README.md","changelog":"history.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-02T05:21:20.000Z","updated_at":"2025-03-06T13:49:51.000Z","dependencies_parsed_at":"2023-12-02T12:23:18.180Z","dependency_job_id":"b349f256-4050-438a-a2f5-2a93b478769b","html_url":"https://github.com/vb64/pipeline.integrity","commit_stats":{"total_commits":35,"total_committers":1,"mean_commits":35.0,"dds":0.0,"last_synced_commit":"f8d1d97457c5ebd2a6c2626b65ad4f58ab152112"},"previous_names":["vb64/pipeline.integrity"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb64%2Fpipeline.integrity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb64%2Fpipeline.integrity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb64%2Fpipeline.integrity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb64%2Fpipeline.integrity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vb64","download_url":"https://codeload.github.com/vb64/pipeline.integrity/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345290,"owners_count":21088243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asme","b31g","integrity","pipeline"],"created_at":"2024-10-21T00:23:05.860Z","updated_at":"2025-04-11T04:51:59.544Z","avatar_url":"https://github.com/vb64.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PipelineIntegrity library\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/pipeline.integrity/pep257.yml?label=Pep257\u0026style=plastic\u0026branch=main)](https://github.com/vb64/pipeline.integrity/actions?query=workflow%3Apep257)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/pipeline.integrity/py2.yml?label=Python%202.7\u0026style=plastic\u0026branch=main)](https://github.com/vb64/pipeline.integrity/actions?query=workflow%3Apy2)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/pipeline.integrity/py3.yml?label=Python%203.8-3.13\u0026style=plastic\u0026branch=main)](https://github.com/vb64/pipeline.integrity/actions?query=workflow%3Apy3)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/767801f5b171469ebc628df3fe696bbc)](https://app.codacy.com/gh/vb64/pipeline.integrity/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/767801f5b171469ebc628df3fe696bbc)](https://app.codacy.com/gh/vb64/pipeline.integrity/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_coverage)\n\n[In Russian](READMEru.md)\n\nThe free, open source PipelineIntegrity library designed to calculate the degree of danger\nof pipeline metal loss defects according to the ASME B31G method.\n\n![ASME B31G method](docs/asme/img/fig_1_1.png)\n\n## Installation\n\n```bash\npip install pipeline-integrity\n```\n\n## Usage\n\nA pipe under pressure, with a length, diameter and wall thickness from specified material.\n\n```python\nfrom pipeline_integrity.material import Material\nfrom pipeline_integrity.pipe import Pipe\n\npipe = Pipe(\n  440,  # length, inches\n  56,  # diameter, inches\n  0.63,  # wall thickness, inches\n  Material(  # pipe material\n    \"Steel\",\n    52000  # SMYS, psi\n  ),\n  900  # pressure, psi\n)\n)\n```\n\nMetal loss defect with a specified position on the pipe and a specified depth.\n\n```python\ndefect = pipe.add_metal_loss(\n  40,  # the defect starts at a distance of 40 inches from the beginning of the pipe\n  4,  # defect length 4 inches\n  10,  # along the circumference of the pipe, the defect begins\n       # at 10 arc minutes from the top of the pipe\n  20,  # the size of the defect along the circumference is 20 arc minutes\n  0.039  # defect depth 0.039 inches\n)\n```\n\nSMTS for pipe material must be set to create\ncontext for calculating the degree of severity of the defect according to the ASME B31G method\n\n```python\nfrom pipeline_integrity.method.asme.b31g_2012 import Context\n\npipe.material.smts = 70000\nasme = Context(defect)\n```\n\nDefect depth less than 10% wall thickness, no danger.\n\n```python\nassert defect.depth == 0.039\nassert pipe.wallthickness == 0.63\n\nassert asme.years() \u003e 0\nassert 0.7 \u003c asme.erf() \u003c 0.71\n```\n\nFor very low pressure cases, repair is never required (special value REPAIR_NOT_REQUIRED=777).\n\n```python\npipe.maop = 1\nassert asme.years() == asme.REPAIR_NOT_REQUIRED\n```\n\nThe depth of the defect is 50% of the pipe wall thickness.\n\n```python\npipe.maop = 900\ndefect.depth = 0.31\nassert defect.length == 4\nassert 0.74 \u003c asme.erf() \u003c 0.75\n```\n\nA defect with a length of 30 inches and a depth of 50% of the pipe wall thickness\nrequires repair at the specified working pressure in the pipe.\n\n```python\ndefect.length = 30\nassert asme.years() == 0\nassert asme.erf() \u003e 1.3\n```\n\nWhen the operating pressure is reduced to a safe value, the defect does not require repair.\n\n```python\nassert pipe.maop == 900\nassert round(asme.safe_pressure, 2) == 653.71\npipe.maop = 500\nasme.is_explain = True\nassert asme.years() \u003e 0\n```\n\nIf you set context property `is_explain = True`, then you can get explanation in text form.\n\n```python\nasme.explain()\n```\n\n```text\nCalculate ERF by ASME B31G 2012 classic.\nCalculate failure stress level by the classic way.\nParameter Sflow = 1.1 * material_smys.\nSflow = 1.1 * 52000 = 57200.0.\nParameter Z = length^2 / (diameter * wallthickness).\nZ = 30^2 / (56 * 0.63) = 25.51.\nParameter Z = 25.51 \u003e 20.\nFailure stress level = Sflow * (1 - depth / wallthickness).\nstress_fail = 57200.0 * (1 - 0.31 / 0.63) = 29053.968.\nFailure pressure = 2 * stress_fail * wallthickness / diameter.\npress_fail = 2 * 29053.968 * 0.63 / 56 = 653.714.\nERF = pipe_maop / press_fail.\nERF = 500 / 653.714 = 0.765\n\nRepair is not required at the moment, calculate the time before repair.\nWith corrosion rate 0.016 mm/year, pipe wall 0.63 and depth 0.31 a through hole is formed after years: 21.\nCalculating the year in which the corrosion growth of the defect will require repair.\nYears: 4 ERF: 0.952.\nYears: 5 ERF: 1.014.\nDefect will require repair after years: 4.\n```\n\n## Development\n\n```bash\ngit clone git@github.com:vb64/pipeline.integrity.git\ncd pipeline.integrity\n```\n\nWith Python 3:\n\n```bash\nmake setup PYTHON_BIN=/path/to/python3\nmake tests\n```\n\nWith Python 2:\n\n```bash\nmake setup2 PYTHON_BIN=/path/to/python2\nmake tests2\n```\n\n## Example\n\nLiving version of online calculator example, that use this library, can be [found here](https://wot-online-hours.appspot.com/).\nThe source code of this example placed in this repo in [example dir](example/web/gae ).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvb64%2Fpipeline.integrity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvb64%2Fpipeline.integrity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvb64%2Fpipeline.integrity/lists"}