//①获取块实例名称(该实例名称一般会关联到实物名称,例如气缸1)
REGION PRE-INSTRUCTIONS
// Firstscan
IF NOT #sInit THEN
// Get instance path
#InstancePath := GetInstanceName(0);
// Set Init flag
#sInit := true;
END_IF;
END_REGION
//②逻辑处理
//输入处理
//逻辑
//输出
//③报警到HMI
REGION Error Management
#tempInstancePath := #InstancePath;
#sDIAGError(SIG := #sError,
SD_1 := #tempInstancePath,
SD_2 := #sErrorText);
"_FC_Translation_EnglishWarningText"(SearchText := #sWarningText,
TranslateText => #s_TranslatedText_1);
#sDIAGWarning(SIG := #sWarning,
SD_1 := #tempInstancePath,
SD_2 := #sWarningText);
IF #sError THEN
#Local.GroupStatus.LocalError := true;
END_IF;
IF #sWarning THEN
#Local.GroupStatus.Warning := true;
END_IF;
// Reset Error and Warning
IF #Local.Ctrl.Reset THEN
#sError := false;
#sWarning := false;
END_IF;
END_REGION