You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.9 KiB
XML
69 lines
1.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
|
|
<POU Name="CTRL_OUT" Id="{2773ee0d-f6d9-45d7-af22-dca036cffc32}" SpecialFunc="None">
|
|
<Declaration><![CDATA[FUNCTION_BLOCK CTRL_OUT
|
|
VAR_INPUT
|
|
CI : REAL; (* input from controller *)
|
|
OFFSET : REAL; (* output ofset *)
|
|
MAN_IN : REAL; (*Manual input *)
|
|
LIM_L : REAL; (* lower output limit *)
|
|
LIM_H : REAL; (* upper output limit *)
|
|
MANUAL : BOOL; (* switch for manual operation *)
|
|
END_VAR
|
|
VAR_OUTPUT
|
|
Y : REAL; (* Control signal *)
|
|
LIM : BOOL; (* TRUE if control signal reaches a limit *)
|
|
END_VAR
|
|
VAR
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[(*
|
|
version 1.1 5. nov 2008
|
|
programmer hugo
|
|
tested by oscat
|
|
*)
|
|
|
|
(* @END_DECLARATION := '0' *)
|
|
|
|
(*
|
|
CTRL_OUT adds to the CI input the value of OFFSET and returns the result
|
|
to Y if MANUAL = FALSE. If MANUAL is TRUE at output Y the input value of
|
|
MAN_IN + OFFSET is issued. Y is always limited to the boundaries defned
|
|
by LIM_L and LIM_H. If Y reaches one of the limits, then the output LIM is
|
|
TRUE. CTRL_OUT can be used to build own rule modules.
|
|
*)
|
|
Y := SEL(MANUAL, CI, MAN_IN) + OFFSET;
|
|
|
|
(* Limit the output *)
|
|
IF Y > LIM_L AND Y < LIM_H THEN
|
|
LIM := FALSE;
|
|
ELSE
|
|
Y := LIMIT(LIM_L, Y, LIM_H);
|
|
LIM := TRUE;
|
|
END_IF;
|
|
|
|
(* revision history
|
|
hm 2. jun. 2008 rev 1.0
|
|
original version
|
|
|
|
hm 5. nov. 2008 rev 1.1
|
|
optimized code
|
|
*)]]></ST>
|
|
</Implementation>
|
|
<LineIds Name="CTRL_OUT">
|
|
<LineId Id="14" Count="3" />
|
|
<LineId Id="20" Count="2" />
|
|
<LineId Id="53" Count="0" />
|
|
<LineId Id="52" Count="0" />
|
|
<LineId Id="56" Count="1" />
|
|
<LineId Id="55" Count="0" />
|
|
<LineId Id="59" Count="0" />
|
|
<LineId Id="58" Count="0" />
|
|
<LineId Id="54" Count="0" />
|
|
<LineId Id="23" Count="9" />
|
|
<LineId Id="35" Count="5" />
|
|
<LineId Id="9" Count="0" />
|
|
</LineIds>
|
|
</POU>
|
|
</TcPlcObject> |