<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.11">
  <POU Name="FB_CylinderTempDiag" Id="{86c2fa19-6456-4b1a-8c13-2cf695bb8069}" SpecialFunc="None">
    <Declaration><![CDATA[(* FB_CylinderTempDiag		- number of control signals控制信号的数量:
									one direction is controllable一个方向是可控的
							- type of feedback signal反馈信号的类型:
									feedback in base and work position基准和工作位置的反馈
							- with temperature diagnosis带温度诊断					*)

FUNCTION_BLOCK FB_CylinderTempDiag EXTENDS FB_CylinderTemp
VAR_INPUT
	fTempMax		AT %I*	: LREAL;						// Global input signal: maximal allowed cylinder temperature for temperature monitoring全局输入信号：用于温度监测的最大允许气缸温度
	fTempMin		AT %I*	: LREAL;						// Global input signal: minimal allowed cylinder temperature for temperature monitoring全局输入信号：用于温度监测的最小允许气缸温度
END_VAR
VAR_OUTPUT
	bError					: BOOL;							// Error signal (diagnosed from temperature monitoring)错误信号（通过温度监测诊断）
	sErrorMsg				: STRING;						// Error message错误消息
END_VAR	]]></Declaration>
    <Implementation>
      <ST><![CDATA[// =========================================================
;
// =========================================================]]></ST>
    </Implementation>
    <Method Name="Diag" Id="{e799b7d6-d444-46cd-af44-fa32a2ec4bec}">
      <Declaration><![CDATA[METHOD PROTECTED Diag
VAR_INPUT
END_VAR
]]></Declaration>
      <Implementation>
        <ST><![CDATA[// =========================================================
// Error if temperatur of cylinder is not in accepted interval如果气缸温度不在可接受的区间内，则出现错误

	
	bError := NOT (fTempCurrent >= fTempMin AND fTempCurrent <= fTempMax);
	
	IF bError THEN
		IF fTempCurrent > fTempMax THEN
			sErrorMsg := 'Temperature above maximum';
		ELSE
			sErrorMsg := 'Temperature below minimum';
		END_IF
	ELSE
		sErrorMsg := '';
	END_IF

// =========================================================]]></ST>
      </Implementation>
    </Method>
    <Method Name="Reset" Id="{6362bc6f-2f7a-4e22-af79-674dd8e60c75}">
      <Declaration><![CDATA[METHOD Reset
VAR_INPUT
END_VAR
]]></Declaration>
      <Implementation>
        <ST><![CDATA[// =========================================================
	
// Calling method Reset of base class FB_Cylinder via 'SUPER^.'通过'SUPER^'调用FB_Cylinder的方法Reset
SUPER^.Reset();			

// Reset error重置错误
bError 		:= FALSE;
sErrorMsg 	:= '';

// =========================================================]]></ST>
      </Implementation>
    </Method>
    <Method Name="StateMachine" Id="{35c21ffd-3877-4395-9a0f-60eedd911c91}">
      <Declaration><![CDATA[METHOD PROTECTED StateMachine
VAR_INPUT
	bBasePosReq		: BOOL;
	bWorkPosReq		: BOOL;
END_VAR]]></Declaration>
      <Implementation>
        <ST><![CDATA[// =========================================================

IF NOT bError THEN
	// Calling method StateMachine of base class FB_Cylinder via 'SUPER^.'通过'SUPER^'调用FB_Cylinder的方法StateMachine
	SUPER^.StateMachine(bBasePosReq := bBasePosReq,
						bWorkPosReq	:= bWorkPosReq );
	
	// Diagnosis诊断
	Diag();
END_IF

// =========================================================]]></ST>
      </Implementation>
    </Method>
    <LineIds Name="FB_CylinderTempDiag">
      <LineId Id="3" Count="1" />
      <LineId Id="2" Count="0" />
    </LineIds>
    <LineIds Name="FB_CylinderTempDiag.Diag">
      <LineId Id="3" Count="1" />
      <LineId Id="21" Count="0" />
      <LineId Id="5" Count="12" />
      <LineId Id="2" Count="0" />
    </LineIds>
    <LineIds Name="FB_CylinderTempDiag.Reset">
      <LineId Id="3" Count="8" />
      <LineId Id="2" Count="0" />
    </LineIds>
    <LineIds Name="FB_CylinderTempDiag.StateMachine">
      <LineId Id="3" Count="10" />
      <LineId Id="2" Count="0" />
    </LineIds>
  </POU>
</TcPlcObject>