Implementation of safety functions for machines and plants