private static void ReadBatterySocRefresh(RS232 paramcom, ValenceBattery paramBattery) { try { paramcom.Write(paramBattery.SNSOCReadSend()); if (paramcom.Read(23) == -1) { throw new Exception("Read SOC Error on SNSOCReadSend!"); } if (!paramBattery.SNSOCReadReturn(paramcom.InputStream)) { throw new Exception("Read SOC Error on SNSOCReadReturn!"); } } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } }
private static void ReadBatterySoc(RS232 paramcom, ValenceBattery paramBattery) { try { paramcom.Write(paramBattery.SNSOCReadSend()); if (paramcom.Read(23) == -1) { throw new Exception("Read SOC Error!"); } if (!paramBattery.SNSOCReadReturn(paramcom.InputStream)) { throw new Exception("Read SOC Error!"); } Console.WriteLine($"VerfN: {paramBattery.VerfN}"); Console.WriteLine($"VerfP: {paramBattery.VerfP}"); Console.WriteLine($"GainN: {paramBattery.GainN}"); Console.WriteLine($"GainP: {paramBattery.GainP}"); Console.WriteLine($"SoC: {Convert.ToString(Math.Round(paramBattery.SOC, 3))}"); Console.WriteLine($"Current: {paramBattery.CURRENT}"); Console.WriteLine($"Model: {paramBattery.MODEL}"); Console.WriteLine($"Serial Number: { Convert.ToInt32(paramBattery.SN).ToString("00000")}"); if (paramBattery.Bal_Cell_1) { //TxtStatusV1.BackColor = Color.PowderBlue; } else { //TxtStatusV1.BackColor = Color.White; } if (paramBattery.Bal_Cell_2) { //TxtStatusV2.BackColor = Color.PowderBlue; } else { //TxtStatusV2.BackColor = Color.White; } if (paramBattery.Bal_Cell_3) { //TxtStatusV3.BackColor = Color.PowderBlue; } else { //TxtStatusV3.BackColor = Color.White; } if (paramBattery.Bal_Cell_4) { //TxtStatusV4.BackColor = Color.PowderBlue; } else { //TxtStatusV4.BackColor = Color.White; } if (Convert.ToDouble(paramBattery.MODE) == 6.0) { if (paramBattery.Bal_Cell_5) { //TxtStatusV5.BackColor = Color.PowderBlue; } else { //TxtStatusV5.BackColor = Color.White; } if (paramBattery.Bal_Cell_6) { //TxtStatusV6.BackColor = Color.PowderBlue; } else { //TxtStatusV6.BackColor = Color.White; } } else { } } catch (Exception ex) { throw ex; } }