Define Your Own Metrics
Create a user-defined metric or Key Performance Indicator (KPI) to display asset data that is specific to your operating environment. Metrics are created on asset types.
Metric Usage Examples
This section discusses metric usage examples to help you use the formula editor. It also provides several metric SQL examples.
Example 4-1 Single Asset Metrics and Multi-Asset Metrics
- Aggregation Functions
- Sensor Attributes in Metrics
- Filters
- Relational Operators
Scenario: We create a metric to measure the maximum fuel level for each power generator. Next, we create a metric to measure the count of generators with sufficient fuel.
- Create a metric,
Max_Hourly_Fuel
that is calculated hourly for each asset.The following SQL is generated corresponding to the metric and calculated hourly:
SELECT MAX('Sensors'.'fuelLevel') FROM 'Generator' GROUP BY ENTITY
You can put this metric on the machine dashboard to see the hourly maximum fuel level for the selected asset.
- Create a metric,
Assets_with_Sufficient_Fuel
to calculate the count of assets that have sufficient fuel levels. The metric defines fuel levels above 20 to be sufficient. Note that a filter is applied after adding theCount
function to add theWhere
clause. A relational operator (>
) is used to perform the comparison.The following SQL is generated corresponding to the metric:
SELECT COUNT(*) FROM 'Generator' WHERE 'Sensors'.'fuelLevel'>20
You can put this metric on the organization dashboard to see the current count of generator assets with sufficient fuel.
Example 4-2 Nested Metrics and Formulas
- Functions
- Metrics within Metrics
- Filters
- Relational Operators, Arithmetic Operators
Scenario: We first create a metric to measure the hourly standard deviation value of the fuel level for each power generator. Next, we create a metric specific to our business use case: The metric calculates the number of generators that can be allocated for the project using a custom formula. The formula makes use of the metrics already created.
- Create a metric,
Fuel_Std_Dev
that is calculated hourly for each asset.The following SQL is generated corresponding to the metric and calculated hourly:
SELECT STDDEV('Sensors'.'fuelLevel') FROM 'Generator' GROUP BY ENTITY
You can put this metric on the machine dashboard to see the hourly standard deviation of the fuel level for the selected asset.
- Create a metric,
Assets_to_Allocate
to calculate the count of assets that are ready to be allocated to the project. The metric defines the following business-specific formula:Find the count of assets for which the fuel levels are greater than the difference between
Max_Hourly_Fuel
and 1.5 times theFuel_Std_Dev
metric. Here,Max_Hourly_Fuel
andFuel_Std_Dev
are the metrics we calculated in the earlier examples.The following SQL is generated corresponding to the metric:
SELECT COUNT(*) FROM 'Generator' WHERE 'Sensors'.'fuelLevel'>'Metrics'.'Max_Hourly_Fuel'['interval':"HOURLY"]-1.5*'Metrics'.'Fuel_Std_Dev'['interval':"HOURLY"]
You can put this metric on the organization dashboard to see the current count of generator assets ready to be allocated.
Metric SQL Examples
Description and Use case for the Metric | Metric SQL Query | Type | Concepts |
---|---|---|---|
Number of assets with incidents > 0. Helps to understand the number of assets that have issues. |
SELECT COUNT(*) FROM 'Assets' WHERE 'Metrics'.'sys_openIncidents' > 0 |
Multi-Asset |
|
Number of assets of specific type with temperature sensor value > 50. Helps understand the number of assets behaving abnormally. |
SELECT COUNT(*) FROM 'AssetWithSensors' WHERE 'Sensors'.'temperature' > 50 |
Multi-Asset |
|
Number of assets of specific type with temperature sensor value > (pressure sensor value * 1.5). Helps understand the number of assets behaving abnormally. |
SELECT COUNT(*) FROM 'AssetWithSensors' WHERE 'Sensors'.'temperature' > 'Sensors'.'pressure' * 1.5 |
Multi-Asset |
|
Number of assets with temperature sensor value > average(temperature value over last 24 hours). Helps understand the number of assets operating in the above average temperature range. |
avgTemp[DAILY] ::= SELECT AVG('Sensors'.'temperatue') FROM 'AssetWithSensors' GROUP BY ENTITY SELECT COUNT(*) FROM 'AssetWithSensors' WHERE 'Sensors'.'temperature' > 'Metrics'.'avgTemp'['interval': "DAILY"] |
Multi-Asset |
|
Number of assets with temperature sensor value * 1.5 + humidity sensor value * 0.75 > 2.7. You may create formula-based metrics based on your models. |
SELECT COUNT(*) FROM 'AssetWithSensors' WHERE 'Sensors'.'temperature' * 1.5 + 'Sensors'.'humidity' * 0.75 > 2.7 |
Multi-Asset |
|
Number of assets with average (temperature in last hour) > average (temperature in last 24 hours). May help identify drifting assets. |
avgTemp[HOURLY, DAILY] ::= SELECT AVG('Sensors'.'temperatue') FROM 'AssetWithSensors' GROUP BY ENTITY SELECT COUNT(*) FROM 'AssetWithSensors' WHERE 'Metrics'.'avgTemp'['interval': "HOURLY"] > 'Metrics'.'avgTemp'['interval': "DAILY"] |
Multi-Asset |
|
Number of assets with average (temperature in last hour) > max (temperature in last 24 hours) - 1.5*standarddev (temperature in last 24 hours) Helps identify drifting assets. |
avgTemp[HOURLY] ::= SELECT AVG('Sensors'.'temperatue') FROM 'AssetWithSensors' GROUP BY ENTITY maxTemp[DAILY] ::= SELECT MAX('Sensors'.'temperatue') FROM 'AssetWithSensors' GROUP BY ENTITY stdevTemp[DAILY] ::= SELECT STDEV('Sensors'.'temperatue') FROM 'AssetWithSensors' GROUP BY ENTITY SELECT COUNT(*) FROM 'AssetWithSensors' WHERE 'Metrics'.'avgTemp'['interval': "HOURLY"] > 'Metrics'.'maxTemp'['interval': "DAILY"] - 1.5 * 'Metrics'.'stdevTemp'['interval': "DAILY"] |
Multi-Asset |
|
(Temperature value + pressure value *1.5 + (humidity value / 3))*0.05-2.7 You may create formula-based metrics based on your models. |
SELECT LAST( ('Sensors'.'temperature' + 'Sensors'.'pressure' * 1.5 + 'Sensors'.'humidity' / 3 ) * 0.05 - 2.7) FROM 'AssetWithSensors' GROUP BY ENTITY |
Single Asset |
|
(Avg temperature value in last 24 hours )+(avg pressure value in last 24 hours) *1.5 +(avg humidity value in last 24 hours / 3))*0.05-2.7 You may create formula-based metrics based on your models. |
avgTemp[DAILY] ::= SELECT AVG('Sensors'.'temperatue') FROM 'AssetWithSensors' GROUP BY ENTITY avgPressure[DAILY] ::= SELECT AVG('Sensors'.'pressure') FROM 'AssetWithSensors' GROUP BY ENTITY avgHumidity[DAILY] ::= SELECT AVG('Sensors'.'humidity') FROM 'AssetWithSensors' GROUP BY ENTITY SELECT LAST( ('Metrics'.'avgTemp'['interval': "DAILY"] + 'Metrics'.'avgPressure'['interval': "DAILY"] * 1.5 + 'Metrics'.'avgHumidity'['interval': "DAILY"] / 3) ) * 0.05 - 2.7) FROM 'AssetWithSensors' GROUP BY ENTITY |
Single Asset |
|
Total time in last 24 hours when the temperature value was > 45 Assessing the amount of time the asset is performing beyond specified temperature limits. |
SELECT TIME_SUM(*) FROM 'AssetWithSensors' WHERE 'Sensors'.'temperature' > 45 GROUP BY ENTITY |
Single-Asset |
|
Total time in last 24 hours when temperature value - pressure value * 1.5 > humidity value *0.75 / tire pressure Knowledge base anomaly behavior definition |
SELECT TIME_SUM(*) FROM 'AssetWithSensors' WHERE 'Sensors'.'temperature' - 'Sensors'.'pressure' * 1.5 > 'Sensors'.'humidity' * 0.75 / 'Sensors'.'tirePressure' GROUP BY ENTITY |
Single-Asset |
|
Total in-use time in last 24 hours when vibration > 300 AND temperature > 100 Understanding assets with anomalous behavior. |
SELECT TIME_SUM(*) FROM 'AssetWithSensors' WHERE 'Sensors'.'vibration' > 100 AND 'Sensors'.'temperature' > 300 GROUP BY ENTITY |
Single-Asset |
|