" />
气缸报警程序;
//trigger monitor time
FOR #i := 1 TO #Cylinder_DB.workposno_hmi BY 1 DO //WorkPos no
FOR #j := 1 TO #Cylinder_DB.WorkPos[#i].cylinderNo BY 1 DO//valve index
IF (((#Cylinder_DB.WorkPos[#i].cylinder[#j].inbase XOR #Cylinder_DB.WorkPos[#i].cylinder[#j].outbase) AND
(#Cylinder_DB.WorkPos[#i].cylinder[#j].outbase OR #Cylinder_DB.WorkPos[#i].cylinder[#j].outwork)) OR
((#Cylinder_DB.WorkPos[#i].cylinder[#j].inwork XOR #Cylinder_DB.WorkPos[#i].cylinder[#j].outwork) AND
(#Cylinder_DB.WorkPos[#i].cylinder[#j].outbase OR #Cylinder_DB.WorkPos[#i].cylinder[#j].outwork))) AND
NOT #Reset AND #Enable
THEN
#Cylinder_DB.WorkPos[#i].cylinder[#j].Running_time := #System_Time - #Cylinder_DB.WorkPos[#i].cylinder[#j].Start_time;
IF (#Cylinder_DB.WorkPos[#i].cylinder[#j].Running_time >= #Cylinder_DB.WorkPos[#i].cylinder[#j].Set_time) THEN
#errorLamp := TRUE;
#Cylinder_DB.WorkPos[#i].error := true;
//
IF #Cylinder_DB.WorkPos[#i].cylinder[#j].outbase THEN
IF #Cylinder_DB.WorkPos[#i].cylinder[#j].inwork THEN
#Cylinder_DB.WorkPos[#i].cylinder[#j].err_donot_inwork := 1;//not to show this signal
ELSIF NOT #Cylinder_DB.WorkPos[#i].cylinder[#j].inbase THEN
#Cylinder_DB.WorkPos[#i].cylinder[#j].err_not_inbase := 1;//not check the signal
END_IF;
END_IF;
IF #Cylinder_DB.WorkPos[#i].cylinder[#j].outwork THEN
IF #Cylinder_DB.WorkPos[#i].cylinder[#j].inbase THEN
#Cylinder_DB.WorkPos[#i].cylinder[#j].err_donot_inbase := 1;//not to show this signal
ELSIF NOT #Cylinder_DB.WorkPos[#i].cylinder[#j].inwork THEN
#Cylinder_DB.WorkPos[#i].cylinder[#j].err_not_inwork := 1;//not check the signal
END_IF;
END_IF;
//
#Cylinder_DB.WorkPos[#i].cylinder[#j].outwork := FALSE;
#Cylinder_DB.WorkPos[#i].cylinder[#j].outbase := FALSE;
END_IF;
EXIT;
ELSE
#Cylinder_DB.WorkPos[#i].cylinder[#j].Start_time := #System_Time;
#Cylinder_DB.WorkPos[#i].cylinder[#j].Running_time := T#0ms;
END_IF;
IF #Cylinder_DB.WorkPos[#i].cylinder[#j].err_not_inbase OR
#Cylinder_DB.WorkPos[#i].cylinder[#j].err_donot_inbase OR
#Cylinder_DB.WorkPos[#i].cylinder[#j].err_not_inwork OR
#Cylinder_DB.WorkPos[#i].cylinder[#j].err_donot_inwork THEN
#errorLamp := 1;
#Cylinder_DB.WorkPos[#i].error := 1;
END_IF;
END_FOR;
END_FOR;
IF (#Reset = true) THEN
#errorLamp := FALSE;
FOR #i := 1 TO #Cylinder_DB.workposno_hmi BY 1 DO //WorkPos no
// IF #Cylinder_DB.WorkPos[#i].error THEN
FOR #j := 1 TO #Cylinder_DB.WorkPos[#i].cylinderNo BY 1 DO //cyl_no
#Cylinder_DB.WorkPos[#i].cylinder[#j].err_not_inbase := 0;
#Cylinder_DB.WorkPos[#i].cylinder[#j].err_donot_inbase := 0;
#Cylinder_DB.WorkPos[#i].cylinder[#j].err_not_inwork := 0;
#Cylinder_DB.WorkPos[#i].cylinder[#j].err_donot_inwork := 0;
END_FOR;
// END_IF;
#Cylinder_DB.WorkPos[#i].error := FALSE;
END_FOR;
END_IF;