| src | ||
| Cargo.lock | ||
| Cargo.toml | ||
| example_input.json | ||
| README.md | ||
Runs the ILI clustering algorithm
Clustering criteria for pipeline defects refer to the guidelines or criteria that are used to determine whether a group of defects in a pipeline should be considered a "cluster." These criteria are typically based on a combination of factors, including the size, location, and severity of the defects, as well as the spacing between them. There are several different clustering criteria that can be used for pipeline defects, depending on the specific context and application. Some common clustering criteria include:
- Percentage of wall loss: This criterion considers the percentage of the pipeline wall that has been lost due to corrosion or other defects. A group of defects that collectively represent a certain percentage of wall loss (e.g., 10%) may be considered a cluster.
- Spacing between defects: This criterion considers the distance between individual defects in a pipeline. If the spacing between defects falls below a certain threshold (e.g., 1 meter), they may be considered a cluster.
- Geographic location: This criterion considers the geographic location of defects within a pipeline. If defects are clustered within a certain area of the pipeline (e.g., a bend or a weld), they may be considered a cluster.
- Severity of defects: This criterion considers the severity or consequence of individual defects. If a group of defects collectively represent a significant risk of failure or leakage, they may be considered a cluster.
Pipeline operators typically use clustering criteria as part of their inspection and maintenance programs to identify and prioritize areas of the pipeline that require attention. By identifying and addressing clusters of defects, operators can help prevent failures and ensure the safe and reliable operation of their pipelines.
Examining the clustering of pipeline defects is a crucial aspect of pipeline integrity management. This involves evaluating the spacing between defects in a pipeline to determine the likelihood of larger defects clustering together. Specific conditions must be met for this distance to be considered acceptable. If these conditions are met, the possibility of defect clustering cannot be overlooked.
Clustering rules
Rules are used to configure the clustering algorithm. There are 11 standard rules and then a 12th custom rule.
Each rule is based on a length and circumferential criteria. If any two anomalies have a horizontal separation less than the length criteria and a circumferential separation less than the circumferential criteria the should be clustered.
The rules are details in the table below.
| Rule no. | Length Criteria | Circumferential Criteria |
|---|---|---|
| Rule 1 | Minimum (L1,L2) | Minimum (W1,W2) |
| Rule 2 | Minimum (6*wall thickness, Minimum (L1,L2)) | Minimum (6*wall thickness, Minimum (W1,W2)) |
| Rule 3 | Minimum (wall thickness, Minimum (L1,L2)) | Minimum (wall thickness, Minimum (W1,W2)) |
| Rule 4 | Minimum (L1,L2) | Minimum (wall thickness, Minimum (W1,W2)) |
| Rule 5 | Average (L1,L2) | Average (W1,W2) |
| Rule 6 | Wall thickness | Wall thickness |
| Rule 7 | 3*Wall thickness | 3*Wall thickness |
| Rule 8 | 2*Minimum (L1,L2) | 2*Minimum (W1,W2) |
| Rule 9 | Minimum (6*wall thickness, Average (L1,L2)) | Minimum (6*wall thickness, Average (W1,W2)) |
| Rule 10 | 1 inch = 25.4 mm | 6*wall thickness |
| Rule 11 | 1 inch = 25.4 mm | (3 × MAOP × OD) / (SF × SMYS × WJF) |
| Rule 12 | User Configurations | User Configurations |
Input
Arguments
org_id: as string which should be a validuuidfor the organizationproject_id: the id of the data project where the pipeline data is foundpipeline_id: anarrayofstringswhich should be valid UUIDs for pipelinessize_settings: a string representing the size setting for clustering, possible valuesoriginaltolerance
interaction: a string representing the interaction setting for clustering, possible valuesenableddisabled
surface_location: a string representing the surface location setting for clustering, possible valuesmatchingany
rule: a string representing the clustering rule to use, possible valuesrule1rule2rule3rule4rule5rule6rule7rule8rule9rule10rule11
Creating the function on the platform
To create this function on the platform using the cli set up the port forwarding as shown in README.
Then run the following command to create the function.
cargo run functions create \
-f functions/ili_clustering \
-d "Runs the ILI clustering algorithm" \
-i org_id=string \
-i project_id=string \
-i pipeline_id=array \
-i ili_id=array \
-i size_settings=string \
-i interaction=string \
-i surface_location=string \
-i rule=string
Testing the function locally
You can run and test the function locally by running
cargo run
Then you can check it work with curl as follows
curl localhost:8080 -d $(jq '. | tojson' functions/ili_clustering/example_input.json)