A quick article to illustrate how to check if the valve has malfunction/faulted. It uses a combination of limit switch status to determine that. This snippet also has a debounce timer for the fault/malfunction status of the valve (limit switch state).

Xybernetics Rockwell RSLogix 5 - Valve Malfunction Check Logic