add temp1, temp2

This commit is contained in:
chi
2025-06-20 11:56:34 +09:00
parent 0ae0faf050
commit f7615396d5
22 changed files with 1800 additions and 802 deletions

View File

@@ -466,9 +466,7 @@
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<None Include="sample.route"> <None Include="sample.route" />
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="ReadMe.txt" /> <Content Include="ReadMe.txt" />

View File

@@ -149,8 +149,9 @@ namespace Project.Dialog
{ {
var bg1 = lbTitle.BackColor; var bg1 = lbTitle.BackColor;
var bg2 = lbTitle.BackColor2; var bg2 = lbTitle.BackColor2;
lbTitle.BackColor = bg2; if (bg1 != null) lbTitle.BackColor2 = (Color)bg1;
lbTitle.BackColor2 = bg1; if (bg2 != null) lbTitle.BackColor = (Color)bg2;
} }
private void btYes_Click(object sender, EventArgs e) private void btYes_Click(object sender, EventArgs e)

View File

@@ -185,8 +185,8 @@ namespace Project.Dialog
{ {
var bg1 = lbTitle.BackColor; var bg1 = lbTitle.BackColor;
var bg2 = lbTitle.BackColor2; var bg2 = lbTitle.BackColor2;
lbTitle.BackColor = bg2; lbTitle.BackColor = (Color)bg2;
lbTitle.BackColor2 = bg1; lbTitle.BackColor2 = (Color)bg1;
} }
private void btYes_Click(object sender, EventArgs e) private void btYes_Click(object sender, EventArgs e)

View File

@@ -179,8 +179,8 @@ namespace Project
{ {
var bg1 = lbTitle.BackColor; var bg1 = lbTitle.BackColor;
var bg2 = lbTitle.BackColor2; var bg2 = lbTitle.BackColor2;
lbTitle.BackColor = bg2; lbTitle.BackColor = (Color)bg2;
lbTitle.BackColor2 = bg1; lbTitle.BackColor2 = (Color)bg1;
} }
private void btYes_Click(object sender, EventArgs e) private void btYes_Click(object sender, EventArgs e)

View File

@@ -35,59 +35,6 @@ namespace Project
} }
} }
//ePosition ParsePosition(uint tag, out string dirBW)
//{
// var tagstr = tag.ToString();
// var tagno = tagstr.Substring(0, tagstr.Length - 1);
// if (tag == PUB.setting.TAGNOT) { dirBW = "0"; return ePosition.NOT; }
// else if (tag == PUB.setting.TAG_QA_QC) { dirBW = "0"; return ePosition.QA_QC; }
// else if (tag == PUB.setting.TAG_QC_F1) { dirBW = "0"; return ePosition.QC_F1; }
// else if (tag == PUB.setting.TAG_F1_F2) { dirBW = "0"; return ePosition.F1_F2; }
// else if (tag == PUB.setting.TAG_F2_F3) { dirBW = "0"; return ePosition.F2_F3; }
// else if (tag == PUB.setting.TAG_F3_F4) { dirBW = "0"; return ePosition.F3_F4; }
// else if (tag == PUB.setting.TAG_F4_F5) { dirBW = "0"; return ePosition.F4_F5; }
// else if (tag == PUB.setting.TAGQAB) { dirBW = "0"; return ePosition.QA; }
// else if (tag == PUB.setting.TAGQCB) { dirBW = "0"; return ePosition.QC; }
// else if (tag == PUB.setting.TAGF1B) { dirBW = "0"; return ePosition.F1; }
// else if (tag == PUB.setting.TAGF2B) { dirBW = "0"; return ePosition.F2; }
// else if (tag == PUB.setting.TAGF3B) { dirBW = "0"; return ePosition.F3; }
// else if (tag == PUB.setting.TAGF4B) { dirBW = "0"; return ePosition.F4; }
// else if (tag == PUB.setting.TAGF5B) { dirBW = "0"; return ePosition.F5; }
// //else if (tag == PUB.setting.TAGQAA) { dirBW = "1"; return ePosition.QA; }
// //else if (tag == PUB.setting.TAGCHA) { dirBW = "1"; return ePosition.CHARGE; }
// else if (tag == PUB.setting.TAGQAA) { dirBW = "1"; return ePosition.QA; }
// else if (tag == PUB.setting.TAGQCA) { dirBW = "1"; return ePosition.QC; }
// else if (tag == PUB.setting.TAGF1A) { dirBW = "1"; return ePosition.F1; }
// else if (tag == PUB.setting.TAGF2A) { dirBW = "1"; return ePosition.F2; }
// else if (tag == PUB.setting.TAGF3A) { dirBW = "1"; return ePosition.F3; }
// else if (tag == PUB.setting.TAGF4A) { dirBW = "1"; return ePosition.F4; }
// else if (tag == PUB.setting.TAGF5A) { dirBW = "1"; return ePosition.F5; }
// else if (tag == PUB.setting.TAGPOT) { dirBW = "0"; return ePosition.POT; }
// else
// {
// if (tag > 9350 && tag < 9400)
// {
// dirBW = "0"; return ePosition.QC_F1;
// }
// else if (tag > 9250 && tag < 9300)
// {
// dirBW = "0"; return ePosition.QA_QC;
// }
// else if (tag > 9000 && tag < 9100)
// {
// dirBW = "0"; return ePosition.NOT;
// }
// else
// {
// dirBW = "0"; return ePosition.NONE;
// }
// }
//}
bool _charging = false; bool _charging = false;
private void AGV_DataReceive(object sender, arDev.Narumi.DataEventArgs e) private void AGV_DataReceive(object sender, arDev.Narumi.DataEventArgs e)
@@ -107,6 +54,11 @@ namespace Project
VAR.BOOL[eVarBool.AGV_ERROR] = PUB.AGV.error.Value > 0; VAR.BOOL[eVarBool.AGV_ERROR] = PUB.AGV.error.Value > 0;
VAR.BOOL[eVarBool.EMERGENCY] = PUB.AGV.error.Emergency; VAR.BOOL[eVarBool.EMERGENCY] = PUB.AGV.error.Emergency;
if (PUB.AGV.data.Direction =='B')
PUB.mapctl.agv.CurrentDirection = AGVControl.Models.Direction.Backward;
else
PUB.mapctl.agv.CurrentDirection = AGVControl.Models.Direction.Forward;
if (PUB.AGV.signal.mark_sensor == false) if (PUB.AGV.signal.mark_sensor == false)
{ {
if (VAR.BOOL[eVarBool.MARK_SENSOROFF] == false) if (VAR.BOOL[eVarBool.MARK_SENSOROFF] == false)

View File

@@ -25,7 +25,7 @@ namespace Project
DateTime lastbmstime = DateTime.Now; DateTime lastbmstime = DateTime.Now;
private void Bms_Message(object sender, arDev.BMS.MessageEventArgs e) private void Bms_Message(object sender, arDev.BMS.MessageEventArgs e)
{ {
if (e.MsgType == arDev.arRS232.MessageType.Error) PUB.logbms.AddE( e.Message); if (e.MsgType == arRS232.MessageType.Error) PUB.logbms.AddE( e.Message);
else else
{ {
var hexstr = e.Data.GetHexString().Trim(); var hexstr = e.Data.GetHexString().Trim();

View File

@@ -108,8 +108,18 @@ namespace Project
eVarTime.LastConn_XBE, eVarTime.LastConnTry_XBE, eVarTime.LastRecv_XBE); eVarTime.LastConn_XBE, eVarTime.LastConnTry_XBE, eVarTime.LastRecv_XBE);
//bms connect //bms connect
ConnectSerialPort(PUB.BMS, PUB.setting.Port_BAT, PUB.setting.Baud_BAT, if (PUB.BMS.IsOpen == false)
eVarTime.LastConn_BAT, eVarTime.LastConnTry_BAT, eVarTime.LastRecv_BAT); {
var ts = VAR.TIME.RUN(eVarTime.LastConn_BAT);
if (ts.TotalSeconds > 3)
{
PUB.BMS.PortName = PUB.setting.Port_BAT;
PUB.BMS.Open();
VAR.TIME.Update(eVarTime.LastConn_BAT);
}
}
//ConnectSerialPort(PUB.BMS, PUB.setting.Port_BAT, PUB.setting.Baud_BAT,
// eVarTime.LastConn_BAT, eVarTime.LastConnTry_BAT, eVarTime.LastRecv_BAT);
//지그비상태전송 //지그비상태전송
if (PUB.XBE != null && PUB.XBE.IsOpen) if (PUB.XBE != null && PUB.XBE.IsOpen)

View File

@@ -65,6 +65,8 @@ namespace Project
lbBat.CurA = PUB.BMS.Current_Amp; lbBat.CurA = PUB.BMS.Current_Amp;
lbBat.IsOpen = PUB.BMS.IsOpen; lbBat.IsOpen = PUB.BMS.IsOpen;
if (PUB.mapctl != null)
PUB.mapctl.Invalidate();
//쓰레드로인해서 메인에서 진행하게한다. SPS는 메인쓰레드에서 진행 됨 //쓰레드로인해서 메인에서 진행하게한다. SPS는 메인쓰레드에서 진행 됨
//팝을 제거 혹은 표시하는 기능 //팝을 제거 혹은 표시하는 기능
@@ -391,7 +393,7 @@ namespace Project
var tswarnmsg = VAR.TIME.RUN(eVarTime.BatWarnTime); var tswarnmsg = VAR.TIME.RUN(eVarTime.BatWarnTime);
if (tswarnmsg.TotalSeconds >= timeoutsec) if (tswarnmsg.TotalSeconds >= timeoutsec)
{ {
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM]==false && VAR.BOOL[eVarBool.FLAG_CHARGEONA] == false) if (VAR.BOOL[eVarBool.FLAG_CHARGEONM] == false && VAR.BOOL[eVarBool.FLAG_CHARGEONA] == false)
{ {
if (PUB.BMS.IsValid == false) if (PUB.BMS.IsValid == false)
{ {

View File

@@ -31,46 +31,56 @@
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.arLabel1 = new arCtl.arLabel();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panel2 = new System.Windows.Forms.Panel(); this.lbcvSt = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.cv1 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.cv2 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.panel4 = new System.Windows.Forms.Panel();
this.cv3 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.panel5 = new System.Windows.Forms.Panel();
this.cv4 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.panel6 = new System.Windows.Forms.Panel();
this.cv5 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.panel7 = new System.Windows.Forms.Panel();
this.cv6 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.panel8 = new System.Windows.Forms.Panel();
this.cv7 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.panel9 = new System.Windows.Forms.Panel(); this.panel9 = new System.Windows.Forms.Panel();
this.cv8 = new System.Windows.Forms.Label(); this.cv8 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label();
this.panel8 = new System.Windows.Forms.Panel();
this.cv7 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.panel7 = new System.Windows.Forms.Panel();
this.cv6 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.panel6 = new System.Windows.Forms.Panel();
this.cv5 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.panel5 = new System.Windows.Forms.Panel();
this.cv4 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.panel4 = new System.Windows.Forms.Panel();
this.cv3 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.cv2 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.cv1 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.arLabel1 = new arCtl.arLabel();
this.lbinfost = new System.Windows.Forms.Label(); this.lbinfost = new System.Windows.Forms.Label();
this.lbcvSt = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.panel10 = new System.Windows.Forms.Panel();
this.lbTemp1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.panel11 = new System.Windows.Forms.Panel();
this.lbtemp2 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
this.panel4.SuspendLayout();
this.panel5.SuspendLayout();
this.panel6.SuspendLayout();
this.panel7.SuspendLayout();
this.panel8.SuspendLayout();
this.panel9.SuspendLayout(); this.panel9.SuspendLayout();
this.panel8.SuspendLayout();
this.panel7.SuspendLayout();
this.panel6.SuspendLayout();
this.panel5.SuspendLayout();
this.panel4.SuspendLayout();
this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
this.groupBox2.SuspendLayout();
this.panel10.SuspendLayout();
this.panel11.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// timer1 // timer1
@@ -80,6 +90,7 @@
// //
// panel1 // panel1
// //
this.panel1.Controls.Add(this.groupBox2);
this.panel1.Controls.Add(this.groupBox1); this.panel1.Controls.Add(this.groupBox1);
this.panel1.Controls.Add(this.button2); this.panel1.Controls.Add(this.button2);
this.panel1.Controls.Add(this.button1); this.panel1.Controls.Add(this.button1);
@@ -89,12 +100,319 @@
this.panel1.Size = new System.Drawing.Size(187, 577); this.panel1.Size = new System.Drawing.Size(187, 577);
this.panel1.TabIndex = 0; this.panel1.TabIndex = 0;
// //
// groupBox1
//
this.groupBox1.Controls.Add(this.panel9);
this.groupBox1.Controls.Add(this.panel8);
this.groupBox1.Controls.Add(this.panel7);
this.groupBox1.Controls.Add(this.panel6);
this.groupBox1.Controls.Add(this.panel5);
this.groupBox1.Controls.Add(this.panel4);
this.groupBox1.Controls.Add(this.panel3);
this.groupBox1.Controls.Add(this.panel2);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.ForeColor = System.Drawing.Color.White;
this.groupBox1.Location = new System.Drawing.Point(0, 118);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(187, 347);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Cell voltage";
//
// lbcvSt
//
this.lbcvSt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lbcvSt.AutoSize = true;
this.lbcvSt.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.lbcvSt.ForeColor = System.Drawing.Color.White;
this.lbcvSt.Location = new System.Drawing.Point(148, 82);
this.lbcvSt.Name = "lbcvSt";
this.lbcvSt.Size = new System.Drawing.Size(39, 27);
this.lbcvSt.TabIndex = 8;
this.lbcvSt.Text = "●";
//
// panel9
//
this.panel9.Controls.Add(this.cv8);
this.panel9.Controls.Add(this.label16);
this.panel9.Dock = System.Windows.Forms.DockStyle.Top;
this.panel9.Location = new System.Drawing.Point(3, 297);
this.panel9.Name = "panel9";
this.panel9.Size = new System.Drawing.Size(181, 40);
this.panel9.TabIndex = 7;
//
// cv8
//
this.cv8.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv8.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv8.Location = new System.Drawing.Point(47, 0);
this.cv8.Name = "cv8";
this.cv8.Size = new System.Drawing.Size(134, 40);
this.cv8.TabIndex = 0;
this.cv8.Text = "--";
this.cv8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label16
//
this.label16.Dock = System.Windows.Forms.DockStyle.Left;
this.label16.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label16.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label16.Location = new System.Drawing.Point(0, 0);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(47, 40);
this.label16.TabIndex = 0;
this.label16.Text = "#8";
this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel8
//
this.panel8.Controls.Add(this.cv7);
this.panel8.Controls.Add(this.label14);
this.panel8.Dock = System.Windows.Forms.DockStyle.Top;
this.panel8.Location = new System.Drawing.Point(3, 257);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(181, 40);
this.panel8.TabIndex = 6;
this.panel8.Paint += new System.Windows.Forms.PaintEventHandler(this.panel8_Paint);
//
// cv7
//
this.cv7.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv7.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv7.Location = new System.Drawing.Point(47, 0);
this.cv7.Name = "cv7";
this.cv7.Size = new System.Drawing.Size(134, 40);
this.cv7.TabIndex = 0;
this.cv7.Text = "--";
this.cv7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label14
//
this.label14.Dock = System.Windows.Forms.DockStyle.Left;
this.label14.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label14.Location = new System.Drawing.Point(0, 0);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(47, 40);
this.label14.TabIndex = 0;
this.label14.Text = "#7";
this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel7
//
this.panel7.Controls.Add(this.cv6);
this.panel7.Controls.Add(this.label12);
this.panel7.Dock = System.Windows.Forms.DockStyle.Top;
this.panel7.Location = new System.Drawing.Point(3, 217);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(181, 40);
this.panel7.TabIndex = 5;
//
// cv6
//
this.cv6.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv6.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv6.Location = new System.Drawing.Point(47, 0);
this.cv6.Name = "cv6";
this.cv6.Size = new System.Drawing.Size(134, 40);
this.cv6.TabIndex = 0;
this.cv6.Text = "--";
this.cv6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label12
//
this.label12.Dock = System.Windows.Forms.DockStyle.Left;
this.label12.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label12.Location = new System.Drawing.Point(0, 0);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(47, 40);
this.label12.TabIndex = 0;
this.label12.Text = "#6";
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel6
//
this.panel6.Controls.Add(this.cv5);
this.panel6.Controls.Add(this.label10);
this.panel6.Dock = System.Windows.Forms.DockStyle.Top;
this.panel6.Location = new System.Drawing.Point(3, 177);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(181, 40);
this.panel6.TabIndex = 4;
this.panel6.Paint += new System.Windows.Forms.PaintEventHandler(this.panel6_Paint);
//
// cv5
//
this.cv5.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv5.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv5.Location = new System.Drawing.Point(47, 0);
this.cv5.Name = "cv5";
this.cv5.Size = new System.Drawing.Size(134, 40);
this.cv5.TabIndex = 0;
this.cv5.Text = "--";
this.cv5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label10
//
this.label10.Dock = System.Windows.Forms.DockStyle.Left;
this.label10.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label10.Location = new System.Drawing.Point(0, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(47, 40);
this.label10.TabIndex = 0;
this.label10.Text = "#5";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel5
//
this.panel5.Controls.Add(this.cv4);
this.panel5.Controls.Add(this.label8);
this.panel5.Dock = System.Windows.Forms.DockStyle.Top;
this.panel5.Location = new System.Drawing.Point(3, 137);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(181, 40);
this.panel5.TabIndex = 3;
//
// cv4
//
this.cv4.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv4.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv4.Location = new System.Drawing.Point(47, 0);
this.cv4.Name = "cv4";
this.cv4.Size = new System.Drawing.Size(134, 40);
this.cv4.TabIndex = 0;
this.cv4.Text = "--";
this.cv4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label8
//
this.label8.Dock = System.Windows.Forms.DockStyle.Left;
this.label8.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label8.Location = new System.Drawing.Point(0, 0);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(47, 40);
this.label8.TabIndex = 0;
this.label8.Text = "#4";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel4
//
this.panel4.Controls.Add(this.cv3);
this.panel4.Controls.Add(this.label6);
this.panel4.Dock = System.Windows.Forms.DockStyle.Top;
this.panel4.Location = new System.Drawing.Point(3, 97);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(181, 40);
this.panel4.TabIndex = 2;
this.panel4.Paint += new System.Windows.Forms.PaintEventHandler(this.panel4_Paint);
//
// cv3
//
this.cv3.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv3.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv3.Location = new System.Drawing.Point(47, 0);
this.cv3.Name = "cv3";
this.cv3.Size = new System.Drawing.Size(134, 40);
this.cv3.TabIndex = 0;
this.cv3.Text = "--";
this.cv3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label6
//
this.label6.Dock = System.Windows.Forms.DockStyle.Left;
this.label6.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label6.Location = new System.Drawing.Point(0, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(47, 40);
this.label6.TabIndex = 0;
this.label6.Text = "#3";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel3
//
this.panel3.Controls.Add(this.cv2);
this.panel3.Controls.Add(this.label4);
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
this.panel3.Location = new System.Drawing.Point(3, 57);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(181, 40);
this.panel3.TabIndex = 1;
this.panel3.Paint += new System.Windows.Forms.PaintEventHandler(this.panel3_Paint);
//
// cv2
//
this.cv2.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv2.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv2.Location = new System.Drawing.Point(47, 0);
this.cv2.Name = "cv2";
this.cv2.Size = new System.Drawing.Size(134, 40);
this.cv2.TabIndex = 0;
this.cv2.Text = "--";
this.cv2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label4
//
this.label4.Dock = System.Windows.Forms.DockStyle.Left;
this.label4.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label4.Location = new System.Drawing.Point(0, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(47, 40);
this.label4.TabIndex = 0;
this.label4.Text = "#2";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel2
//
this.panel2.Controls.Add(this.cv1);
this.panel2.Controls.Add(this.label1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(3, 17);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(181, 40);
this.panel2.TabIndex = 0;
//
// cv1
//
this.cv1.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv1.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv1.Location = new System.Drawing.Point(47, 0);
this.cv1.Name = "cv1";
this.cv1.Size = new System.Drawing.Size(134, 40);
this.cv1.TabIndex = 0;
this.cv1.Text = "--";
this.cv1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Left;
this.label1.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 40);
this.label1.TabIndex = 0;
this.label1.Text = "#1";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button2 // button2
// //
this.button2.Dock = System.Windows.Forms.DockStyle.Top; this.button2.Dock = System.Windows.Forms.DockStyle.Top;
this.button2.Location = new System.Drawing.Point(0, 67); this.button2.Location = new System.Drawing.Point(0, 59);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(187, 67); this.button2.Size = new System.Drawing.Size(187, 59);
this.button2.TabIndex = 1; this.button2.TabIndex = 1;
this.button2.Text = "Query Cell Voltage"; this.button2.Text = "Query Cell Voltage";
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
@@ -105,7 +423,7 @@
this.button1.Dock = System.Windows.Forms.DockStyle.Top; this.button1.Dock = System.Windows.Forms.DockStyle.Top;
this.button1.Location = new System.Drawing.Point(0, 0); this.button1.Location = new System.Drawing.Point(0, 0);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(187, 67); this.button1.Size = new System.Drawing.Size(187, 59);
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
this.button1.Text = "Query Remain"; this.button1.Text = "Query Remain";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
@@ -155,302 +473,6 @@
this.arLabel1.TextShadow = false; this.arLabel1.TextShadow = false;
this.arLabel1.TextVisible = true; this.arLabel1.TextVisible = true;
// //
// groupBox1
//
this.groupBox1.Controls.Add(this.lbcvSt);
this.groupBox1.Controls.Add(this.panel9);
this.groupBox1.Controls.Add(this.panel8);
this.groupBox1.Controls.Add(this.panel7);
this.groupBox1.Controls.Add(this.panel6);
this.groupBox1.Controls.Add(this.panel5);
this.groupBox1.Controls.Add(this.panel4);
this.groupBox1.Controls.Add(this.panel3);
this.groupBox1.Controls.Add(this.panel2);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.ForeColor = System.Drawing.Color.White;
this.groupBox1.Location = new System.Drawing.Point(0, 134);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(187, 443);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Cell voltage";
//
// panel2
//
this.panel2.Controls.Add(this.cv1);
this.panel2.Controls.Add(this.label1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(3, 17);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(181, 40);
this.panel2.TabIndex = 0;
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Left;
this.label1.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 40);
this.label1.TabIndex = 0;
this.label1.Text = "#1";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// cv1
//
this.cv1.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv1.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv1.Location = new System.Drawing.Point(47, 0);
this.cv1.Name = "cv1";
this.cv1.Size = new System.Drawing.Size(134, 40);
this.cv1.TabIndex = 0;
this.cv1.Text = "--";
this.cv1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel3
//
this.panel3.Controls.Add(this.cv2);
this.panel3.Controls.Add(this.label4);
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
this.panel3.Location = new System.Drawing.Point(3, 57);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(181, 40);
this.panel3.TabIndex = 1;
this.panel3.Paint += new System.Windows.Forms.PaintEventHandler(this.panel3_Paint);
//
// cv2
//
this.cv2.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv2.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv2.Location = new System.Drawing.Point(47, 0);
this.cv2.Name = "cv2";
this.cv2.Size = new System.Drawing.Size(134, 40);
this.cv2.TabIndex = 0;
this.cv2.Text = "--";
this.cv2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label4
//
this.label4.Dock = System.Windows.Forms.DockStyle.Left;
this.label4.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label4.Location = new System.Drawing.Point(0, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(47, 40);
this.label4.TabIndex = 0;
this.label4.Text = "#2";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel4
//
this.panel4.Controls.Add(this.cv3);
this.panel4.Controls.Add(this.label6);
this.panel4.Dock = System.Windows.Forms.DockStyle.Top;
this.panel4.Location = new System.Drawing.Point(3, 97);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(181, 40);
this.panel4.TabIndex = 2;
this.panel4.Paint += new System.Windows.Forms.PaintEventHandler(this.panel4_Paint);
//
// cv3
//
this.cv3.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv3.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv3.Location = new System.Drawing.Point(47, 0);
this.cv3.Name = "cv3";
this.cv3.Size = new System.Drawing.Size(134, 40);
this.cv3.TabIndex = 0;
this.cv3.Text = "--";
this.cv3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label6
//
this.label6.Dock = System.Windows.Forms.DockStyle.Left;
this.label6.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label6.Location = new System.Drawing.Point(0, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(47, 40);
this.label6.TabIndex = 0;
this.label6.Text = "#3";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel5
//
this.panel5.Controls.Add(this.cv4);
this.panel5.Controls.Add(this.label8);
this.panel5.Dock = System.Windows.Forms.DockStyle.Top;
this.panel5.Location = new System.Drawing.Point(3, 137);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(181, 40);
this.panel5.TabIndex = 3;
//
// cv4
//
this.cv4.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv4.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv4.Location = new System.Drawing.Point(47, 0);
this.cv4.Name = "cv4";
this.cv4.Size = new System.Drawing.Size(134, 40);
this.cv4.TabIndex = 0;
this.cv4.Text = "--";
this.cv4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label8
//
this.label8.Dock = System.Windows.Forms.DockStyle.Left;
this.label8.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label8.Location = new System.Drawing.Point(0, 0);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(47, 40);
this.label8.TabIndex = 0;
this.label8.Text = "#4";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel6
//
this.panel6.Controls.Add(this.cv5);
this.panel6.Controls.Add(this.label10);
this.panel6.Dock = System.Windows.Forms.DockStyle.Top;
this.panel6.Location = new System.Drawing.Point(3, 177);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(181, 40);
this.panel6.TabIndex = 4;
this.panel6.Paint += new System.Windows.Forms.PaintEventHandler(this.panel6_Paint);
//
// cv5
//
this.cv5.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv5.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv5.Location = new System.Drawing.Point(47, 0);
this.cv5.Name = "cv5";
this.cv5.Size = new System.Drawing.Size(134, 40);
this.cv5.TabIndex = 0;
this.cv5.Text = "--";
this.cv5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label10
//
this.label10.Dock = System.Windows.Forms.DockStyle.Left;
this.label10.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label10.Location = new System.Drawing.Point(0, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(47, 40);
this.label10.TabIndex = 0;
this.label10.Text = "#5";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel7
//
this.panel7.Controls.Add(this.cv6);
this.panel7.Controls.Add(this.label12);
this.panel7.Dock = System.Windows.Forms.DockStyle.Top;
this.panel7.Location = new System.Drawing.Point(3, 217);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(181, 40);
this.panel7.TabIndex = 5;
//
// cv6
//
this.cv6.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv6.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv6.Location = new System.Drawing.Point(47, 0);
this.cv6.Name = "cv6";
this.cv6.Size = new System.Drawing.Size(134, 40);
this.cv6.TabIndex = 0;
this.cv6.Text = "--";
this.cv6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label12
//
this.label12.Dock = System.Windows.Forms.DockStyle.Left;
this.label12.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label12.Location = new System.Drawing.Point(0, 0);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(47, 40);
this.label12.TabIndex = 0;
this.label12.Text = "#6";
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel8
//
this.panel8.Controls.Add(this.cv7);
this.panel8.Controls.Add(this.label14);
this.panel8.Dock = System.Windows.Forms.DockStyle.Top;
this.panel8.Location = new System.Drawing.Point(3, 257);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(181, 40);
this.panel8.TabIndex = 6;
this.panel8.Paint += new System.Windows.Forms.PaintEventHandler(this.panel8_Paint);
//
// cv7
//
this.cv7.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv7.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv7.Location = new System.Drawing.Point(47, 0);
this.cv7.Name = "cv7";
this.cv7.Size = new System.Drawing.Size(134, 40);
this.cv7.TabIndex = 0;
this.cv7.Text = "--";
this.cv7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label14
//
this.label14.Dock = System.Windows.Forms.DockStyle.Left;
this.label14.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label14.Location = new System.Drawing.Point(0, 0);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(47, 40);
this.label14.TabIndex = 0;
this.label14.Text = "#7";
this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel9
//
this.panel9.Controls.Add(this.cv8);
this.panel9.Controls.Add(this.label16);
this.panel9.Dock = System.Windows.Forms.DockStyle.Top;
this.panel9.Location = new System.Drawing.Point(3, 297);
this.panel9.Name = "panel9";
this.panel9.Size = new System.Drawing.Size(181, 40);
this.panel9.TabIndex = 7;
//
// cv8
//
this.cv8.Dock = System.Windows.Forms.DockStyle.Fill;
this.cv8.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cv8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.cv8.Location = new System.Drawing.Point(47, 0);
this.cv8.Name = "cv8";
this.cv8.Size = new System.Drawing.Size(134, 40);
this.cv8.TabIndex = 0;
this.cv8.Text = "--";
this.cv8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label16
//
this.label16.Dock = System.Windows.Forms.DockStyle.Left;
this.label16.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label16.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label16.Location = new System.Drawing.Point(0, 0);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(47, 40);
this.label16.TabIndex = 0;
this.label16.Text = "#8";
this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lbinfost // lbinfost
// //
this.lbinfost.AutoSize = true; this.lbinfost.AutoSize = true;
@@ -462,17 +484,87 @@
this.lbinfost.TabIndex = 2; this.lbinfost.TabIndex = 2;
this.lbinfost.Text = "●"; this.lbinfost.Text = "●";
// //
// lbcvSt // groupBox2
// //
this.lbcvSt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.groupBox2.Controls.Add(this.lbcvSt);
this.lbcvSt.AutoSize = true; this.groupBox2.Controls.Add(this.panel11);
this.lbcvSt.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); this.groupBox2.Controls.Add(this.panel10);
this.lbcvSt.ForeColor = System.Drawing.Color.White; this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbcvSt.Location = new System.Drawing.Point(2, 411); this.groupBox2.ForeColor = System.Drawing.Color.White;
this.lbcvSt.Name = "lbcvSt"; this.groupBox2.Location = new System.Drawing.Point(0, 465);
this.lbcvSt.Size = new System.Drawing.Size(39, 27); this.groupBox2.Name = "groupBox2";
this.lbcvSt.TabIndex = 8; this.groupBox2.Size = new System.Drawing.Size(187, 112);
this.lbcvSt.Text = "●"; this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Temp";
//
// panel10
//
this.panel10.Controls.Add(this.lbTemp1);
this.panel10.Controls.Add(this.label3);
this.panel10.Dock = System.Windows.Forms.DockStyle.Top;
this.panel10.Location = new System.Drawing.Point(3, 17);
this.panel10.Name = "panel10";
this.panel10.Size = new System.Drawing.Size(181, 40);
this.panel10.TabIndex = 9;
//
// label2
//
this.lbTemp1.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbTemp1.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbTemp1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.lbTemp1.Location = new System.Drawing.Point(47, 0);
this.lbTemp1.Name = "label2";
this.lbTemp1.Size = new System.Drawing.Size(134, 40);
this.lbTemp1.TabIndex = 0;
this.lbTemp1.Text = "--";
this.lbTemp1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.Dock = System.Windows.Forms.DockStyle.Left;
this.label3.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label3.Location = new System.Drawing.Point(0, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(47, 40);
this.label3.TabIndex = 0;
this.label3.Text = "#1";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel11
//
this.panel11.Controls.Add(this.lbtemp2);
this.panel11.Controls.Add(this.label7);
this.panel11.Dock = System.Windows.Forms.DockStyle.Top;
this.panel11.Location = new System.Drawing.Point(3, 57);
this.panel11.Name = "panel11";
this.panel11.Size = new System.Drawing.Size(181, 40);
this.panel11.TabIndex = 10;
//
// label5
//
this.lbtemp2.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbtemp2.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbtemp2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.lbtemp2.Location = new System.Drawing.Point(47, 0);
this.lbtemp2.Name = "label5";
this.lbtemp2.Size = new System.Drawing.Size(134, 40);
this.lbtemp2.TabIndex = 0;
this.lbtemp2.Text = "--";
this.lbtemp2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label7
//
this.label7.Dock = System.Windows.Forms.DockStyle.Left;
this.label7.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label7.Location = new System.Drawing.Point(0, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(47, 40);
this.label7.TabIndex = 0;
this.label7.Text = "#2";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// fBms // fBms
// //
@@ -490,15 +582,18 @@
this.VisibleChanged += new System.EventHandler(this.fAgv_VisibleChanged); this.VisibleChanged += new System.EventHandler(this.fAgv_VisibleChanged);
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.panel5.ResumeLayout(false);
this.panel6.ResumeLayout(false);
this.panel7.ResumeLayout(false);
this.panel8.ResumeLayout(false);
this.panel9.ResumeLayout(false); this.panel9.ResumeLayout(false);
this.panel8.ResumeLayout(false);
this.panel7.ResumeLayout(false);
this.panel6.ResumeLayout(false);
this.panel5.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.panel10.ResumeLayout(false);
this.panel11.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -537,5 +632,12 @@
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label lbinfost; private System.Windows.Forms.Label lbinfost;
private System.Windows.Forms.Label lbcvSt; private System.Windows.Forms.Label lbcvSt;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Panel panel11;
private System.Windows.Forms.Label lbtemp2;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Panel panel10;
private System.Windows.Forms.Label lbTemp1;
private System.Windows.Forms.Label label3;
} }
} }

View File

@@ -73,6 +73,8 @@ namespace Project.ViewForm
this.cv6.Text = PUB.BMS.CellVoltage[5].ToString("N3") + "v"; this.cv6.Text = PUB.BMS.CellVoltage[5].ToString("N3") + "v";
this.cv7.Text = PUB.BMS.CellVoltage[6].ToString("N3") + "v"; this.cv7.Text = PUB.BMS.CellVoltage[6].ToString("N3") + "v";
this.cv8.Text = PUB.BMS.CellVoltage[7].ToString("N3") + "v"; this.cv8.Text = PUB.BMS.CellVoltage[7].ToString("N3") + "v";
this.lbTemp1.Text = PUB.BMS.Current_temp1.ToString() + "℃";
this.lbtemp2.Text = PUB.BMS.Current_temp2.ToString() + "℃";
timer1.Start(); timer1.Start();
} }

View File

@@ -1,113 +1,102 @@
[RFID_POINTS] [RFID_POINTS]
100,486,0002 100,486,517
164,494,0003 173,488,516
229,493,0004 230,493,515
309,489,0005 309,489,514
370,490,0006 370,490,513
437,486,0007 437,487,512
483,459,0008 483,459,511
511,421,0009 511,421,510
543,371,0010 543,371,509
569,329,0011 569,329,508
608,289,0012 608,289,507
661,279,0013 661,279,506
700,297,0014 701,297,505
698,349,0015 698,349,504
698,391,0016 698,391,503
699,449,0017 699,449,502
691,491,0018 691,491,501
569,275,0019 570,275,400
518,264,0020 517,264,401
454,264,0021 454,264,402
388,261,0022 388,262,403
314,258,0023 315,258,404
639,234,0024 639,234,600
621,182,0025 621,182,601
629,143,0026 641,183,602
657,101,0027 657,101,603
627,82,0028 627,82,604
560,73,0029 560,73,605
499,65,0030 499,65,606
432,65,0031 432,65,607
264,232,0032 264,232,405
363,60,0033 363,60,608
654,508,0034 654,508,500
96,542,0050 96,542,100
159,542,0051 159,542,101
226,542,0061 226,542,102
309,541,0070 309,541,103
369,542,0071 369,542,104
483,165,0010 483,165,753
735,163,0011 735,163,700
523,170,0001 523,170,752
565,175,0002 565,175,751
597,182,0003 597,182,750
665,181,0004 665,181,703
700,176,0005 700,176,702
721,170,0006 722,170,701
[RFID_LINES] [RFID_LINES]
96,542,100,486,0005,0002,False,56.14267 100,486,173,488,517,516,False,73.02739
100,486,164,494,0002,0003,False,64.49806 173,488,230,493,516,515,False,57.21888
164,494,229,493,0003,0004,False,65.00769 230,493,309,489,515,514,False,79.1012
229,493,309,489,0004,0005,False,80.09994 309,489,370,490,514,513,False,61.0082
309,489,370,490,0005,0006,False,61.0082 370,490,437,487,513,512,False,67.06713
370,490,437,486,0006,0007,False,67.11929 437,487,483,459,512,511,False,53.85165
437,486,483,459,0007,0008,False,53.33854 483,459,511,421,511,510,False,47.20169
483,459,511,421,0008,0009,False,47.20169 511,421,543,371,510,509,False,59.36329
511,421,543,371,0009,0010,False,59.36329 543,371,569,329,509,508,False,49.39635
543,371,569,329,0010,0011,False,49.39635 569,329,608,289,508,507,False,55.86591
569,329,608,289,0011,0012,False,55.86591 608,289,639,234,507,600,False,63.13478
608,289,661,279,0012,0013,False,53.93515 639,234,665,181,600,703,False,59.03389
661,279,700,297,0013,0014,False,42.95346 665,181,657,101,703,603,False,80.399
700,297,698,349,0014,0015,False,52.03845 657,101,627,82,603,604,False,35.51056
698,349,698,391,0015,0016,False,42 627,82,560,73,604,605,False,67.60178
698,391,699,449,0016,0017,False,58.00862 560,73,499,65,605,606,False,61.52235
699,449,691,491,0017,0018,False,42.75512 499,65,432,65,606,607,False,67
691,491,654,508,0018,0034,False,40.71855 432,65,363,60,607,608,False,69.18092
159,542,164,494,0006,0003,False,48.25971 641,183,665,181,602,703,False,24.08319
226,542,229,493,0007,0004,False,49.09175 665,181,700,176,703,702,False,35.35534
309,541,309,489,0008,0005,False,52 700,176,722,170,702,701,False,22.80351
369,542,370,490,0009,0006,False,52.00961 722,170,735,163,701,700,False,14.76482
370,490,370,490,0006,0006,False,0 641,183,621,182,602,601,False,20.02498
608,289,569,275,0012,0019,False,41.4367 621,182,597,182,601,750,False,24
569,275,518,264,0019,0020,False,52.17279 597,182,565,175,750,751,False,32.75668
518,264,454,264,0020,0021,False,64 565,175,523,170,751,752,False,42.29657
454,264,388,261,0021,0022,False,66.06815 523,170,483,165,752,753,False,40.31129
388,261,314,258,0022,0023,False,74.06078 264,232,315,258,405,404,False,57.24509
661,279,639,234,0013,0024,False,50.08992 315,258,388,262,404,403,False,73.1095
639,234,621,182,0024,0025,False,55.02727 388,262,454,264,403,402,False,66.0303
621,182,629,143,0025,0026,False,39.81206 454,264,517,264,402,401,False,63
629,143,657,101,0026,0027,False,50.47772 517,264,570,275,401,400,False,54.12947
657,101,627,82,0027,0028,False,35.51056 570,275,608,289,400,507,False,40.49691
627,82,560,73,0028,0029,False,67.60178 608,289,661,279,507,506,False,53.93515
560,73,499,65,0029,0030,False,61.52235 661,279,701,297,506,505,False,43.86343
483,165,523,170,0010,0001,False,40.31129 701,297,698,349,505,504,False,52.08647
523,170,565,175,0001,0002,False,42.29657 698,349,698,391,504,503,False,42
565,175,597,182,0002,0003,False,32.75668 698,391,699,449,503,502,False,58.00862
597,182,621,182,0003,0025,False,24 699,449,691,491,502,501,False,42.75512
621,182,665,181,0025,0004,False,44.01136 691,491,654,508,501,500,False,40.71855
665,181,700,176,0004,0005,False,35.35534 96,542,100,486,100,517,False,56.14267
700,176,721,170,0005,0006,False,21.84033 159,542,173,488,101,516,False,55.7853
721,170,735,163,0006,0011,False,15.65248 226,542,230,493,102,515,False,49.16299
735,163,721,170,0011,0006,False,15.65248 309,541,309,489,103,514,False,52
721,170,735,163,0006,0011,False,15.65248 369,542,370,490,104,513,False,52.00961
314,258,388,261,0023,0022,False,74.06078
388,261,454,264,0022,0021,False,66.06815
454,264,518,264,0021,0020,False,64
518,264,569,275,0020,0019,False,52.17279
569,275,608,289,0019,0012,False,41.4367
264,232,314,258,0032,0023,False,56.35601
363,60,432,65,0033,0031,False,69.18092
432,65,499,65,0031,0030,False,67
[MAP_TEXTS] [MAP_TEXTS]
179,251,-1,-16777216,Arial,12,OPS-2 179,251,-1,-16777216,Arial,12,OPS-2
239,52,-256,-65408,Arial,12,SSOTRON-3 239,52,-256,-65408,Arial,12,SSOTRON-3
617,527,-16711936,-16777216,Arial,12,SSOTRON-1 617,527,-16711936,-16777216,Arial,12,SSOTRON-1
87,551,-16777216,16777215,Arial,12,B1 87,551,-16777216,16777215,Arial,12,B1
150,551,-16777216,16777215,Arial,12,B2 150,550,-16777216,16777215,Arial,12,B2
227,553,-16777216,16777215,Arial,12,B3 227,553,-16777216,16777215,Arial,12,B3
299,555,-16777216,16777215,Arial,12,B4 299,555,-16777216,16777215,Arial,12,B4
367,554,-16777216,16777215,Arial,12,B5 367,554,-16777216,16777215,Arial,12,B5

View File

@@ -0,0 +1,3 @@
{
"dotnet.preferCSharpExtension": true
}

View File

@@ -49,6 +49,12 @@ namespace AGVControl
public List<Point> Path { get; set; } public List<Point> Path { get; set; }
} }
public enum AGVMoveState
{
Stop = 0,
Run
}
public enum AGVActionReasonCode public enum AGVActionReasonCode
{ {
Unknown = 0, Unknown = 0,
@@ -57,7 +63,8 @@ namespace AGVControl
NotOnPath, // 현재 위치가 경로에 없음 NotOnPath, // 현재 위치가 경로에 없음
Arrived, // 경로의 마지막 지점(목적지 도달) Arrived, // 경로의 마지막 지점(목적지 도달)
Normal, // 정상(다음 RFID 있음) Normal, // 정상(다음 RFID 있음)
NeedTurn NeedTurn,
NoTurnPoint,
} }
public class AGVActionPrediction public class AGVActionPrediction
@@ -66,6 +73,7 @@ namespace AGVControl
public uint? NextRFID { get; set; } public uint? NextRFID { get; set; }
public string Reason { get; set; } public string Reason { get; set; }
public AGVActionReasonCode ReasonCode { get; set; } public AGVActionReasonCode ReasonCode { get; set; }
public AGVMoveState MoveState { get; set; } // RUN 또는 STOP
} }
public partial class MapControl : Control public partial class MapControl : Control
@@ -401,35 +409,17 @@ namespace AGVControl
var selected_rfid = rfidPoints.Where(t => t.Bounds.Expand(SELECTION_DISTANCE, SELECTION_DISTANCE).Contains(mapPoint)).FirstOrDefault(); var selected_rfid = rfidPoints.Where(t => t.Bounds.Expand(SELECTION_DISTANCE, SELECTION_DISTANCE).Contains(mapPoint)).FirstOrDefault();
if (selected_rfid != null) if (selected_rfid != null)
{ {
var oldtagno = selected_rfid.RFIDValue; UTIL.ShowPropertyDialog(selected_rfid);
AR.UTIL.ShowProperty(selected_rfid);
if (selected_rfid.RFIDValue != oldtagno)
{
var items1 = this.rfidConnections.Where(t=>t.StartRFID == oldtagno);
foreach (var item in items1)
item.StartRFID = selected_rfid.RFIDValue;
var items2 = this.rfidConnections.Where(t => t.EndRFID == oldtagno);
foreach (var item in items2)
item.EndRFID = selected_rfid.RFIDValue;
}
this.Invalidate(); this.Invalidate();
return; return;
} }
// 텍스트 객체 찾기 // 텍스트 객체 찾기
var selected_txt = mapTexts.Where(t => t.Bounds.Expand(SELECTION_DISTANCE, SELECTION_DISTANCE).Contains(mapPoint)).FirstOrDefault(); var selected_txt = mapTexts.Where(t => t.Bounds.Expand(SELECTION_DISTANCE, SELECTION_DISTANCE).Contains(mapPoint)).FirstOrDefault();
if (selected_txt != null) if (selected_txt != null)
{ {
var rlt = AR.UTIL.InputBox("input", selected_txt.Text); UTIL.ShowPropertyDialog(selected_txt);
if (rlt.Item1 == true)
{
selected_txt.Text = rlt.Item2;
this.Invalidate(); this.Invalidate();
}
return; return;
} }
} }
@@ -451,7 +441,7 @@ namespace AGVControl
} }
else else
{ {
zoom /= 1.1f; zoom /= 1.2f;
} }
zoom = Math.Max(0.1f, Math.Min(10.0f, zoom)); zoom = Math.Max(0.1f, Math.Min(10.0f, zoom));
@@ -744,9 +734,17 @@ namespace AGVControl
var rfidPoint = FindRFIDPoint(rfidValue); var rfidPoint = FindRFIDPoint(rfidValue);
if (rfidPoint != null) if (rfidPoint != null)
{ {
// 이전 위치 저장 (방향 검증용)
Point previousPosition = agv.CurrentPosition;
uint previousRFID = agv.CurrentRFID;
// AGV 위치 업데이트
agv.CurrentPosition = rfidPoint.Location; agv.CurrentPosition = rfidPoint.Location;
agv.CurrentRFID = rfidValue; agv.CurrentRFID = rfidValue;
// 이동 경로에 추가
agv.AddToMovementHistory(rfidValue, rfidPoint.Location);
// 목적지가 설정되어 있고 경로가 있는 경우 검증 // 목적지가 설정되어 있고 경로가 있는 경우 검증
if (agv.TargetPosition != Point.Empty && agv.CurrentPath.Count > 0) if (agv.TargetPosition != Point.Empty && agv.CurrentPath.Count > 0)
{ {
@@ -784,6 +782,52 @@ namespace AGVControl
} }
} }
// 방향 검증 및 정정 (이전 위치가 있고 경로가 있는 경우)
if (previousRFID != 0 && agv.CurrentPath.Count > 0)
{
// RFID 연결 정보 기반 예상 방향 계산
Direction? expectedDirection = null;
int currentIdx = agv.CurrentPath.FindIndex(p => p == agv.CurrentPosition);
if (currentIdx >= 0 && currentIdx < agv.CurrentPath.Count - 1)
{
// 현재 위치와 다음 위치의 RFID 찾기
var currentRFIDPoint = FindRFIDPoint(agv.CurrentRFID);
var nextPoint = agv.CurrentPath[currentIdx + 1];
var nextRFIDPoint = rfidPoints.FirstOrDefault(p => p.Location == nextPoint);
if (currentRFIDPoint != null && nextRFIDPoint != null)
{
// rfidConnections에서 연결 정보 확인
var connection = rfidConnections.FirstOrDefault(c =>
(c.StartRFID == currentRFIDPoint.RFIDValue && c.EndRFID == nextRFIDPoint.RFIDValue) ||
(c.IsBidirectional && c.StartRFID == nextRFIDPoint.RFIDValue && c.EndRFID == currentRFIDPoint.RFIDValue));
if (connection != null)
{
// 연결된 경로이므로 방향 결정
if (connection.StartRFID == currentRFIDPoint.RFIDValue && connection.EndRFID == nextRFIDPoint.RFIDValue)
{
expectedDirection = Direction.Forward; // Start -> End 방향
}
else
{
expectedDirection = Direction.Backward; // End -> Start 방향
}
}
}
}
if (expectedDirection.HasValue)
{
bool directionValid = agv.ValidateAndCorrectDirectionByConnection(expectedDirection.Value, rfidConnections.ToList());
if (!directionValid)
{
// 방향이 정정되었음을 로그로 기록
Console.WriteLine($"AGV 방향 정정 (연결 정보 기반): 예상 {expectedDirection.Value} -> 실제 {agv.CurrentDirection}");
}
}
}
this.Invalidate(); this.Invalidate();
return true; return true;
} }
@@ -1234,38 +1278,53 @@ namespace AGVControl
var half = MarkerSize / 2f; var half = MarkerSize / 2f;
rfid.Bounds = new RectangleF(rfid.Location.X - half, rfid.Location.Y - half, MarkerSize, MarkerSize); rfid.Bounds = new RectangleF(rfid.Location.X - half, rfid.Location.Y - half, MarkerSize, MarkerSize);
// 회전 가능 여부에 따라 다른 색상 사용 // 종단 RFID는 특별한 색상으로 표시
using (var brush = new SolidBrush(rfid.IsRotatable ? Color.Yellow : Color.Green)) Color pointColor;
if (rfid.IsTerminal)
{
pointColor = Color.Orange; // 종단은 주황색
}
else if (rfid.IsRotatable)
{
pointColor = Color.Yellow; // 회전 가능은 노란색
}
else
{
pointColor = Color.Green; // 일반은 초록색
}
using (var brush = new SolidBrush(pointColor))
{ {
g.FillEllipse(brush, rfid.Bounds); g.FillEllipse(brush, rfid.Bounds);
} }
// 고정방향이 있으면 테두리 색상 표시 // 고정방향이 있으면 테두리 색상 표시
if (rfid.FixedDirection.HasValue) if (rfid.FixedDirection.HasValue)
{ {
Color borderColor = rfid.FixedDirection.Value == Direction.Forward ? Color.DeepSkyBlue : Color.Gold; using (var pen = new Pen(borderColor, 2)) Color borderColor = rfid.FixedDirection.Value == Direction.Forward ? Color.DeepSkyBlue : Color.Gold;
using (var pen = new Pen(borderColor, 2))
{ {
g.DrawEllipse(pen, rfid.Bounds.Expand(5, 5)); g.DrawEllipse(pen, rfid.Bounds.Expand(5,5));
}
} }
} }
// RFID 표시 // 종단 RFID는 특별한 테두리 표시
foreach (var rfid in rfidPoints) if (rfid.IsTerminal)
{ {
var tagstr = $"{rfid.RFIDValue}"; using (var pen = new Pen(Color.Red, 3))
var fsize = g.MeasureString(tagstr, Font);
var rect = new RectangleF(rfid.Bounds.X - (fsize.Width / 2f) + 3,
rfid.Bounds.Y + 6,
fsize.Width,
fsize.Height);
g.DrawString(tagstr, Font, Brushes.WhiteSmoke, rect, new StringFormat
{ {
Alignment = StringAlignment.Center, pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
LineAlignment = StringAlignment.Center, g.DrawEllipse(pen, rfid.Bounds.Expand(8,8));
});
} }
} }
var str = rfid.RFIDValue.ToString();
g.DrawString(str, this.Font, Brushes.DarkGray, rfid.Bounds.X, rfid.Bounds.Y+5);
}
}
private void DrawAGV(Graphics g) private void DrawAGV(Graphics g)
{ {
var agvsize = 30; var agvsize = 30;
@@ -1277,11 +1336,64 @@ namespace AGVControl
agv.CurrentPosition.Y - halfsize, agv.CurrentPosition.Y - halfsize,
agvsize, agvsize); agvsize, agvsize);
// 삼각형 화살표를 위한 포인트 배열 // AGV 몸체 회전 각도 계산
Point[] trianglePoints = new Point[3]; float bodyRotation = 0f;
var arrowSize = halfsize - 5; // 삼각형 크기 if (agv.CurrentPath != null && agv.CurrentPath.Count > 1)
{
// 현재 위치에서 다음 목적지 방향 계산
int currentIdx = agv.CurrentPath.FindIndex(p => p == agv.CurrentPosition);
if (currentIdx >= 0 && currentIdx < agv.CurrentPath.Count - 1)
{
Point nextPoint = agv.CurrentPath[currentIdx + 1];
float deltaX = nextPoint.X - agv.CurrentPosition.X;
float deltaY = nextPoint.Y - agv.CurrentPosition.Y;
bodyRotation = (float)Math.Atan2(deltaY, deltaX) * 180f / (float)Math.PI;
}
}
// AGV의 방향에 따라 삼각형 포인트 계산 // 그래픽스 상태 저장
var originalTransform = g.Transform;
// AGV 위치로 이동하고 회전
g.TranslateTransform(agv.CurrentPosition.X, agv.CurrentPosition.Y);
g.RotateTransform(bodyRotation);
// 원 그리기 (회전된 상태)
Color bgcolor = agv.BatteryLevel > 80 ? Color.Lime : (agv.BatteryLevel > 60 ? Color.Gold : Color.Tomato);
using (var circleBrush = new SolidBrush(Color.FromArgb(150, bgcolor)))
g.FillEllipse(circleBrush, -halfsize, -halfsize, agvsize, agvsize);
using (var circlePen = new Pen(Color.Black, 2))
g.DrawEllipse(circlePen, -halfsize, -halfsize, agvsize, agvsize);
// 리프트 그리기 (회전된 상태, 항상 전진 방향쪽)
var liftWidth = circleRect.Width;
var liftHeight = (int)(circleRect.Height * 0.4);
var liftOffset = halfsize + 1;
var liftRect = new Rectangle(
-liftWidth / 2,
-halfsize - liftOffset,
liftWidth, liftHeight);
using (var liftBrush = new SolidBrush(Color.FromArgb(200, Color.DarkGray)))
g.FillRectangle(liftBrush, liftRect);
using (var liftPen = new Pen(Color.Black, 1))
g.DrawRectangle(liftPen, liftRect);
// 리프트 연결선 그리기
using (var connectionPen = new Pen(Color.Black, 2))
{
g.DrawLine(connectionPen, 0, -halfsize, 0, -halfsize - liftOffset);
}
// 그래픽스 상태 복원
g.Transform = originalTransform;
// 삼각형 화살표 그리기 (현재 이동 방향, 회전하지 않음)
Point[] trianglePoints = new Point[3];
var arrowSize = halfsize - 5;
// AGV의 현재 이동 방향에 따라 삼각형 포인트 계산
switch (agv.CurrentDirection) switch (agv.CurrentDirection)
{ {
case Direction.Forward: case Direction.Forward:
@@ -1296,16 +1408,6 @@ namespace AGVControl
break; break;
} }
// 원 그리기
Color bgcolor = agv.BatteryLevel > 80 ? Color.Lime : (agv.BatteryLevel > 60 ? Color.Gold : Color.Tomato);
using (var circleBrush = new SolidBrush(Color.FromArgb(150, bgcolor)))
g.FillEllipse(circleBrush, circleRect);
using (var circlePen = new Pen(Color.Black, 2))
g.DrawEllipse(circlePen, circleRect);
// 삼각형 화살표 그리기
using (var arrowBrush = new SolidBrush(Color.FromArgb(200, Color.White))) using (var arrowBrush = new SolidBrush(Color.FromArgb(200, Color.White)))
g.FillPolygon(arrowBrush, trianglePoints); g.FillPolygon(arrowBrush, trianglePoints);
using (var arrowPen = new Pen(Color.Black, 2)) using (var arrowPen = new Pen(Color.Black, 2))
@@ -1563,17 +1665,15 @@ namespace AGVControl
lines.Add("[RFID_POINTS]"); lines.Add("[RFID_POINTS]");
foreach (var point in rfidPoints) foreach (var point in rfidPoints)
{ {
lines.Add($"{point.Location.X},{point.Location.Y},{point.RFIDValue}"); lines.Add($"{point.Location.X},{point.Location.Y},{point.RFIDValue},{point.IsRotatable},{point.FixedDirection},{point.IsTerminal}");
} }
// RFID 라인 저장 // RFID 라인 저장
lines.Add("[RFID_LINES]"); lines.Add("[RFID_LINES]");
foreach (var connection in rfidConnections) foreach (var connection in rfidConnections)
{ {
var startPoint = rfidPoints.FirstOrDefault(p => p.RFIDValue == connection.StartRFID)?.Location ?? Point.Empty; var startPoint = rfidPoints.First(p => p.RFIDValue == connection.StartRFID).Location;
var endPoint = rfidPoints.FirstOrDefault(p => p.RFIDValue == connection.EndRFID)?.Location ?? Point.Empty; var endPoint = rfidPoints.First(p => p.RFIDValue == connection.EndRFID).Location;
if (startPoint.IsEmpty || endPoint.IsEmpty) continue;
lines.Add($"{startPoint.X},{startPoint.Y},{endPoint.X},{endPoint.Y}," + lines.Add($"{startPoint.X},{startPoint.Y},{endPoint.X},{endPoint.Y}," +
$"{connection.StartRFID},{connection.EndRFID},{connection.IsBidirectional},{connection.Distance}"); $"{connection.StartRFID},{connection.EndRFID},{connection.IsBidirectional},{connection.Distance}");
} }
@@ -1625,19 +1725,38 @@ namespace AGVControl
var validY = int.TryParse(rfidParts[1], out int valY); var validY = int.TryParse(rfidParts[1], out int valY);
var validN = uint.TryParse(rfidParts[2], out uint valRfid); var validN = uint.TryParse(rfidParts[2], out uint valRfid);
if (validX && validY && validN) if (validX && validY && validN)
{ {
if (rfidPoints.Where(t => t.RFIDValue == valRfid).Any()) if (rfidPoints.Where(t => t.RFIDValue == valRfid).Any())
{ {
//이미존재한다 //이미존재한다
var newvalue = var newvalue =
sb.AppendLine($"rfid중복{valRfid}"); sb.AppendLine($"rfid중복{valRfid}");
} }
AddRFIDPoint(new Point(valX, valY), valRfid);
var rfidPoint = new RFIDPoint
{
Location = new Point(valX, valY),
RFIDValue = valRfid
};
// 추가 속성 로드 (기본값 처리)
if (rfidParts.Length >= 4)
{
bool isRotatable;
bool.TryParse(rfidParts[3], out isRotatable);
rfidPoint.IsRotatable = isRotatable;
}
if (rfidParts.Length >= 5 && !string.IsNullOrEmpty(rfidParts[4]))
rfidPoint.FixedDirection = (Direction)Enum.Parse(typeof(Direction), rfidParts[4]);
if (rfidParts.Length >= 6)
{
bool isTerminal;
bool.TryParse(rfidParts[5], out isTerminal);
rfidPoint.IsTerminal = isTerminal;
}
rfidPoints.Add(rfidPoint);
} }
else sb.AppendLine($"[{section}] {line}"); else sb.AppendLine($"[{section}] {line}");
} }
@@ -1908,7 +2027,8 @@ namespace AGVControl
Direction = Direction.Backward, Direction = Direction.Backward,
NextRFID = null, NextRFID = null,
Reason = "AGV 위치 미확정(처음 기동)", Reason = "AGV 위치 미확정(처음 기동)",
ReasonCode = AGVActionReasonCode.NoPosition ReasonCode = AGVActionReasonCode.NoPosition,
MoveState = AGVMoveState.Run
}; };
} }
@@ -1920,7 +2040,8 @@ namespace AGVControl
Direction = agv.CurrentDirection, Direction = agv.CurrentDirection,
NextRFID = null, NextRFID = null,
Reason = "경로 없음 또는 현재 위치 미확정", Reason = "경로 없음 또는 현재 위치 미확정",
ReasonCode = AGVActionReasonCode.NoPath ReasonCode = AGVActionReasonCode.NoPath,
MoveState = AGVMoveState.Stop
}; };
} }
@@ -1933,7 +2054,8 @@ namespace AGVControl
Direction = agv.CurrentDirection, Direction = agv.CurrentDirection,
NextRFID = null, NextRFID = null,
Reason = "현재 위치가 경로에 없음", Reason = "현재 위치가 경로에 없음",
ReasonCode = AGVActionReasonCode.NotOnPath ReasonCode = AGVActionReasonCode.NotOnPath,
MoveState = AGVMoveState.Stop
}; };
} }
@@ -1948,7 +2070,11 @@ namespace AGVControl
{ {
// 목적지 바로 전 위치에서 목적지로 이동할 때의 방향 // 목적지 바로 전 위치에서 목적지로 이동할 때의 방향
var beforeDest = agv.CurrentPath[agv.CurrentPath.Count - 2]; var beforeDest = agv.CurrentPath[agv.CurrentPath.Count - 2];
Direction arriveDir = (destPoint.X > beforeDest.X) ? Direction.Forward : Direction.Backward; float arriveDeltaX = destPoint.X - beforeDest.X;
float arriveDeltaY = destPoint.Y - beforeDest.Y;
Direction arriveDir = (Math.Abs(arriveDeltaX) > Math.Abs(arriveDeltaY)) ?
(arriveDeltaX > 0 ? Direction.Forward : Direction.Backward) :
(arriveDeltaY > 0 ? Direction.Forward : Direction.Backward);
if (arriveDir != destRFID.FixedDirection.Value) if (arriveDir != destRFID.FixedDirection.Value)
{ {
// 목적지 도달 전, 마지막 회전 가능한 RFID를 찾음 // 목적지 도달 전, 마지막 회전 가능한 RFID를 찾음
@@ -1961,7 +2087,7 @@ namespace AGVControl
} }
if (lastRotatableIdx >= 0) if (lastRotatableIdx >= 0)
{ {
// 회전 가능한 위치에 도달하면 NeedTurn 반환 // 회전 가능한 위치에 도달하면 NeedTurn 반환 (STOP)
if (idx == lastRotatableIdx) if (idx == lastRotatableIdx)
{ {
var rfid = rfidPoints.FirstOrDefault(r => r.Location == agv.CurrentPath[lastRotatableIdx]); var rfid = rfidPoints.FirstOrDefault(r => r.Location == agv.CurrentPath[lastRotatableIdx]);
@@ -1970,35 +2096,43 @@ namespace AGVControl
Direction = agv.CurrentDirection, Direction = agv.CurrentDirection,
NextRFID = rfid?.RFIDValue, NextRFID = rfid?.RFIDValue,
Reason = "목적지 진입방향 맞추기 위해 회전 필요", Reason = "목적지 진입방향 맞추기 위해 회전 필요",
ReasonCode = AGVActionReasonCode.NeedTurn ReasonCode = AGVActionReasonCode.NeedTurn,
MoveState = AGVMoveState.Stop
}; };
} }
else if (idx < lastRotatableIdx) else if (idx < lastRotatableIdx)
{ {
// 회전 가능한 위치까지 이동 안내 // 회전 가능한 위치까지 이동 안내 (RUN)
var rfid = rfidPoints.FirstOrDefault(r => r.Location == agv.CurrentPath[lastRotatableIdx]); var rfid = rfidPoints.FirstOrDefault(r => r.Location == agv.CurrentPath[lastRotatableIdx]);
float moveDeltaX = agv.CurrentPath[lastRotatableIdx].X - agv.CurrentPosition.X;
float moveDeltaY = agv.CurrentPath[lastRotatableIdx].Y - agv.CurrentPosition.Y;
Direction moveDir = (Math.Abs(moveDeltaX) > Math.Abs(moveDeltaY)) ?
(moveDeltaX > 0 ? Direction.Forward : Direction.Backward) :
(moveDeltaY > 0 ? Direction.Forward : Direction.Backward);
return new AGVActionPrediction return new AGVActionPrediction
{ {
Direction = (agv.CurrentPath[lastRotatableIdx].X > agv.CurrentPosition.X) ? Direction.Forward : Direction.Backward, Direction = moveDir,
NextRFID = rfid?.RFIDValue, NextRFID = rfid?.RFIDValue,
Reason = "회전 가능한 위치로 이동 중", Reason = "회전 가능한 위치로 이동 중",
ReasonCode = AGVActionReasonCode.Normal ReasonCode = AGVActionReasonCode.Normal,
MoveState = AGVMoveState.Run
}; };
} }
} }
// 회전 가능한 위치가 없음 // 회전 가능한 위치가 없음 (STOP)
return new AGVActionPrediction return new AGVActionPrediction
{ {
Direction = agv.CurrentDirection, Direction = agv.CurrentDirection,
NextRFID = null, NextRFID = null,
Reason = "경로상에 회전 가능한 위치가 없음", Reason = "경로상에 회전 가능한 위치가 없음",
ReasonCode = AGVActionReasonCode.Unknown ReasonCode = AGVActionReasonCode.NoTurnPoint,
MoveState = AGVMoveState.Stop
}; };
} }
} }
} }
// 5. 목적지 도달 시(방향이 맞는 경우) // 5. 목적지 도달 시(방향이 맞는 경우) (STOP)
if (idx == agv.CurrentPath.Count - 1) if (idx == agv.CurrentPath.Count - 1)
{ {
return new AGVActionPrediction return new AGVActionPrediction
@@ -2006,21 +2140,29 @@ namespace AGVControl
Direction = agv.CurrentDirection, Direction = agv.CurrentDirection,
NextRFID = null, NextRFID = null,
Reason = "경로의 마지막 지점(목적지 도달)", Reason = "경로의 마지막 지점(목적지 도달)",
ReasonCode = AGVActionReasonCode.Arrived ReasonCode = AGVActionReasonCode.Arrived,
MoveState = AGVMoveState.Stop
}; };
} }
// 6. 일반 경로 주행 // 6. 일반 경로 주행 (RUN)
Point nextPoint = agv.CurrentPath[idx + 1]; Point nextPoint = agv.CurrentPath[idx + 1];
var nextRFID = rfidPoints.FirstOrDefault(r => r.Location == nextPoint)?.RFIDValue; var nextRFID = rfidPoints.FirstOrDefault(r => r.Location == nextPoint)?.RFIDValue;
Direction nextDir = (nextPoint.X > agv.CurrentPosition.X) ? Direction.Forward : Direction.Backward;
// X, Y 좌표 모두 고려한 방향 판단
float deltaX = nextPoint.X - agv.CurrentPosition.X;
float deltaY = nextPoint.Y - agv.CurrentPosition.Y;
Direction nextDir = (Math.Abs(deltaX) > Math.Abs(deltaY)) ?
(deltaX > 0 ? Direction.Forward : Direction.Backward) :
(deltaY > 0 ? Direction.Forward : Direction.Backward);
return new AGVActionPrediction return new AGVActionPrediction
{ {
Direction = nextDir, Direction = nextDir,
NextRFID = nextRFID, NextRFID = nextRFID,
Reason = null, Reason = null,
ReasonCode = AGVActionReasonCode.Normal ReasonCode = AGVActionReasonCode.Normal,
MoveState = AGVMoveState.Run
}; };
} }
#endregion #endregion

View File

@@ -1,9 +1,16 @@
using System;
using System.Drawing; using System.Drawing;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace AGVControl.Models namespace AGVControl.Models
{ {
public enum Direction
{
Forward = 0,
Backward = 1
}
public class AGV public class AGV
{ {
public Point CurrentPosition { get; set; } public Point CurrentPosition { get; set; }
@@ -19,12 +26,17 @@ namespace AGVControl.Models
/// </summary> /// </summary>
public Direction TargetDirection { get; set; } public Direction TargetDirection { get; set; }
public bool IsMoving { get; set; } public bool IsMoving { get; set; }
public List<Point> CurrentPath { get; set; } public List<Point> CurrentPath { get; set; } = new List<Point>();
public List<Point> PlannedPath { get; set; } public List<Point> PlannedPath { get; set; }
public List<string> PathRFIDs { get; set; } public List<string> PathRFIDs { get; set; }
public Point TargetPosition { get; set; } public Point TargetPosition { get; set; }
public uint TargetRFID { get; set; } public uint TargetRFID { get; set; }
// 이동 경로 기록을 위한 새로운 속성들
public List<uint> MovementHistory { get; set; } = new List<uint>();
public List<Point> PositionHistory { get; set; } = new List<Point>();
public const int HISTORY_SIZE = 4; // 최근 4개 위치 기록
public AGV() public AGV()
{ {
CurrentPath = new List<Point>(); CurrentPath = new List<Point>();
@@ -45,12 +57,179 @@ namespace AGVControl.Models
} }
} }
// 이동 경로에 새로운 RFID 추가
public void AddToMovementHistory(uint rfidValue, Point position)
{
// 중복 RFID가 연속으로 들어오는 경우 무시
if (MovementHistory.Count > 0 && MovementHistory[MovementHistory.Count - 1] == rfidValue)
return;
MovementHistory.Add(rfidValue);
PositionHistory.Add(position);
// 기록 크기 제한
if (MovementHistory.Count > HISTORY_SIZE)
{
MovementHistory.RemoveAt(0);
PositionHistory.RemoveAt(0);
}
} }
public enum Direction // 연결 정보 기반 실제 이동 방향 계산
public Direction? CalculateActualDirectionByConnection(uint currentRFID, uint previousRFID, List<RFIDConnection> connections)
{ {
Forward, if (connections == null || connections.Count == 0)
Backward return null;
// 이전 RFID에서 현재 RFID로의 연결 확인
var connection = connections.FirstOrDefault(c =>
(c.StartRFID == previousRFID && c.EndRFID == currentRFID) ||
(c.IsBidirectional && c.StartRFID == currentRFID && c.EndRFID == previousRFID));
if (connection == null)
return null; // 연결되지 않은 경로
// 연결 방향에 따라 실제 이동 방향 결정
if (connection.StartRFID == previousRFID && connection.EndRFID == currentRFID)
{
return Direction.Forward; // Start -> End 방향으로 이동
}
else
{
return Direction.Backward; // End -> Start 방향으로 이동
}
}
// 연결 정보 기반 방향 불일치 검증 및 정정
public bool ValidateAndCorrectDirectionByConnection(Direction expectedDirection, List<RFIDConnection> connections)
{
if (MovementHistory.Count < 2 || connections == null)
return true; // 검증 불가능한 경우
// 최근 두 RFID 값 가져오기
var recentRFIDs = MovementHistory.Skip(Math.Max(0, MovementHistory.Count - 2)).Take(2).ToList();
if (recentRFIDs.Count < 2)
return true;
var previousRFID = recentRFIDs[0];
var currentRFID = recentRFIDs[1];
var actualDirection = CalculateActualDirectionByConnection(currentRFID, previousRFID, connections);
if (!actualDirection.HasValue)
return true; // 연결 정보로 방향 판단 불가
// 방향이 일치하지 않는 경우
if (actualDirection.Value != expectedDirection)
{
// AGV 방향을 실제 이동 방향으로 정정
CurrentDirection = actualDirection.Value;
TargetDirection = actualDirection.Value;
return false; // 정정됨을 알림
}
return true; // 방향 일치
}
// RFID 순서 기반 실제 이동 방향 계산 (기존 메서드 - 호환성 유지)
public Direction? CalculateActualDirectionByRFID()
{
if (MovementHistory.Count < 2)
return null;
// 최근 두 RFID 값으로부터 실제 이동 방향 계산
var recentRFIDs = MovementHistory.Skip(Math.Max(0, MovementHistory.Count - 2)).Take(2).ToList();
if (recentRFIDs.Count < 2)
return null;
var prevRFID = recentRFIDs[0];
var currentRFID = recentRFIDs[1];
// RFID 값의 증가/감소로 방향 판단
if (currentRFID > prevRFID)
{
return Direction.Forward; // RFID 값이 증가하면 전진
}
else if (currentRFID < prevRFID)
{
return Direction.Backward; // RFID 값이 감소하면 후진
}
else
{
return null; // 같은 RFID 값이면 방향 판단 불가
}
}
// 경로상 RFID 순서 기반 예상 방향 계산
public Direction? CalculateExpectedDirectionByRFID()
{
if (CurrentPath == null || CurrentPath.Count < 2)
return null;
// 현재 위치의 RFID 찾기
var currentRFID = CurrentRFID;
if (currentRFID == 0)
return null;
// 경로상 다음 RFID 찾기
int currentIdx = CurrentPath.FindIndex(p => p == CurrentPosition);
if (currentIdx < 0 || currentIdx >= CurrentPath.Count - 1)
return null;
// 다음 위치의 RFID 찾기 (MapControl에서 RFID 정보 필요)
// 이 부분은 MapControl에서 처리하도록 수정 필요
return null;
}
// 실제 이동 방향 계산 (기존 메서드 - 호환성 유지)
public Direction? CalculateActualDirection()
{
if (MovementHistory.Count < 2)
return null;
// 최근 두 위치로부터 실제 이동 방향 계산
var recentPositions = PositionHistory.Skip(Math.Max(0, PositionHistory.Count - 2)).Take(2).ToList();
if (recentPositions.Count < 2)
return null;
var prevPos = recentPositions[0];
var currentPos = recentPositions[1];
// X축 이동이 더 큰 경우
if (Math.Abs(currentPos.X - prevPos.X) > Math.Abs(currentPos.Y - prevPos.Y))
{
return currentPos.X > prevPos.X ? Direction.Forward : Direction.Backward;
}
// Y축 이동이 더 큰 경우
else
{
return currentPos.Y > prevPos.Y ? Direction.Forward : Direction.Backward;
}
}
// 경로상 예상 방향 계산
public Direction? CalculateExpectedDirection()
{
if (CurrentPath == null || CurrentPath.Count < 2)
return null;
int currentIdx = CurrentPath.FindIndex(p => p == CurrentPosition);
if (currentIdx < 0 || currentIdx >= CurrentPath.Count - 1)
return null;
var currentPos = CurrentPath[currentIdx];
var nextPos = CurrentPath[currentIdx + 1];
// X축 이동이 더 큰 경우
if (Math.Abs(nextPos.X - currentPos.X) > Math.Abs(nextPos.Y - currentPos.Y))
{
return nextPos.X > currentPos.X ? Direction.Forward : Direction.Backward;
}
// Y축 이동이 더 큰 경우
else
{
return nextPos.Y > currentPos.Y ? Direction.Forward : Direction.Backward;
}
}
} }
public class PathNode public class PathNode

View File

@@ -11,6 +11,7 @@ namespace AGVControl.Models
public bool IsBidirectional { get; set; } // 양방향 연결 여부 public bool IsBidirectional { get; set; } // 양방향 연결 여부
public bool IsRotatable { get; set; } // 회전 가능 여부 public bool IsRotatable { get; set; } // 회전 가능 여부
public Direction? FixedDirection { get; set; } // 고정 방향(없으면 null) public Direction? FixedDirection { get; set; } // 고정 방향(없으면 null)
public bool IsTerminal { get; set; } // 종단 여부
public RectangleF Bounds { get; set; } public RectangleF Bounds { get; set; }
public RFIDPoint() public RFIDPoint()
@@ -18,6 +19,7 @@ namespace AGVControl.Models
IsRotatable = false; // 기본값은 회전 불가능 IsRotatable = false; // 기본값은 회전 불가능
IsBidirectional = true; // 기본값은 양방향 IsBidirectional = true; // 기본값은 양방향
FixedDirection = null; FixedDirection = null;
IsTerminal = false; // 기본값은 종단 아님
} }
} }
} }

View File

@@ -200,6 +200,14 @@ namespace arDev
Current_LevelA = LastReceiveBuffer[23]; //<- 23번자료는 byte이므로 소수점이잇는 데이터로 직접 계산한다 Current_LevelA = LastReceiveBuffer[23]; //<- 23번자료는 byte이므로 소수점이잇는 데이터로 직접 계산한다
Current_DataTime = DateTime.Now; Current_DataTime = DateTime.Now;
//250620 jwlee 추가
int temp1 = (LastReceiveBuffer[27] << 8) | LastReceiveBuffer[28];
int temp2 = (LastReceiveBuffer[29] << 8) | LastReceiveBuffer[30];
Current_temp1 = (temp1 - 2731) / 10f;
Current_temp2 = (temp2 - 2731) / 10f;
CheckManualCharge(); CheckManualCharge();
Recv0 = true; Recv0 = true;
@@ -333,6 +341,16 @@ namespace arDev
/// </summary> /// </summary>
public int Current_Amp { get; set; } public int Current_Amp { get; set; }
/// <summary>
/// BMS 온도값1
/// </summary>
public double Current_temp1 { get; set; }
/// <summary>
/// BMS 온도값2
/// </summary>
public double Current_temp2 { get; set; }
/// <summary> /// <summary>
/// 총 전류량 /// 총 전류량
/// </summary> /// </summary>

View File

@@ -46,12 +46,7 @@
<Compile Include="BMSInformationEventArgs.cs" /> <Compile Include="BMSInformationEventArgs.cs" />
<Compile Include="BMS.cs" /> <Compile Include="BMS.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> <Compile Include="RS232.cs" />
<ItemGroup>
<ProjectReference Include="..\CommData\CommData.csproj">
<Project>{14e8c9a5-013e-49ba-b435-efefc77dd623}</Project>
<Name>CommData</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@@ -0,0 +1,485 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Threading;
using System.Threading.Tasks;
public abstract partial class arRS232 : IDisposable
{
protected System.IO.Ports.SerialPort _device;
protected ManualResetEvent _mre;
protected byte[] LastReceiveBuffer = new byte[] { };
/// <summary>
/// 최종 전송 메세지
/// </summary>
public byte[] lastSendBuffer = new byte[] { };
protected List<byte> tempBuffer = new List<byte>();
protected Boolean findSTX = false;
public string errorMessage { get; set; }
public DateTime LastConnTime { get; set; }
public DateTime LastConnTryTime { get; set; }
public DateTime lastSendTime;
/// <summary>
/// 메세지 수신시 사용하는 내부버퍼
/// </summary>
protected List<byte> _buffer = new List<byte>();
// public byte[] LastRecvData;
public string LastRecvString
{
get
{
if (LastReceiveBuffer == null) return String.Empty;
else return System.Text.Encoding.Default.GetString(LastReceiveBuffer);
}
}
/// <summary>
/// 마지막으로 데이터를 받은 시간
/// </summary>
public DateTime lastRecvTime;
public int WriteError = 0;
public string WriteErrorMessage = string.Empty;
public int WaitTimeout { get; set; } = 1000;
public int MinRecvLength { get; set; } = 1;
/// <summary>
/// 포트이름
/// </summary>
[Description("시리얼 포트 이름")]
[Category("설정"), DisplayName("Port Name")]
public string PortName
{
get
{
if (_device == null) return string.Empty;
else return _device.PortName;
}
set
{
if (this.IsOpen)
{
Message?.Invoke(this, new MessageEventArgs("포트가 열려있어 포트이름을 변경할 수 없습니다", true));
}
else if (String.IsNullOrEmpty(value) == false)
_device.PortName = value;
else
{
Message?.Invoke(this, new MessageEventArgs("No PortName", true));
}
}
}
public int BaudRate
{
get
{
if (_device == null) return 0;
else return _device.BaudRate;
}
set
{
if (this.IsOpen)
{
Message?.Invoke(this, new MessageEventArgs("포트가 열려있어 BaudRate(를) 변경할 수 없습니다", true));
}
else if (value != 0)
_device.BaudRate = value;
else Message?.Invoke(this, new MessageEventArgs("No baud rate", true));
}
}
public arRS232()
{
_device = new System.IO.Ports.SerialPort();
this.BaudRate = 9600;
_device.DataReceived += barcode_DataReceived;
_device.ErrorReceived += this.barcode_ErrorReceived;
_device.WriteTimeout = 5000;
_device.ReadTimeout = 5000;
// _device.DtrEnable = false;
_device.ReadBufferSize = 8192;
_device.WriteBufferSize = 8192;
errorMessage = string.Empty;
lastRecvTime = DateTime.Parse("1982-11-23");
LastConnTime = DateTime.Parse("1982-11-23");
LastConnTryTime = DateTime.Parse("1982-11-23");
lastRecvTime = DateTime.Parse("1982-11-23");
this._mre = new ManualResetEvent(true);
}
~arRS232()
{
Dispose(false);
}
// Flag: Has Dispose already been called?
bool disposed = false;
// Public implementation of Dispose pattern callable by consumers.
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
// Protected implementation of Dispose pattern.
protected virtual void Dispose(bool disposing)
{
if (disposed)
return;
if (disposing)
{
// Free any other managed objects here.
//
}
_device.DataReceived -= barcode_DataReceived;
_device.ErrorReceived -= this.barcode_ErrorReceived;
// Free any unmanaged objects here.
//
disposed = true;
}
public Boolean Open()
{
try
{
_device.Open();
return IsOpen;
}
catch (Exception ex)
{
errorMessage = ex.Message;
Message.Invoke(this, new MessageEventArgs(ex.Message, true));
return false;
}
}
public string GetHexString(Byte[] input)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (byte b in input)
sb.Append(" " + b.ToString("X2"));
return sb.ToString();
}
/// <summary>
/// 포트가 열려있는지 확인
/// </summary>
[Description("현재 시리얼포트가 열려있는지 확인합니다")]
[Category("정보"), DisplayName("Port Open")]
public Boolean IsOpen
{
get
{
if (_device == null) return false;
return _device.IsOpen;
}
}
public virtual void Close(Boolean PortClose = true)
{
if (_device != null && _device.IsOpen)
{
_device.DiscardInBuffer();
_device.DiscardOutBuffer();
if (PortClose) _device.Close(); //dispose에서는 포트를 직접 클리어하지 않게 해뒀다.
}
}
protected Boolean RaiseRecvData()
{
return RaiseRecvData(LastReceiveBuffer.ToArray(), false);
}
/// <summary>
/// 수신받은 메세지를 발생 시킵니다
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public virtual Boolean RaiseRecvData(byte[] Data, bool udpatelastbuffer)
{
//181206 - 최종수신 메세지 기록
lastRecvTime = DateTime.Now;
if (udpatelastbuffer && Data != null)
{
if (LastReceiveBuffer == null || LastReceiveBuffer.Length != Data.Length)
{
LastReceiveBuffer = new byte[Data.Length];
Array.Copy(Data, LastReceiveBuffer, Data.Length);
}
}
try
{
Message?.Invoke(this, new MessageEventArgs(Data, true)); //recvmessage
if (ProcessRecvData(Data) == false)
{
//Message?.Invoke(this, new MessageEventArgs(Data, true)); //recvmessage
Message?.Invoke(this, new MessageEventArgs(this.errorMessage, true)); //errormessage
return false;
}
else
{
return true;
}
}
catch (Exception ex)
{
this.errorMessage = ex.Message;
this.Message?.Invoke(this, new MessageEventArgs(ex.Message, true));
return false;
}
}
/// <summary>
/// 수신받은 자료를 처리한다
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public abstract bool ProcessRecvData(byte[] data);
#region "Internal Events"
void barcode_ErrorReceived(object sender, System.IO.Ports.SerialErrorReceivedEventArgs e)
{
Message?.Invoke(this, new MessageEventArgs(e.ToString(), true));
}
byte[] buffer = new byte[] { };
void barcode_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
try
{
int ReadCount = _device.BytesToRead;
buffer = new byte[ReadCount];
_device.Read(buffer, 0, buffer.Length);
System.Text.StringBuilder LogMsg = new StringBuilder();
byte[] remainBuffer;
Repeat:
if (CustomParser(buffer, out remainBuffer))
{
//분석완료이므로 받은 데이터를 버퍼에 기록한다
if (LastReceiveBuffer == null || (LastReceiveBuffer.Length != tempBuffer.Count))
Array.Resize(ref LastReceiveBuffer, tempBuffer.Count);
Array.Copy(tempBuffer.ToArray(), LastReceiveBuffer, tempBuffer.Count);
tempBuffer.Clear();
//수신메세지발생
RaiseRecvData();
if (remainBuffer != null && remainBuffer.Length > 0)
{
//버퍼를 변경해서 다시 전송을 해준다.
Array.Resize(ref buffer, remainBuffer.Length);
Array.Copy(remainBuffer, buffer, remainBuffer.Length);
goto Repeat; //남은 버퍼가 있다면 진행을 해준다.
}
}
}
catch (Exception ex)
{
if (IsOpen)
{
//_device.DiscardInBuffer();
//_device.DiscardOutBuffer();
}
errorMessage = ex.Message;
this.Message?.Invoke(this, new MessageEventArgs(ex.Message, true));
}
}
#endregion
#region "External Events"
/// <summary>
/// 오류 및 기타 일반 메세지
/// </summary>
public event EventHandler<MessageEventArgs> Message;
#endregion
#region "Event Args"
/// <summary>
/// 데이터를 수신할떄 사용함(RAW 포함)
/// </summary>
public class ReceiveDataEventArgs : EventArgs
{
private byte[] _buffer = null;
/// <summary>
/// 바이트배열의 버퍼값
/// </summary>
public byte[] Value { get { return _buffer; } }
/// <summary>
/// 버퍼(바이트배열)의 데이터를 문자로 반환합니다.
/// </summary>
public string StrValue
{
get
{
//return string.Empty;
if (_buffer == null || _buffer.Length < 1) return string.Empty;
else return System.Text.Encoding.Default.GetString(_buffer);
}
}
public ReceiveDataEventArgs(byte[] buffer)
{
_buffer = buffer;
}
}
/// <summary>
/// 메세지를 강제 발생
/// </summary>
/// <param name="mt"></param>
/// <param name="message"></param>
protected virtual void RaiseMessage(MessageType mt, string message)
{
this.Message?.Invoke(this, new MessageEventArgs(mt, message));
}
public enum MessageType
{
Normal,
Error,
Send,
Recv,
}
public class MessageEventArgs : EventArgs
{
public MessageType MsgType { get; set; }
private string _message = string.Empty;
/// <summary>
/// Recv,Send,Normal,Error 모두 지원
/// </summary>
public string Message { get { return _message; } }
private byte[] _data = null;
/// <summary>
/// Recv,Send에서만 값이 존재 합니다
/// </summary>
public byte[] Data { get { return _data; } }
public MessageEventArgs(string Message, bool isError = false)
{
if (isError) MsgType = MessageType.Error;
else MsgType = MessageType.Normal;
_message = Message;
}
public MessageEventArgs(MessageType msgtype, string Message)
{
MsgType = msgtype;
_message = Message;
_data = System.Text.Encoding.Default.GetBytes(Message);
}
public MessageEventArgs(byte[] buffer, bool isRecv = true)
{
if (isRecv) MsgType = MessageType.Recv;
else MsgType = MessageType.Send;
_data = new byte[buffer.Length];
Array.Copy(buffer, _data, Data.Length);
_message = System.Text.Encoding.Default.GetString(_data);
}
}
#endregion
protected abstract bool CustomParser(byte[] buf, out byte[] remainBuffer);
/// <summary>
/// 데이터수신시간이 설정값보다 x 2.5를 초과하면 false 가 반환됨
/// </summary>
public Boolean IsValid
{
get
{
if (IsOpen == false) return false;
if (lastRecvTime.Year == 1982) return false;
var ts = DateTime.Now - lastRecvTime;
if (ts.TotalSeconds > 5) return false;
return true;
}
}
protected bool WriteData(string cmd)
{
return WriteData(System.Text.Encoding.Default.GetBytes(cmd));
}
/// <summary>
/// 포트에 쓰기(barcode_DataReceived 이벤트로 메세지수신)
/// </summary>
protected Boolean WriteData(byte[] data)
{
Boolean bRet = false;
//171205 : 타임아웃시간추가
if (!_mre.WaitOne(WaitTimeout))
{
errorMessage = $"WriteData:MRE:WaitOne:TimeOut {WaitTimeout}ms";
this.Message?.Invoke(this, new MessageEventArgs(errorMessage, true));
return false;
}
_mre.Reset();
//Array.Resize(ref data, data.Length + 2);
try
{
lastSendTime = DateTime.Now;
if (lastSendBuffer == null) lastSendBuffer = new byte[data.Length]; //171113
else Array.Resize(ref lastSendBuffer, data.Length);
Array.Copy(data, lastSendBuffer, data.Length);
for (int i = 0; i < data.Length; i++)
_device.Write(data, i, 1);
//_device.Write(data, 0, data.Length);
//171113
this.Message?.Invoke(this, new MessageEventArgs(data, false));
bRet = true;
WriteError = 0;
WriteErrorMessage = string.Empty;
}
catch (Exception ex)
{
// this.isinit = false;
this.Message?.Invoke(this, new MessageEventArgs(ex.Message, true));
bRet = false;
WriteError += 1; //연속쓰기오류횟수
WriteErrorMessage = ex.Message;
}
finally
{
_mre.Set();
}
return bRet;
}
}

View File

@@ -30,34 +30,34 @@ namespace AGVEmulator
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
AGVEmulator.UC.AgvViewer.ptdata ptdata1 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata85 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata2 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata86 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata3 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata87 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata4 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata88 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata5 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata89 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata6 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata90 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata7 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata91 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata8 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata92 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata9 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata93 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata10 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata94 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata11 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata95 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata12 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata96 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata13 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata97 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata14 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata98 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata15 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata99 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata16 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata100 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata17 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata101 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata18 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata102 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata19 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata103 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata20 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata104 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata21 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata105 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata22 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata106 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata23 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata107 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata24 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata108 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata25 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata109 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata26 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata110 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata27 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata111 = new AGVEmulator.UC.AgvViewer.ptdata();
AGVEmulator.UC.AgvViewer.ptdata ptdata28 = new AGVEmulator.UC.AgvViewer.ptdata(); AGVEmulator.UC.AgvViewer.ptdata ptdata112 = new AGVEmulator.UC.AgvViewer.ptdata();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rtBMS = new arCtl.LogTextBox(); this.rtBMS = new arCtl.LogTextBox();
@@ -132,6 +132,8 @@ namespace AGVEmulator
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.panel3 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel();
this.nudIDAgv = new System.Windows.Forms.NumericUpDown();
this.label7 = new System.Windows.Forms.Label();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.nudTagNo = new System.Windows.Forms.NumericUpDown(); this.nudTagNo = new System.Windows.Forms.NumericUpDown();
@@ -152,8 +154,12 @@ namespace AGVEmulator
this.sbBMS = new System.Windows.Forms.ToolStripStatusLabel(); this.sbBMS = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.sbCAL = new System.Windows.Forms.ToolStripStatusLabel(); this.sbCAL = new System.Windows.Forms.ToolStripStatusLabel();
this.label7 = new System.Windows.Forms.Label(); this.trbT1 = new System.Windows.Forms.TrackBar();
this.nudIDAgv = new System.Windows.Forms.NumericUpDown(); this.trbT2 = new System.Windows.Forms.TrackBar();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
@@ -179,11 +185,13 @@ namespace AGVEmulator
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout(); this.tabPage3.SuspendLayout();
this.panel3.SuspendLayout(); this.panel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudIDAgv)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).BeginInit();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudIDAgv)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trbT1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trbT2)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
@@ -221,6 +229,12 @@ namespace AGVEmulator
// //
// panel1 // panel1
// //
this.panel1.Controls.Add(this.label11);
this.panel1.Controls.Add(this.label10);
this.panel1.Controls.Add(this.label9);
this.panel1.Controls.Add(this.label8);
this.panel1.Controls.Add(this.trbT2);
this.panel1.Controls.Add(this.trbT1);
this.panel1.Controls.Add(this.btc8); this.panel1.Controls.Add(this.btc8);
this.panel1.Controls.Add(this.btc4); this.panel1.Controls.Add(this.btc4);
this.panel1.Controls.Add(this.btc7); this.panel1.Controls.Add(this.btc7);
@@ -1016,120 +1030,120 @@ namespace AGVEmulator
this.agvViewer1.lastmarkdir = ""; this.agvViewer1.lastmarkdir = "";
this.agvViewer1.lasttag = ""; this.agvViewer1.lasttag = "";
this.agvViewer1.lasttagdir = ""; this.agvViewer1.lasttagdir = "";
ptdata1.active = false; ptdata85.active = false;
ptdata1.data = "NOT"; ptdata85.data = "NOT";
ptdata1.pos = 30F; ptdata85.pos = 30F;
ptdata2.active = false; ptdata86.active = false;
ptdata2.data = "QA"; ptdata86.data = "QA";
ptdata2.pos = 200F; ptdata86.pos = 200F;
ptdata3.active = false; ptdata87.active = false;
ptdata3.data = "CHG"; ptdata87.data = "CHG";
ptdata3.pos = 300F; ptdata87.pos = 300F;
ptdata4.active = false; ptdata88.active = false;
ptdata4.data = "QC"; ptdata88.data = "QC";
ptdata4.pos = 400F; ptdata88.pos = 400F;
ptdata5.active = false; ptdata89.active = false;
ptdata5.data = "#FVI-1"; ptdata89.data = "#FVI-1";
ptdata5.pos = 500F; ptdata89.pos = 500F;
ptdata6.active = false; ptdata90.active = false;
ptdata6.data = "#FVI-2"; ptdata90.data = "#FVI-2";
ptdata6.pos = 600F; ptdata90.pos = 600F;
ptdata7.active = false; ptdata91.active = false;
ptdata7.data = "#FVI-3"; ptdata91.data = "#FVI-3";
ptdata7.pos = 700F; ptdata91.pos = 700F;
ptdata8.active = false; ptdata92.active = false;
ptdata8.data = "#FVI-4"; ptdata92.data = "#FVI-4";
ptdata8.pos = 800F; ptdata92.pos = 800F;
ptdata9.active = false; ptdata93.active = false;
ptdata9.data = "#FVI-5"; ptdata93.data = "#FVI-5";
ptdata9.pos = 900F; ptdata93.pos = 900F;
ptdata10.active = false; ptdata94.active = false;
ptdata10.data = "POT"; ptdata94.data = "POT";
ptdata10.pos = 970F; ptdata94.pos = 970F;
this.agvViewer1.listMRK = new AGVEmulator.UC.AgvViewer.ptdata[] { this.agvViewer1.listMRK = new AGVEmulator.UC.AgvViewer.ptdata[] {
ptdata1, ptdata85,
ptdata2, ptdata86,
ptdata3, ptdata87,
ptdata4, ptdata88,
ptdata5, ptdata89,
ptdata6, ptdata90,
ptdata7, ptdata91,
ptdata8, ptdata92,
ptdata9, ptdata93,
ptdata10}; ptdata94};
ptdata11.active = false; ptdata95.active = false;
ptdata11.data = "9000"; ptdata95.data = "9000";
ptdata11.pos = 80F; ptdata95.pos = 80F;
ptdata12.active = false; ptdata96.active = false;
ptdata12.data = "9001"; ptdata96.data = "9001";
ptdata12.pos = 120F; ptdata96.pos = 120F;
ptdata13.active = false; ptdata97.active = false;
ptdata13.data = "9010"; ptdata97.data = "9010";
ptdata13.pos = 180F; ptdata97.pos = 180F;
ptdata14.active = false; ptdata98.active = false;
ptdata14.data = "9011"; ptdata98.data = "9011";
ptdata14.pos = 220F; ptdata98.pos = 220F;
ptdata15.active = false; ptdata99.active = false;
ptdata15.data = "9020"; ptdata99.data = "9020";
ptdata15.pos = 280F; ptdata99.pos = 280F;
ptdata16.active = false; ptdata100.active = false;
ptdata16.data = "9021"; ptdata100.data = "9021";
ptdata16.pos = 320F; ptdata100.pos = 320F;
ptdata17.active = false; ptdata101.active = false;
ptdata17.data = "9030"; ptdata101.data = "9030";
ptdata17.pos = 380F; ptdata101.pos = 380F;
ptdata18.active = false; ptdata102.active = false;
ptdata18.data = "9031"; ptdata102.data = "9031";
ptdata18.pos = 420F; ptdata102.pos = 420F;
ptdata19.active = false; ptdata103.active = false;
ptdata19.data = "9040"; ptdata103.data = "9040";
ptdata19.pos = 480F; ptdata103.pos = 480F;
ptdata20.active = false; ptdata104.active = false;
ptdata20.data = "9041"; ptdata104.data = "9041";
ptdata20.pos = 520F; ptdata104.pos = 520F;
ptdata21.active = false; ptdata105.active = false;
ptdata21.data = "9050"; ptdata105.data = "9050";
ptdata21.pos = 580F; ptdata105.pos = 580F;
ptdata22.active = false; ptdata106.active = false;
ptdata22.data = "9051"; ptdata106.data = "9051";
ptdata22.pos = 620F; ptdata106.pos = 620F;
ptdata23.active = false; ptdata107.active = false;
ptdata23.data = "9060"; ptdata107.data = "9060";
ptdata23.pos = 680F; ptdata107.pos = 680F;
ptdata24.active = false; ptdata108.active = false;
ptdata24.data = "9061"; ptdata108.data = "9061";
ptdata24.pos = 720F; ptdata108.pos = 720F;
ptdata25.active = false; ptdata109.active = false;
ptdata25.data = "9070"; ptdata109.data = "9070";
ptdata25.pos = 780F; ptdata109.pos = 780F;
ptdata26.active = false; ptdata110.active = false;
ptdata26.data = "9071"; ptdata110.data = "9071";
ptdata26.pos = 820F; ptdata110.pos = 820F;
ptdata27.active = false; ptdata111.active = false;
ptdata27.data = "9000"; ptdata111.data = "9000";
ptdata27.pos = 10F; ptdata111.pos = 10F;
ptdata28.active = false; ptdata112.active = false;
ptdata28.data = "9001"; ptdata112.data = "9001";
ptdata28.pos = 50F; ptdata112.pos = 50F;
this.agvViewer1.listTAG = new AGVEmulator.UC.AgvViewer.ptdata[] { this.agvViewer1.listTAG = new AGVEmulator.UC.AgvViewer.ptdata[] {
ptdata11, ptdata95,
ptdata12, ptdata96,
ptdata13, ptdata97,
ptdata14, ptdata98,
ptdata15, ptdata99,
ptdata16, ptdata100,
ptdata17, ptdata101,
ptdata18, ptdata102,
ptdata19, ptdata103,
ptdata20, ptdata104,
ptdata21, ptdata105,
ptdata22, ptdata106,
ptdata23, ptdata107,
ptdata24, ptdata108,
ptdata25, ptdata109,
ptdata26, ptdata110,
ptdata27, ptdata111,
ptdata28}; ptdata112};
this.agvViewer1.Location = new System.Drawing.Point(241, 0); this.agvViewer1.Location = new System.Drawing.Point(241, 0);
this.agvViewer1.Name = "agvViewer1"; this.agvViewer1.Name = "agvViewer1";
this.agvViewer1.Size = new System.Drawing.Size(899, 120); this.agvViewer1.Size = new System.Drawing.Size(899, 120);
@@ -1192,6 +1206,34 @@ namespace AGVEmulator
this.panel3.Size = new System.Drawing.Size(364, 622); this.panel3.Size = new System.Drawing.Size(364, 622);
this.panel3.TabIndex = 15; this.panel3.TabIndex = 15;
// //
// nudIDAgv
//
this.nudIDAgv.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.nudIDAgv.Location = new System.Drawing.Point(6, 249);
this.nudIDAgv.Maximum = new decimal(new int[] {
9999999,
0,
0,
0});
this.nudIDAgv.Name = "nudIDAgv";
this.nudIDAgv.Size = new System.Drawing.Size(98, 38);
this.nudIDAgv.TabIndex = 13;
this.nudIDAgv.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.nudIDAgv.Value = new decimal(new int[] {
10,
0,
0,
0});
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(32, 220);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(45, 12);
this.label7.TabIndex = 12;
this.label7.Text = "AGV ID";
//
// numericUpDown2 // numericUpDown2
// //
this.numericUpDown2.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); this.numericUpDown2.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
@@ -1388,33 +1430,69 @@ namespace AGVEmulator
this.sbCAL.Size = new System.Drawing.Size(19, 17); this.sbCAL.Size = new System.Drawing.Size(19, 17);
this.sbCAL.Text = "●"; this.sbCAL.Text = "●";
// //
// label7 // trbT1
// //
this.label7.AutoSize = true; this.trbT1.LargeChange = 10;
this.label7.Location = new System.Drawing.Point(32, 220); this.trbT1.Location = new System.Drawing.Point(442, 7);
this.label7.Name = "label7"; this.trbT1.Maximum = 990;
this.label7.Size = new System.Drawing.Size(45, 12); this.trbT1.Name = "trbT1";
this.label7.TabIndex = 12; this.trbT1.Size = new System.Drawing.Size(172, 45);
this.label7.Text = "AGV ID"; this.trbT1.SmallChange = 5;
this.trbT1.TabIndex = 14;
this.trbT1.Value = 200;
this.trbT1.Scroll += new System.EventHandler(this.trbT1_Scroll);
// //
// nudIDAgv // trbT2
// //
this.nudIDAgv.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); this.trbT2.LargeChange = 10;
this.nudIDAgv.Location = new System.Drawing.Point(6, 249); this.trbT2.Location = new System.Drawing.Point(442, 58);
this.nudIDAgv.Maximum = new decimal(new int[] { this.trbT2.Maximum = 990;
9999999, this.trbT2.Name = "trbT2";
0, this.trbT2.Size = new System.Drawing.Size(172, 45);
0, this.trbT2.SmallChange = 5;
0}); this.trbT2.TabIndex = 15;
this.nudIDAgv.Name = "nudIDAgv"; this.trbT2.Value = 200;
this.nudIDAgv.Size = new System.Drawing.Size(98, 38); this.trbT2.Scroll += new System.EventHandler(this.trbT2_Scroll);
this.nudIDAgv.TabIndex = 13; //
this.nudIDAgv.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // label8
this.nudIDAgv.Value = new decimal(new int[] { //
10, this.label8.AutoSize = true;
0, this.label8.Location = new System.Drawing.Point(392, 18);
0, this.label8.Name = "label8";
0}); this.label8.Size = new System.Drawing.Size(44, 12);
this.label8.TabIndex = 16;
this.label8.Text = "Temp1";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(391, 72);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(44, 12);
this.label9.TabIndex = 17;
this.label9.Text = "Temp2";
//
// label10
//
this.label10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.label10.ForeColor = System.Drawing.Color.White;
this.label10.Location = new System.Drawing.Point(620, 12);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(75, 24);
this.label10.TabIndex = 18;
this.label10.Text = "Curr";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label11
//
this.label11.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.label11.ForeColor = System.Drawing.Color.White;
this.label11.Location = new System.Drawing.Point(620, 68);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(75, 24);
this.label11.TabIndex = 19;
this.label11.Text = "Curr";
this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// Form1 // Form1
// //
@@ -1462,13 +1540,15 @@ namespace AGVEmulator
this.tabPage3.ResumeLayout(false); this.tabPage3.ResumeLayout(false);
this.panel3.ResumeLayout(false); this.panel3.ResumeLayout(false);
this.panel3.PerformLayout(); this.panel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudIDAgv)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).EndInit();
this.toolStrip1.ResumeLayout(false); this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout(); this.toolStrip1.PerformLayout();
this.statusStrip1.ResumeLayout(false); this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout(); this.statusStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudIDAgv)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.trbT1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trbT2)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -1571,6 +1651,12 @@ namespace AGVEmulator
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label7;
private System.Windows.Forms.NumericUpDown nudIDAgv; private System.Windows.Forms.NumericUpDown nudIDAgv;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TrackBar trbT2;
private System.Windows.Forms.TrackBar trbT1;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label10;
} }
} }

View File

@@ -101,6 +101,8 @@ namespace AGVEmulator
serAGV.BaudRate = 57600; serAGV.BaudRate = 57600;
// serPLC.BaudRate = 57600; // serPLC.BaudRate = 57600;
trackBar1_Scroll(null, null); trackBar1_Scroll(null, null);
trbT2_Scroll(null, null);
trbT1_Scroll(null, null);
timer1.Start(); timer1.Start();
//plc inout 이름 설정 //plc inout 이름 설정
@@ -568,15 +570,30 @@ namespace AGVEmulator
private void button6_Click(object sender, EventArgs e) private void button6_Click(object sender, EventArgs e)
{ {
var target = (byte)nudIDAgv.Value; var target = (byte)nudIDAgv.Value;
var tagno =(uint) nudTagNo.Value; var tagno = (uint)nudTagNo.Value;
this.XBE.SendGotoTag( target, tagno); this.XBE.SendGotoTag(target, tagno);
} }
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
var target = (byte)nudIDAgv.Value; var target = (byte)nudIDAgv.Value;
var tagno = (uint)numericUpDown2.Value; var tagno = (uint)numericUpDown2.Value;
this.XBE.SendCurrentPos(target,tagno); this.XBE.SendCurrentPos(target, tagno);
}
UInt16 Temp1, Temp2;
private void trbT1_Scroll(object sender, EventArgs e)
{
//값에 /10해서 표시한다.
Temp1 =(UInt16) trbT1.Value;
label10.Text = $"{Temp1 / 10f}º";
}
private void trbT2_Scroll(object sender, EventArgs e)
{
Temp2 = (UInt16)trbT2.Value;
label11.Text = $"{Temp2 / 10f}º";
} }
private void toolStripButton1_Click(object sender, EventArgs e) private void toolStripButton1_Click(object sender, EventArgs e)

View File

@@ -26,6 +26,7 @@ namespace AGVEmulator
this.cellvolt[i] = (UInt16)rnd.Next(3300, 3350); this.cellvolt[i] = (UInt16)rnd.Next(3300, 3350);
} }
Array.Copy(this.cellvolt, 0, e.cellVolt, 0, 8); Array.Copy(this.cellvolt, 0, e.cellVolt, 0, 8);
this.btc1.Invoke(new Action(() => this.btc1.Invoke(new Action(() =>
{ {
var idx = 0; var idx = 0;
@@ -53,6 +54,8 @@ namespace AGVEmulator
e.MaxA = (int)BMS_MaxA; e.MaxA = (int)BMS_MaxA;
e.Remain = BMS_Remain; e.Remain = BMS_Remain;
e.Volt = BMS_Volt; e.Volt = BMS_Volt;
e.Temp1 = this.Temp1;
e.Temp2 = this.Temp2;
} }

View File

@@ -14,12 +14,16 @@ namespace AGVEmulator
public float Remain { get; set; } public float Remain { get; set; }
public int CurA { get; set; } public int CurA { get; set; }
public int MaxA { get; set; } public int MaxA { get; set; }
public UInt16 Temp1 { get; set; }
public UInt16 Temp2 { get; set; }
public RequestBatteryDataArgs() public RequestBatteryDataArgs()
{ {
this.Volt = 25; this.Volt = 25;
this.Remain = 79f; this.Remain = 79f;
this.CurA = 40; this.CurA = 40;
this.MaxA = 80; this.MaxA = 80;
Temp1 = 0;
Temp2 = 0;
} }
} }
public class RequestVoltageDataArgs : EventArgs public class RequestVoltageDataArgs : EventArgs
@@ -53,7 +57,7 @@ namespace AGVEmulator
if (data.First() != 0xDD || data.Last() != 0x77) if (data.First() != 0xDD || data.Last() != 0x77)
{ {
RaiseMessage(MessageType.Error, "stx,etx error"); RaiseMessage(MessageType.Error, $"stx,etx error data={data.HexString()}");
return false; return false;
} }
var sts = data[1]; var sts = data[1];
@@ -89,6 +93,14 @@ namespace AGVEmulator
var perc = (byte)(int)p.Remain; var perc = (byte)(int)p.Remain;
Array.Copy(new byte[] { perc }, 0, basic_payload, 19, 1); Array.Copy(new byte[] { perc }, 0, basic_payload, 19, 1);
//temp1
var temp1 = BitConverter.GetBytes((UInt16)(p.Temp1 + 2731)).Reverse().ToArray();
Array.Copy(temp1, 0, basic_payload, 23,2);
//temp2
var temp2 = BitConverter.GetBytes((UInt16)(p.Temp2 + 2731)).Reverse().ToArray();
Array.Copy(temp2, 0, basic_payload, 25, 2);
var datalen = (byte)basic_payload.Length; var datalen = (byte)basic_payload.Length;
var payload_cs = new List<byte>(); var payload_cs = new List<byte>();
payload_cs.Add(datalen); payload_cs.Add(datalen);
@@ -115,7 +127,7 @@ namespace AGVEmulator
//Array.Copy(BitConverter.GetBytes(chksum).Reverse().ToArray(), 0, barrFD77, 20, 2); //Array.Copy(BitConverter.GetBytes(chksum).Reverse().ToArray(), 0, barrFD77, 20, 2);
RaiseMessage(MessageType.Normal, $"Volt:{p.Volt}v,Remain:{p.Remain}%"); RaiseMessage(MessageType.Normal, $"Volt:{p.Volt}v,Remain:{p.Remain}%,temp1:{p.Temp1/10f},Temp2:{p.Temp2/10f}");
var sendstr = System.Text.Encoding.Default.GetString(barr0D); var sendstr = System.Text.Encoding.Default.GetString(barr0D);
RaiseMessage(MessageType.Normal, "Tx:" + barr0D.HexString()); RaiseMessage(MessageType.Normal, "Tx:" + barr0D.HexString());
@@ -137,7 +149,7 @@ namespace AGVEmulator
{ {
var volt = p.cellVolt[i]; var volt = p.cellVolt[i];
var arr_cellvolt = BitConverter.GetBytes(volt).Reverse().ToArray(); var arr_cellvolt = BitConverter.GetBytes(volt).Reverse().ToArray();
Array.Copy(arr_cellvolt, 0, payload, ( i * 2), arr_cellvolt.Length); Array.Copy(arr_cellvolt, 0, payload, (i * 2), arr_cellvolt.Length);
} }
//makechecksum //makechecksum