diff --git a/Cs_HMI/Project/Class/EEMStatus.cs b/Cs_HMI/Project/Class/EEMStatus.cs index 7b3a806..5aaa936 100644 --- a/Cs_HMI/Project/Class/EEMStatus.cs +++ b/Cs_HMI/Project/Class/EEMStatus.cs @@ -121,8 +121,8 @@ public static partial class EEMStatus var file = System.IO.Path.Combine(path, $"{DateTime.Now.ToString("HHmmssfff")}_BMS_INF.sql"); - var sql = "insert into AGV_Shuttle_BMS(MCID,wdate,info_volt,info_current,info_capa,info_level,info_temp1,info_temp2,soc,cycle,protection,balance) " + - $"values('{mcid}','{timestr}',{data.packVoltage},{data.current},{data.fullCapacity},{data.RawLevel},{data.ntcTemp[0]},{data.ntcTemp[1]},{data.rsoc},{data.cycleCount},{data.raw_protection},{data.fullBalance})"; + var sql = "insert into AGV_Shuttle_BMS(MCID,wdate,info_volt,info_current,info_capa,info_level,info_temp1,info_temp2,soc,cycle,protection,balance,watt) " + + $"values('{mcid}','{timestr}',{data.packVoltage},{data.current},{data.fullCapacity},{data.RawLevel},{data.ntcTemp[0]},{data.ntcTemp[1]},{data.rsoc},{data.cycleCount},{data.raw_protection},{data.fullBalance},{data.watt})"; System.IO.File.WriteAllText(file, sql, System.Text.Encoding.Default); LastBMSIFTime = DateTime.Now; diff --git a/Cs_HMI/Project/Device/BMS.cs b/Cs_HMI/Project/Device/BMS.cs index 633042b..6df82c7 100644 --- a/Cs_HMI/Project/Device/BMS.cs +++ b/Cs_HMI/Project/Device/BMS.cs @@ -25,7 +25,8 @@ namespace arDev get { if (Voltage.Any() == false) return 0f; - return Math.Abs(Voltage.Max() - Voltage.Min()); + var value = Math.Abs(Voltage.Max() - Voltage.Min()); + return value * 1000f; } } } @@ -71,7 +72,7 @@ namespace arDev protectionStatus = new BMSProtectionStatus(); mosfetStatus = new BMSMosfetStatus(); productionDate = new DateTime(); - ntcTemp = new float[] { 0f,0f}; + ntcTemp = new float[] { 0f, 0f }; } public void Clear() @@ -435,8 +436,8 @@ namespace arDev //250620 jwlee 추가 newinfo.ntcCount = LastReceiveBuffer[offset + 22]; //센서갯수 - int temp1 = (LastReceiveBuffer[offset + 23] << 8) | LastReceiveBuffer[24]; - int temp2 = (LastReceiveBuffer[offset + 25] << 8) | LastReceiveBuffer[36]; + int temp1 = (LastReceiveBuffer[offset + 23] << 8) | LastReceiveBuffer[offset + 24]; + int temp2 = (LastReceiveBuffer[offset + 25] << 8) | LastReceiveBuffer[offset + 26]; var Current_temp1 = (temp1 - 2731) / 10f; var Current_temp2 = (temp2 - 2731) / 10f; newinfo.ntcTemp = new float[] { (temp1 - 2731) / 10f, (temp2 - 2731) / 10f }; diff --git a/Cs_HMI/Project/ViewForm/fBms.cs b/Cs_HMI/Project/ViewForm/fBms.cs index 5c81ae9..d1f29f6 100644 --- a/Cs_HMI/Project/ViewForm/fBms.cs +++ b/Cs_HMI/Project/ViewForm/fBms.cs @@ -70,10 +70,14 @@ namespace Project.ViewForm else if (PUB.BMS.IsValid == false) this.lbCycle.Text = "데이터가 유효하지 않습니다"; else - this.lbCycle.Text = $"Cell Average:{volt.Average},Delta:{volt.Delta},Cycle({data.cycleCount})"; + this.lbCycle.Text = $"Average:{volt.Average:N2}v, Delta:{volt.Delta:N0}, Cycle({data.cycleCount})"; this.arLabel1.Text = $"{data.rsoc}%"; - this.arLabel1.Sign = $"{data.packVoltage}v, {data.watt}w";// PUB.BMS.Current_Volt.ToString() + "v"; - this.cv1.Text = volt.Voltage[0].ToString("N3") + "v"; + this.arLabel1.Sign = $"{data.packVoltage}v, {data.watt:N0}w";// PUB.BMS.Current_Volt.ToString() + "v"; + + if (data.watt < 0) this.arLabel1.SignColor = Color.Tomato; + else this.arLabel1.SignColor = Color.Lime; + + this.cv1.Text = volt.Voltage[0].ToString("N3") + "v"; this.cv2.Text = volt.Voltage[1].ToString("N3") + "v"; this.cv3.Text = volt.Voltage[2].ToString("N3") + "v"; this.cv4.Text = volt.Voltage[3].ToString("N3") + "v";