Analysis and simulation of the operation of a Kelvin probe