diff --git a/LFP_Manager/Controls/ucCalibrationView.Designer.cs b/LFP_Manager/Controls/ucCalibrationView.Designer.cs deleted file mode 100644 index 2ad16c0..0000000 --- a/LFP_Manager/Controls/ucCalibrationView.Designer.cs +++ /dev/null @@ -1,303 +0,0 @@ - -namespace LFP_Manager.Controls -{ - partial class ucCalibrationView - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); - this.edDchCalibration = new DevExpress.XtraEditors.TextEdit(); - this.edChgCalibration = new DevExpress.XtraEditors.TextEdit(); - this.edChgOption = new DevExpress.XtraEditors.TextEdit(); - this.edBattCapacity = new DevExpress.XtraEditors.TextEdit(); - this.Root = new DevExpress.XtraLayout.LayoutControlGroup(); - this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); - this.gbBattCapacity = new DevExpress.XtraLayout.LayoutControlGroup(); - this.lbBattCapacity = new DevExpress.XtraLayout.SimpleLabelItem(); - this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); - this.gbCalibrationValue = new DevExpress.XtraLayout.LayoutControlGroup(); - this.lbChgOption = new DevExpress.XtraLayout.SimpleLabelItem(); - this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); - this.lbChgCalibration = new DevExpress.XtraLayout.SimpleLabelItem(); - this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem(); - this.lbDchCalibration = new DevExpress.XtraLayout.SimpleLabelItem(); - this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit(); - this.layoutControl1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.edDchCalibration.Properties)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.edChgCalibration.Properties)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.edChgOption.Properties)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.edBattCapacity.Properties)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.gbBattCapacity)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.lbBattCapacity)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.gbCalibrationValue)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.lbChgOption)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.lbChgCalibration)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.lbDchCalibration)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit(); - this.SuspendLayout(); - // - // layoutControl1 - // - this.layoutControl1.AllowCustomization = false; - this.layoutControl1.Controls.Add(this.edDchCalibration); - this.layoutControl1.Controls.Add(this.edChgCalibration); - this.layoutControl1.Controls.Add(this.edChgOption); - this.layoutControl1.Controls.Add(this.edBattCapacity); - this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.layoutControl1.Location = new System.Drawing.Point(0, 0); - this.layoutControl1.Name = "layoutControl1"; - this.layoutControl1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(993, 152, 650, 400); - this.layoutControl1.Root = this.Root; - this.layoutControl1.Size = new System.Drawing.Size(449, 277); - this.layoutControl1.TabIndex = 0; - this.layoutControl1.Text = "layoutControl1"; - // - // edDchCalibration - // - this.edDchCalibration.Location = new System.Drawing.Point(129, 132); - this.edDchCalibration.Name = "edDchCalibration"; - this.edDchCalibration.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); - this.edDchCalibration.Properties.Appearance.Options.UseFont = true; - this.edDchCalibration.Properties.Appearance.Options.UseTextOptions = true; - this.edDchCalibration.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; - this.edDchCalibration.Size = new System.Drawing.Size(314, 22); - this.edDchCalibration.StyleController = this.layoutControl1; - this.edDchCalibration.TabIndex = 7; - // - // edChgCalibration - // - this.edChgCalibration.Location = new System.Drawing.Point(129, 106); - this.edChgCalibration.Name = "edChgCalibration"; - this.edChgCalibration.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); - this.edChgCalibration.Properties.Appearance.Options.UseFont = true; - this.edChgCalibration.Properties.Appearance.Options.UseTextOptions = true; - this.edChgCalibration.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; - this.edChgCalibration.Size = new System.Drawing.Size(314, 22); - this.edChgCalibration.StyleController = this.layoutControl1; - this.edChgCalibration.TabIndex = 6; - // - // edChgOption - // - this.edChgOption.Location = new System.Drawing.Point(129, 80); - this.edChgOption.Name = "edChgOption"; - this.edChgOption.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); - this.edChgOption.Properties.Appearance.Options.UseFont = true; - this.edChgOption.Properties.Appearance.Options.UseTextOptions = true; - this.edChgOption.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; - this.edChgOption.Size = new System.Drawing.Size(314, 22); - this.edChgOption.StyleController = this.layoutControl1; - this.edChgOption.TabIndex = 5; - // - // edBattCapacity - // - this.edBattCapacity.Location = new System.Drawing.Point(129, 27); - this.edBattCapacity.Name = "edBattCapacity"; - this.edBattCapacity.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); - this.edBattCapacity.Properties.Appearance.Options.UseFont = true; - this.edBattCapacity.Properties.Appearance.Options.UseTextOptions = true; - this.edBattCapacity.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; - this.edBattCapacity.Size = new System.Drawing.Size(314, 22); - this.edBattCapacity.StyleController = this.layoutControl1; - this.edBattCapacity.TabIndex = 4; - // - // Root - // - this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; - this.Root.GroupBordersVisible = false; - this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.emptySpaceItem1, - this.gbBattCapacity, - this.gbCalibrationValue}); - this.Root.Name = "Root"; - this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(1, 1, 1, 1); - this.Root.Size = new System.Drawing.Size(449, 277); - this.Root.TextVisible = false; - // - // emptySpaceItem1 - // - this.emptySpaceItem1.AllowHotTrack = false; - this.emptySpaceItem1.Location = new System.Drawing.Point(0, 158); - this.emptySpaceItem1.Name = "emptySpaceItem1"; - this.emptySpaceItem1.Size = new System.Drawing.Size(447, 117); - this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); - // - // gbBattCapacity - // - this.gbBattCapacity.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.lbBattCapacity, - this.layoutControlItem1}); - this.gbBattCapacity.Location = new System.Drawing.Point(0, 0); - this.gbBattCapacity.Name = "gbBattCapacity"; - this.gbBattCapacity.Padding = new DevExpress.XtraLayout.Utils.Padding(1, 1, 1, 1); - this.gbBattCapacity.Size = new System.Drawing.Size(447, 53); - this.gbBattCapacity.Spacing = new DevExpress.XtraLayout.Utils.Padding(1, 1, 1, 1); - this.gbBattCapacity.Text = "Battery Capacity"; - // - // lbBattCapacity - // - this.lbBattCapacity.AllowHotTrack = false; - this.lbBattCapacity.Location = new System.Drawing.Point(0, 0); - this.lbBattCapacity.Name = "lbBattCapacity"; - this.lbBattCapacity.Size = new System.Drawing.Size(123, 26); - this.lbBattCapacity.Text = " Battery Capacity"; - this.lbBattCapacity.TextSize = new System.Drawing.Size(96, 14); - // - // layoutControlItem1 - // - this.layoutControlItem1.Control = this.edBattCapacity; - this.layoutControlItem1.Location = new System.Drawing.Point(123, 0); - this.layoutControlItem1.Name = "layoutControlItem1"; - this.layoutControlItem1.Size = new System.Drawing.Size(318, 26); - this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem1.TextVisible = false; - // - // gbCalibrationValue - // - this.gbCalibrationValue.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.lbChgOption, - this.layoutControlItem2, - this.lbChgCalibration, - this.layoutControlItem3, - this.lbDchCalibration, - this.layoutControlItem4}); - this.gbCalibrationValue.Location = new System.Drawing.Point(0, 53); - this.gbCalibrationValue.Name = "gbCalibrationValue"; - this.gbCalibrationValue.Padding = new DevExpress.XtraLayout.Utils.Padding(1, 1, 1, 1); - this.gbCalibrationValue.Size = new System.Drawing.Size(447, 105); - this.gbCalibrationValue.Spacing = new DevExpress.XtraLayout.Utils.Padding(1, 1, 1, 1); - this.gbCalibrationValue.Text = "Calibration Value"; - // - // lbChgOption - // - this.lbChgOption.AllowHotTrack = false; - this.lbChgOption.Location = new System.Drawing.Point(0, 0); - this.lbChgOption.Name = "lbChgOption"; - this.lbChgOption.Size = new System.Drawing.Size(123, 26); - this.lbChgOption.Text = " Charge Option"; - this.lbChgOption.TextSize = new System.Drawing.Size(96, 14); - // - // layoutControlItem2 - // - this.layoutControlItem2.Control = this.edChgOption; - this.layoutControlItem2.Location = new System.Drawing.Point(123, 0); - this.layoutControlItem2.Name = "layoutControlItem2"; - this.layoutControlItem2.Size = new System.Drawing.Size(318, 26); - this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem2.TextVisible = false; - // - // lbChgCalibration - // - this.lbChgCalibration.AllowHotTrack = false; - this.lbChgCalibration.Location = new System.Drawing.Point(0, 26); - this.lbChgCalibration.Name = "lbChgCalibration"; - this.lbChgCalibration.Size = new System.Drawing.Size(123, 26); - this.lbChgCalibration.Text = " Calibration (CHG)"; - this.lbChgCalibration.TextSize = new System.Drawing.Size(96, 14); - // - // layoutControlItem3 - // - this.layoutControlItem3.Control = this.edChgCalibration; - this.layoutControlItem3.Location = new System.Drawing.Point(123, 26); - this.layoutControlItem3.Name = "layoutControlItem3"; - this.layoutControlItem3.Size = new System.Drawing.Size(318, 26); - this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem3.TextVisible = false; - // - // lbDchCalibration - // - this.lbDchCalibration.AllowHotTrack = false; - this.lbDchCalibration.Location = new System.Drawing.Point(0, 52); - this.lbDchCalibration.Name = "lbDchCalibration"; - this.lbDchCalibration.Size = new System.Drawing.Size(123, 26); - this.lbDchCalibration.Text = " Calibration (DCH)"; - this.lbDchCalibration.TextSize = new System.Drawing.Size(96, 14); - // - // layoutControlItem4 - // - this.layoutControlItem4.Control = this.edDchCalibration; - this.layoutControlItem4.Location = new System.Drawing.Point(123, 52); - this.layoutControlItem4.Name = "layoutControlItem4"; - this.layoutControlItem4.Size = new System.Drawing.Size(318, 26); - this.layoutControlItem4.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem4.TextVisible = false; - // - // ucCalibrationView - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.layoutControl1); - this.Name = "ucCalibrationView"; - this.Size = new System.Drawing.Size(449, 277); - ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit(); - this.layoutControl1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.edDchCalibration.Properties)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.edChgCalibration.Properties)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.edChgOption.Properties)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.edBattCapacity.Properties)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.gbBattCapacity)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.lbBattCapacity)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.gbCalibrationValue)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.lbChgOption)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.lbChgCalibration)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.lbDchCalibration)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private DevExpress.XtraLayout.LayoutControl layoutControl1; - private DevExpress.XtraLayout.LayoutControlGroup Root; - private DevExpress.XtraEditors.TextEdit edBattCapacity; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; - private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1; - private DevExpress.XtraEditors.TextEdit edDchCalibration; - private DevExpress.XtraEditors.TextEdit edChgCalibration; - private DevExpress.XtraEditors.TextEdit edChgOption; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4; - private DevExpress.XtraLayout.SimpleLabelItem lbBattCapacity; - private DevExpress.XtraLayout.SimpleLabelItem lbChgOption; - private DevExpress.XtraLayout.SimpleLabelItem lbChgCalibration; - private DevExpress.XtraLayout.SimpleLabelItem lbDchCalibration; - private DevExpress.XtraLayout.LayoutControlGroup gbBattCapacity; - private DevExpress.XtraLayout.LayoutControlGroup gbCalibrationValue; - } -} diff --git a/LFP_Manager/Controls/ucCalibrationView.cs b/LFP_Manager/Controls/ucCalibrationView.cs deleted file mode 100644 index 6839a25..0000000 --- a/LFP_Manager/Controls/ucCalibrationView.cs +++ /dev/null @@ -1,63 +0,0 @@ -using DevExpress.XtraEditors; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -using LFP_Manager.DataStructure; - -namespace LFP_Manager.Controls -{ - public partial class ucCalibrationView : DevExpress.XtraEditors.XtraUserControl - { - #region VARIABLES - - DeviceSystemData ModuleData; - - #endregion - - public ucCalibrationView() - { - InitializeComponent(); - - edBattCapacity.Enabled = false; - edChgOption.Enabled = false; - edChgCalibration.Enabled = false; - edDchCalibration.Enabled = false; - } - - public void DisplayValue(ref DeviceSystemData[] aSystemData) - { - ModuleData = aSystemData[0]; - - if (this.InvokeRequired) - { - this.Invoke(new MethodInvoker(delegate () - { - edBattCapacity.Text = String.Format("{0}", ModuleData.CalibrationData.Battery.Capacity); - if (ModuleData.CalibrationData.Current.ChargeOption == 0) - edChgOption.Text = "Full Charge"; - else - edChgOption.Text = "Limit Charge"; - edChgCalibration.Text = String.Format("{0}", ModuleData.CalibrationData.Current.ChgCalibration_K); - edDchCalibration.Text = String.Format("{0}", ModuleData.CalibrationData.Current.DchCalibration_K); - })); - } - else - { - edBattCapacity.Text = String.Format("{0}", ModuleData.CalibrationData.Battery.Capacity); - if (ModuleData.CalibrationData.Current.ChargeOption == 0) - edChgOption.Text = "Full Charge"; - else - edChgOption.Text = "Limit Charge"; - edChgCalibration.Text = String.Format("{0}", ModuleData.CalibrationData.Current.ChgCalibration_K); - edDchCalibration.Text = String.Format("{0}", ModuleData.CalibrationData.Current.DchCalibration_K); - } - } - } -} diff --git a/LFP_Manager/Controls/ucCalibrationView.resx b/LFP_Manager/Controls/ucCalibrationView.resx deleted file mode 100644 index 1af7de1..0000000 --- a/LFP_Manager/Controls/ucCalibrationView.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/LFP_Manager/DataStructure/csDataStructure.cs b/LFP_Manager/DataStructure/csDataStructure.cs index f1aef6b..82f8c46 100644 --- a/LFP_Manager/DataStructure/csDataStructure.cs +++ b/LFP_Manager/DataStructure/csDataStructure.cs @@ -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; } } diff --git a/LFP_Manager/Function/CsRs485CommFunction124050.cs b/LFP_Manager/Function/CsRs485CommFunction124050.cs index b836c24..83d916d 100644 --- a/LFP_Manager/Function/CsRs485CommFunction124050.cs +++ b/LFP_Manager/Function/CsRs485CommFunction124050.cs @@ -907,20 +907,6 @@ namespace LFP_Manager.Function break; } } - private static void SetReadIdRegister(short reg_addr, short reg_value, ref DeviceSystemData rSystemData) - { - switch (reg_addr) - { - case 0x4000: rSystemData.GyroValue.X_axis = (short)(reg_value); break; // - case 0x4001: rSystemData.GyroValue.Y_axis = (short)(reg_value); break; // - case 0x4002: rSystemData.GyroValue.Z_axis = (short)(reg_value); break; // - case 0x4003: rSystemData.GyroValue.Gyro_policy_sel = (short)(reg_value); break; // - case 0x4004: rSystemData.GyroValue.Gyro_func_sw = (short)(reg_value); break; // - case 0x4006: rSystemData.GyroValue.Gyro_state = (short)(reg_value); break; // - default: - break; - } - } private static void SetCoilRegister(short reg_addr, short reg_value, ref DeviceSystemData rSystemData) { @@ -931,66 +917,9 @@ namespace LFP_Manager.Function rSystemData.CalibrationData.FetCalib.FetStatus = reg_value; break; case 0x502E: - rSystemData.CalibrationData.Current.ChargeOption = reg_value; + rSystemData.CalibrationData.ChaMode.Mode = reg_value; break; } } - - private static short MakeUartWarningData(short rdata) - { - short result = 0; - bool[] bAlarm = csUtils.Int16ToBitArray(rdata); - - if (bAlarm[0] == true) result |= (short)(1 << 2); // 0x0001:Pack OV - if (bAlarm[1] == true) result |= (short)(1 << 4); // 0x0002:Cell OV - if (bAlarm[2] == true) result |= (short)(1 << 3); // 0x0004:Pack UV - if (bAlarm[3] == true) result |= (short)(1 << 5); // 0x0008:Cell UV - - if (bAlarm[4] == true) result |= (short)(1 << 6); // 0x0010:Charging OC - if (bAlarm[5] == true) result |= (short)(1 << 7); // 0x0020:Discharging OC - - if (bAlarm[8] == true) result |= (short)(1 << 0); // 0x0080: Charging Over Tempratuer - if (bAlarm[9] == true) result |= (short)(1 << 0); // 0x0080: Discharging Over Tempratuer - if (bAlarm[10] == true) result |= (short)(1 << 1); // 0x0040: Charging Under Tempratuer - if (bAlarm[11] == true) result |= (short)(1 << 1); // 0x0040: Discharging Under Tempratuer - if (bAlarm[12] == true) result |= (short)(1 << 11); // 0x0200:SOC Low - - return result; - } - - private static short MakeUartTripData(short rdata) - { - short result = 0; - bool[] bAlarm = csUtils.Int16ToBitArray(rdata); - - if (bAlarm[0] == true) result |= (short)(1 << 2); // 0x0001:Pack OV - if (bAlarm[1] == true) result |= (short)(1 << 4); // 0x0002:Cell OV - if (bAlarm[2] == true) result |= (short)(1 << 3); // 0x0004:Pack UV - if (bAlarm[3] == true) result |= (short)(1 << 5); // 0x0008:Cell UV - - if (bAlarm[4] == true) result |= (short)(1 << 6); // 0x0010:Charging OC - if (bAlarm[5] == true) result |= (short)(1 << 7); // 0x0020:Discharging OC - - if (bAlarm[8] == true) result |= (short)(1 << 0); // 0x0080: Charging Over Temprature - if (bAlarm[9] == true) result |= (short)(1 << 0); // 0x0080: Discharging Over Temprature - if (bAlarm[10] == true) result |= (short)(1 << 1); // 0x0040: Charging Under Temprature - if (bAlarm[11] == true) result |= (short)(1 << 1); // 0x0040: Discharging Under Temprature - if (bAlarm[13] == true) result |= (short)(1 << 9); // 0x0200:Short Circuit Protection - - return result; - } - - private static short MakeUartErrorData(short rdata, short cdata) - { - short result = cdata; - bool[] bAlarm = csUtils.Int16ToBitArray(rdata); - - if (bAlarm[0] == true) result |= (short)(1 << 9); // 0x0001:Voltage error - if (bAlarm[1] == true) result |= (short)(1 << 9); // 0x0002:Temperature error - if (bAlarm[2] == true) result |= (short)(1 << 9); // 0x0004: 电流检测Error - if (bAlarm[3] == true) result |= (short)(1 << 9); // 0x0010:Cell unbalance - - return result; - } } } diff --git a/LFP_Manager/Function/CsSerialCommFunction124050.cs b/LFP_Manager/Function/CsSerialCommFunction124050.cs index 2baf758..5118735 100644 --- a/LFP_Manager/Function/CsSerialCommFunction124050.cs +++ b/LFP_Manager/Function/CsSerialCommFunction124050.cs @@ -488,7 +488,7 @@ namespace LFP_Manager.Function rSystemData.CalibrationData.FetCalib.FetStatus = reg_value; break; case 0x502E: - rSystemData.CalibrationData.Current.ChargeOption = reg_value; + rSystemData.CalibrationData.ChaMode.Mode = reg_value; break; } } diff --git a/LFP_Manager/Function/CsSerialCommFunctionDelta.cs b/LFP_Manager/Function/CsSerialCommFunctionDelta.cs index 77f9536..27e4560 100644 --- a/LFP_Manager/Function/CsSerialCommFunctionDelta.cs +++ b/LFP_Manager/Function/CsSerialCommFunctionDelta.cs @@ -896,66 +896,9 @@ namespace LFP_Manager.Function rSystemData.CalibrationData.FetCalib.FetStatus = reg_value; break; case 0x502E: - rSystemData.CalibrationData.Current.ChargeOption = reg_value; + rSystemData.CalibrationData.ChaMode.Mode = reg_value; break; } } - - private static short MakeUartWarningData(short rdata) - { - short result = 0; - bool[] bAlarm = csUtils.Int16ToBitArray(rdata); - - if (bAlarm[0] == true) result |= (short)(1 << 2); // 0x0001:Pack OV - if (bAlarm[1] == true) result |= (short)(1 << 4); // 0x0002:Cell OV - if (bAlarm[2] == true) result |= (short)(1 << 3); // 0x0004:Pack UV - if (bAlarm[3] == true) result |= (short)(1 << 5); // 0x0008:Cell UV - - if (bAlarm[4] == true) result |= (short)(1 << 6); // 0x0010:Charging OC - if (bAlarm[5] == true) result |= (short)(1 << 7); // 0x0020:Discharging OC - - if (bAlarm[8] == true) result |= (short)(1 << 0); // 0x0080: Charging Over Tempratuer - if (bAlarm[9] == true) result |= (short)(1 << 0); // 0x0080: Discharging Over Tempratuer - if (bAlarm[10] == true) result |= (short)(1 << 1); // 0x0040: Charging Under Tempratuer - if (bAlarm[11] == true) result |= (short)(1 << 1); // 0x0040: Discharging Under Tempratuer - if (bAlarm[12] == true) result |= (short)(1 << 11); // 0x0200:SOC Low - - return result; - } - - private static short MakeUartTripData(short rdata) - { - short result = 0; - bool[] bAlarm = csUtils.Int16ToBitArray(rdata); - - if (bAlarm[0] == true) result |= (short)(1 << 2); // 0x0001:Pack OV - if (bAlarm[1] == true) result |= (short)(1 << 4); // 0x0002:Cell OV - if (bAlarm[2] == true) result |= (short)(1 << 3); // 0x0004:Pack UV - if (bAlarm[3] == true) result |= (short)(1 << 5); // 0x0008:Cell UV - - if (bAlarm[4] == true) result |= (short)(1 << 6); // 0x0010:Charging OC - if (bAlarm[5] == true) result |= (short)(1 << 7); // 0x0020:Discharging OC - - if (bAlarm[8] == true) result |= (short)(1 << 0); // 0x0080: Charging Over Temprature - if (bAlarm[9] == true) result |= (short)(1 << 0); // 0x0080: Discharging Over Temprature - if (bAlarm[10] == true) result |= (short)(1 << 1); // 0x0040: Charging Under Temprature - if (bAlarm[11] == true) result |= (short)(1 << 1); // 0x0040: Discharging Under Temprature - if (bAlarm[13] == true) result |= (short)(1 << 9); // 0x0200:Short Circuit Protection - - return result; - } - - private static short MakeUartErrorData(short rdata, short cdata) - { - short result = cdata; - bool[] bAlarm = csUtils.Int16ToBitArray(rdata); - - if (bAlarm[0] == true) result |= (short)(1 << 9); // 0x0001:Voltage error - if (bAlarm[1] == true) result |= (short)(1 << 9); // 0x0002:Temperature error - if (bAlarm[2] == true) result |= (short)(1 << 9); // 0x0004: 电流检测Error - if (bAlarm[3] == true) result |= (short)(1 << 9); // 0x0010:Cell unbalance - - return result; - } } } diff --git a/LFP_Manager/Function/csSerialCommFunction.cs b/LFP_Manager/Function/csSerialCommFunction.cs index 99a31f0..ebfca47 100644 --- a/LFP_Manager/Function/csSerialCommFunction.cs +++ b/LFP_Manager/Function/csSerialCommFunction.cs @@ -527,7 +527,7 @@ namespace LFP_Manager.Function rSystemData.CalibrationData.FetCalib.FetStatus = reg_value; break; case 0x502E: - rSystemData.CalibrationData.Current.ChargeOption = reg_value; + rSystemData.CalibrationData.ChaMode.Mode = reg_value; break; } } diff --git a/LFP_Manager/LFP_Manager_DBG_Delta.csproj b/LFP_Manager/LFP_Manager_DBG_Delta.csproj index e89d5a0..850bf56 100644 --- a/LFP_Manager/LFP_Manager_DBG_Delta.csproj +++ b/LFP_Manager/LFP_Manager_DBG_Delta.csproj @@ -256,12 +256,6 @@ ucCalibration.cs - - UserControl - - - ucCalibrationView.cs - UserControl @@ -481,9 +475,6 @@ ucCalibration.cs - - ucCalibrationView.cs - ucCommConfig.cs diff --git a/LFP_Manager/Threads/CsRs485Thread124050.cs b/LFP_Manager/Threads/CsRs485Thread124050.cs index 6c963eb..f3c07a9 100644 --- a/LFP_Manager/Threads/CsRs485Thread124050.cs +++ b/LFP_Manager/Threads/CsRs485Thread124050.cs @@ -566,8 +566,8 @@ namespace LFP_Manager.Threads TimeOutCount[ModuleID - 1] = 10; if (SystemData[ModuleID - 1].ShelfCommFail == false) { - SystemData[ModuleID - 1].ShelfCommFail = true; csUtils.DataInit(Config, ref SystemData[ModuleID - 1]); + SystemData[ModuleID - 1].ShelfCommFail = true; } } Thread.Sleep(100); diff --git a/LFP_Manager/Threads/CsUartThread124050.cs b/LFP_Manager/Threads/CsUartThread124050.cs index 0e06f73..db0ea53 100644 --- a/LFP_Manager/Threads/CsUartThread124050.cs +++ b/LFP_Manager/Threads/CsUartThread124050.cs @@ -743,8 +743,8 @@ namespace LFP_Manager.Threads //SystemData[0].CommFail = true; if (SystemData.ShelfCommFail == false) { - SystemData.ShelfCommFail = true; csUtils.DataInit(Config, ref SystemData); + SystemData.ShelfCommFail = true; } } Thread.Sleep(100); diff --git a/LFP_Manager/Threads/CsUartThreadDelta.cs b/LFP_Manager/Threads/CsUartThreadDelta.cs index 2a690b4..14c3261 100644 --- a/LFP_Manager/Threads/CsUartThreadDelta.cs +++ b/LFP_Manager/Threads/CsUartThreadDelta.cs @@ -551,8 +551,8 @@ namespace LFP_Manager.Threads //SystemData[0].CommFail = true; if (SystemData[ModuleID - 1].ShelfCommFail == false) { - SystemData[ModuleID - 1].ShelfCommFail = true; csUtils.DataInit(Config, ref SystemData[ModuleID - 1]); + SystemData[ModuleID - 1].ShelfCommFail = true; } } Thread.Sleep(100); diff --git a/LFP_Manager/Threads/csUartThread.cs b/LFP_Manager/Threads/csUartThread.cs index b236a65..6a73566 100644 --- a/LFP_Manager/Threads/csUartThread.cs +++ b/LFP_Manager/Threads/csUartThread.cs @@ -754,8 +754,8 @@ namespace LFP_Manager.Threads //SystemData[0].CommFail = true; if (SystemData.ShelfCommFail == false) { - SystemData.ShelfCommFail = true; csUtils.DataInit(Config, ref SystemData); + SystemData.ShelfCommFail = true; } } Thread.Sleep(100); diff --git a/LFP_Manager/Utils/CsDbProcess.cs b/LFP_Manager/Utils/CsDbProcess.cs index 770988b..676c356 100644 --- a/LFP_Manager/Utils/CsDbProcess.cs +++ b/LFP_Manager/Utils/CsDbProcess.cs @@ -644,7 +644,7 @@ namespace LFP_Manager.Utils parameters.Add(new SQLiteParameter("ext1_temp", (systemData.ValueData.Ext1Temperature / 10.0).ToString())); parameters.Add(new SQLiteParameter("ext2_temp", (systemData.ValueData.Ext2Temperature / 10.0).ToString())); - parameters.Add(new SQLiteParameter("chg_option", systemData.CalibrationData.Current.ChargeOption.ToString())); + parameters.Add(new SQLiteParameter("chg_option", systemData.CalibrationData.ChaMode.Mode.ToString())); return parameters.ToArray(); } diff --git a/LFP_Manager/Utils/csDBUtils.cs b/LFP_Manager/Utils/csDBUtils.cs index 2382116..7dd288f 100644 --- a/LFP_Manager/Utils/csDBUtils.cs +++ b/LFP_Manager/Utils/csDBUtils.cs @@ -581,7 +581,7 @@ namespace LFP_Manager.Utils p[j++].Value = ((float)aSystemData.ValueData.Ext1Temperature / 10).ToString(); // 34 temperature_ext1 - FET Temp p[j++].Value = ((float)aSystemData.ValueData.Ext2Temperature / 10).ToString(); // 35 temperature_ext2 - Lmt Temp - p[j++].Value = aSystemData.CalibrationData.Current.ChargeOption.ToString(); // 36 chg_option + p[j++].Value = aSystemData.CalibrationData.ChaMode.Mode.ToString(); // 36 chg_option command.ExecuteNonQuery(); diff --git a/LFP_Manager/Utils/csUtils.cs b/LFP_Manager/Utils/csUtils.cs index 00b836a..d808732 100644 --- a/LFP_Manager/Utils/csUtils.cs +++ b/LFP_Manager/Utils/csUtils.cs @@ -272,7 +272,7 @@ namespace LFP_Manager.Utils public static void DataInit(CommConfig aConfig, ref DeviceSystemData aSystemData) { - aSystemData.ShelfCommFail = true; + aSystemData.Reset(); switch (aConfig.CommType) { @@ -324,41 +324,6 @@ namespace LFP_Manager.Utils aSystemData.tempQty = 4; break; } - - for (int j = 0; j < aSystemData.ValueData.CellVoltage.Length; j++) - { - aSystemData.ValueData.CellVoltage[j] = 0; - } - for (int j = 0; j < aSystemData.ValueData.CellTemperature.Length; j++) - { - aSystemData.ValueData.CellTemperature[j] = 0; - } - aSystemData.ValueData.voltageOfPack = 0; - aSystemData.ValueData.current = 0; - aSystemData.ValueData.rSOC = 0; - aSystemData.AvgData.maxCellVoltage = 0; - aSystemData.AvgData.minCellVoltage = 0; - aSystemData.AvgData.avgCellVoltage = 0; - aSystemData.AvgData.maxTemp = 0; - aSystemData.AvgData.minTemp = 0; - aSystemData.AvgData.avgTemp = 0; - aSystemData.heatbeat = 0; - aSystemData.StatusData.warning = 0; - aSystemData.StatusData.protection = 0; - - for (int j = 0; j < aSystemData.Information.BMS_SN.Length; j++) - { - aSystemData.Information.BMS_SN[j] = 0; - } - for (int j = 0; j < aSystemData.Information.Module_SN.Length; j++) - { - aSystemData.Information.Module_SN[j] = 0; - } - - aSystemData.CalibrationData.Battery.Capacity = 0; - aSystemData.CalibrationData.Current.ChaAndDchSelect = 0; - aSystemData.CalibrationData.Current.ChgCalibration_K = 0; - aSystemData.CalibrationData.Current.DchCalibration_K = 0; } #endregion