589 lines
22 KiB
C#
589 lines
22 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Text;
|
|
|
|
namespace INT_PT002.DataStore
|
|
{
|
|
public class AlarmList
|
|
{
|
|
#region Field
|
|
private bool m_IsServoEmergencyStop;
|
|
private bool m_IsServoAlarm;
|
|
private bool m_IsServoTorqueAlarm;
|
|
private bool m_IsPressureError;
|
|
private bool m_IsPressureSensorError;
|
|
|
|
private Collection<bool> m_CollectionIsSensorBoardError;
|
|
private Collection<bool> m_CollectionIsDisplacementSensorError;
|
|
|
|
public event Define.EventHandlerAlarmStateChange EventAlarmStateChange;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public AlarmList()
|
|
{
|
|
this.Initialize();
|
|
}
|
|
#endregion
|
|
|
|
#region Property
|
|
public bool IsServoEmergencyStop
|
|
{
|
|
get { return this.m_IsServoEmergencyStop; }
|
|
set { this.m_IsServoEmergencyStop = value; }
|
|
}
|
|
public bool IsServoAlarm
|
|
{
|
|
get { return this.m_IsServoAlarm; }
|
|
set { this.m_IsServoAlarm = value; }
|
|
}
|
|
public bool IsServoTorqueAlarmTorque
|
|
{
|
|
get { return this.m_IsServoTorqueAlarm; }
|
|
set { this.m_IsServoTorqueAlarm = value; }
|
|
}
|
|
public bool IsPressureError
|
|
{
|
|
get { return this.m_IsPressureError; }
|
|
set { this.m_IsPressureError = value; }
|
|
}
|
|
public bool IsPressureSensorError
|
|
{
|
|
get { return this.m_IsPressureSensorError; }
|
|
set { this.m_IsPressureSensorError = value; }
|
|
}
|
|
|
|
public Collection<bool> CollectionIsSensorBoardError
|
|
{
|
|
get { return this.m_CollectionIsSensorBoardError; }
|
|
set { this.m_CollectionIsSensorBoardError = value; }
|
|
}
|
|
public Collection<bool> CollectionIsDisplacementSensorError
|
|
{
|
|
get { return this.m_CollectionIsDisplacementSensorError; }
|
|
set { this.m_CollectionIsDisplacementSensorError = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Method
|
|
private void Initialize()
|
|
{
|
|
this.IsServoEmergencyStop = false;
|
|
this.IsServoAlarm = false;
|
|
this.IsServoTorqueAlarmTorque = false;
|
|
this.IsPressureError = false;
|
|
this.IsPressureSensorError = false;
|
|
|
|
this.CollectionIsSensorBoardError = new Collection<bool>();
|
|
this.CollectionIsDisplacementSensorError = new Collection<bool>();
|
|
for (int i = 0; i < 10; i++)
|
|
{
|
|
this.CollectionIsSensorBoardError.Add(false);
|
|
this.CollectionIsDisplacementSensorError.Add(false);
|
|
}
|
|
}
|
|
|
|
public void SetAlarm(string alarm)
|
|
{
|
|
string sValue1 = "", sValue2 = "", sValue3 = "", sValue4 = "", sValue5 = "", sValue6 = "", sValue7 = "", sValue8 = "";
|
|
|
|
if (alarm.Length != 8)
|
|
return;
|
|
|
|
sValue1 = Convert.ToString(Convert.ToInt16(alarm.Substring(0, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
|
|
sValue2 = Convert.ToString(Convert.ToInt16(alarm.Substring(1, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
|
|
sValue3 = Convert.ToString(Convert.ToInt16(alarm.Substring(2, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
|
|
sValue4 = Convert.ToString(Convert.ToInt16(alarm.Substring(3, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
|
|
sValue5 = Convert.ToString(Convert.ToInt16(alarm.Substring(4, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
|
|
sValue6 = Convert.ToString(Convert.ToInt16(alarm.Substring(5, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
|
|
sValue7 = Convert.ToString(Convert.ToInt16(alarm.Substring(6, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
|
|
sValue8 = Convert.ToString(Convert.ToInt16(alarm.Substring(7, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
|
|
|
|
// 알람 32-
|
|
if (sValue8[0] == '0')
|
|
{
|
|
}
|
|
else
|
|
{
|
|
}
|
|
// 알람 31-
|
|
if (sValue8[1] == '0')
|
|
{
|
|
}
|
|
else
|
|
{
|
|
}
|
|
// 알람 30-변위센서10 에러
|
|
if (sValue8[2] == '0')
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[9] != false)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[9] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a30_DisplacementSensor10Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[9] != true)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[9] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a30_DisplacementSensor10Error, "ON");
|
|
}
|
|
}
|
|
// 알람 29-변위센서9 에러
|
|
if (sValue8[3] == '0')
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[8] != false)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[8] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a29_DisplacementSensor9Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[8] != true)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[8] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a29_DisplacementSensor9Error, "ON");
|
|
}
|
|
}
|
|
|
|
// 알람 28-변위센서8 에러
|
|
if (sValue7[0] == '0')
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[7] != false)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[7] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a28_DisplacementSensor8Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[7] != true)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[7] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a28_DisplacementSensor8Error, "ON");
|
|
}
|
|
}
|
|
// 알람 27-변위센서7 에러
|
|
if (sValue7[1] == '0')
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[6] != false)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[6] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a27_DisplacementSensor7Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[6] != true)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[6] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a27_DisplacementSensor7Error, "ON");
|
|
}
|
|
}
|
|
// 알람 26-변위센서6 에러
|
|
if (sValue7[2] == '0')
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[5] != false)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[5] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a26_DisplacementSensor6Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[5] != true)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[5] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a26_DisplacementSensor6Error, "ON");
|
|
}
|
|
}
|
|
// 알람 25-변위센서5 에러
|
|
if (sValue7[3] == '0')
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[4] != false)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[4] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a25_DisplacementSensor5Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[4] != true)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[4] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a25_DisplacementSensor5Error, "ON");
|
|
}
|
|
}
|
|
|
|
// 알람 24-변위센서4 에러
|
|
if (sValue6[0] == '0')
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[3] != false)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[3] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a24_DisplacementSensor4Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[3] != true)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[3] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a24_DisplacementSensor4Error, "ON");
|
|
}
|
|
}
|
|
// 알람 23-변위센서3 에러
|
|
if (sValue6[1] == '0')
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[2] != false)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[2] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a23_DisplacementSensor3Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[2] != true)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[2] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a23_DisplacementSensor3Error, "ON");
|
|
}
|
|
}
|
|
// 알람 22-변위센서2 에러
|
|
if (sValue6[2] == '0')
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[1] != false)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[1] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a22_DisplacementSensor2Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[1] != true)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[1] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a22_DisplacementSensor2Error, "ON");
|
|
}
|
|
}
|
|
// 알람 21-변위센서1 에러
|
|
if (sValue6[3] == '0')
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[0] != false)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[0] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a21_DisplacementSensor1Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsDisplacementSensorError[0] != true)
|
|
{
|
|
this.CollectionIsDisplacementSensorError[0] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a21_DisplacementSensor1Error, "ON");
|
|
}
|
|
}
|
|
|
|
// 알람 20-
|
|
if (sValue5[0] == '0')
|
|
{
|
|
}
|
|
else
|
|
{
|
|
}
|
|
// 알람 19-
|
|
if (sValue5[1] == '0')
|
|
{
|
|
}
|
|
else
|
|
{
|
|
}
|
|
// 알람 18-센서보드10 에러
|
|
if (sValue5[2] == '0')
|
|
{
|
|
if (this.CollectionIsSensorBoardError[9] != false)
|
|
{
|
|
this.CollectionIsSensorBoardError[9] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a18_SensorBoard10Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsSensorBoardError[9] != true)
|
|
{
|
|
this.CollectionIsSensorBoardError[9] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a18_SensorBoard10Error, "ON");
|
|
}
|
|
}
|
|
// 알람 17-센서보드9 에러
|
|
if (sValue5[3] == '0')
|
|
{
|
|
if (this.CollectionIsSensorBoardError[8] != false)
|
|
{
|
|
this.CollectionIsSensorBoardError[8] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a17_SensorBoard9Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsSensorBoardError[8] != true)
|
|
{
|
|
this.CollectionIsSensorBoardError[8] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a17_SensorBoard9Error, "ON");
|
|
}
|
|
}
|
|
|
|
// 알람 16-센서보드8 에러
|
|
if (sValue4[0] == '0')
|
|
{
|
|
if (this.CollectionIsSensorBoardError[7] != false)
|
|
{
|
|
this.CollectionIsSensorBoardError[7] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a16_SensorBoard8Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsSensorBoardError[7] != true)
|
|
{
|
|
this.CollectionIsSensorBoardError[7] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a16_SensorBoard8Error, "ON");
|
|
}
|
|
}
|
|
// 알람 15-센서보드7 에러
|
|
if (sValue4[1] == '0')
|
|
{
|
|
if (this.CollectionIsSensorBoardError[6] != false)
|
|
{
|
|
this.CollectionIsSensorBoardError[6] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a15_SensorBoard7Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsSensorBoardError[6] != true)
|
|
{
|
|
this.CollectionIsSensorBoardError[6] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a15_SensorBoard7Error, "ON");
|
|
}
|
|
}
|
|
// 알람 14-센서보드6 에러
|
|
if (sValue4[2] == '0')
|
|
{
|
|
if (this.CollectionIsSensorBoardError[5] != false)
|
|
{
|
|
this.CollectionIsSensorBoardError[5] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a14_SensorBoard6Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsSensorBoardError[5] != true)
|
|
{
|
|
this.CollectionIsSensorBoardError[5] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a14_SensorBoard6Error, "ON");
|
|
}
|
|
}
|
|
// 알람 13-센서보드5 에러
|
|
if (sValue4[3] == '0')
|
|
{
|
|
if (this.CollectionIsSensorBoardError[4] != false)
|
|
{
|
|
this.CollectionIsSensorBoardError[4] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a13_SensorBoard5Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsSensorBoardError[4] != true)
|
|
{
|
|
this.CollectionIsSensorBoardError[4] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a13_SensorBoard5Error, "ON");
|
|
}
|
|
}
|
|
|
|
// 알람 12-센서보드4 에러
|
|
if (sValue3[0] == '0')
|
|
{
|
|
if (this.CollectionIsSensorBoardError[3] != false)
|
|
{
|
|
this.CollectionIsSensorBoardError[3] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a12_SensorBoard4Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsSensorBoardError[3] != true)
|
|
{
|
|
this.CollectionIsSensorBoardError[3] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a12_SensorBoard4Error, "ON");
|
|
}
|
|
}
|
|
// 알람 11-센서보드3 에러
|
|
if (sValue3[1] == '0')
|
|
{
|
|
if (this.CollectionIsSensorBoardError[2] != false)
|
|
{
|
|
this.CollectionIsSensorBoardError[2] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a11_SensorBoard3Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsSensorBoardError[2] != true)
|
|
{
|
|
this.CollectionIsSensorBoardError[2] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a11_SensorBoard3Error, "ON");
|
|
}
|
|
}
|
|
// 알람 10-센서보드2 에러
|
|
if (sValue3[2] == '0')
|
|
{
|
|
if (this.CollectionIsSensorBoardError[1] != false)
|
|
{
|
|
this.CollectionIsSensorBoardError[1] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a10_SensorBoard2Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsSensorBoardError[1] != true)
|
|
{
|
|
this.CollectionIsSensorBoardError[1] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a10_SensorBoard2Error, "ON");
|
|
}
|
|
}
|
|
// 알람 9-센서보드1 에러
|
|
if (sValue3[3] == '0')
|
|
{
|
|
if (this.CollectionIsSensorBoardError[0] != false)
|
|
{
|
|
this.CollectionIsSensorBoardError[0] = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a9_SensorBoard1Error, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.CollectionIsSensorBoardError[0] != true)
|
|
{
|
|
this.CollectionIsSensorBoardError[0] = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a9_SensorBoard1Error, "ON");
|
|
}
|
|
}
|
|
|
|
// 알람 8-
|
|
if (sValue2[0] == '0')
|
|
{
|
|
}
|
|
else
|
|
{
|
|
}
|
|
// 알람 7-
|
|
if (sValue2[1] == '0')
|
|
{
|
|
}
|
|
else
|
|
{
|
|
}
|
|
// 알람 6-
|
|
if (sValue2[2] == '0')
|
|
{
|
|
}
|
|
else
|
|
{
|
|
}
|
|
// 알람 5-압력게이지 에러
|
|
if (sValue2[3] == '0')
|
|
{
|
|
if (this.IsPressureSensorError != false)
|
|
{
|
|
this.IsPressureSensorError = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a5_PressureSensorError, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.IsPressureSensorError != true)
|
|
{
|
|
this.IsPressureSensorError = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a5_PressureSensorError, "ON");
|
|
}
|
|
}
|
|
|
|
// 알람 4-압력에러
|
|
if (sValue1[0] == '0')
|
|
{
|
|
if (this.IsPressureError != false)
|
|
{
|
|
this.IsPressureError = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a4_PressureError, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.IsPressureError != true)
|
|
{
|
|
this.IsPressureError = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a4_PressureError, "ON");
|
|
}
|
|
}
|
|
// 알람 3-서보 토크
|
|
if (sValue1[1] == '0')
|
|
{
|
|
if (this.IsServoTorqueAlarmTorque != false)
|
|
{
|
|
this.IsServoTorqueAlarmTorque = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a3_ServoTorqueAlarm, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.IsServoTorqueAlarmTorque != true)
|
|
{
|
|
this.IsServoTorqueAlarmTorque = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a3_ServoTorqueAlarm, "ON");
|
|
}
|
|
}
|
|
// 알람 2-서보 알람
|
|
if (sValue1[2] == '0')
|
|
{
|
|
if (this.IsServoAlarm != false)
|
|
{
|
|
this.IsServoAlarm = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a2_ServoAlarm, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.IsServoAlarm != true)
|
|
{
|
|
this.IsServoAlarm = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a2_ServoAlarm, "ON");
|
|
}
|
|
}
|
|
// 알람 1-서보OFF
|
|
if (sValue1[3] == '0')
|
|
{
|
|
if (this.IsServoEmergencyStop != false)
|
|
{
|
|
this.IsServoEmergencyStop = false;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a1_ServoEmergencyStop, "OFF");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.IsServoEmergencyStop != true)
|
|
{
|
|
this.IsServoEmergencyStop = true;
|
|
this.EventAlarmStateChange(Define.E_TrackingAlarm.a1_ServoEmergencyStop, "ON");
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|