64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
|
|
namespace AGVEmulator
|
|
{
|
|
public partial class fMain
|
|
{
|
|
private void BMS_Message(object sender, AR.Dev.RS232.MessageEventArgs e)
|
|
{
|
|
|
|
logBMS.Add(e.Message);
|
|
|
|
}
|
|
|
|
private void BMS_RequestVoltageData(object sender, DevBMS.RequestVoltageDataArgs e)
|
|
{
|
|
|
|
//cell전압값추가
|
|
for (int i = 0; i < cellvolt.Length; i++)
|
|
{
|
|
this.cellvolt[i] = (UInt16)rnd.Next(3300, 3350);
|
|
}
|
|
Array.Copy(this.cellvolt, 0, e.cellVolt, 0, 8);
|
|
|
|
this.btc1.Invoke(new Action(() =>
|
|
{
|
|
var idx = 0;
|
|
btc1.Text = (this.cellvolt[idx++] / 1000f).ToString();
|
|
btc2.Text = (this.cellvolt[idx++] / 1000f).ToString();
|
|
btc3.Text = (this.cellvolt[idx++] / 1000f).ToString();
|
|
btc4.Text = (this.cellvolt[idx++] / 1000f).ToString();
|
|
btc5.Text = (this.cellvolt[idx++] / 1000f).ToString();
|
|
btc6.Text = (this.cellvolt[idx++] / 1000f).ToString();
|
|
btc7.Text = (this.cellvolt[idx++] / 1000f).ToString();
|
|
btc8.Text = (this.cellvolt[idx++] / 1000f).ToString();
|
|
}));
|
|
|
|
}
|
|
private void Bms_RequestBatteryData(object sender, DevBMS.RequestBatteryDataArgs e)
|
|
{
|
|
if (checkBox1.Checked)
|
|
this.trackBar1.Invoke(new Action(() =>
|
|
{
|
|
this.trackBar1.Value -= 1;
|
|
trackBar1_Scroll(null, null);
|
|
}));
|
|
|
|
e.CurA = (int)BMS_CurA;
|
|
e.MaxA = (int)BMS_MaxA;
|
|
e.Remain = BMS_Remain;
|
|
e.Volt = BMS_Volt;
|
|
e.Temp1 = this.Temp1;
|
|
e.Temp2 = this.Temp2;
|
|
|
|
}
|
|
|
|
}
|
|
}
|