algorithm + code regarding abrupt change detection in voltage and current