A real-time supervisor system based on trinary logic to control experiments with behaving animals and humans