The FaultInterface is the main way to retrieve information about alarms and alarm history in addition to clearing alarms and warnings.
Name | Description |
---|---|
GetActiveAlarms | Get any active alarms. |
GetAlarmHistory | Get the alarm history for a given time period. |
ClearAllFaults | Clear errors. |
Get any active alarms.
StatusInfo GetActiveAlarms(ActiveAlarms& activeAlarmsData);
activeAlarmsData
[out] Current active alarms. See ActiveAlarms.
0 if successful, otherwise a StatusInfo object with a description of error.
//Open connection to controller
StatusInfo status;
MotomanController* c = YMConnect::OpenConnection("192.168.1.31", status);
ActiveAlarms activeAlarmsData;
//Use the FaultInterface to get the active alarms
status = c->Faults->GetActiveAlarms(activeAlarmsData);
//Print the results
std::cout << status << std::endl;
std::cout << activeAlarmsData << std::endl;
YMConnect::CloseConnection(c);
Output
Code (0): OK
1 alarms active.
Alarm 1 : Code: 8000
Subcode: 0
Time: 2023/10/12 04:45
Name: Alarm Example
Similar to GetActiveAlarms, but returns the number of alarms specified by the quantity parameter.
StatusInfo GetAlarmHistory(AlarmCategory category, UINT32 quantity, AlarmHistory& alarmHistoryData);
category
[in] The category of alarms to retrieve. See AlarmCategory.
quantity
[in] The number of alarms to retrieve. Maximum is 100.
alarmHistoryData
[out] Number of alarms returned here is specified in quantity. See AlarmData.
0 if successful, otherwise a StatusInfo object with a description of error.
//Open connection to controller
StatusInfo status;
MotomanController* c = YMConnect::OpenConnection("192.168.1.31", status);
AlarmHistory alarmHistoryData;
//Use the FaultInterface to get the alarm history
status = c->Faults->GetAlarmHistory(AlarmCategory::Minor, 3, alarms);
//Print the results
std::cout << status << std::endl;
std::cout << alarms << std::endl;
YMConnect::CloseConnection(c);
Output
Code (0): OK
3 alarms in history.
Alarm 1 : Code: 8000
Subcode: 0
Time: 2023/10/12 04:45
Name: SAMPLE ALARM
Alarm 2 : Code: 4744
Subcode: 0
Time: 2023/10/11 00:23
Name: M-SAF PP ENABLE SW SIG. ERROR
Alarm 3 : Code: 4744
Subcode: 0
Time: 2023/10/11 00:23
Name: M-SAF PP ENABLE SW SIG. ERROR
Clear all errors and alarms.
StatusInfo ClearAllFaults();
Please note that this function will not clear Major alarms.
None.
0 if successful, otherwise a StatusInfo object with a description of error.
//Open connection to controller
StatusInfo status;
MotomanController* c = YMConnect::OpenConnection("192.168.1.31", status);
//Use the FaultInterface to clear all faults (errors and alarms)
status = c->Faults->ClearAllFaults();
//Print the results
std::cout << status << std::endl;
YMConnect::CloseConnection(c);
Output
Code (0): OK