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.

197 lines
3.3 KiB

4 months ago
FUNCTION_BLOCK BS_FEC
VAR_EXTERNAL
END_VAR
VAR_INPUT
RUN : BOOL ; (* PID功能块启用 *)
SET : REAL ; (* 调节目标值 *)
FB : REAL ; (* 调节目标值的反馈值 *)
Dead_Band : REAL :=10.0 ; (* 死区 *)
Delay : TIME :=t#300s;(* 延时时间 *)
END_VAR
VAR_OUTPUT
DevC : BOOL ; (* 设备开关控制 *)
END_VAR
VAR
ton1 : TON ;
ton2 : TON ;
END_VAR
(*Automatically declared*)
VAR_EXTERNAL
END_VAR
(** {* **)
(** **)
(** ʱ �䣺20200220 **)
(** �� ����1.0 **)
(** �� �ߣ���ƽ **)
(** �� �ƣ��豸����ֵ�س��� **)
(** ˵ ���������豸���ص�ֵ�س��� **)
(** �� ע�������ڷ�����������ֵ�ȿ��� **)
(** �����飺�� **)
(** **)
(** �������� **)
(** RUN : BOOL ; PID���ܿ����� **)
(** SET : REAL ; ����Ŀ��ֵ **)
(** FB : REAL ; ����Ŀ��ֵ�ķ���ֵ **)
(** Dead_Band : REAL ; ����,Ĭ��10 **)
(** Delay : TIME ; ��ʱʱ��,Ĭ��300S **)
(** �������� **)
(** DevC : BOOL ; �豸�������� **)
(** **)
(** *} **)
(** **)
(** {* **)
(** FB>SET DevC:=1 **)
(** FB-(SET-D)<0 DevC:=0 **)
(** **)
(** *} **)
(** ton1(pt:=Delay); **)
(* call - Stmt *)
CAL ton1 (
pt := Delay
)
(** ton2(pt:=Delay); **)
(* call - Stmt *)
CAL ton2 (
pt := Delay
)
(** **)
(** if RUN =1 then **)
(* if - Cond *)
LD RUN
EQ 1
JMPCN ODK_SKIP_000000000000001_000000000000001
(* then - Stmts *)
(** if FB-SET>=0.0 then **)
(* if - Cond *)
LD FB
SUB SET
GE 0.0
JMPCN ODK_SKIP_000000000000002_000000000000001
(* then - Stmts *)
(** DevC:=1; **)
(* assign - Stmt *)
LD 1
ST DevC
(** ton1.in:=1; **)
(* assign - Stmt *)
LD 1
ST ton1.in
JMP ODK_END_IF_000000000000002
(** else **)
(* else *)
ODK_SKIP_000000000000002_000000000000001:
(* else - Stmts *)
(** ton1.in:=0; **)
(* assign - Stmt *)
LD 0
ST ton1.in
(** end_if; **)
(* if - End *)
ODK_END_IF_000000000000002:
(** if ton1.q=1 then **)
(* if - Cond *)
LD ton1.q
EQ 1
JMPCN ODK_SKIP_000000000000003_000000000000001
(* then - Stmts *)
(** DevC:=1; **)
(* assign - Stmt *)
LD 1
ST DevC
JMP ODK_END_IF_000000000000003
(** end_if; **)
(* if - End *)
ODK_SKIP_000000000000003_000000000000001:
ODK_END_IF_000000000000003:
(** if FB-(SET-Dead_Band)<0.0 then **)
(* if - Cond *)
LD FB
SUB ( SET
SUB Dead_Band
)
LT 0.0
JMPCN ODK_SKIP_000000000000004_000000000000001
(* then - Stmts *)
(** ton2.in:=1; **)
(* assign - Stmt *)
LD 1
ST ton2.in
JMP ODK_END_IF_000000000000004
(** else **)
(* else *)
ODK_SKIP_000000000000004_000000000000001:
(* else - Stmts *)
(** ton2.in:=0; **)
(* assign - Stmt *)
LD 0
ST ton2.in
(** end_if; **)
(* if - End *)
ODK_END_IF_000000000000004:
(** if ton2.q=1 then **)
(* if - Cond *)
LD ton2.q
EQ 1
JMPCN ODK_SKIP_000000000000005_000000000000001
(* then - Stmts *)
(** DevC:=0; **)
(* assign - Stmt *)
LD 0
ST DevC
JMP ODK_END_IF_000000000000005
(** end_if; **)
(* if - End *)
ODK_SKIP_000000000000005_000000000000001:
ODK_END_IF_000000000000005:
JMP ODK_END_IF_000000000000001
(** end_if; **)
(* if - End *)
ODK_SKIP_000000000000001_000000000000001:
ODK_END_IF_000000000000001:
(** **)
(** **)
(** **)
(** **)
(** **)
(** **)
END_FUNCTION_BLOCK