V1.0.1.7-1 -- 2025/12/17

* Datastructure improved
This commit is contained in:
2025-12-17 16:19:26 +09:00
parent 671d6545a3
commit 5b5a4b4c59
16 changed files with 404 additions and 705 deletions

View File

@@ -131,6 +131,17 @@ namespace LFP_Manager.DataStructure
{
DateTimeStr = "-";
}
public void Reset()
{
year = 0;
month = 0;
day = 0;
hour = 0;
minute = 0;
second = 0;
DateTimeStr = "-";
}
}
public class DeviceSystemData
@@ -205,6 +216,33 @@ namespace LFP_Manager.DataStructure
MaxValue = new DeviceMaxValue();
GyroValue = new DeviceGyroValue();
}
public void Reset()
{
active = false;
mNo = 0;
cellQty = csConstData.SystemInfo.MAX_MODULE_CELL_SIZE;
tempQty = csConstData.SystemInfo.MAX_MODULE_TEMP_SIZE;
ChargeVoltage = 0;
DOD = 0;
MaxChaCurrent = 0;
MaxDchCurrent = 0;
heatbeat = 0;
CommFail = false;
ShelfCommFail = false;
LastRxTime = DateTime.MinValue;
BmsDateTimeInt = 0;
BmsDateTime.Reset();
ValueData.Reset();
AvgData.Reset();
StatusData.Reset();
ParamData.Reset();
CalibrationData.Reset();
Information.Reset();
EtcStatus.Reset();
MaxValue.Reset();
GyroValue.Reset();
}
}
public class DeviceValueTotalData
@@ -282,6 +320,51 @@ namespace LFP_Manager.DataStructure
CellVoltage = new ushort[csConstData.SystemInfo.MAX_MODULE_CELL_SIZE];
CellTemperature = new short[csConstData.SystemInfo.MAX_MODULE_TEMP_SIZE];
}
public void Reset()
{
voltageOfPack = 0;
current = 0;
cha_current = 0;
dch_current = 0;
averageCurrent = 0;
rSOC = 0;
NumOfCells = 0;
NumOfTemps = 0;
for (int i = 0; i < csConstData.SystemInfo.MAX_MODULE_CELL_SIZE; i++)
{
CellVoltage[i] = 0;
}
for (int i = 0; i < csConstData.SystemInfo.MAX_MODULE_TEMP_SIZE; i++)
{
CellTemperature[i] = 0;
}
Ext1Temperature = 0;
Ext2Temperature = 0;
remainingCapacity = 0;
stateOfHealth = 0;
cycleCount = 0;
fullChargeCapacity = 0;
designedCapacity = 0;
TimeLeft = 0;
Ah_Charged = 0;
Ah_Discharged = 0;
NoOfDischargeCycles = 0;
NoOfChargeCycles = 0;
ModuleAlarms = 0;
ModuleWarnings = 0;
ModuleStatus = 0;
ModuleVoltage_int = 0;
ModBusDocVersion = 0;
ParametersChanged = 0;
MaxBattChargeCurr = 0;
MaxBattDischargeCurr = 0;
BatteryProdDateYear = 0;
BatteryProdDateMonth = 0;
BatteryProdDateDay = 0;
BatteryModelDescription = 0;
BatteryType = 0;
}
}
public class DeviceAvgData
@@ -303,6 +386,22 @@ namespace LFP_Manager.DataStructure
{
}
public void Reset()
{
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
@@ -331,6 +430,28 @@ namespace LFP_Manager.DataStructure
public short cellBallanceStatus;
public short cellBalanceValue;
public short cellBalanceFlag;
public DeviceStatusData()
{
}
public void Reset()
{
batteryStatus = 0;
batteryStatus1 = 0;
warning = 0;
protection = 0;
protection1 = 0;
status = 0;
faultAndStatus = 0;
relayStatus = 0;
errorCode = 0;
specialAlarm = 0;
faultstatus = 0;
cellBallanceStatus = 0;
cellBalanceValue = 0;
cellBalanceFlag = 0;
}
}
public class DeviceCommStatus
@@ -410,6 +531,71 @@ namespace LFP_Manager.DataStructure
public short DefalutParamAll;
public ushort ReadParamAll;
public DeviceParamData()
{
}
public void Reset()
{
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;
ChaOverCurrentTrip1 = 0;
ChaOverCurrentTrip2 = 0;
ChaOverCurrentWarning = 0;
ChaOverCurrentReleaseTime = 0;
ChaOverCurrentTimes = 0;
ChaOverCurrentDelay1 = 0;
ChaOverCurrentDelay2 = 0;
DchOverCurrentTrip1 = 0;
DchOverCurrentTrip2 = 0;
DchOverCurrentWarning = 0;
DchOverCurrentReleaseTime = 0;
DchOverCurrentTimes = 0;
DchOverCurrentDelay1 = 0;
DchOverCurrentDelay2 = 0;
PcbHighTempTrip = 0;
PcbHighTempWarning = 0;
PcbHighTempRelease = 0;
EnvLowTempWarning = 0;
EnvLowTempTrip = 0;
EnvLowTempRelease = 0;
EnvHighTempWarning = 0;
EnvHighTempTrip = 0;
EnvHighTempRelease = 0;
ShortCircuit = 0;
LowSocTrip = 0;
LowSocWarning = 0;
LowSocRelease = 0;
CellVoltageDifferenceTrip = 0;
CellVoltageDifferenceWarning = 0;
CellVoltageDifferenceRelease = 0;
CellVoltageDifferenceTime = 0;
DefalutParamOption = 0;
DefalutParamAll = 0;
ReadParamAll = 0;
}
public DeviceParamData DeepCopy()
{
DeviceParamData newCopy = new DeviceParamData
@@ -489,11 +675,8 @@ namespace LFP_Manager.DataStructure
public class DeviceCalibration
{
public CellVoltageCalib CellVoltge;
public SystemVoltageCalib SystemVoltage;
public ForcedBalControl ForcedBalancing;
public BatteryParameter Battery;
public CurrentCalib Current;
public SystemInfor SystemInfo;
public CapCalibration CapCalib;
public FetCalibration FetCalib;
@@ -510,11 +693,8 @@ namespace LFP_Manager.DataStructure
public DeviceCalibration()
{
CellVoltge = new CellVoltageCalib();
SystemVoltage = new SystemVoltageCalib();
ForcedBalancing = new ForcedBalControl();
Battery = new BatteryParameter();
Current = new CurrentCalib();
SystemInfo = new SystemInfor();
CapCalib = new CapCalibration();
FetCalib = new FetCalibration();
@@ -529,15 +709,29 @@ namespace LFP_Manager.DataStructure
AntiTheftComm = new TAntiTheftComm();
AntiTheftGyro = new TAntiTheftGyro();
}
public void Reset()
{
ForcedBalancing.Reset();
Battery.Reset();
SystemInfo.Reset();
CapCalib.Reset();
FetCalib.Reset();
ChaMode.Reset();
AntiTheft.Reset();
BmsDateTime.Reset();
BalCalib.Reset();
InvData.Reset();
AntiTheftComm.Reset();
AntiTheftGyro.Reset();
}
public DeviceCalibration DeepCopy()
{
DeviceCalibration newCopy = new DeviceCalibration
{
CellVoltge = CellVoltge,
SystemVoltage = SystemVoltage,
ForcedBalancing = ForcedBalancing,
Battery = Battery,
Current = Current,
SystemInfo = SystemInfo,
CapCalib = CapCalib.DeepCopy(),
@@ -563,6 +757,14 @@ namespace LFP_Manager.DataStructure
FuncSwitch = 0;
Unlock = 0;
}
public void Reset()
{
TimeOut = 0;
FuncSwitch = 0;
Unlock = 0;
}
public TAntiTheftComm DeepCopy()
{
TAntiTheftComm newCopy = new TAntiTheftComm
@@ -594,6 +796,18 @@ namespace LFP_Manager.DataStructure
GyroState = 0;
Unlock = 0;
}
public void Reset()
{
XAxis = 0;
YAxis = 0;
ZAxis = 0;
GyroPolicySel = 0;
GyroFuncSwitch = 0;
GyroState = 0;
Unlock = 0;
}
public TAntiTheftGyro DeepCopy()
{
TAntiTheftGyro newCopy = new TAntiTheftGyro
@@ -610,27 +824,25 @@ namespace LFP_Manager.DataStructure
}
}
public class CellVoltageCalib
{
public short CurrentCellNo; // 0: ODD, 1: EVEN
public short OddCellVoltageCalibration_K;
public short OddCellVoltageCalibration_B;
public short EvenCellVoltageCalibration_K;
public short EvenCellVoltageCalibration_B;
}
public class SystemVoltageCalib
{
[MarshalAs(UnmanagedType.I2, SizeConst = 2)]
public short Calibration_K;
public short Calibration_B;
}
public class ForcedBalControl
{
public short Control;
public short CellNo;
public bool AutoB;
public ForcedBalControl()
{
Control = 0;
CellNo = 0;
AutoB = false;
}
public void Reset()
{
Control = 0;
CellNo = 0;
AutoB = false;
}
}
public class BatteryParameter
@@ -638,18 +850,20 @@ namespace LFP_Manager.DataStructure
public short CellQty;
public short TempQty;
public UInt32 Capacity;
}
public class CurrentCalib
{
public short SelectSubItem;
public short ShuntRange;
public short CurrentZero;
public short VoltageZero;
public Int32 ChgCalibration_K;
public Int32 DchCalibration_K;
public short ChaAndDchSelect;
public short ChargeOption;
public BatteryParameter()
{
CellQty = 0;
TempQty = 0;
Capacity = 0;
}
public void Reset()
{
CellQty = 0;
TempQty = 0;
Capacity = 0;
}
}
public class SystemInfor
@@ -657,6 +871,20 @@ namespace LFP_Manager.DataStructure
//public short Id;
public DateTime devTime;
public ushort LastRebootCause;
public SystemInfor()
{
//Id = 0;
devTime = DateTime.MinValue;
LastRebootCause = 0;
}
public void Reset()
{
//Id = 0;
devTime = DateTime.MinValue;
LastRebootCause = 0;
}
}
public class CapCalibration
@@ -671,6 +899,14 @@ namespace LFP_Manager.DataStructure
SocValue = 0;
CycleCount = 0;
}
public void Reset()
{
DesignCapacity = 0;
SocValue = 0;
CycleCount = 0;
}
public CapCalibration DeepCopy()
{
CapCalibration newCopy = new CapCalibration
@@ -693,6 +929,13 @@ namespace LFP_Manager.DataStructure
Mode = 0;
Value = 0;
}
public void Reset()
{
Mode = 0;
Value = 0;
}
public ChargeMode DeepCopy()
{
ChargeMode newCopy = new ChargeMode
@@ -713,6 +956,13 @@ namespace LFP_Manager.DataStructure
Comm = 0;
GyroScope = 0;
}
public void Reset()
{
Comm = 0;
GyroScope = 0;
}
public TAntiTheft DeepCopy()
{
TAntiTheft newCopy = new TAntiTheft
@@ -735,6 +985,14 @@ namespace LFP_Manager.DataStructure
lValue = 0;
sValue = new short[2];
}
public void Reset()
{
Str = "";
lValue = 0;
sValue = new short[2];
}
public TBmsDateTime DeepCopy()
{
TBmsDateTime newCopy = new TBmsDateTime
@@ -759,6 +1017,13 @@ namespace LFP_Manager.DataStructure
Volt = 0;
Diff = 0;
}
public void Reset()
{
Volt = 0;
Diff = 0;
}
public TBalCalib DeepCopy()
{
TBalCalib newCopy = new TBalCalib
@@ -780,6 +1045,36 @@ namespace LFP_Manager.DataStructure
public short PreChaFetOn; // 6013
public short HeaterFetOn; // 6014
public short ChaFetOn; // 6015
public FetCalibration()
{
}
public void Reset()
{
FetStatus = 0;
DchFetOff = 0;
ChaFetOff = 0;
LmtChaFetOff = 0;
PreChaFetOn = 0;
HeaterFetOn = 0;
ChaFetOn = 0;
}
public FetCalibration DeepCopy()
{
FetCalibration newCopy = new FetCalibration
{
FetStatus = FetStatus,
DchFetOff = DchFetOff,
ChaFetOff = ChaFetOff,
LmtChaFetOff = LmtChaFetOff,
PreChaFetOn = PreChaFetOn,
HeaterFetOn = HeaterFetOn,
ChaFetOn = ChaFetOn,
};
return newCopy;
}
}
public class DeviceInforation
@@ -827,6 +1122,24 @@ namespace LFP_Manager.DataStructure
ManufacturingDate = "-";
SwProductRev = "-";
}
public void Reset()
{
Array.Clear(ManuDate_Byte, 0, ManuDate_Byte.Length);
Array.Clear(Model_Byte, 0, Model_Byte.Length);
Array.Clear(FwVer_Byte, 0, FwVer_Byte.Length);
Array.Clear(BMS_SN, 0, BMS_SN.Length);
Array.Clear(Module_SN, 0, Module_SN.Length);
Array.Clear(Vendor_Byte, 0, Vendor_Byte.Length);
VendorName = "-";
ProductCode = "-";
MajorMinorRev = "-";
ModelName = "-";
HwSerialNumber = "-";
HwProductRev = "-";
ManufacturingDate = "-";
SwProductRev = "-";
}
}
public class DeviceEtcStatus
@@ -858,6 +1171,33 @@ namespace LFP_Manager.DataStructure
public short BalanceDeltaV; // mV 均衡启动压差
public short WarnLowCapacity; // 低容量告警
public short HistroyDelete; // 删除数据记录
public DeviceEtcStatus()
{
}
public void Reset()
{
SwitchHW = 0;
SwitchWarning = 0;
SwitchProtect = 0;
LogDurationIdle = 0;
LogDurationActive = 0;
DataAndTime = 0;
ChgOCPModel = 0;
ChgLmtVoltage = 0;
SOC_StopFloat = 0;
SOC_RecvFloat = 0;
DurationFloat = 0;
DurationIdle = 0;
VoltageStopFloat = 0;
VoltageRecvFloat = 0;
FloatMode = 0;
BalanceVoltage = 0;
BalanceDeltaV = 0;
WarnLowCapacity = 0;
HistroyDelete = 0;
}
}
public class DeviceMaxValue
@@ -870,7 +1210,15 @@ namespace LFP_Manager.DataStructure
public DeviceMaxValue()
{
}
public void Reset()
{
MaxChgCurrent = 0;
MaxChgTemperature = 0;
MinChgTemperature = 0;
FloatChgVolt = 0;
BoostChgVolt = 0;
}
}
public class DeviceGyroValue
@@ -884,7 +1232,16 @@ namespace LFP_Manager.DataStructure
public DeviceGyroValue()
{
}
public void Reset()
{
X_axis = 0;
Y_axis = 0;
Z_axis = 0;
Gyro_policy_sel = 0;
Gyro_func_sw = 0;
Gyro_state = 0;
}
}