Control algorithm coded in C programming language