DCOM - custom plugin for logging alarm events to csv file

  • Developers
  • DCOM - custom plugin for logging alarm events to csv file
Tim Montag

Posted on 18.09.2015 19:28

Good evening everybody,

I am trying to implement a plugin for writing alarm events to a csv file during a measurement. Therefore I thought of using the iPlugin3 and the OnAlarm procedure.
The csv file should look like the following:

timestamp1;alarmname1
timestamp2;alarmname2
...

The OnAlarm procedure is being called and the timestamp is written to the csv file correctly for every alarm, but so far I couldn't access the name of the alarm. I read about the IAlarmCond.Name property in the manual, which should contain the name of the alarm.
Here is the intended code:

...
Public Sub OnAlarm(ByVal CondIndex As Integer, ByVal Status As Boolean) Implements DEWEsoft.IPlugin3.OnAlarm
If Status = True Then
Dim AlarmTime As String = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
Dim AlarmName As String = Name
Dim AlarmString As String = AlarmTime + ";" + AlarmName + vbNewLine
My.Computer.FileSystem.WriteAllText("C:\DeweAlarms\Alarms.csv", AlarmString, True)
End If
End Sub
...
Public ReadOnly Property Name As String Implements DEWEsoft.IAlarmCond.Name
Get
Return <<AlarmName>>
End Get
End Property

I just don't know how to get access name of the alarm (<<AlarmName>>). Maybe you can give me a hint.

DEWESoft Support
Technical support
Posted on 22.09.2015 13:26

Hi,

The names of alarms can be retrieved from the Event list. In order to read Event list items your CSV export addon (btw, in case of export we use term addon instead of plugin - see figure below) must implement WriteEvent method() declared in ICustomExport2:

function WriteEvent(EventType: Integer; const EventTypeString: WideString; Time: Double; const Comment: WideString): HResult; stdcall;


For each event in the list (including alarm events) WriteEvent() will be called with corresponding parameters.

Login to reply to this topic. If you don't have account yet, you can signup for free account .