초기 커밋.
This commit is contained in:
136
LFP_Manager_PRM/DataStructure/csCanConstData.cs
Normal file
136
LFP_Manager_PRM/DataStructure/csCanConstData.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace LFP_Manager.DataStructure
|
||||
{
|
||||
public static class csCanConstData
|
||||
{
|
||||
public static class CanDeviceInfo
|
||||
{
|
||||
public const int VCI_PCI5121 = 1;
|
||||
public const int VCI_PCI9810 = 2;
|
||||
public const int VCI_USBCAN1 = 3;
|
||||
public const int VCI_USBCAN2 = 4;
|
||||
public const int VCI_USBCAN2A = 4;
|
||||
public const int VCI_PCI9820 = 5;
|
||||
public const int VCI_CAN232 = 6;
|
||||
public const int VCI_PCI5110 = 7;
|
||||
public const int VCI_CANLITE = 8;
|
||||
public const int VCI_ISA9620 = 9;
|
||||
public const int VCI_ISA5420 = 10;
|
||||
public const int VCI_PC104CAN = 11;
|
||||
public const int VCI_CANETUDP = 12;
|
||||
public const int VCI_CANETE = 12;
|
||||
public const int VCI_DNP9810 = 13;
|
||||
public const int VCI_PCI9840 = 14;
|
||||
public const int VCI_PC104CAN2 = 15;
|
||||
public const int VCI_PCI9820I = 16;
|
||||
public const int VCI_CANETTCP = 17;
|
||||
public const int VCI_PEC9920 = 18;
|
||||
public const int VCI_PCI5010U = 19;
|
||||
public const int VCI_USBCAN_E_U = 20;
|
||||
public const int VCI_USBCAN_2E_U = 21;
|
||||
public const int VCI_PCI5020U = 22;
|
||||
public const int VCI_EG20T_CAN = 23;
|
||||
public const int VCI_VALUE_CAN4_1 = 30;
|
||||
|
||||
private static readonly string[] _deviceNames = new[]
|
||||
{
|
||||
"PCI5121", "PCI9810", "USBCAN1", "USBCAN2", "USBCAN2A",
|
||||
"PCI9820", "CAN232", "PCI5110", "CANLITE", "ISA9620",
|
||||
"ISA5420", "PC104CAN", "CANETUDP", "CANETE", "DNP9810",
|
||||
"PCI9840", "PC104CAN2", "PCI9820I", "CANETTCP", "PEC9920",
|
||||
"PCI5010U", "USBCAN_E_U", "USBCAN_2E_U", "PCI5020U",
|
||||
"EG20T_CAN", "VALUE_CAN4-1"
|
||||
};
|
||||
|
||||
private static readonly int[] _deviceIds = new[]
|
||||
{
|
||||
1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 30
|
||||
};
|
||||
|
||||
public static string[] DeviceNames => _deviceNames;
|
||||
public static int[] DeviceIds => _deviceIds;
|
||||
}
|
||||
|
||||
public static class BaudRate
|
||||
{
|
||||
/// <summary>
|
||||
/// CAN 통신 속도 (bps)
|
||||
/// </summary>
|
||||
private static readonly int[] _baudRateInts = new[]
|
||||
{
|
||||
1000000, 800000, 500000, 250000, 125000,
|
||||
100000, 50000, 20000, 10000, 5000
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// CAN 통신 속도 설정값
|
||||
/// </summary>
|
||||
private static readonly int[] _baudRates = new[]
|
||||
{
|
||||
0x060003, // 1000Kbps
|
||||
0x060004, // 800Kbps
|
||||
0x060007, // 500Kbps
|
||||
0x1C0008, // 250Kbps
|
||||
0x1C0011, // 125Kbps
|
||||
0x160023, // 100Kbps
|
||||
0x1C002C, // 50Kbps
|
||||
0x1600B3, // 20Kbps
|
||||
0x1C00E0, // 10Kbps
|
||||
0x1C01C1 // 5Kbps
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// USBCAN II 전용 통신 속도 설정값 (Timer 0 + Timer 1)
|
||||
/// </summary>
|
||||
private static readonly int[] _baudRatesOther = new[]
|
||||
{
|
||||
0x0014, // 1000Kbps
|
||||
0x0016, // 800Kbps
|
||||
0x001C, // 500Kbps
|
||||
0x011C, // 250Kbps
|
||||
0x031C, // 125Kbps
|
||||
0x041C, // 100Kbps
|
||||
0x091C, // 50Kbps
|
||||
0x181C, // 20Kbps
|
||||
0x311C, // 10Kbps
|
||||
0xBFFF // 5Kbps
|
||||
};
|
||||
|
||||
private static readonly string[] _baudRateStrings = new[]
|
||||
{
|
||||
"1000Kbps", "800Kbps", "500Kbps", "250Kbps", "125Kbps",
|
||||
"100Kbps", "50Kbps", "20Kbps", "10Kbps", "5Kbps"
|
||||
};
|
||||
|
||||
public static int[] BaudRateInts => _baudRateInts;
|
||||
public static int[] BaudRates => _baudRates;
|
||||
public static int[] BaudRatesOther => _baudRatesOther;
|
||||
public static string[] BaudRateStrings => _baudRateStrings;
|
||||
}
|
||||
|
||||
public static class SendType
|
||||
{
|
||||
public const int Normal = 0;
|
||||
public const int Single_Normal = 1;
|
||||
public const int Loop_Back = 2;
|
||||
public const int Single_Loop_Back = 3;
|
||||
}
|
||||
|
||||
public static class FrameType
|
||||
{
|
||||
public const int Standard = 0;
|
||||
public const int Extended = 1;
|
||||
}
|
||||
|
||||
public static class FrameFormat
|
||||
{
|
||||
public const int Data_Frame = 0;
|
||||
public const int Remote_Frame = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
113
LFP_Manager_PRM/DataStructure/csConstData.cs
Normal file
113
LFP_Manager_PRM/DataStructure/csConstData.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace LFP_Manager.DataStructure
|
||||
{
|
||||
public static class csConstData
|
||||
{
|
||||
public static class SystemInfo
|
||||
{
|
||||
public const int MAX_MODULE_CELL_SIZE = 36;
|
||||
public const int MAX_MODULE_TEMP_SIZE = 16;
|
||||
public const int CELL_MAX_PER_IC = 18;
|
||||
}
|
||||
|
||||
public static class Unit
|
||||
{
|
||||
public const int CELL_DIV_P3 = 1000;
|
||||
public const int CELL_DIV_P4 = 10000;
|
||||
|
||||
public const string CELL_DIS_P3 = "{0:0.000}";
|
||||
public const string CELL_DIS_P4 = "{0:0.0000}";
|
||||
}
|
||||
|
||||
public static class CommType
|
||||
{
|
||||
public const int COMM_SNMP = 0;
|
||||
public const int COMM_UARTCAN = 1;
|
||||
public const int COMM_USBCAN = 2;
|
||||
|
||||
public static readonly string[] UartCAN_Speed = new[]
|
||||
{
|
||||
"9600",
|
||||
"19200",
|
||||
"38400",
|
||||
"57600",
|
||||
"115200",
|
||||
"230400",
|
||||
"460800",
|
||||
};
|
||||
|
||||
public static readonly string[] UART_MODEL = new[]
|
||||
{
|
||||
"LFPS-48150",
|
||||
};
|
||||
|
||||
public static readonly string[] CAN_MODEL = new[]
|
||||
{
|
||||
"PR-57150",
|
||||
"PR-64150",
|
||||
"LFPM-57080",
|
||||
"PR-102150",
|
||||
"PR-115300",
|
||||
"PR-67150",
|
||||
};
|
||||
}
|
||||
|
||||
public static class ResetFlag
|
||||
{
|
||||
public const ushort SystemReset = 0x0001;
|
||||
public const ushort LcdHistoryDelete = 0x0002;
|
||||
}
|
||||
|
||||
public static class CRC
|
||||
{
|
||||
private static readonly byte[] _auchCRCHi =
|
||||
{
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
|
||||
0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01,
|
||||
0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
|
||||
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01,
|
||||
0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
|
||||
0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01,
|
||||
0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
|
||||
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01,
|
||||
0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81,0x40
|
||||
};
|
||||
|
||||
private static readonly byte[] _auchCRCLo =
|
||||
{
|
||||
0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7, 0x05, 0xC5, 0xC4,
|
||||
0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09,
|
||||
0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD,
|
||||
0x1D, 0x1C, 0xDC, 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3,
|
||||
0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32, 0x36, 0xF6, 0xF7,
|
||||
0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A,
|
||||
0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA, 0xEE,
|
||||
0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26,
|
||||
0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1, 0x63, 0xA3, 0xA2,
|
||||
0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4, 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F,
|
||||
0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, 0xB9, 0x79, 0xBB,
|
||||
0x7B, 0x7A, 0xBA, 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5,
|
||||
0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0, 0x50, 0x90, 0x91,
|
||||
0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C,
|
||||
0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, 0x88,
|
||||
0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C,
|
||||
0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80,0x40
|
||||
};
|
||||
|
||||
public static byte[] AuchCRCHi => _auchCRCHi;
|
||||
public static byte[] AuchCRCLo => _auchCRCLo;
|
||||
}
|
||||
}
|
||||
}
|
||||
732
LFP_Manager_PRM/DataStructure/csDataStructure.cs
Normal file
732
LFP_Manager_PRM/DataStructure/csDataStructure.cs
Normal file
@@ -0,0 +1,732 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LFP_Manager.DataStructure
|
||||
{
|
||||
public class CommConfig
|
||||
{
|
||||
public string AppPath;
|
||||
public string mSN;
|
||||
|
||||
public int CommType;
|
||||
|
||||
public int TargetModelIndex;
|
||||
|
||||
public string SnmpIP;
|
||||
public int SnmpModelIndex;
|
||||
public int SnmpMdQty;
|
||||
|
||||
public string UartPort;
|
||||
public int UartBaudrate;
|
||||
public int UartModelIndex;
|
||||
|
||||
public int CanDevice;
|
||||
public int CanIndex;
|
||||
public int CanNo;
|
||||
public int CanBaudrate;
|
||||
|
||||
public int DbLogPeriod;
|
||||
|
||||
public int CbTestGap;
|
||||
public int CbTestTime;
|
||||
|
||||
public CommConfig()
|
||||
{
|
||||
CommType = 0;
|
||||
TargetModelIndex = 0;
|
||||
SnmpIP = "";
|
||||
SnmpModelIndex = 0;
|
||||
SnmpMdQty = 0;
|
||||
UartPort = "";
|
||||
UartBaudrate = 0;
|
||||
UartModelIndex = 0;
|
||||
CanDevice = 0;
|
||||
CanIndex = 0;
|
||||
CanNo = 0;
|
||||
CanBaudrate = 0;
|
||||
|
||||
DbLogPeriod = 5;
|
||||
|
||||
CbTestGap = 1500;
|
||||
CbTestTime = 3000;
|
||||
}
|
||||
}
|
||||
|
||||
public class TMinMax
|
||||
{
|
||||
public short value;
|
||||
public short num;
|
||||
|
||||
public TMinMax()
|
||||
{
|
||||
value = 0;
|
||||
num = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceSystemTotalData
|
||||
{
|
||||
public bool CommFail;
|
||||
|
||||
public DeviceValueTotalData ValueData;
|
||||
public DeviceStatusTotalData StatusData;
|
||||
public DeviceAvgData AvgData;
|
||||
|
||||
public DeviceSystemTotalData()
|
||||
{
|
||||
CommFail = false;
|
||||
ValueData = new DeviceValueTotalData();
|
||||
StatusData = new DeviceStatusTotalData();
|
||||
AvgData = new DeviceAvgData();
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceSystemData
|
||||
{
|
||||
public int mNo;
|
||||
public int cellQty;
|
||||
public int tempQty;
|
||||
public UInt32 heatbeat;
|
||||
public int OneBuffTime;
|
||||
public int AllBuffTime;
|
||||
public bool CommFail;
|
||||
public bool ShelfCommFail;
|
||||
public DateTime LastRxTime;
|
||||
|
||||
public DeviceValueData ValueData;
|
||||
public DeviceAvgData AvgData;
|
||||
public DeviceStatusData StatusData;
|
||||
public DeviceParamData ParamData;
|
||||
public DeviceCalibration CalibriationData;
|
||||
|
||||
public DeviceInforation Information;
|
||||
public DeviceSystemData()
|
||||
{
|
||||
mNo = 0;
|
||||
heatbeat = 0;
|
||||
OneBuffTime = 0;
|
||||
AllBuffTime = 0;
|
||||
CommFail = false;
|
||||
ShelfCommFail = false;
|
||||
LastRxTime = new DateTime();
|
||||
|
||||
ValueData = new DeviceValueData();
|
||||
AvgData = new DeviceAvgData();
|
||||
StatusData = new DeviceStatusData();
|
||||
ParamData = new DeviceParamData();
|
||||
CalibriationData = new DeviceCalibration();
|
||||
|
||||
Information = new DeviceInforation();
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceValueTotalData
|
||||
{
|
||||
public short TotalVoltage;
|
||||
public short TotalCurrent;
|
||||
public short TotalSOC;
|
||||
public short TotalTemp;
|
||||
|
||||
public DeviceValueTotalData()
|
||||
{
|
||||
TotalVoltage = 0;
|
||||
TotalCurrent = 0;
|
||||
TotalSOC = 0;
|
||||
TotalTemp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceValueData
|
||||
{
|
||||
public byte[] fw_ver;
|
||||
|
||||
public short voltageOfPack;
|
||||
public short current;
|
||||
public short averageCurrent;
|
||||
public short rSOC;
|
||||
|
||||
public ushort[] CellVoltage;
|
||||
public short[] CellTemperature;
|
||||
|
||||
public short CpuTemperature;
|
||||
public short FetTemperature;
|
||||
|
||||
public short remainingCapacity;
|
||||
public short stateOfHealth;
|
||||
public short cycleCount;
|
||||
public short fullChargeCapacity;
|
||||
public short designedCapacity;
|
||||
public DeviceValueData()
|
||||
{
|
||||
fw_ver = new byte[4];
|
||||
|
||||
voltageOfPack = 0;
|
||||
current = 0;
|
||||
averageCurrent = 0;
|
||||
rSOC = 0;
|
||||
|
||||
CellVoltage = new ushort[csConstData.SystemInfo.MAX_MODULE_CELL_SIZE];
|
||||
CellTemperature = new short[csConstData.SystemInfo.MAX_MODULE_TEMP_SIZE];
|
||||
|
||||
CpuTemperature = 0;
|
||||
FetTemperature = 0;
|
||||
|
||||
remainingCapacity = 0;
|
||||
stateOfHealth = 0;
|
||||
cycleCount = 0;
|
||||
fullChargeCapacity = 0;
|
||||
designedCapacity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceAvgData
|
||||
{
|
||||
public ushort maxCellVoltage;
|
||||
public ushort minCellVoltage;
|
||||
public ushort avgCellVoltage;
|
||||
public ushort diffCellVoltage;
|
||||
public short maxCellNum;
|
||||
public short minCellNum;
|
||||
public short maxTemp;
|
||||
public short minTemp;
|
||||
public short avgTemp;
|
||||
public short diffTemp;
|
||||
public short maxTempNum;
|
||||
public short minTempNum;
|
||||
public DeviceAvgData()
|
||||
{
|
||||
maxCellVoltage = 0;
|
||||
minCellVoltage = 0;
|
||||
avgCellVoltage = 0;
|
||||
diffCellVoltage = 0;
|
||||
maxCellNum = 0;
|
||||
minCellNum = 0;
|
||||
maxTemp = 0;
|
||||
minTemp = 0;
|
||||
avgTemp = 0;
|
||||
diffTemp = 0;
|
||||
maxTempNum = 0;
|
||||
minTempNum = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceStatusTotalData
|
||||
{
|
||||
public short batteryStatus;
|
||||
public short warning;
|
||||
public short protect;
|
||||
public short status;
|
||||
|
||||
public DeviceStatusTotalData()
|
||||
{
|
||||
batteryStatus = 0;
|
||||
warning = 0;
|
||||
protect = 0;
|
||||
status = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceStatusData
|
||||
{
|
||||
public short batteryStatusA;
|
||||
public short batteryStatusB;
|
||||
public short warning;
|
||||
public short protect;
|
||||
public short protect1;
|
||||
public short status;
|
||||
public short alarm;
|
||||
public short relayStatus;
|
||||
public uint cellBallanceStatusLv;
|
||||
public uint cellBallanceStatusHv;
|
||||
public ushort cellBalanceValue;
|
||||
|
||||
public uint BalanceEnable;
|
||||
public uint BalanceMode;
|
||||
|
||||
public short cellBalanceInterval;
|
||||
public short cellBalanceEndGap;
|
||||
public short cellBalanceFlag;
|
||||
public DeviceStatusData()
|
||||
{
|
||||
batteryStatusA = 0;
|
||||
batteryStatusB = 0;
|
||||
warning = 0;
|
||||
protect = 0;
|
||||
protect1 = 0;
|
||||
status = 0;
|
||||
alarm = 0;
|
||||
relayStatus = 0;
|
||||
cellBallanceStatusLv = 0;
|
||||
cellBallanceStatusHv = 0;
|
||||
cellBalanceValue = 0;
|
||||
cellBalanceInterval = 0;
|
||||
cellBalanceEndGap = 0;
|
||||
cellBalanceFlag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceCommStatus
|
||||
{
|
||||
public DateTime LastRxTime;
|
||||
public bool CommFail;
|
||||
public DeviceCommStatus()
|
||||
{
|
||||
LastRxTime = new DateTime();
|
||||
CommFail = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceParamData
|
||||
{
|
||||
public short CellOverVoltageTrip;
|
||||
public short CellOverVoltageWarning;
|
||||
public short CellOverVoltageRelease;
|
||||
public short CellUnderVoltageTrip;
|
||||
public short CellUnderVoltageWarning;
|
||||
public short CellUnderVoltageRelease;
|
||||
|
||||
public short SysOverVoltageTrip;
|
||||
public short SysOverVoltageWarning;
|
||||
public short SysOverVoltageRelease;
|
||||
public short SysUnderVoltageTrip;
|
||||
public short SysUnderVoltageWarning;
|
||||
public short SysUnderVoltageRelease;
|
||||
|
||||
public short ChaHighTempTrip;
|
||||
public short ChaHighTempWarning;
|
||||
public short ChaHighTempRelease;
|
||||
public short ChaLowTempTrip;
|
||||
public short ChaLowTempWarning;
|
||||
public short ChaLowTempRelease;
|
||||
public short DchHighTempTrip;
|
||||
public short DchHighTempWarning;
|
||||
public short DchHighTempRelease;
|
||||
public short DchLowTempTrip;
|
||||
public short DchLowTempWarning;
|
||||
public short DchLowTempRelease;
|
||||
|
||||
public short ChaOverCurrentTrip;
|
||||
public short ChaOverCurrentWarning;
|
||||
public short ChaOverCurrentRelease;
|
||||
public short DchOverCurrentTrip;
|
||||
public short DchOverCurrentWarning;
|
||||
public short DchOverCurrentRelease;
|
||||
|
||||
public short LowSocTrip;
|
||||
public short LowSocWarning;
|
||||
public short LowSocRelease;
|
||||
|
||||
public short CellVoltageDifferenceTrip;
|
||||
public short CellVoltageDifferenceWarning;
|
||||
public short CellVoltageDifferenceRelease;
|
||||
public short CellVoltageDifferenceTime;
|
||||
|
||||
public short DefalutParamOption;
|
||||
public short DefalutParamAll;
|
||||
public DeviceParamData()
|
||||
{
|
||||
CellOverVoltageTrip = 0;
|
||||
CellOverVoltageWarning = 0;
|
||||
CellOverVoltageRelease = 0;
|
||||
CellUnderVoltageTrip = 0;
|
||||
CellUnderVoltageWarning = 0;
|
||||
CellUnderVoltageRelease = 0;
|
||||
|
||||
SysOverVoltageTrip = 0;
|
||||
SysOverVoltageWarning = 0;
|
||||
SysOverVoltageRelease = 0;
|
||||
SysUnderVoltageTrip = 0;
|
||||
SysUnderVoltageWarning = 0;
|
||||
SysUnderVoltageRelease = 0;
|
||||
|
||||
ChaHighTempTrip = 0;
|
||||
ChaHighTempWarning = 0;
|
||||
ChaHighTempRelease = 0;
|
||||
ChaLowTempTrip = 0;
|
||||
ChaLowTempWarning = 0;
|
||||
ChaLowTempRelease = 0;
|
||||
DchHighTempTrip = 0;
|
||||
DchHighTempWarning = 0;
|
||||
DchHighTempRelease = 0;
|
||||
DchLowTempTrip = 0;
|
||||
DchLowTempWarning = 0;
|
||||
DchLowTempRelease = 0;
|
||||
|
||||
ChaOverCurrentTrip = 0;
|
||||
ChaOverCurrentWarning = 0;
|
||||
ChaOverCurrentRelease = 0;
|
||||
DchOverCurrentTrip = 0;
|
||||
DchOverCurrentWarning = 0;
|
||||
DchOverCurrentRelease = 0;
|
||||
|
||||
LowSocTrip = 0;
|
||||
LowSocWarning = 0;
|
||||
LowSocRelease = 0;
|
||||
|
||||
CellVoltageDifferenceTrip = 0;
|
||||
CellVoltageDifferenceWarning = 0;
|
||||
CellVoltageDifferenceRelease = 0;
|
||||
CellVoltageDifferenceTime = 0;
|
||||
|
||||
DefalutParamOption = 0;
|
||||
DefalutParamAll = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceCalibration
|
||||
{
|
||||
public CellVoltageCalib CellVoltge;
|
||||
public SystemVoltageCalib SystemVoltage;
|
||||
public ForcedBalControl ForcedBalancing;
|
||||
public ForcedBalControl2 ForcedBalancing2; // For PR-57150
|
||||
public BatteryParameter Battery;
|
||||
public CurrentCalib Current;
|
||||
public SystemInfor SystemInfo;
|
||||
public SocCalibration SocCalib;
|
||||
public TCbParam CbParam;
|
||||
|
||||
public DeviceInforation InvData;
|
||||
|
||||
public short CellBalancingVoltage;
|
||||
public short CellBalancingVoltageInterval;
|
||||
public short CellBalancingVoltageEndGap;
|
||||
|
||||
public DeviceCalibration()
|
||||
{
|
||||
CellVoltge = new CellVoltageCalib();
|
||||
SystemVoltage = new SystemVoltageCalib();
|
||||
ForcedBalancing = new ForcedBalControl();
|
||||
ForcedBalancing2 = new ForcedBalControl2(); // For PR-57150
|
||||
Battery = new BatteryParameter();
|
||||
Current = new CurrentCalib();
|
||||
SystemInfo = new SystemInfor();
|
||||
SocCalib = new SocCalibration();
|
||||
CbParam = new TCbParam();
|
||||
|
||||
InvData = new DeviceInforation();
|
||||
|
||||
CellBalancingVoltage = 0;
|
||||
CellBalancingVoltageInterval = 0;
|
||||
CellBalancingVoltageEndGap = 0;
|
||||
}
|
||||
public DeviceCalibration DeepCopy()
|
||||
{
|
||||
DeviceCalibration newCopy = new DeviceCalibration
|
||||
{
|
||||
CellVoltge = CellVoltge,
|
||||
SystemVoltage = SystemVoltage,
|
||||
ForcedBalancing = ForcedBalancing.DeepCopy(),
|
||||
Battery = Battery,
|
||||
Current = Current,
|
||||
SystemInfo = SystemInfo,
|
||||
SocCalib = SocCalib,
|
||||
CbParam = CbParam.DeepCopy(),
|
||||
|
||||
InvData = InvData,
|
||||
|
||||
CellBalancingVoltage = CellBalancingVoltage,
|
||||
CellBalancingVoltageInterval = CellBalancingVoltageInterval,
|
||||
CellBalancingVoltageEndGap = CellBalancingVoltageEndGap,
|
||||
};
|
||||
return newCopy;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class DeviceInforation
|
||||
{
|
||||
public UInt32 ManufactureDate;
|
||||
public byte[] pcb_sn;
|
||||
public byte[] module_sn;
|
||||
public DeviceInforation()
|
||||
{
|
||||
ManufactureDate = 0;
|
||||
pcb_sn = new byte[16];
|
||||
module_sn = new byte[32];
|
||||
}
|
||||
}
|
||||
|
||||
public class CellVoltageCalib
|
||||
{
|
||||
public short CvOffsetLow;
|
||||
public short CvOffsetHigh;
|
||||
public CellVoltageCalib()
|
||||
{
|
||||
CvOffsetLow = 0;
|
||||
CvOffsetHigh = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class SystemVoltageCalib
|
||||
{
|
||||
public short Calibration_K;
|
||||
public short Calibration_B;
|
||||
public SystemVoltageCalib()
|
||||
{
|
||||
Calibration_K = 0;
|
||||
Calibration_B = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class ForcedBalControl
|
||||
{
|
||||
public short Control;
|
||||
public short CellNo;
|
||||
public bool AutoB;
|
||||
public bool DCP;
|
||||
public ForcedBalControl()
|
||||
{
|
||||
Control = 0;
|
||||
CellNo = 0;
|
||||
AutoB = false;
|
||||
DCP = false;
|
||||
}
|
||||
public ForcedBalControl DeepCopy()
|
||||
{
|
||||
ForcedBalControl newCopy = new ForcedBalControl()
|
||||
{
|
||||
Control = Control,
|
||||
CellNo = CellNo,
|
||||
AutoB = AutoB,
|
||||
DCP = DCP
|
||||
};
|
||||
return newCopy;
|
||||
}
|
||||
}
|
||||
|
||||
public class ForcedBalControl2
|
||||
{
|
||||
public int Control;
|
||||
public int CellNo;
|
||||
public int Mode;
|
||||
public int Enable;
|
||||
public ForcedBalControl2()
|
||||
{
|
||||
Control = 0;
|
||||
CellNo = 0;
|
||||
Mode = 0;
|
||||
Enable = 0;
|
||||
}
|
||||
public ForcedBalControl2 DeepCopy()
|
||||
{
|
||||
ForcedBalControl2 newCopy = new ForcedBalControl2()
|
||||
{
|
||||
Control = Control,
|
||||
CellNo = CellNo,
|
||||
Mode = Mode,
|
||||
Enable = Enable
|
||||
};
|
||||
return newCopy;
|
||||
}
|
||||
}
|
||||
|
||||
public class BatteryParameter
|
||||
{
|
||||
public short CellQty;
|
||||
public short TempQty;
|
||||
public UInt32 Capacity;
|
||||
public BatteryParameter()
|
||||
{
|
||||
CellQty = 0;
|
||||
TempQty = 0;
|
||||
Capacity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class CurrentCalib
|
||||
{
|
||||
public short SelectSubItem;
|
||||
public short ShuntRange;
|
||||
public short CurrentZero;
|
||||
public short VoltageZero;
|
||||
public Int32 Calibration_K;
|
||||
public short ChaAndDchSelect;
|
||||
public short ChargeOption;
|
||||
public CurrentCalib()
|
||||
{
|
||||
SelectSubItem = 0;
|
||||
ShuntRange = 0;
|
||||
CurrentZero = 0;
|
||||
VoltageZero = 0;
|
||||
Calibration_K = 0;
|
||||
ChaAndDchSelect = 0;
|
||||
ChargeOption = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class SystemInfor
|
||||
{
|
||||
//public short Id;
|
||||
public DateTime devTime;
|
||||
public UInt16 devAddr;
|
||||
public SystemInfor()
|
||||
{
|
||||
devTime = new DateTime();
|
||||
devAddr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class SocCalibration
|
||||
{
|
||||
public short CellNo;
|
||||
public short SocValue;
|
||||
public SocCalibration()
|
||||
{
|
||||
CellNo = 0;
|
||||
SocValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class TCbParam
|
||||
{
|
||||
public short Threadhold;
|
||||
public short Window;
|
||||
public short Min;
|
||||
public short Interval;
|
||||
public TCbParam()
|
||||
{
|
||||
Threadhold = 0;
|
||||
Window = 0;
|
||||
Min = 0;
|
||||
Interval = 0;
|
||||
}
|
||||
public TCbParam DeepCopy()
|
||||
{
|
||||
TCbParam newCopy = new TCbParam
|
||||
{
|
||||
Threadhold = Threadhold,
|
||||
Window = Window,
|
||||
Min = Min,
|
||||
Interval = Interval
|
||||
};
|
||||
return newCopy;
|
||||
}
|
||||
}
|
||||
|
||||
public class DataFunction
|
||||
{
|
||||
public static void DataInit(ref DeviceSystemData sData, ref CommConfig sConfig)
|
||||
{
|
||||
sData.ShelfCommFail = true;
|
||||
|
||||
switch (sConfig.TargetModelIndex)
|
||||
{
|
||||
case 0: // PR-57150
|
||||
sData.cellQty = 18;
|
||||
sData.tempQty = 6;
|
||||
break;
|
||||
case 1: // PR-64150
|
||||
sData.cellQty = 20;
|
||||
sData.tempQty = 8;
|
||||
break;
|
||||
case 2: // LFPM-57080
|
||||
sData.cellQty = 18;
|
||||
sData.tempQty = 6;
|
||||
break;
|
||||
case 3: // PR-102150
|
||||
sData.cellQty = 32;
|
||||
sData.tempQty = 8;
|
||||
break;
|
||||
case 4: // PR-115300
|
||||
sData.cellQty = 36;
|
||||
sData.tempQty = 16;
|
||||
break;
|
||||
case 5: // PR-67150
|
||||
sData.cellQty = 21;
|
||||
sData.tempQty = 8;
|
||||
break;
|
||||
default:
|
||||
sData.cellQty = 18;
|
||||
sData.tempQty = 6;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int j = 0; j < csConstData.SystemInfo.MAX_MODULE_CELL_SIZE; j++)
|
||||
{
|
||||
sData.ValueData.CellVoltage[j] = 0;
|
||||
}
|
||||
for (int j = 0; j < csConstData.SystemInfo.MAX_MODULE_TEMP_SIZE; j++)
|
||||
{
|
||||
sData.ValueData.CellTemperature[j] = 0;
|
||||
}
|
||||
sData.ValueData.voltageOfPack = 0;
|
||||
sData.ValueData.current = 0;
|
||||
sData.ValueData.rSOC = 0;
|
||||
sData.AvgData.maxCellVoltage = 0;
|
||||
sData.AvgData.minCellVoltage = 0;
|
||||
sData.AvgData.avgCellVoltage = 0;
|
||||
sData.AvgData.maxTemp = 0;
|
||||
sData.AvgData.minTemp = 0;
|
||||
sData.AvgData.avgTemp = 0;
|
||||
sData.heatbeat = 0;
|
||||
sData.StatusData.warning = 0;
|
||||
sData.StatusData.protect = 0;
|
||||
}
|
||||
}
|
||||
public class TCanTxBuff
|
||||
{
|
||||
private const int BuffMax = 4096;
|
||||
public int InPos;
|
||||
public int OutPos;
|
||||
public TCanTRxData[] Buf;
|
||||
public TCanTxBuff()
|
||||
{
|
||||
InPos = 0;
|
||||
OutPos = 0;
|
||||
Buf = new TCanTRxData[BuffMax];
|
||||
for (int i = 0; i < BuffMax; i++)
|
||||
{
|
||||
Buf[i] = new TCanTRxData();
|
||||
}
|
||||
}
|
||||
|
||||
public void PutBuff(TCanTRxData CanTxData)
|
||||
{
|
||||
if (CanTxData != null)
|
||||
{
|
||||
Buf[InPos++] = CanTxData.DeepCopy();
|
||||
InPos %= BuffMax;
|
||||
}
|
||||
}
|
||||
public TCanTRxData GetBuff()
|
||||
{
|
||||
TCanTRxData result = null;
|
||||
|
||||
if (InPos != OutPos)
|
||||
{
|
||||
result = Buf[OutPos++].DeepCopy();
|
||||
OutPos %= BuffMax;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
public class TCanTRxData
|
||||
{
|
||||
public int type;
|
||||
public UInt32 exid;
|
||||
public byte[] data;
|
||||
|
||||
public TCanTRxData()
|
||||
{
|
||||
type = 0;
|
||||
exid = 0;
|
||||
data = new byte[8];
|
||||
}
|
||||
public TCanTRxData DeepCopy()
|
||||
{
|
||||
TCanTRxData newCopy = new TCanTRxData
|
||||
{
|
||||
exid = exid
|
||||
};
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
newCopy.data[i] = data[i];
|
||||
}
|
||||
return newCopy;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
67
LFP_Manager_PRM/DataStructure/csDbConstData.cs
Normal file
67
LFP_Manager_PRM/DataStructure/csDbConstData.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace LFP_Manager.DataStructure
|
||||
{
|
||||
class csDbConstData
|
||||
{
|
||||
public class DataBase
|
||||
{
|
||||
public static string FileName = @"\db\AlamrHistory.db";
|
||||
public static string TableName = "History";
|
||||
public static string CreateTable =
|
||||
"CREATE TABLE " + TableName + " ("
|
||||
+ "HTime DateTime NOT NULL, "
|
||||
+ "model varchar(10), "
|
||||
+ "sno int, "
|
||||
+ "alarm_name varchar(20), "
|
||||
+ "alarm_code int, "
|
||||
+ "flag_name varchar(20), "
|
||||
+ "flag int, "
|
||||
+ "param1 float, "
|
||||
+ "param2 float, "
|
||||
+ ");";
|
||||
}
|
||||
|
||||
public static readonly int ALARM_NAME_SIZE = 9;
|
||||
|
||||
public class DB_ALARM
|
||||
{
|
||||
public static int CELL_UNDER_VOLTAGE = 0;
|
||||
public static int CELL_OVER_VOLTAGE = 1;
|
||||
public static int SYSTEM_UNDER_VOLTAGE = 2;
|
||||
public static int SYSTEM_OVER_VOLTAGAE = 3;
|
||||
public static int HIGH_TEMPERATURE = 4;
|
||||
public static int LOW_TEMPERATURE = 5;
|
||||
public static int CHARGE_OVER_CURRENT = 6;
|
||||
public static int DISCHARGE_OVER_CURRENT = 7;
|
||||
public static int LOW_SOC = 8;
|
||||
|
||||
public static readonly string[] ALARM_NAME =
|
||||
{
|
||||
"CELL UNDER VOLTAGE",
|
||||
"CELL OVER VOLTAGE",
|
||||
"SYSTEM UNDER VOLTAGE",
|
||||
"SYSTEM OVER VOLTAGAE",
|
||||
"HIGH TEMPERATURE",
|
||||
"LOW TEMPERATURE",
|
||||
"CHARGE OVER CURRENT",
|
||||
"DISCHARGE OVER CURRENT",
|
||||
"LOW SOC",
|
||||
};
|
||||
|
||||
public static int FLAG_RELEASE = 0;
|
||||
public static int FLAG_WARNING = 1;
|
||||
public static int FLAG_TRIP = 2;
|
||||
|
||||
public static readonly string[] FLAG_NAME =
|
||||
{
|
||||
"RELEASE",
|
||||
"WARNING",
|
||||
"FAULT",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
203
LFP_Manager_PRM/DataStructure/csSbCanLibConstData.cs
Normal file
203
LFP_Manager_PRM/DataStructure/csSbCanLibConstData.cs
Normal file
@@ -0,0 +1,203 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LFP_Manager.DataStructure
|
||||
{
|
||||
/*************************************
|
||||
Serial Info Struct
|
||||
**************************************/
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct SerialConfigInfo
|
||||
{
|
||||
public UInt32 Baudrate;
|
||||
public byte data;
|
||||
public byte parity;
|
||||
public byte stop;
|
||||
public byte flow;
|
||||
}
|
||||
|
||||
enum DataBits
|
||||
{
|
||||
Data8 = 8,
|
||||
};
|
||||
|
||||
enum Parity
|
||||
{
|
||||
NoParity = 0,
|
||||
EvenParity = 2,
|
||||
OddParity = 3,
|
||||
SpaceParity = 4,
|
||||
MarkParity = 5
|
||||
};
|
||||
|
||||
enum StopBits
|
||||
{
|
||||
OneStop = 1,
|
||||
TwoStop = 2
|
||||
};
|
||||
|
||||
enum FlowControl
|
||||
{
|
||||
NoFlowControl,
|
||||
HardwareControl
|
||||
};
|
||||
|
||||
enum SerialBaudRate
|
||||
{
|
||||
SerialBaud300 = 300,
|
||||
SerialBaud600 = 600,
|
||||
SerialBaud1200 = 1200,
|
||||
SerialBaud2400 = 2400,
|
||||
SerialBaud3600 = 3600,
|
||||
SerialBaud4800 = 4800,
|
||||
SerialBaud7200 = 7200,
|
||||
SerialBaud9600 = 9600,
|
||||
SerialBaud19200 = 19200,
|
||||
SerialBaud38400 = 38400,
|
||||
SerialBaud57600 = 57600,
|
||||
SerialBaud115200 = 115200,
|
||||
SerialBaud230400 = 230400,
|
||||
SerialBaud460800 = 460800,
|
||||
SerialBaud921600 = 921600,
|
||||
SerialUnknownBaud = -1
|
||||
};
|
||||
|
||||
enum CANBaudRate
|
||||
{
|
||||
CANBaud20 = 20,
|
||||
CANBaud50 = 50,
|
||||
CANBaud100 = 100,
|
||||
CANBaud125 = 125,
|
||||
CANBaud200 = 200,
|
||||
CANBaud250 = 250,
|
||||
CANBaud300 = 300,
|
||||
CANBaud500 = 500,
|
||||
CANBaud800 = 800,
|
||||
CANBaud1000 = 1000,
|
||||
CANUnknownBaud = -1
|
||||
};
|
||||
|
||||
//public class csSbCanLibConstData
|
||||
//{
|
||||
/*************************************
|
||||
define
|
||||
**************************************/
|
||||
//public bool ISDAR(byte x)
|
||||
// {
|
||||
// return (x & 0x01) != 0x00;
|
||||
// }
|
||||
|
||||
//public bool ISABOR(byte x)
|
||||
// {
|
||||
// return (x & 0x02) != 0x00;
|
||||
//}
|
||||
|
||||
//public void SETDAR(ref byte x)
|
||||
// {
|
||||
// x |= 0x01;
|
||||
// }
|
||||
//public void SETABOR(ref byte x)
|
||||
//{
|
||||
// x |= 0x02;
|
||||
//}
|
||||
|
||||
//public const byte CR = 0x0D;
|
||||
|
||||
////Error Code
|
||||
//public const byte Invalid_Arg = 0x01;
|
||||
//public const byte No_Error = 0x00;
|
||||
|
||||
enum CAN_StructFormat
|
||||
{
|
||||
TX_STD_DATA = 0x14,
|
||||
TX_STD_REMOTE = 0x15,
|
||||
TX_EXT_DATA = 0x16,
|
||||
TX_EXT_REMOTE = 0x17,
|
||||
RX_STD_DATA = 0x04,
|
||||
RX_STD_REMOTE = 0x05,
|
||||
RX_EXT_DATA = 0x06,
|
||||
RX_EXT_REMOTE = 0x07
|
||||
};
|
||||
|
||||
/*************************************
|
||||
CAN Serial Struct
|
||||
**************************************/
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential, Pack=1)]
|
||||
public struct CAN_Struct
|
||||
{
|
||||
public byte Format;
|
||||
public UInt32 ID;
|
||||
public byte DLC;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public byte[] DATA;
|
||||
}
|
||||
|
||||
/*************************************
|
||||
CAN Info Struct
|
||||
**************************************/
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential, Pack=1)]
|
||||
public struct CANConfigInfo
|
||||
{
|
||||
public UInt32 Baudrate;
|
||||
public UInt32 ID;
|
||||
public UInt32 Mask;
|
||||
public byte Spec;
|
||||
public bool DAR;
|
||||
public bool ABOR;
|
||||
}
|
||||
enum CANSpec
|
||||
{
|
||||
CAN_A = 3, //Max Standard CAN ID Length for ascii (0~7FF)
|
||||
CAN_B = 8 //Max Extended CAN ID Length for ascii (0~1FFFFFFF)
|
||||
};
|
||||
|
||||
/*************************************
|
||||
Option Info Struct
|
||||
**************************************/
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct OptionInfo
|
||||
{
|
||||
public byte mode;
|
||||
public byte delay;
|
||||
public byte STD_D_Command_Header;
|
||||
public byte STD_R_Command_Header;
|
||||
public byte EXT_D_Command_Header;
|
||||
public byte EXT_R_Command_Header;
|
||||
}
|
||||
public static class CAN_SerialCommandHeader
|
||||
{
|
||||
public static readonly char STD_DATA = 't';
|
||||
public static readonly char STD_REMOTE = 'T';
|
||||
public static readonly char EXT_DATA = 'e';
|
||||
public static readonly char EXT_REMOTE = 'E';
|
||||
}; //CS-CAN Default Serial Command Header
|
||||
|
||||
/*************************************
|
||||
CAN Error Info Struct
|
||||
**************************************/
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct CANErorrInfo
|
||||
{
|
||||
public byte TEC; // Transmit Error Count
|
||||
public byte REC; // Receive Error Count
|
||||
public byte LEC; // Last Error Count
|
||||
public UInt32 StuffCount; // Stuff Error Count
|
||||
public UInt32 FormCount; // Form Error Count
|
||||
public UInt32 AckECount; // Ack Error Count
|
||||
public UInt32 BitCount; // Bit Error Count
|
||||
public UInt32 CRCCount; // CRC Error Count
|
||||
|
||||
public byte errorInfo; // Erroe Status
|
||||
}
|
||||
//}
|
||||
}
|
||||
Reference in New Issue
Block a user