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.

36 lines
1.5 KiB
Plaintext

<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<POU Name="LimitValueLREAL" Id="{c413c3eb-b86b-4870-9ccc-b4a38f9398ae}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION LimitValueLREAL : LREAL
VAR_INPUT
LowerLimit: LREAL; (* 1st input variable - Lower limit *)
Input: LREAL; (* 2nd input variable *)
UpperLimit: LREAL; (* 3rd input variable - Upper limit *)
END_VAR
VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[(*
The 1st LowerLimit input variable forms the lower and the 3rd UpperLimit input variable the upper limit value.
If the 2nd Input variable is within this limit, it will be transferred to the output variable.
If it is above this limit, the upper limit value will be transferred;
if it is below this limit the lower limit value will be transferred.
*)
IF Input > UpperLimit THEN
LimitValueLREAL := UpperLimit; (* If input is above upper limit, set output to upper limit *)
ELSIF Input < LowerLimit THEN
LimitValueLREAL := LowerLimit; (* If input is below lower limit, set output to lower limit *)
ELSE
LimitValueLREAL := Input; (* If input is within limits, pass it through *)
END_IF;]]></ST>
</Implementation>
<LineIds Name="LimitValueLREAL">
<LineId Id="18" Count="0" />
<LineId Id="22" Count="3" />
<LineId Id="20" Count="0" />
<LineId Id="12" Count="5" />
<LineId Id="7" Count="0" />
</LineIds>
</POU>
</TcPlcObject>