DCOM - custom plugin for logging alarm events to csv file
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:
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)
Public ReadOnly Property Name As String Implements DEWEsoft.IAlarmCond.Name
I just don't know how to get access name of the alarm (<<AlarmName>>). Maybe you can give me a hint.
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.