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.

33 lines
949 B
XML

<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<POU Name="fbHeatLevel" Id="{5d088aac-8a67-4376-a05b-3fb7868bdd95}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK fbHeatLevel
VAR_INPUT
inTemp : INT;
inHeatLevelArray : ARRAY[0..30] OF INT ;// ARRAY [0..30] OF INT;
END_VAR
VAR_OUTPUT
outLevel : INT;
outIndex : INT;
END_VAR
VAR
aux : INT;
Index : INT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Operates with Temperature range -400 to 200, which is x0.1 OR -40.0°C to 20.0°C
aux := LimitValueINT(LowerLimit:= -400, Input:= inTemp, UpperLimit:= 200);
Index := (-1 * aux + 200)/20 ;
outLevel := inHeatLevelArray[Index];
outIndex := Index;
]]></ST>
</Implementation>
<LineIds Name="fbHeatLevel">
<LineId Id="20" Count="4" />
<LineId Id="17" Count="0" />
<LineId Id="38" Count="0" />
</LineIds>
</POU>
</TcPlcObject>