自动加减载中的水泵最大运行时间停泵和最小运行时间启泵程序块
三台水泵最大运行时间停泵
n := 0;
m := 0;
Pump_number:=0;
FOR #j := 0 TO 3 DO
IF #Condition[#j] = 0 OR #Working[#j] = 0 THEN
#Time[#j] := #Time_gameover;
END_IF;
END_FOR;
MaxTime := MAX(IN1 := #Time[0], IN2 := #Time[1], IN3 := #Time[2], IN4 := #Time[3]);
FOR #i := 0 TO 3 DO
IF #MaxTime <> #Time[#i] THEN
#n := #n + 1;
ELSE
#m := #n + 1;
EXIT;
END_IF;
END_FOR;
Pump_number := #m;
三台水泵最小运行时间启泵
n := 0;
m := 0;
Pump_number:=0;
FOR #j := 0 TO 3 DO
IF #Condition[#j] = 0 OR #Working[#j] = 1 THEN
#Time[#j] := #Time_gameover;
END_IF;
END_FOR;
MinTime := MIN(IN1 := #Time[0], IN2 := #Time[1], IN3 := #Time[2], IN4 := #Time[3]);
FOR #i := 0 TO 3 DO
IF #MinTime <> #Time[#i] THEN
#n := #n + 1;
ELSE
#m := #n + 1;
EXIT;
END_IF;
END_FOR;