需要写Cicode函数来浏览报警列表并将它们逐个导出到设备文件中。
以下是如何导出所有类别的警报名称和时间的示例cicode。 它可以轻松扩展以导出更多警报字段。
FUNCTION AlarmExport(INT Category=0)
INT Current;
INT Next;
INT hdev;
STRING field1;
STRING field2;
IF FileExist("[DATA]:ActiveAlarm2.dbf") THEN
FileDelete("[DATA]:ActiveAlarm2.dbf");
END
hdev = DevOpen("activeAlarmDev2"); //open the device called activeAlarmDev2
Current=AlarmFirstCatRec(Category,0);
WHILE Current <> -1 DO
field1 = AlarmGetFieldRec(Current, "Name");
field2 = AlarmGetFieldRec(Current,"Time");
// add more fields here if you want more than Name and Time
DevAppend(hdev);
DevSetField(hdev,"Name",field1);
DevSetField(hdev,"time",field2);
Next=AlarmNextCatRec(Current,Category,0);
Current=Next;
END
DevClose(hdev);
END
然后需要在Citect工程编辑器“系统”菜单中选择“外围设备”,并参考下图添加外围设备:
是否有帮助?