workflow_r(CLK:=benable);stop_r(CLK:=stop);stop_ing_r(CLK:=stop_ing);start_r(CLK:=start);
IF NOT benable THEN
RETURN;
END_IF
IF workflow_r.Q THEN
w:=w+1;
END_IF
IF hand_AUTO=0 THEN
hand_ing:=1;
ELSE
hand_ing:=0;
END_IF
IF hand_AUTO=1 THEN
AUTO_ing:=1;
ELSE
AUTO_ing:=0;
END_IF
IF AUTO_ing AND Rest_over AND start_r.Q THEN
Auto_run_ing:=1;
END_IF
IF Auto_run_ing THEN
stop_ing:=0;
END_IF
IF stop_r.Q THEN
stop_ing:=1;
END_IF
IF stop_ing_r.Q THEN
stop_ing:=1;
Auto_run_ing:=0;
END_IF