using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Globalization;
|
using System.Linq;
|
using System.Text;
|
using System.Threading;
|
using System.Threading.Tasks;
|
|
namespace SA_LTT.Module
|
{
|
public class Chiller : ComPort
|
{
|
public struct StatusFlag1
|
{
|
private bool[] _datas;
|
private bool _runFlag;
|
private bool _operationStopAlarmFlag;
|
private bool _operationContinuedAlarmFlag;
|
private bool _reserve3;
|
private bool _pressUnitFlag;
|
private bool _remoteStatusFlag;
|
private bool _reserve6;
|
private bool _reserve7;
|
private bool _reserve8;
|
private bool _completionOfPreparationFlag;
|
private bool _temperatureUnitFlag;
|
private bool _runTimerFlag;
|
private bool _stopTimerFlag;
|
private bool _resetAfterPowerFailureFlag;
|
private bool _antiFreezingFlag;
|
private bool _automaticFluidFillingFlag;
|
|
public bool[] Datas
|
{
|
get
|
{
|
if (_datas == null)
|
{
|
_datas = new bool[16];
|
}
|
|
return _datas;
|
}
|
|
private set
|
{
|
_datas = value;
|
}
|
}
|
|
public bool RunFlag
|
{
|
get
|
{
|
return _runFlag;
|
}
|
|
private set
|
{
|
_runFlag = value;
|
}
|
}
|
|
public bool OperationStopAlarmFlag
|
{
|
get
|
{
|
return _operationStopAlarmFlag;
|
}
|
|
private set
|
{
|
_operationStopAlarmFlag = value;
|
}
|
}
|
|
public bool OperationContinuedAlarmFlag
|
{
|
get
|
{
|
return _operationContinuedAlarmFlag;
|
}
|
|
private set
|
{
|
_operationContinuedAlarmFlag = value;
|
}
|
}
|
|
public bool Reserve3
|
{
|
get
|
{
|
return _reserve3;
|
}
|
|
private set
|
{
|
_reserve3 = value;
|
}
|
}
|
|
public bool PressUnitFlag
|
{
|
get
|
{
|
return _pressUnitFlag;
|
}
|
|
private set
|
{
|
_pressUnitFlag = value;
|
}
|
}
|
|
public bool RemoteStatusFlag
|
{
|
get
|
{
|
return _remoteStatusFlag;
|
}
|
|
private set
|
{
|
_remoteStatusFlag = value;
|
}
|
}
|
|
public bool Reserve6
|
{
|
get
|
{
|
return _reserve6;
|
}
|
|
private set
|
{
|
_reserve6 = value;
|
}
|
}
|
|
public bool Reserve7
|
{
|
get
|
{
|
return _reserve7;
|
}
|
|
private set
|
{
|
_reserve7 = value;
|
}
|
}
|
|
public bool Reserve8
|
{
|
get
|
{
|
return _reserve8;
|
}
|
|
private set
|
{
|
_reserve8 = value;
|
}
|
}
|
|
public bool CompletionOfPreparationFlag
|
{
|
get
|
{
|
return _completionOfPreparationFlag;
|
}
|
|
private set
|
{
|
_completionOfPreparationFlag = value;
|
}
|
}
|
|
public bool TemperatureUnitFlag
|
{
|
get
|
{
|
return _temperatureUnitFlag;
|
}
|
|
private set
|
{
|
_temperatureUnitFlag = value;
|
}
|
}
|
|
public bool RunTimerFlag
|
{
|
get
|
{
|
return _runTimerFlag;
|
}
|
|
private set
|
{
|
_runTimerFlag = value;
|
}
|
}
|
|
public bool StopTimerFlag
|
{
|
get
|
{
|
return _stopTimerFlag;
|
}
|
|
private set
|
{
|
_stopTimerFlag = value;
|
}
|
}
|
|
public bool ResetAfterPowerFailureFlag
|
{
|
get
|
{
|
return _resetAfterPowerFailureFlag;
|
}
|
|
private set
|
{
|
_resetAfterPowerFailureFlag = value;
|
}
|
}
|
|
public bool AntiFreezingFlag
|
{
|
get
|
{
|
return _antiFreezingFlag;
|
}
|
|
private set
|
{
|
_antiFreezingFlag = value;
|
}
|
}
|
|
public bool AutomaticFluidFillingFlag
|
{
|
get
|
{
|
return _automaticFluidFillingFlag;
|
}
|
|
private set
|
{
|
_automaticFluidFillingFlag = value;
|
}
|
}
|
|
public void SetData(byte[] bytes)
|
{
|
var bit = new BitArray(bytes);
|
|
if (bit.Length < 16) return;
|
|
for (int i = 0; i < 16; i++)
|
{
|
Datas[i] = bit[i];
|
}
|
|
RunFlag = bit[0];
|
OperationStopAlarmFlag = bit[1];
|
OperationContinuedAlarmFlag = bit[2];
|
Reserve3 = bit[3];
|
PressUnitFlag = bit[4];
|
RemoteStatusFlag = bit[5];
|
Reserve6 = bit[6];
|
Reserve7 = bit[7];
|
Reserve8 = bit[8];
|
CompletionOfPreparationFlag = bit[9];
|
TemperatureUnitFlag = bit[10];
|
RunTimerFlag = bit[11];
|
StopTimerFlag = bit[12];
|
ResetAfterPowerFailureFlag = bit[13];
|
AntiFreezingFlag = bit[14];
|
AutomaticFluidFillingFlag = bit[15];
|
}
|
}
|
|
public struct AlarmFlag1
|
{
|
private bool[] _datas;
|
private bool _lowLevelInTank;
|
private bool _highCirculatingFluidDischargeTemp;
|
private bool _circulatingFluidDischargeTempRise;
|
private bool _circulatingFluidDischargeTempDrop;
|
private bool _highCirculatingFluidReturnTemp;
|
private bool _highCirculatingFluidDischargePressure;
|
private bool _abnormalPumpOperation;
|
private bool _circulatingFluidDischargePressureRise;
|
private bool _circulatingFluidDischargePressureDrop;
|
private bool _highCompressorIntakeTemp;
|
private bool _lowCompressorIntakeTemp;
|
private bool _lowSuperHeatTemperature;
|
private bool _highCompressorDischargePressure;
|
private bool _reserve13;
|
private bool _refrigerantCircuitHighPressureDrop;
|
private bool _refrigerantCircuitLowPressureRise;
|
|
public bool[] Datas
|
{
|
get
|
{
|
if (_datas == null)
|
{
|
_datas = new bool[16];
|
}
|
|
return _datas;
|
}
|
|
private set
|
{
|
_datas = value;
|
}
|
}
|
|
public bool LowLevelInTank
|
{
|
get
|
{
|
return _lowLevelInTank;
|
}
|
|
private set
|
{
|
_lowLevelInTank = value;
|
}
|
}
|
|
public bool HighCirculatingFluidDischargeTemp
|
{
|
get
|
{
|
return _highCirculatingFluidDischargeTemp;
|
}
|
|
private set
|
{
|
_highCirculatingFluidDischargeTemp = value;
|
}
|
}
|
|
public bool CirculatingFluidDischargeTempRise
|
{
|
get
|
{
|
return _circulatingFluidDischargeTempRise;
|
}
|
|
private set
|
{
|
_circulatingFluidDischargeTempRise = value;
|
}
|
}
|
|
public bool CirculatingFluidDischargeTempDrop
|
{
|
get
|
{
|
return _circulatingFluidDischargeTempDrop;
|
}
|
|
private set
|
{
|
_circulatingFluidDischargeTempDrop = value;
|
}
|
}
|
|
public bool HighCirculatingFluidReturnTemp
|
{
|
get
|
{
|
return _highCirculatingFluidReturnTemp;
|
}
|
|
private set
|
{
|
_highCirculatingFluidReturnTemp = value;
|
}
|
}
|
|
public bool HighCirculatingFluidDischargePressure
|
{
|
get
|
{
|
return _highCirculatingFluidDischargePressure;
|
}
|
|
private set
|
{
|
_highCirculatingFluidDischargePressure = value;
|
}
|
}
|
|
public bool AbnormalPumpOperation
|
{
|
get
|
{
|
return _abnormalPumpOperation;
|
}
|
|
private set
|
{
|
_abnormalPumpOperation = value;
|
}
|
}
|
|
public bool CirculatingFluidDischargePressureRise
|
{
|
get
|
{
|
return _circulatingFluidDischargePressureRise;
|
}
|
|
private set
|
{
|
_circulatingFluidDischargePressureRise = value;
|
}
|
}
|
|
public bool CirculatingFluidDischargePressureDrop
|
{
|
get
|
{
|
return _circulatingFluidDischargePressureDrop;
|
}
|
|
private set
|
{
|
_circulatingFluidDischargePressureDrop = value;
|
}
|
}
|
|
public bool HighCompressorIntakeTemp
|
{
|
get
|
{
|
return _highCompressorIntakeTemp;
|
}
|
|
private set
|
{
|
_highCompressorIntakeTemp = value;
|
}
|
}
|
|
public bool LowCompressorIntakeTemp
|
{
|
get
|
{
|
return _lowCompressorIntakeTemp;
|
}
|
|
private set
|
{
|
_lowCompressorIntakeTemp = value;
|
}
|
}
|
|
public bool LowSuperHeatTemperature
|
{
|
get
|
{
|
return _lowSuperHeatTemperature;
|
}
|
|
private set
|
{
|
_lowSuperHeatTemperature = value;
|
}
|
}
|
|
public bool HighCompressorDischargePressure
|
{
|
get
|
{
|
return _highCompressorDischargePressure;
|
}
|
|
private set
|
{
|
_highCompressorDischargePressure = value;
|
}
|
}
|
|
public bool Reserve13
|
{
|
get
|
{
|
return _reserve13;
|
}
|
|
private set
|
{
|
_reserve13 = value;
|
}
|
}
|
|
public bool RefrigerantCircuitHighPressureDrop
|
{
|
get
|
{
|
return _refrigerantCircuitHighPressureDrop;
|
}
|
|
private set
|
{
|
_refrigerantCircuitHighPressureDrop = value;
|
}
|
}
|
|
public bool RefrigerantCircuitLowPressureRise
|
{
|
get
|
{
|
return _refrigerantCircuitLowPressureRise;
|
}
|
|
private set
|
{
|
_refrigerantCircuitLowPressureRise = value;
|
}
|
}
|
|
public void SetData(byte[] bytes)
|
{
|
if (_datas == null)
|
{
|
_datas = new bool[16];
|
}
|
|
var bit = new BitArray(bytes);
|
|
if (bit.Length < 16) return;
|
|
for (int i = 0; i < 16; i++)
|
{
|
_datas[i] = bit[i];
|
}
|
|
LowLevelInTank = bit[0];
|
HighCirculatingFluidDischargeTemp = bit[1];
|
CirculatingFluidDischargeTempRise = bit[2];
|
CirculatingFluidDischargeTempDrop = bit[3];
|
HighCirculatingFluidReturnTemp = bit[4];
|
HighCirculatingFluidDischargePressure = bit[5];
|
AbnormalPumpOperation = bit[6];
|
CirculatingFluidDischargePressureRise = bit[7];
|
CirculatingFluidDischargePressureDrop = bit[8];
|
HighCompressorIntakeTemp = bit[9];
|
LowCompressorIntakeTemp = bit[10];
|
LowSuperHeatTemperature = bit[11];
|
HighCompressorDischargePressure = bit[12];
|
Reserve13 = bit[13];
|
RefrigerantCircuitHighPressureDrop = bit[14];
|
RefrigerantCircuitLowPressureRise = bit[15];
|
}
|
}
|
|
public struct AlarmFlag2
|
{
|
private bool[] _datas;
|
private bool _refrigerantCircuitLowPressureDrop;
|
private bool _compressorOverload;
|
private bool _communicationError;
|
private bool _memoryError;
|
private bool _dcLineFuseCut;
|
private bool _circulatingFluidDischargeTempSensorFailure;
|
private bool _circulatingFluidReturnTempSensorFailure;
|
private bool _compressorIntankTempSensorFailure;
|
private bool _circulatingFluidDischargePressureSensorFailure;
|
private bool _compressorDischargePressureSensorFailure;
|
private bool _compressorIntankPressureSensorFailure;
|
private bool _maintenanceOfPump;
|
private bool _maintenanceOfFanMotor;
|
private bool _maintenanceOfCompressor;
|
private bool _contactInput1SignalDetectionAlarm;
|
private bool _contactInput2SignalDetectionAlarm;
|
|
public bool[] Datas
|
{
|
get
|
{
|
if (_datas == null)
|
{
|
_datas = new bool[16];
|
}
|
|
return _datas;
|
}
|
|
private set
|
{
|
_datas = value;
|
}
|
}
|
|
public bool RefrigerantCircuitLowPressureDrop
|
{
|
get
|
{
|
return _refrigerantCircuitLowPressureDrop;
|
}
|
|
private set
|
{
|
_refrigerantCircuitLowPressureDrop = value;
|
}
|
}
|
|
public bool CompressorOverload
|
{
|
get
|
{
|
return _compressorOverload;
|
}
|
|
private set
|
{
|
_compressorOverload = value;
|
}
|
}
|
|
public bool CommunicationError
|
{
|
get
|
{
|
return _communicationError;
|
}
|
|
private set
|
{
|
_communicationError = value;
|
}
|
}
|
|
public bool MemoryError
|
{
|
get
|
{
|
return _memoryError;
|
}
|
|
private set
|
{
|
_memoryError = value;
|
}
|
}
|
|
public bool DcLineFuseCut
|
{
|
get
|
{
|
return _dcLineFuseCut;
|
}
|
|
private set
|
{
|
_dcLineFuseCut = value;
|
}
|
}
|
|
public bool CirculatingFluidDischargeTempSensorFailure
|
{
|
get
|
{
|
return _circulatingFluidDischargeTempSensorFailure;
|
}
|
|
private set
|
{
|
_circulatingFluidDischargeTempSensorFailure = value;
|
}
|
}
|
|
public bool CirculatingFluidReturnTempSensorFailure
|
{
|
get
|
{
|
return _circulatingFluidReturnTempSensorFailure;
|
}
|
|
private set
|
{
|
_circulatingFluidReturnTempSensorFailure = value;
|
}
|
}
|
|
public bool CompressorIntankTempSensorFailure
|
{
|
get
|
{
|
return _compressorIntankTempSensorFailure;
|
}
|
|
private set
|
{
|
_compressorIntankTempSensorFailure = value;
|
}
|
}
|
|
public bool CirculatingFluidDischargePressureSensorFailure
|
{
|
get
|
{
|
return _circulatingFluidDischargePressureSensorFailure;
|
}
|
|
private set
|
{
|
_circulatingFluidDischargePressureSensorFailure = value;
|
}
|
}
|
|
public bool CompressorDischargePressureSensorFailure
|
{
|
get
|
{
|
return _compressorDischargePressureSensorFailure;
|
}
|
|
private set
|
{
|
_compressorDischargePressureSensorFailure = value;
|
}
|
}
|
|
public bool CompressorIntankPressureSensorFailure
|
{
|
get
|
{
|
return _compressorIntankPressureSensorFailure;
|
}
|
|
private set
|
{
|
_compressorIntankPressureSensorFailure = value;
|
}
|
}
|
|
public bool MaintenanceOfPump
|
{
|
get
|
{
|
return _maintenanceOfPump;
|
}
|
|
private set
|
{
|
_maintenanceOfPump = value;
|
}
|
}
|
|
public bool MaintenanceOfFanMotor
|
{
|
get
|
{
|
return _maintenanceOfFanMotor;
|
}
|
|
private set
|
{
|
_maintenanceOfFanMotor = value;
|
}
|
}
|
|
public bool MaintenanceOfCompressor
|
{
|
get
|
{
|
return _maintenanceOfCompressor;
|
}
|
|
private set
|
{
|
_maintenanceOfCompressor = value;
|
}
|
}
|
|
public bool ContactInput1SignalDetectionAlarm
|
{
|
get
|
{
|
return _contactInput1SignalDetectionAlarm;
|
}
|
|
private set
|
{
|
_contactInput1SignalDetectionAlarm = value;
|
}
|
}
|
|
public bool ContactInput2SignalDetectionAlarm
|
{
|
get
|
{
|
return _contactInput2SignalDetectionAlarm;
|
}
|
|
private set
|
{
|
_contactInput2SignalDetectionAlarm = value;
|
}
|
}
|
|
public void SetData(byte[] bytes)
|
{
|
var bit = new BitArray(bytes);
|
|
if (bit.Length < 16) return;
|
|
for (int i = 0; i < 16; i++)
|
{
|
Datas[i] = bit[i];
|
}
|
|
RefrigerantCircuitLowPressureDrop = bit[0];
|
CompressorOverload = bit[1];
|
CommunicationError = bit[2];
|
MemoryError = bit[3];
|
DcLineFuseCut = bit[4];
|
CirculatingFluidDischargeTempSensorFailure = bit[5];
|
CirculatingFluidReturnTempSensorFailure = bit[6];
|
CompressorIntankTempSensorFailure = bit[7];
|
CirculatingFluidDischargePressureSensorFailure = bit[8];
|
CompressorDischargePressureSensorFailure = bit[9];
|
CompressorIntankPressureSensorFailure = bit[10];
|
MaintenanceOfPump = bit[11];
|
MaintenanceOfFanMotor = bit[12];
|
MaintenanceOfCompressor = bit[13];
|
ContactInput1SignalDetectionAlarm = bit[14];
|
ContactInput2SignalDetectionAlarm = bit[15];
|
}
|
}
|
|
public struct AlarmFlag3
|
{
|
private bool[] _datas;
|
private bool _waterLeakage;
|
private bool _electricResistivityConductivityLevelRise;
|
private bool _electricResistivityConductivityLevelDrop;
|
private bool _electricResistivityConductivitySensorError;
|
private bool _reserve4;
|
private bool _reserve5;
|
private bool _reserve6;
|
private bool _reserve7;
|
private bool _reserve8;
|
private bool _reserve9;
|
private bool _reserve10;
|
private bool _reserve11;
|
private bool _reserve12;
|
private bool _reserve13;
|
private bool _reserve14;
|
private bool _reserve15;
|
|
public bool[] Datas
|
{
|
get
|
{
|
if (_datas == null)
|
{
|
_datas = new bool[16];
|
}
|
|
return _datas;
|
}
|
|
private set
|
{
|
_datas = value;
|
}
|
}
|
|
public bool WaterLeakage
|
{
|
get
|
{
|
return _waterLeakage;
|
}
|
|
private set
|
{
|
_waterLeakage = value;
|
}
|
}
|
|
public bool ElectricResistivityConductivityLevelRise
|
{
|
get
|
{
|
return _electricResistivityConductivityLevelRise;
|
}
|
|
private set
|
{
|
_electricResistivityConductivityLevelRise = value;
|
}
|
}
|
|
public bool ElectricResistivityConductivityLevelDrop
|
{
|
get
|
{
|
return _electricResistivityConductivityLevelDrop;
|
}
|
|
private set
|
{
|
_electricResistivityConductivityLevelDrop = value;
|
}
|
}
|
|
public bool ElectricResistivityConductivitySensorError
|
{
|
get
|
{
|
return _electricResistivityConductivitySensorError;
|
}
|
|
private set
|
{
|
_electricResistivityConductivitySensorError = value;
|
}
|
}
|
|
public bool Reserve4
|
{
|
get
|
{
|
return _reserve4;
|
}
|
|
private set
|
{
|
_reserve4 = value;
|
}
|
}
|
|
public bool Reserve5
|
{
|
get
|
{
|
return _reserve5;
|
}
|
|
private set
|
{
|
_reserve5 = value;
|
}
|
}
|
|
public bool Reserve6
|
{
|
get
|
{
|
return _reserve6;
|
}
|
|
private set
|
{
|
_reserve6 = value;
|
}
|
}
|
|
public bool Reserve7
|
{
|
get
|
{
|
return _reserve7;
|
}
|
|
private set
|
{
|
_reserve7 = value;
|
}
|
}
|
|
public bool Reserve8
|
{
|
get
|
{
|
return _reserve8;
|
}
|
|
private set
|
{
|
_reserve8 = value;
|
}
|
}
|
|
public bool Reserve9
|
{
|
get
|
{
|
return _reserve9;
|
}
|
|
private set
|
{
|
_reserve9 = value;
|
}
|
}
|
|
public bool Reserve10
|
{
|
get
|
{
|
return _reserve10;
|
}
|
|
private set
|
{
|
_reserve10 = value;
|
}
|
}
|
|
public bool Reserve11
|
{
|
get
|
{
|
return _reserve11;
|
}
|
|
private set
|
{
|
_reserve11 = value;
|
}
|
}
|
|
public bool Reserve12
|
{
|
get
|
{
|
return _reserve12;
|
}
|
|
private set
|
{
|
_reserve12 = value;
|
}
|
}
|
|
public bool Reserve13
|
{
|
get
|
{
|
return _reserve13;
|
}
|
|
private set
|
{
|
_reserve13 = value;
|
}
|
}
|
|
public bool Reserve14
|
{
|
get
|
{
|
return _reserve14;
|
}
|
|
private set
|
{
|
_reserve14 = value;
|
}
|
}
|
|
public bool Reserve15
|
{
|
get
|
{
|
return _reserve15;
|
}
|
|
private set
|
{
|
_reserve15 = value;
|
}
|
}
|
|
public void SetData(byte[] bytes)
|
{
|
var bit = new BitArray(bytes);
|
|
if (bit.Length < 16) return;
|
|
for (int i = 0; i < 16; i++)
|
{
|
Datas[i] = bit[i];
|
}
|
|
WaterLeakage = bit[0];
|
ElectricResistivityConductivityLevelRise = bit[1];
|
ElectricResistivityConductivityLevelDrop = bit[2];
|
ElectricResistivityConductivitySensorError = bit[3];
|
Reserve4 = bit[4];
|
Reserve5 = bit[5];
|
Reserve6 = bit[6];
|
Reserve7 = bit[7];
|
Reserve8 = bit[8];
|
Reserve9 = bit[9];
|
Reserve10 = bit[10];
|
Reserve11 = bit[11];
|
Reserve12 = bit[12];
|
Reserve13 = bit[13];
|
Reserve14 = bit[14];
|
Reserve15 = bit[15];
|
}
|
}
|
|
public struct StatusFlag2
|
{
|
private bool[] _datas;
|
|
private bool _electricResistivityConductivitySettingFlag1;
|
private bool _electricResistivityConductivitySettingFlag2;
|
private bool _reserve2;
|
private bool _reserve3;
|
private bool _reserve4;
|
private bool _reserve5;
|
private bool _reserve6;
|
private bool _reserve7;
|
private bool _reserve8;
|
private bool _reserve9;
|
private bool _reserve10;
|
private bool _reserve11;
|
private bool _reserve12;
|
private bool _reserve13;
|
private bool _reserve14;
|
private bool _reserve15;
|
|
public bool[] Datas
|
{
|
get
|
{
|
if (_datas == null)
|
{
|
_datas = new bool[16];
|
}
|
|
return _datas;
|
}
|
|
private set
|
{
|
_datas = value;
|
}
|
}
|
|
public bool ElectricResistivityConductivitySettingFlag1
|
{
|
get
|
{
|
return _electricResistivityConductivitySettingFlag1;
|
}
|
|
private set
|
{
|
_electricResistivityConductivitySettingFlag1 = value;
|
}
|
}
|
|
public bool ElectricResistivityConductivitySettingFlag2
|
{
|
get
|
{
|
return _electricResistivityConductivitySettingFlag2;
|
}
|
|
private set
|
{
|
_electricResistivityConductivitySettingFlag2 = value;
|
}
|
}
|
|
public bool Reserve2
|
{
|
get
|
{
|
return _reserve2;
|
}
|
|
private set
|
{
|
_reserve2 = value;
|
}
|
}
|
|
public bool Reserve3
|
{
|
get
|
{
|
return _reserve3;
|
}
|
|
private set
|
{
|
_reserve3 = value;
|
}
|
}
|
|
public bool Reserve4
|
{
|
get
|
{
|
return _reserve4;
|
}
|
|
private set
|
{
|
_reserve4 = value;
|
}
|
}
|
|
public bool Reserve5
|
{
|
get
|
{
|
return _reserve5;
|
}
|
|
private set
|
{
|
_reserve5 = value;
|
}
|
}
|
|
public bool Reserve6
|
{
|
get
|
{
|
return _reserve6;
|
}
|
|
private set
|
{
|
_reserve6 = value;
|
}
|
}
|
|
public bool Reserve7
|
{
|
get
|
{
|
return _reserve7;
|
}
|
|
private set
|
{
|
_reserve7 = value;
|
}
|
}
|
|
public bool Reserve8
|
{
|
get
|
{
|
return _reserve8;
|
}
|
|
private set
|
{
|
_reserve8 = value;
|
}
|
}
|
|
public bool Reserve9
|
{
|
get
|
{
|
return _reserve9;
|
}
|
|
private set
|
{
|
_reserve9 = value;
|
}
|
}
|
|
public bool Reserve10
|
{
|
get
|
{
|
return _reserve10;
|
}
|
|
private set
|
{
|
_reserve10 = value;
|
}
|
}
|
|
public bool Reserve11
|
{
|
get
|
{
|
return _reserve11;
|
}
|
|
private set
|
{
|
_reserve11 = value;
|
}
|
}
|
|
public bool Reserve12
|
{
|
get
|
{
|
return _reserve12;
|
}
|
|
private set
|
{
|
_reserve12 = value;
|
}
|
}
|
|
public bool Reserve13
|
{
|
get
|
{
|
return _reserve13;
|
}
|
|
private set
|
{
|
_reserve13 = value;
|
}
|
}
|
|
public bool Reserve14
|
{
|
get
|
{
|
return _reserve14;
|
}
|
|
private set
|
{
|
_reserve14 = value;
|
}
|
}
|
|
public bool Reserve15
|
{
|
get
|
{
|
return _reserve15;
|
}
|
|
private set
|
{
|
_reserve15 = value;
|
}
|
}
|
|
public void SetData(byte[] bytes)
|
{
|
var bit = new BitArray(bytes);
|
|
if (bit.Length < 16) return;
|
|
for (int i = 0; i < 16; i++)
|
{
|
Datas[i] = bit[i];
|
}
|
|
ElectricResistivityConductivitySettingFlag1 = bit[0];
|
ElectricResistivityConductivitySettingFlag2 = bit[1];
|
Reserve2 = bit[2];
|
Reserve3 = bit[3];
|
Reserve4 = bit[4];
|
Reserve5 = bit[5];
|
Reserve6 = bit[6];
|
Reserve7 = bit[7];
|
Reserve8 = bit[8];
|
Reserve9 = bit[9];
|
Reserve10 = bit[10];
|
Reserve11 = bit[11];
|
Reserve12 = bit[12];
|
Reserve13 = bit[13];
|
Reserve14 = bit[14];
|
Reserve15 = bit[15];
|
}
|
}
|
|
Equipment _equipment;
|
|
public StatusFlag1 statusFlag1 = new StatusFlag1();
|
public AlarmFlag1 alarmFlag1 = new AlarmFlag1();
|
public AlarmFlag2 alarmFlag2 = new AlarmFlag2();
|
public AlarmFlag3 alarmFlag3 = new AlarmFlag3();
|
public StatusFlag2 statusFlag2 = new StatusFlag2();
|
|
private float _circulatingFluidDischargeTemperature;
|
private float _circulatingFluidDischargePressure;
|
private float _electricResistivity;
|
private float _circulatingFluidSetTemperature;
|
|
private Thread t_statusUpdate;
|
|
public float CirculatingFluidDischargeTemperature
|
{
|
get
|
{
|
return _circulatingFluidDischargeTemperature;
|
}
|
|
private set
|
{
|
_circulatingFluidDischargeTemperature = value;
|
}
|
}
|
|
public float CirculatingFluidDischargePressure
|
{
|
get
|
{
|
return _circulatingFluidDischargePressure;
|
}
|
|
private set
|
{
|
_circulatingFluidDischargePressure = value;
|
}
|
}
|
|
public float ElectricResistivity
|
{
|
get
|
{
|
return _electricResistivity;
|
}
|
|
private set
|
{
|
_electricResistivity = value;
|
}
|
}
|
|
public float CirculatingFluidSetTemperature
|
{
|
get
|
{
|
return _circulatingFluidSetTemperature;
|
}
|
|
private set
|
{
|
_circulatingFluidSetTemperature = value;
|
}
|
}
|
|
public Chiller(Equipment equipment)
|
{
|
_equipment = equipment;
|
|
serialPort.PortName = "COM10";
|
serialPort.BaudRate = 19200;
|
serialPort.Parity = System.IO.Ports.Parity.Even;
|
serialPort.DataBits = 7;
|
serialPort.StopBits = System.IO.Ports.StopBits.One;
|
serialPort.ReadTimeout = 500;
|
ReceiveWaitSeconds = 0.1;
|
|
Terminator = "\r\n";
|
|
t_statusUpdate = new Thread(statusUpdate);
|
t_statusUpdate.Start();
|
}
|
|
public void statusUpdate()
|
{
|
while (_equipment.IsDisposed == false)
|
{
|
try
|
{
|
Thread.Sleep(500);
|
|
if (IsOpen)
|
{
|
// Todo. Command 설정.
|
GetStatus();
|
AlarmCheck();
|
}
|
else
|
{
|
if (_equipment.alarmManager.OccurredAlarms.Exists(x => x.Code == AlarmCode.AL_0061_CHILLER_DISCONNECTED))
|
{
|
|
}
|
else
|
{
|
if (Open() == false)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0061_CHILLER_DISCONNECTED);
|
}
|
}
|
}
|
}
|
catch (Exception e)
|
{
|
EquipmentLogManager.Instance.WriteExceptionLog(e.StackTrace);
|
}
|
}
|
}
|
|
public void Run()
|
{
|
string command = ":0106000C0001EC\r\n";
|
|
string data = WriteRead(command);
|
}
|
|
public void Stop()
|
{
|
string command = ":0106000C0000EB\r\n";
|
|
string data = WriteRead(command);
|
}
|
|
public void GetStatus()
|
{
|
// Todo. Read Registry가 이상함;; 재확인 필요.
|
// 0000 부터 000C 까지 읽음.
|
string command = ":01030000000DEF\r\n";
|
|
string data = WriteRead(command);
|
|
if(data == string.Empty)
|
{
|
return;
|
}
|
data = data.Replace(":", "");
|
//data = "01031A00B4000000180000000100000000000000000000000000B4000160";
|
string code = data.Substring(0, 2);
|
string function = data.Substring(2, 2);
|
|
//수정
|
string byteCount = data.Substring(4, 2);
|
|
string dischargeTemperature = data.Substring(6, 4);
|
string reserved1 = data.Substring(10, 4);
|
string dischargePressure = data.Substring(14, 4);
|
string electricResistivityFluid = data.Substring(18, 4);
|
string statusFlag1 = data.Substring(22, 4);
|
string alarmFlag1 = data.Substring(26, 4);
|
string alarmFlag2 = data.Substring(30, 4);
|
string alarmFlag3 = data.Substring(34, 4);
|
string reserved2 = data.Substring(38, 4);
|
string statusFlag2 = data.Substring(42, 4);
|
string reserved3 = data.Substring(46, 4);
|
string circulatingTemperature = data.Substring(50, 4);
|
string commandToRun = data.Substring(54, 4);
|
|
int fluidDischargeTemperature = int.Parse(dischargeTemperature, NumberStyles.HexNumber);
|
int fluidDischargePressure = int.Parse(dischargePressure, NumberStyles.HexNumber);
|
int electricResistivity = int.Parse(electricResistivityFluid, NumberStyles.HexNumber);
|
int fluidSetTemperature = int.Parse(circulatingTemperature, NumberStyles.HexNumber);
|
int dd = int.Parse(reserved1, NumberStyles.HexNumber);
|
|
CirculatingFluidDischargeTemperature = fluidDischargeTemperature * 0.1f;
|
CirculatingFluidDischargePressure = fluidDischargePressure * 0.01f;
|
ElectricResistivity = electricResistivity * 0.1f;
|
CirculatingFluidSetTemperature = fluidSetTemperature * 0.1f;
|
|
SetStatusFlag1(statusFlag1);
|
SetStatusFlag2(statusFlag2);
|
|
SetAlarmFlag1(alarmFlag1);
|
SetAlarmFlag2(alarmFlag2);
|
SetAlarmFlag3(alarmFlag3);
|
}
|
|
private void SetStatusFlag1(string statusFlag1)
|
{
|
int integerStatusFlag = int.Parse(statusFlag1, NumberStyles.HexNumber);
|
byte[] status = BitConverter.GetBytes(integerStatusFlag);
|
|
this.statusFlag1.SetData(status);
|
}
|
|
private void SetStatusFlag2(string statusFlag2)
|
{
|
int integerStatusFlag = int.Parse(statusFlag2, NumberStyles.HexNumber);
|
byte[] status = BitConverter.GetBytes(integerStatusFlag);
|
|
this.statusFlag2.SetData(status);
|
}
|
|
private void SetAlarmFlag1(string alarmFlag1)
|
{
|
int integerAlarmFlag = int.Parse(alarmFlag1, NumberStyles.HexNumber);
|
byte[] alarms = BitConverter.GetBytes(integerAlarmFlag);
|
|
this.alarmFlag1.SetData(alarms);
|
}
|
|
private void SetAlarmFlag2(string alarmFlag2)
|
{
|
int integerAlarmFlag = int.Parse(alarmFlag2, NumberStyles.HexNumber);
|
byte[] alarms = BitConverter.GetBytes(integerAlarmFlag);
|
|
this.alarmFlag2.SetData(alarms);
|
}
|
|
private void SetAlarmFlag3(string alarmFlag3)
|
{
|
int integerAlarmFlag = int.Parse(alarmFlag3, NumberStyles.HexNumber);
|
byte[] alarms = BitConverter.GetBytes(integerAlarmFlag);
|
|
this.alarmFlag3.SetData(alarms);
|
}
|
|
public void AlarmCheck()
|
{
|
// Alarm 1
|
if(alarmFlag1.LowLevelInTank)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0400_CHILLER_LOW_LEVEL_IN_TANK);
|
}
|
if (alarmFlag1.HighCirculatingFluidDischargeTemp)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0401_CHILLER_HIGH_CIRCULATING_FLUID_DISCHARGE_TEMP);
|
}
|
if (alarmFlag1.CirculatingFluidDischargeTempRise)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0402_CHILLER_CIRCULATING_FLUID_DISCHARGE_TEMP_RISE);
|
}
|
if (alarmFlag1.CirculatingFluidDischargeTempDrop)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0403_CHILLER_CIRCULATING_FLUID_DISCHARGE_TEMP_DROP);
|
}
|
if (alarmFlag1.HighCirculatingFluidReturnTemp)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0404_CHILLER_HIGH_CIRCULATING_FLUID_RETURN_TEMP);
|
}
|
if (alarmFlag1.HighCirculatingFluidDischargePressure)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0405_CHILLER_HIGH_CIRCULATING_FLUID_DISCHARGE_PRESSURE);
|
}
|
if (alarmFlag1.AbnormalPumpOperation)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0406_CHILLER_ABNORMAL_PUMP_OPERATION);
|
}
|
if (alarmFlag1.CirculatingFluidDischargePressureRise)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0407_CHILLER_CIRCULATING_FLUID_DISCHARGE_PRESSURE_RISE);
|
}
|
if (alarmFlag1.CirculatingFluidDischargePressureDrop)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0408_CHILLER_CIRCULATING_FLUID_DISCHARGE_PRESSURE_DROP);
|
}
|
if (alarmFlag1.HighCompressorIntakeTemp)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0409_CHILLER_HIGH_COMPRESSOR_INTANK_TEMP);
|
}
|
if (alarmFlag1.LowCompressorIntakeTemp)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0410_CHILLER_LOW_COMPRESSOR_INTANK_TEMP);
|
}
|
if (alarmFlag1.LowSuperHeatTemperature)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0411_CHILLER_LOW_SUPER_HEAT_TEMPERATURE);
|
}
|
if (alarmFlag1.HighCompressorDischargePressure)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0412_CHILLER_HIGH_COMPRESSOR_DISCHARGE_PRESSURE);
|
}
|
if (alarmFlag1.RefrigerantCircuitHighPressureDrop)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0413_CHILLER_REFRIGERANT_CIRCUIT_HIGH_PRESSURE_DROP);
|
}
|
if (alarmFlag1.RefrigerantCircuitLowPressureRise)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0414_CHILLER_REFRIGERANT_CIRCUIT_LOW_PRESSURE_RISE);
|
}
|
|
// Alarm 2
|
if(alarmFlag2.RefrigerantCircuitLowPressureDrop)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0415_CHILLER_REFRIGERANT_CIRCUIT_LOW_PRESSURE_DROP);
|
}
|
if (alarmFlag2.CompressorOverload)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0416_CHILLER_COMPRESSOR_OVER_LOAD);
|
}
|
if (alarmFlag2.CommunicationError)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0417_CHILLER_COMMUNICATION_ERROR);
|
}
|
if (alarmFlag2.MemoryError)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0418_CHILLER_MEMORY_ERROR);
|
}
|
if (alarmFlag2.DcLineFuseCut)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0419_CHILLER_DC_LINE_FUSE_CUT);
|
}
|
if (alarmFlag2.CirculatingFluidDischargeTempSensorFailure)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0420_CHILLER_CIRCULATING_FLUID_DISCHARGE_TEMP_SENSOR_FAILURE);
|
}
|
if (alarmFlag2.CirculatingFluidReturnTempSensorFailure)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0421_CHILLER_CIRCULATING_FLUID_TEMP_SENSOR_FAILURE);
|
}
|
if (alarmFlag2.CompressorIntankTempSensorFailure)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0422_CHILLER_COMPRESSOR_INTANK_TEMP_SENSOR_FAILURE);
|
}
|
if (alarmFlag2.CirculatingFluidDischargePressureSensorFailure)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0423_CHILLER_CIRCULATING_FLUID_DISCHARGE_PRESSURE_SENSOR_FAILURE);
|
}
|
if (alarmFlag2.CompressorDischargePressureSensorFailure)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0424_CHILLER_COMPRESSOR_DISCHARGE_PRESSURE_SENSOR_FAILURE);
|
}
|
if (alarmFlag2.CompressorIntankPressureSensorFailure)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0425_CHILLER_COMPRESSOR_INTANK_PRESSURE_SENSOR_FAILURE);
|
}
|
if (alarmFlag2.MaintenanceOfPump)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0426_CHILLER_MAINTENANCE_OF_PUMP);
|
}
|
if (alarmFlag2.MaintenanceOfFanMotor)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0427_CHILLER_MAINTENENCE_OF_FAN_MOTOR);
|
}
|
if (alarmFlag2.MaintenanceOfCompressor)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0428_CHILLER_MAINTENENCE_OF_COMPRESSOR);
|
}
|
if (alarmFlag2.ContactInput1SignalDetectionAlarm)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0429_CHILLER_CONTACT_INPUT_1_SIGNAL_DETECTION_ALARM);
|
}
|
if (alarmFlag2.ContactInput2SignalDetectionAlarm)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0430_CHILLER_CONTACT_INPUT_2_SIGNAL_DETECTION_ALARM);
|
}
|
|
// Alarm 3
|
if(alarmFlag3.WaterLeakage)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0431_CHILLER_WATER_LEAKAGE);
|
}
|
if (alarmFlag3.ElectricResistivityConductivityLevelRise)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0432_CHILLER_ELECTRIC_RESISTIVITY_COMDUCTIVITY_LEVEL_RISE);
|
}
|
if (alarmFlag3.ElectricResistivityConductivityLevelDrop)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0433_CHILLER_ELECTRIC_RESISTIVITY_COMDUCTIVITY_LEVEL_DROP);
|
}
|
if (alarmFlag3.ElectricResistivityConductivitySensorError)
|
{
|
_equipment.alarmManager.Occur(AlarmCode.AL_0434_CHILLER_ELECTRIC_RESISTIVITY_COMDUCTIVITY_SENSOR_ERROR);
|
}
|
}
|
|
public byte GetLRC(byte[] datas)
|
{
|
byte LRC = 0x05;
|
|
return LRC;
|
}
|
}
|
}
|