Flexible relay commands algorithm based on different applications in industry