(* Motor Starter: Seal-In, N.C. Stop and Warning Horn — Motor Starter scene X1 = Start (N.O.) X2 = Stop (N.C., TRUE when not pressed) X3 = Motor overload aux contact (N.C., TRUE while healthy, maintained) Y1 = Motor contactor Y2 = Green run light Y3 = Warning horn Start sounds the horn for 2 s, then the contactor pulls in. Stop or an overload trip drops everything at once, and nothing restarts on its own. *) VAR StartRequest : BOOL; // sealed-in start request WarnTimer : TON; // 2 s warning before the contactor pulls in END_VAR (* Seal-in — Start latches the request; Stop or an overload trip breaks it. X2 and X3 are N.C., so they are TRUE when the machine is healthy. *) StartRequest := (X1 OR StartRequest) AND X2 AND X3; (* Warning timer — timed from the sealed-in request, not from X1. Losing the request resets it, so a stop during the warning aborts the start. *) WarnTimer(IN := StartRequest, PT := T#2s); (* Horn during the warning only, contactor after it, run light follows *) Y3 := StartRequest AND NOT WarnTimer.Q; Y1 := WarnTimer.Q; Y2 := Y1;