Bulk Create Guardrails

When setting up the Kelvin Platform, one of the initial tasks is to install an edge computer and establish two-way data transfer with your Assets.

Guardrails is a safety feature designed to prevent sending erroneous data to your Assets, whether through the API, the Kelvin UI, or automatically via a Kelvin SmartApp™. It acts as a final safeguard, overriding any data write decisions made by Operations or programs.

Reference:

Field Option Description
Asset asset name - ex: plunger-lift-01 Name of the Asset for the Guardrail.
Data Stream datastream name - ex: tubing_pressure The Data Stream associated with the asset, usually a measurement or parameter like pressure or temperature.
Control true | false Indicates whether the Guardrail functionality is enabled for this asset.
Minimum Value number | datastream name Specifies the minimum value for the data stream or another referenced Data Stream name.
Minimum Value Type value | datastream Defines whether the minimum value is a static number or linked to another data stream.
Minimum Value Included true | false Specifies whether the minimum value is inclusive in the comparison.
Maximum Value number | datastream name Specifies the maximum value for the data stream or another referenced Data Stream name.
Maximum Value Type value | datastream Defines whether the maximum value is a static number or linked to another data stream.
Maximum Value Included true | false Specifies whether the maximum value is inclusive in the comparison.
Relative Increase Minimum Value number Sets the minimum allowable relative increase for the data stream.
Relative Increase Minimum Value Type value | percentage Determines if the minimum increase is a specific value or a percentage.
Relative Increase Minimum Value Included true | false Indicates if the minimum relative increase is inclusive.
Relative Increase Maximum Value number Sets the maximum allowable relative increase for the data stream.
Relative Increase Maximum Value Type value | percentage Determines if the maximum increase is a specific value or a percentage.
Relative Increase Maximum Value Included true | false Indicates if the maximum relative increase is inclusive.
Relative Decrease Minimum Value number Sets the minimum allowable relative decrease for the data stream.
Relative Decrease Minimum Value Type value | percentage Determines if the minimum decrease is a specific value or a percentage.
Relative Decrease Minimum Value Included true | false Indicates if the minimum relative decrease is inclusive.
Relative Decrease Maximum Value number Sets the maximum allowable relative decrease for the data stream.
Relative Decrease Maximum Value Type value | percentage Determines if the maximum decrease is a specific value or a percentage.
Relative Decrease Maximum Value Included true | false Indicates if the maximum relative decrease is inclusive.

You can download a sample template with data filled in here.

Download guardrails-data.csv

To start, click on Guardrails in the Contextualization section of the left side bar and click on the Import Guardrails button.

In Step 1 drag and drop your csv file of Guardrails and then click Next to go to Step 2.

Success

You can download the template format from here to use as reference when creating your Guardrails list.

In Step 2 the csv file will be validated and any errors highlighted. If all is ok, then you can proceed to click the Import button.

Congratulations, you have imported all your Asset / Data Stream pair guardrails.

Warning

Any values sent to the Asset / Data Stream pair outside of this min/max range will be automatically rejected and the original value will remain in the Asset's data.

Any values sent to the Asset / Data Stream pair outside of the defined allowable change range will be automatically rejected and the original value will remain in the Asset's data.

API cURL Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
curl -X 'POST' \
'https://<url.kelvin.ai>/api/v4/guardrails/bulk/create' \
-H "Authorization: Bearer <Your Current Token>" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"guardrails":[
        {
            "resource":"krn:ad:press_line_05/motor_speed_setpoint",
            "control_disabled":false,
            "updater":{
                "number":{
                "max":{
                    "source":"krn:ad:press_line_05/speed_limit",
                    "inclusive":false
                }
                }
            },
            "number":{
                "relative":{

                },
                "min":{
                "value":800,
                "inclusive":true
                }
            }
        },
        {
            "resource":"krn:ad:press_line_05/oil_flow_rate",
            "control_disabled":true,
            "updater":{

            },
            "number":{
                "relative":{
                "increase":{
                    "max":{
                        "value":0.1,
                        "type":"value",
                        "inclusive":true
                    },
                    "min":{
                        "value":10,
                        "type":"percentage",
                        "inclusive":false
                    }
                },
                "decrease":{
                    "max":{
                        "value":0.1,
                        "type":"value",
                        "inclusive":true
                    },
                    "min":{
                        "value":10,
                        "type":"percentage",
                        "inclusive":true
                    }
                }
                },
                "max":{
                "value":0.6,
                "inclusive":true
                },
                "min":{
                "value":0.2,
                "inclusive":true
                }
            }
        }
    ]
    }'

You will get a response similar to this;

API cURL Example Response
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
[
    {
        "number": {
        "min": {
            "updated_at": "2024-10-03T03:42:57.674804Z",
            "updated_by": "krn:user:user@example.com",
            "inclusive": true,
            "value": 0.2
        },
        "max": {
            "updated_at": "2024-10-03T03:42:57.674804Z",
            "updated_by": "krn:user:user@example.com",
            "inclusive": true,
            "value": 0.6
        },
        "relative": {
            "increase": {
            "min": {
                "type": "percentage",
                "value": 10,
                "inclusive": false
            },
            "max": {
                "type": "value",
                "value": 0.1,
                "inclusive": true
            }
            },
            "decrease": {
            "min": {
                "type": "percentage",
                "value": 10,
                "inclusive": true
            },
            "max": {
                "type": "value",
                "value": 0.1,
                "inclusive": true
            }
            }
        }
        },
        "updater": null,
        "created_by": "krn:user:user@example.com",
        "created_at": "2024-10-03T03:42:57.674804Z",
        "updated_by": "krn:user:user@example.com",
        "updated_at": "2024-10-03T03:42:57.674804Z",
        "resource": "krn:ad:press_line_05/oil_flow_rate",
        "control_disabled": true
    },
    {
        "number": {
        "min": {
            "updated_at": "2024-10-03T03:42:57.674851Z",
            "updated_by": "krn:user:user@example.com",
            "inclusive": true,
            "value": 800
        },
        "max": null,
        "relative": {
            "increase": null,
            "decrease": null
        }
        },
        "updater": {
        "number": {
            "min": null,
            "max": {
            "source": "krn:ad:press_line_05/speed_limit",
            "inclusive": false
            }
        }
        },
        "created_by": "krn:user:user@example.com",
        "created_at": "2024-10-03T03:42:57.674851Z",
        "updated_by": "krn:user:user@example.com",
        "updated_at": "2024-10-03T03:42:57.674851Z",
        "resource": "krn:ad:press_line_05/motor_speed_setpoint",
        "control_disabled": false
    }
]

Currently this is not possible in the Kelvin Python API client.