Classifying a continuous value into discrete states

A Calculated Property can turn numeric ranges into meaningful states

Say you are managing fryers in fast-food shops, and your only sensor is measuring the temperature of the oil in each fryer. You're interested in the state of the fryer - cool (off), hot (operating) or somewhere in-between?fryer_stateCPs allow you to convert the continuous temperature value into a string which describes the current state of the fryer.

fryer_state:

(temp_F < 80) ? "cool" : (temp_F < 300) ? "warm" : "hot"

Of course "warm" is a rather ambiguous - it could mean that the fryer is warming-up or cooling-down. We can distinguish these using CP's ability to see the previous value of temperature:

fryer_state:

(temp_F < 80) ? "cool" : (temp_F < 300) ? ((temp_F > $previous/temp_F) ? "warming-up" : "cooling-down") : "hot"

Because we've converted a continuous floating-point number (with potentially an infinite number of states) into a small number of meaningful states, we can now use KPI metrics such as "Percentage of time in each value of" to tell us how many of our fryers are in each state, and when:

fryer_state_over_time_for_CPs

Learn more about Calculated Properties