Modified FB_AlarmMessage
- FB_AlarmMessage now displays its parent source in the event source info instead of its own source
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<TcPlcObject Version="1.1.0.1">
|
<TcPlcObject Version="1.1.0.1">
|
||||||
<POU Name="FB_AlarmMessage" Id="{4e628f13-10b9-47d9-8d26-ceb4bcb9bf43}" SpecialFunc="None">
|
<POU Name="FB_AlarmMessage" Id="{00b96800-3427-0356-3ac6-5d6b32218bad}" SpecialFunc="None">
|
||||||
<Declaration><![CDATA[FUNCTION_BLOCK FINAL FB_AlarmMessage
|
<Declaration><![CDATA[FUNCTION_BLOCK FINAL FB_AlarmMessage
|
||||||
VAR_INPUT
|
VAR_INPUT
|
||||||
xActive : BOOL;
|
xActive : BOOL;
|
||||||
@@ -8,6 +8,8 @@ VAR_INPUT
|
|||||||
xAcknowledge : BOOL;
|
xAcknowledge : BOOL;
|
||||||
timOnDelay : TIME := T#0S;
|
timOnDelay : TIME := T#0S;
|
||||||
timOffDelay : TIME := T#0S;
|
timOffDelay : TIME := T#0S;
|
||||||
|
|
||||||
|
{attribute 'hide'}
|
||||||
xInUnitTestMode : BOOL := FALSE;
|
xInUnitTestMode : BOOL := FALSE;
|
||||||
END_VAR
|
END_VAR
|
||||||
VAR_OUTPUT
|
VAR_OUTPUT
|
||||||
@@ -15,6 +17,7 @@ END_VAR
|
|||||||
VAR
|
VAR
|
||||||
_fbReleaseAlarm : FB_ReleaseSignal;
|
_fbReleaseAlarm : FB_ReleaseSignal;
|
||||||
_fbAlarmMessage : FB_TcAlarm;
|
_fbAlarmMessage : FB_TcAlarm;
|
||||||
|
_fbSourceInfo : FB_TcSourceInfo;
|
||||||
END_VAR
|
END_VAR
|
||||||
]]></Declaration>
|
]]></Declaration>
|
||||||
<Implementation>
|
<Implementation>
|
||||||
@@ -40,9 +43,9 @@ IF _fbAlarmMessage.eConfirmationState = TcEventConfirmationState.WaitForConfirma
|
|||||||
_fbAlarmMessage.Confirm(0);
|
_fbAlarmMessage.Confirm(0);
|
||||||
END_IF]]></ST>
|
END_IF]]></ST>
|
||||||
</Implementation>
|
</Implementation>
|
||||||
<Property Name="Active" Id="{4e7fa79e-e44f-42ff-ab45-0e14a9921a12}">
|
<Property Name="Active" Id="{00a4408d-c0d1-0670-1ca5-9dcb270a2efc}">
|
||||||
<Declaration><![CDATA[PROPERTY Active : BOOL]]></Declaration>
|
<Declaration><![CDATA[PROPERTY Active : BOOL]]></Declaration>
|
||||||
<Get Name="Get" Id="{70df159d-fc9d-44c5-ae42-7d731a5dae12}">
|
<Get Name="Get" Id="{3e04f28e-d803-004a-19a2-eeac94c59afc}">
|
||||||
<Declaration><![CDATA[VAR
|
<Declaration><![CDATA[VAR
|
||||||
END_VAR
|
END_VAR
|
||||||
]]></Declaration>
|
]]></Declaration>
|
||||||
@@ -51,9 +54,9 @@ END_VAR
|
|||||||
</Implementation>
|
</Implementation>
|
||||||
</Get>
|
</Get>
|
||||||
</Property>
|
</Property>
|
||||||
<Property Name="Arguments" Id="{f40c819a-ad71-4e81-830e-67d02b4e9e2f}">
|
<Property Name="Arguments" Id="{bad76689-89ef-0a0e-34ee-f40fa5d6aac1}">
|
||||||
<Declaration><![CDATA[PROPERTY PUBLIC Arguments : I_TcArguments]]></Declaration>
|
<Declaration><![CDATA[PROPERTY PUBLIC Arguments : I_TcArguments]]></Declaration>
|
||||||
<Get Name="Get" Id="{c1b8ca1b-cb6c-4841-8282-61423914cb4e}">
|
<Get Name="Get" Id="{8f632d08-eff2-0cce-3562-f29db78cffa0}">
|
||||||
<Declaration><![CDATA[VAR
|
<Declaration><![CDATA[VAR
|
||||||
END_VAR
|
END_VAR
|
||||||
]]></Declaration>
|
]]></Declaration>
|
||||||
@@ -62,7 +65,7 @@ END_VAR
|
|||||||
</Implementation>
|
</Implementation>
|
||||||
</Get>
|
</Get>
|
||||||
</Property>
|
</Property>
|
||||||
<Method Name="FB_init" Id="{59e606ca-879e-463e-9089-6aa9e1011af6}">
|
<Method Name="FB_init" Id="{173de1d9-a300-02b1-2769-f9766f992e18}">
|
||||||
<Declaration><![CDATA[//FB_Init ist immer implizit verfügbar und wird primär für die Initialisierung verwendet.
|
<Declaration><![CDATA[//FB_Init ist immer implizit verfügbar und wird primär für die Initialisierung verwendet.
|
||||||
//Der Rückgabewert wird nicht ausgewertet. Für gezielte Einflussnahme können Sie
|
//Der Rückgabewert wird nicht ausgewertet. Für gezielte Einflussnahme können Sie
|
||||||
//die Methoden explizit deklarieren und darin mit dem Standard-Initialisierungscode
|
//die Methoden explizit deklarieren und darin mit dem Standard-Initialisierungscode
|
||||||
@@ -74,15 +77,37 @@ bInCopyCode: BOOL; // TRUE: Die Instanz wird danach in den Kopiercode kopiert (
|
|||||||
|
|
||||||
stEventEntry : TcEventEntry;
|
stEventEntry : TcEventEntry;
|
||||||
xWithConfirmation : BOOL;
|
xWithConfirmation : BOOL;
|
||||||
|
END_VAR
|
||||||
|
VAR
|
||||||
|
_sTmp : STRING;
|
||||||
|
_sLeft : STRING;
|
||||||
|
_sRight : STRING;
|
||||||
|
_udiI : UDINT;
|
||||||
|
_udiPosition : UDINT;
|
||||||
END_VAR]]></Declaration>
|
END_VAR]]></Declaration>
|
||||||
<Implementation>
|
<Implementation>
|
||||||
<ST><![CDATA[// Create alarm
|
<ST><![CDATA[// Edit source info name, so that we get the parent as a source
|
||||||
|
// and not this fb
|
||||||
|
_sTmp := _fbSourceInfo.sName;
|
||||||
|
FindAndSplitChar(
|
||||||
|
sSeparatorChar:= '.',
|
||||||
|
pSrcString:= ADR(_sTmp),
|
||||||
|
pLeftString:= ADR(_sLeft),
|
||||||
|
nLeftSize:= SIZEOF(_sLeft),
|
||||||
|
pRightString:= ADR(_sRight),
|
||||||
|
nRightSize:= SIZEOF(_sRight),
|
||||||
|
bSearchFromRight:= TRUE);
|
||||||
|
|
||||||
|
_fbSourceInfo.sName := _sLeft;
|
||||||
|
|
||||||
|
|
||||||
|
// Create alarm
|
||||||
_fbAlarmMessage.CreateEx(stEventEntry := stEventEntry, bWithConfirmation := xWithConfirmation);]]></ST>
|
_fbAlarmMessage.CreateEx(stEventEntry := stEventEntry, bWithConfirmation := xWithConfirmation);]]></ST>
|
||||||
</Implementation>
|
</Implementation>
|
||||||
</Method>
|
</Method>
|
||||||
<Property Name="Raised" Id="{6c8f10b8-0c5e-4665-b985-30ac574d84e9}">
|
<Property Name="Raised" Id="{2254f7ab-28c0-02ea-0e65-a373d9d5b007}">
|
||||||
<Declaration><![CDATA[PROPERTY Raised : BOOL]]></Declaration>
|
<Declaration><![CDATA[PROPERTY Raised : BOOL]]></Declaration>
|
||||||
<Get Name="Get" Id="{0ef44270-1843-4da0-932f-31f831130a1d}">
|
<Get Name="Get" Id="{402fa563-3cdd-092f-24cf-a227bf8b3ef3}">
|
||||||
<Declaration><![CDATA[VAR
|
<Declaration><![CDATA[VAR
|
||||||
END_VAR
|
END_VAR
|
||||||
]]></Declaration>
|
]]></Declaration>
|
||||||
@@ -91,9 +116,9 @@ END_VAR
|
|||||||
</Implementation>
|
</Implementation>
|
||||||
</Get>
|
</Get>
|
||||||
</Property>
|
</Property>
|
||||||
<Property Name="Triggered" Id="{84255a39-f5bd-41ec-9bb9-56c375350a5b}">
|
<Property Name="Triggered" Id="{cafebd2a-d123-0563-2c59-c51cfbad3eb5}">
|
||||||
<Declaration><![CDATA[PROPERTY Triggered : BOOL]]></Declaration>
|
<Declaration><![CDATA[PROPERTY Triggered : BOOL]]></Declaration>
|
||||||
<Get Name="Get" Id="{1df049dd-1509-4300-b01e-e32eececdb86}">
|
<Get Name="Get" Id="{532baece-3197-078f-07fe-70f16274ef68}">
|
||||||
<Declaration><![CDATA[VAR
|
<Declaration><![CDATA[VAR
|
||||||
END_VAR
|
END_VAR
|
||||||
]]></Declaration>
|
]]></Declaration>
|
||||||
|
|||||||
Reference in New Issue
Block a user