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.

165 lines
2.9 KiB

4 months ago
FUNCTION_BLOCK BS_RunTime
VAR_EXTERNAL
END_VAR
VAR_INPUT
Run :BOOL;
RunTimeSet :REAL;
RunTimeRST :BOOL;
RunTimeRec_In :REAL;
END_VAR
VAR_OUTPUT
RunTime :REAL;
END_VAR
VAR
Time_m :TON;
Time_RST :TON;
Cycle :BOOL;
Minute :REAL;
ini :BOOL;
Runtime_ini :REAL;
END_VAR
(*Automatically declared*)
VAR_EXTERNAL
END_VAR
(** {* **)
(** **)
(** ʱ �䣺20190907 **)
(** �� ����1.0 **)
(** �� �ߣ�Ҧ�� **)
(** �� �ƣ�����ʱ���ۼƳ��� **)
(** ˵ ��������ʱ���ۼƳ��򣬵�λ���ӣ���ͨ�����ð�ť�޸ļ�������ֵ **)
(** ʱ �䣺20220210 **)
(** �� ����1.1 **)
(** �� �ߣ���ƽ **)
(** �� �ƣ�����ʱ���ۼƳ��� **)
(** ˵ �������Ӷϵ�����д��ֵ��������ʹ�ϵ�ǰ���ݽ������� **)
(** �� ע�� **)
(** �����飺 **)
(** **)
(** *} **)
(** {*��ʼ�����ϵ�ǰ����д���ۼ�ֵ*} **)
(** if ini=0 then **)
(* if - Cond *)
LD ini
EQ 0
JMPCN ODK_SKIP_000000000000001_000000000000001
(* then - Stmts *)
(** Runtime_ini:=RunTimeRec_In; **)
(* assign - Stmt *)
LD RunTimeRec_In
ST Runtime_ini
(** ini:=1; **)
(* assign - Stmt *)
LD 1
ST ini
JMP ODK_END_IF_000000000000001
(** end_if; **)
(* if - End *)
ODK_SKIP_000000000000001_000000000000001:
ODK_END_IF_000000000000001:
(** {*��ʱ����Ϊ����*} **)
(** if RunTimeRST=0 then **)
(* if - Cond *)
LD RunTimeRST
EQ 0
JMPCN ODK_SKIP_000000000000002_000000000000001
(* then - Stmts *)
(** time_m(in:=Cycle,pt:=t#60s); **)
(* call - Stmt *)
CAL time_m (
in := Cycle,
pt := t#60s
)
(** Cycle:= not Time_m.q; **)
(* assign - Stmt *)
LD time_m.q
NOT
ST Cycle
(** if Run then **)
(* if - Cond *)
LD Run
JMPCN ODK_SKIP_000000000000003_000000000000001
(* then - Stmts *)
(** if Time_m.q then **)
(* if - Cond *)
LD time_m.q
JMPCN ODK_SKIP_000000000000004_000000000000001
(* then - Stmts *)
(** Minute:=Minute+1.0; **)
(* assign - Stmt *)
LD Minute
ADD 1.0
ST Minute
JMP ODK_END_IF_000000000000004
(** end_if; **)
(* if - End *)
ODK_SKIP_000000000000004_000000000000001:
ODK_END_IF_000000000000004:
JMP ODK_END_IF_000000000000003
(** end_if; **)
(* if - End *)
ODK_SKIP_000000000000003_000000000000001:
ODK_END_IF_000000000000003:
(** Runtime:=Minute/60.0+Runtime_ini; **)
(* assign - Stmt *)
LD Minute
DIV 60.0
ADD Runtime_ini
ST Runtime
JMP ODK_END_IF_000000000000002
(** end_if; **)
(* if - End *)
ODK_SKIP_000000000000002_000000000000001:
ODK_END_IF_000000000000002:
(** {*���ð�ť����ʱ���ڼ�Minute�Ķ�ֵ��RunTimeSet��ֵ*} **)
(** if RunTimeRST=1 then **)
(* if - Cond *)
LD RunTimeRST
EQ 1
JMPCN ODK_SKIP_000000000000005_000000000000001
(* then - Stmts *)
(** Minute:=RunTimeSet*60.0; **)
(* assign - Stmt *)
LD RunTimeSet
MUL 60.0
ST Minute
JMP ODK_END_IF_000000000000005
(** end_if; **)
(* if - End *)
ODK_SKIP_000000000000005_000000000000001:
ODK_END_IF_000000000000005:
END_FUNCTION_BLOCK