If Value increase X percent then do this


I'm trying to come up with a code to control the movement of a motor, based on current consumption.

I tried to do it with fixed values, for example, if the current without any extra load is 1.70 amps, when It goes up to 1.80 it activates a relay.

The problem is that I'm not receiving the exact same measure every time, so my threshold gets too little or too big.

So I thought it would be a good idea to use percentage. If Value (amps in this case) increase 10%, then activate the relay.

Can anyone help me to write down that conditional and the variables I need?



    if (value > refVal * 1.1)
        ; do this