You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

234 lines
5.8 KiB

FUNCTION_BLOCK BS_DelayRemoteVavle
VAR_EXTERNAL
END_VAR
VAR_INPUT
Lock :INT;
REAL_RemoteSet:REAL;
REAL_IN01 :REAL;
REAL_IN02 :REAL;
REAL_IN03 :REAL;
REAL_IN04 :REAL;
REAL_IN05 :REAL;
REAL_IN06 :REAL;
REAL_IN07 :REAL;
REAL_IN08 :REAL;
REAL_IN09 :REAL;
REAL_IN10 :REAL;
BOOL_RemoteSet:BOOL;
BOOL_IN01 :BOOL;
BOOL_IN02 :BOOL;
BOOL_IN03 :BOOL;
BOOL_IN04 :BOOL;
BOOL_IN05 :BOOL;
BOOL_IN06 :BOOL;
BOOL_IN07 :BOOL;
BOOL_IN08 :BOOL;
BOOL_IN09 :BOOL;
BOOL_IN10 :BOOL;
INT_RemoteSet:INT;
INT_IN01 :INT;
INT_IN02 :INT;
INT_IN03 :INT;
INT_IN04 :INT;
INT_IN05 :INT;
INT_IN06 :INT;
INT_IN07 :INT;
INT_IN08 :INT;
INT_IN09 :INT;
INT_IN10 :INT;
END_VAR
VAR_OUTPUT
REAL_OUT01 :REAL;
REAL_OUT02 :REAL;
REAL_OUT03 :REAL;
REAL_OUT04 :REAL;
REAL_OUT05 :REAL;
REAL_OUT06 :REAL;
REAL_OUT07 :REAL;
REAL_OUT08 :REAL;
REAL_OUT09 :REAL;
REAL_OUT10 :REAL;
BOOL_OUT01 :BOOL;
BOOL_OUT02 :BOOL;
BOOL_OUT03 :BOOL;
BOOL_OUT04 :BOOL;
BOOL_OUT05 :BOOL;
BOOL_OUT06 :BOOL;
BOOL_OUT07 :BOOL;
BOOL_OUT08 :BOOL;
BOOL_OUT09 :BOOL;
BOOL_OUT10 :BOOL;
INT_OUT01 :INT;
INT_OUT02 :INT;
INT_OUT03 :INT;
INT_OUT04 :INT;
INT_OUT05 :INT;
INT_OUT06 :INT;
INT_OUT07 :INT;
INT_OUT08 :INT;
INT_OUT09 :INT;
INT_OUT10 :INT;
END_VAR
VAR
REAL_RemoteSetP :REAL;
BOOL_RemoteSetP :BOOL;
INT_RemoteSetP :INT;
Delay_Ton1 :TON;
Delay_Ton2 :TON;
Delay_Ton3 :TON;
END_VAR
(*
20191008
1.1
1-5s分别赋值1-10变量/1-5s分别赋值11-20变量
LOCK 0均不锁定;1锁定BOOL;2,INT;3,REAL;
10组BOOL,10组REAL,10组INT
*)
(**********REAL50个变量赋值50个变量也可单独赋值*************)
Delay_Ton1(PT :=t#5s );
if REAL_RemoteSet<>REAL_RemoteSetP and Delay_Ton1.Q=0 then
Delay_Ton1.IN:=1;
end_if;
if Delay_Ton1.Q=1 then
Delay_Ton1.IN:=0;
end_if;
Delay_Ton2(PT :=t#5s );
if BOOL_RemoteSet<>BOOL_RemoteSetP and Delay_Ton2.Q=0 then
Delay_Ton2.IN:=1;
end_if;
if Delay_Ton2.Q=1 then
Delay_Ton2.IN:=0;
end_if;
Delay_Ton3(PT :=t#5s );
if INT_RemoteSet<>INT_RemoteSetP and Delay_Ton3.Q=0 then
Delay_Ton3.IN:=1;
end_if;
if Delay_Ton3.Q=1 then
Delay_Ton3.IN:=0;
end_if;
if REAL_RemoteSet<>REAL_RemoteSetP then
if Delay_Ton1.et>t#0.0s then REAL_OUT01:=REAL_RemoteSet; end_if;
if Delay_Ton1.et>t#0.5s then REAL_OUT02:=REAL_RemoteSet; end_if;
if Delay_Ton1.et>t#1.0s then REAL_OUT03:=REAL_RemoteSet; end_if;
if Delay_Ton1.et>t#1.5s then REAL_OUT04:=REAL_RemoteSet; end_if;
if Delay_Ton1.et>t#2.0s then REAL_OUT05:=REAL_RemoteSet; end_if;
if Delay_Ton1.et>t#2.5s then REAL_OUT06:=REAL_RemoteSet; end_if;
if Delay_Ton1.et>t#3.0s then REAL_OUT07:=REAL_RemoteSet; end_if;
if Delay_Ton1.et>t#3.5s then REAL_OUT08:=REAL_RemoteSet; end_if;
if Delay_Ton1.et>t#4.0s then REAL_OUT09:=REAL_RemoteSet; end_if;
if Delay_Ton1.et>t#4.5s then REAL_OUT10:=REAL_RemoteSet; end_if;
elsif REAL_RemoteSet=REAL_RemoteSetP then
REAL_OUT01:=REAL_IN01;
REAL_OUT02:=REAL_IN02;
REAL_OUT03:=REAL_IN03;
REAL_OUT04:=REAL_IN04;
REAL_OUT05:=REAL_IN05;
REAL_OUT06:=REAL_IN06;
REAL_OUT07:=REAL_IN07;
REAL_OUT08:=REAL_IN08;
REAL_OUT09:=REAL_IN09;
REAL_OUT10:=REAL_IN10;
end_if;
(**********BOOL50个变量赋值50个变量也可单独赋值*************)
if BOOL_RemoteSet<>BOOL_RemoteSetP then
if Delay_Ton2.et>t#0.0s then BOOL_OUT01:=BOOL_RemoteSet; end_if;
if Delay_Ton2.et>t#0.5s then BOOL_OUT02:=BOOL_RemoteSet; end_if;
if Delay_Ton2.et>t#1.0s then BOOL_OUT03:=BOOL_RemoteSet; end_if;
if Delay_Ton2.et>t#1.5s then BOOL_OUT04:=BOOL_RemoteSet; end_if;
if Delay_Ton2.et>t#2.0s then BOOL_OUT05:=BOOL_RemoteSet; end_if;
if Delay_Ton2.et>t#2.5s then BOOL_OUT06:=BOOL_RemoteSet; end_if;
if Delay_Ton2.et>t#3.0s then BOOL_OUT07:=BOOL_RemoteSet; end_if;
if Delay_Ton2.et>t#3.5s then BOOL_OUT08:=BOOL_RemoteSet; end_if;
if Delay_Ton2.et>t#4.0s then BOOL_OUT09:=BOOL_RemoteSet; end_if;
if Delay_Ton2.et>t#4.5s then BOOL_OUT10:=BOOL_RemoteSet; end_if;
elsif BOOL_RemoteSet=BOOL_RemoteSetP then
BOOL_OUT01:=BOOL_IN01;
BOOL_OUT02:=BOOL_IN02;
BOOL_OUT03:=BOOL_IN03;
BOOL_OUT04:=BOOL_IN04;
BOOL_OUT05:=BOOL_IN05;
BOOL_OUT06:=BOOL_IN06;
BOOL_OUT07:=BOOL_IN07;
BOOL_OUT08:=BOOL_IN08;
BOOL_OUT09:=BOOL_IN09;
BOOL_OUT10:=BOOL_IN10;
end_if;
(**********INT50个变量赋值50个变量也可单独赋值*************)
if INT_RemoteSet<>INT_RemoteSetP then
if Delay_Ton3.et>t#0.0s then INT_OUT01:=INT_RemoteSet; end_if;
if Delay_Ton3.et>t#0.5s then INT_OUT02:=INT_RemoteSet; end_if;
if Delay_Ton3.et>t#1.0s then INT_OUT03:=INT_RemoteSet; end_if;
if Delay_Ton3.et>t#1.5s then INT_OUT04:=INT_RemoteSet; end_if;
if Delay_Ton3.et>t#2.0s then INT_OUT05:=INT_RemoteSet; end_if;
if Delay_Ton3.et>t#2.5s then INT_OUT06:=INT_RemoteSet; end_if;
if Delay_Ton3.et>t#3.0s then INT_OUT07:=INT_RemoteSet; end_if;
if Delay_Ton3.et>t#3.5s then INT_OUT08:=INT_RemoteSet; end_if;
if Delay_Ton3.et>t#4.0s then INT_OUT09:=INT_RemoteSet; end_if;
if Delay_Ton3.et>t#4.5s then INT_OUT10:=INT_RemoteSet; end_if;
elsif INT_RemoteSet=INT_RemoteSetP then
INT_OUT01:=INT_IN01;
INT_OUT02:=INT_IN02;
INT_OUT03:=INT_IN03;
INT_OUT04:=INT_IN04;
INT_OUT05:=INT_IN05;
INT_OUT06:=INT_IN06;
INT_OUT07:=INT_IN07;
INT_OUT08:=INT_IN08;
INT_OUT09:=INT_IN09;
INT_OUT10:=INT_IN10;
end_if;
case lock of
(*01锁定BOOL;2,INT;3,REAL;*)
0:
BOOL_RemoteSetP:=BOOL_RemoteSet;
INT_RemoteSetP:=INT_RemoteSet;
REAL_RemoteSetP:=REAL_RemoteSet;
1:
INT_RemoteSetP:=INT_RemoteSet;
REAL_RemoteSetP:=REAL_RemoteSet;
2:
BOOL_RemoteSetP:=BOOL_RemoteSet;
REAL_RemoteSetP:=REAL_RemoteSet;
3:
BOOL_RemoteSetP:=BOOL_RemoteSet;
INT_RemoteSetP:=INT_RemoteSet;
end_case;
END_FUNCTION_BLOCK