diff --git a/Cs_HMI/Project/AGV4.csproj b/Cs_HMI/Project/AGV4.csproj
index 6f0ffc8..8eabc53 100644
--- a/Cs_HMI/Project/AGV4.csproj
+++ b/Cs_HMI/Project/AGV4.csproj
@@ -173,7 +173,7 @@
DataSet1.xsd
-
+
Form
@@ -264,7 +264,6 @@
-
Form
@@ -298,6 +297,9 @@
Form
+
+ Form
+
Form
@@ -328,8 +330,6 @@
Form
-
-
Form
@@ -547,7 +547,9 @@
ENIGProtocol
-
+
+
+
rem xcopy "$(TargetDir)*.exe" "\\192.168.1.80\Amkor\AGV2" /Y
diff --git a/Cs_HMI/Project/CSetting.cs b/Cs_HMI/Project/CSetting.cs
index 764ca34..619f2a3 100644
--- a/Cs_HMI/Project/CSetting.cs
+++ b/Cs_HMI/Project/CSetting.cs
@@ -7,6 +7,7 @@ using System.Drawing.Design;
using System.Runtime.CompilerServices;
using System.Management;
using System.IO.Ports;
+using AR;
namespace Project
{
@@ -413,7 +414,7 @@ namespace Project
if (Language.isEmpty()) Language = "Kor";
if (Password_Setup.isEmpty()) Password_Setup = "0000";
- if (musicfile.isEmpty()) musicfile = Util.CurrentPath + "music.mp3";
+ if (musicfile.isEmpty()) musicfile = UTIL.CurrentPath + "music.mp3";
if (musicvol == 0) musicvol = 50;
@@ -565,7 +566,7 @@ namespace Project
public CounterSetting()
{
- this.filename = Util.CurrentPath + "counter.xml";
+ this.filename = AR.UTIL.CurrentPath + "counter.xml";
}
public override void AfterLoad()
{
diff --git a/Cs_HMI/Project/Class/CParser.cs b/Cs_HMI/Project/Class/CParser.cs
index 0b64ada..e086661 100644
--- a/Cs_HMI/Project/Class/CParser.cs
+++ b/Cs_HMI/Project/Class/CParser.cs
@@ -95,7 +95,7 @@
// SrcText = s;
// Check_error(SrcText);
// if (this.isError)
-// Util.MsgE(ErrMsg.ToString());// Interaction.MsgBox(ErrMsg.ToString(), MsgBoxStyle.Critical, "오류");
+// UTIL.MsgE(ErrMsg.ToString());// Interaction.MsgBox(ErrMsg.ToString(), MsgBoxStyle.Critical, "오류");
// }
// protected string Buffer1 = "";
@@ -395,7 +395,7 @@
// else
// {
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
-// Util.MsgE(Param1, MsgBoxStyle.Information, "확인");
+// UTIL.MsgE(Param1, MsgBoxStyle.Information, "확인");
// }
// break;
@@ -718,7 +718,7 @@
// case "SAVE1":
// {
// if (ParamList.Count < 1)
-// Util.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
+// UTIL.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
// else
// {
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
@@ -731,7 +731,7 @@
// case "SAVE2":
// {
// if (ParamList.Count < 1)
-// Util.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
+// UTIL.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
// else
// {
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
@@ -744,7 +744,7 @@
// case "SAVE3":
// {
// if (ParamList.Count < 1)
-// Util.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
+// UTIL.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
// else
// {
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
@@ -757,7 +757,7 @@
// case "SAVE4":
// {
// if (ParamList.Count < 1)
-// Util.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
+// UTIL.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
// else
// {
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
diff --git a/Cs_HMI/Project/Class/CResult.cs b/Cs_HMI/Project/Class/CResult.cs
index abe0b06..f26b037 100644
--- a/Cs_HMI/Project/Class/CResult.cs
+++ b/Cs_HMI/Project/Class/CResult.cs
@@ -4,6 +4,7 @@ using System.Drawing;
using System.Linq;
using System.Text;
using Project.StateMachine;
+using AR;
namespace Project
{
@@ -174,7 +175,7 @@ namespace Project
public void SetResultMessage(eResult code, eECode err, eNextStep systempause, params object[] args)
{
- var rltMsg = UTIL.GetResultCodeMessage(code);
+ var rltMsg = PUB.GetResultCodeMessage(code);
var codeMSg = $"[E{(int)err}] ";// + Util.GetResultCodeMessage(code);
if (err == eECode.MESSAGE_ERROR)
{
@@ -187,7 +188,7 @@ namespace Project
- var erMsg = UTIL.GetErrorMessage(err, args);
+ var erMsg = PUB.GetErrorMessage(err, args);
var msg = codeMSg + erMsg;
this.ResultCode = code;
diff --git a/Cs_HMI/Project/Device/Xbee.cs b/Cs_HMI/Project/Device/Xbee.cs
index da8decb..54513a7 100644
--- a/Cs_HMI/Project/Device/Xbee.cs
+++ b/Cs_HMI/Project/Device/Xbee.cs
@@ -10,6 +10,7 @@ using System.Security.Cryptography;
using AR;
using System.IO.Ports;
using System.Security.Cryptography.X509Certificates;
+using System.Windows.Forms;
namespace Project.Device
{
@@ -21,6 +22,20 @@ namespace Project.Device
public DateTime LastStatusSendTime = DateTime.Now;
private EEProtocol proto;
+ public class MessageArgs : EventArgs
+ {
+ public bool IsError { get; set; }
+ public string Message { get; set; }
+ public MessageArgs(bool iserr,string m)
+ {
+ this.IsError = iserr;
+ this.Message = m;
+ }
+ }
+
+ public event EventHandler MessageReceived;
+ public event EventHandler ProtocReceived;
+
public Xbee()
{
this.DataReceived += Xbee_DataReceived;
@@ -35,7 +50,7 @@ namespace Project.Device
proto.OnMessage -= Proto_OnMessage;
}
-
+
///
/// 지그비장치에 데이터를 전송합니다
///
@@ -78,100 +93,15 @@ namespace Project.Device
var id = e.ReceivedPacket.ID.ToString("X2");
PUB.logxbee.Add("RX", $"{hexstrRaw}\nID:{id},CMD:{cmd},DATA:{hexstr}");
- //TODO : 기능 처리필요 (XBee 메세지 데이터처리)
- //PUB.CheckManualChargeMode() : 수동충전확인
- //VAR.BOOL[eVarBool.FLAG_AUTORUN] : 자동실행
- //PUB.Speak("현재 위치는 QA 입니다.") : 음성출력
+ ProtocReceived?.Invoke(this, e);
- //ACS 수신 데이터 처리(타 장비는 확인하지 않는다)
- if (e.ReceivedPacket.ID == 0)
- {
- var data = e.ReceivedPacket.Data;
- switch (e.ReceivedPacket.Command)
- {
- case 1: //Request PATH
- var pathID = data[0];
- var pathPage = data[1];
-
- //TODO : 요청받은 맵 데이터를 전송해야한다
-
-
- break;
- case 100: //move to tag
- var TargetTag = System.Text.Encoding.Default.GetString(data, 0, 6);
-
- //1.현재위치에서 경로계산 하여 경로저장
- //2.현재위치를 모를경우 이전 이동 기록을 통해 위치를 추정한다
- //3.대상태그에 맞는 전/후진 방향을 결정하여 이동을 수행한다
-
- break;
- case 101: //stop
- PUB.AGV.AGVMoveStop("xbee");
- break;
- case 102: //Error Reset
- PUB.AGV.AGVErrorReset();
- break;
- case 103: //charing command (0:off, 1:on)
- var CharingCmd = data[0];
-
- //0.자동모드가 아니라면 실행하지 않는다
- //1.충전프로세스를 시작한다
- //2.1분간 충전진행 신호가 없다면 반대편으로 1TAG이동하여 다시 시도한다
- //3.3회 시도 실패시 오류 데이터를 HOST에 전송한다
-
- break;
- case 104: //Manual Move (Direction, speed, runtime)
- var Direction = data[0]; //0=back, 1=forward, 2=left, 3=right
- var Speed = data[1]; //0=slow, 1=normal, 2=fast
- var Runtime = data[2]; // running seconds
-
- arDev.Narumi.ManulOpt opt = arDev.Narumi.ManulOpt.BS;
- arDev.Narumi.Speed spd = arDev.Narumi.Speed.Low;
- if (Speed == 1) spd = arDev.Narumi.Speed.Mid;
- else if (Speed == 2) spd = arDev.Narumi.Speed.High;
-
- //0.자동모드가 아니라면 실행하지 않는다
- //1.입력된 파라미터로 AGV를 이동한다
- if (Direction == 0) opt = arDev.Narumi.ManulOpt.BS;
- else if (Direction == 1) opt = arDev.Narumi.ManulOpt.FS;
- else if (Direction == 2) opt = arDev.Narumi.ManulOpt.LT;
- else if (Direction == 3) opt = arDev.Narumi.ManulOpt.RT;
-
- PUB.AGV.AGVMoveManual(opt, spd, arDev.Narumi.Sensor.PBSOn);
- break;
- case 105: //Set MarkStop
- var MarkStop = data[0]; //0=off, 1=on
-
- //마크센서에서 멈추게 한다
- PUB.AGV.AGVMoveStop("Xbee", arDev.Narumi.eStopOpt.MarkStop);
- break;
- case 106: //Lift Control
- var LiftCommand = data[0]; //0=stop, 1=up, 2=down
- arDev.Narumi.LiftCommand LCmd = arDev.Narumi.LiftCommand.STP;
- if (LiftCommand == 1) LCmd = arDev.Narumi.LiftCommand.UP;
- else if (LiftCommand == 2) LCmd = arDev.Narumi.LiftCommand.DN;
-
- //리프트제어
- PUB.AGV.LiftControl(LCmd);
- break;
-
- case 107: //clear path
- //TODO: 현재 설정된 경로삭제기능 필요
- break;
- case 108: //send path
- //TODO : 경로정보를 수신받고 페이지가 1을 초과하면 나머지 페이지정보도 요청할 수 있어야 한다
- break;
-
-
- }
- }
+
}
private void Proto_OnMessage(object sender, EEProtocol.MessageEventArgs e)
{
- if (e.IsError) PUB.log.AddE(e.Message);
- else PUB.log.Add(e.Message);
+ MessageReceived?.Invoke(this, new MessageArgs(e.IsError, e.Message));
}
@@ -207,7 +137,7 @@ namespace Project.Device
Send(packet);
}
-
+
///
diff --git a/Cs_HMI/Project/Dialog/fSystem.cs b/Cs_HMI/Project/Dialog/fSystem.cs
index fa05ab7..4b67ba3 100644
--- a/Cs_HMI/Project/Dialog/fSystem.cs
+++ b/Cs_HMI/Project/Dialog/fSystem.cs
@@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
+using AR;
using System.IO.Compression;
namespace Project.Dialog
@@ -22,12 +23,12 @@ namespace Project.Dialog
private void button1_Click(object sender, EventArgs e)
{
- Util.RunProcess(@"c:\windows\system32\shutdown.exe", "-r -t 5");
+ UTIL.RunProcess(@"c:\windows\system32\shutdown.exe", "-r -t 5");
}
private void button2_Click(object sender, EventArgs e)
{
- Util.RunProcess(@"c:\windows\system32\shutdown.exe", "-s -t 5");
+ UTIL.RunProcess(@"c:\windows\system32\shutdown.exe", "-s -t 5");
}
private void button3_Click(object sender, EventArgs e)
@@ -65,7 +66,7 @@ namespace Project.Dialog
private void arLabel9_Click(object sender, EventArgs e)
{
shutdown = true;
- Util.SystemShutdown(10);
+ PUB.SystemShutdown(10);
this.Close();
}
@@ -73,7 +74,7 @@ namespace Project.Dialog
private void arLabel10_Click(object sender, EventArgs e)
{
shutdown = true;
- Util.SystemReboot(10);
+ PUB.SystemReboot(10);
this.Close();
}
@@ -93,7 +94,7 @@ namespace Project.Dialog
if (prc.ProcessName.StartsWith("svchost")) continue;
sb.Append(" " + prc.ProcessName);
}
- Util.MsgI(sb.ToString(),true);
+ UTIL.MsgI(sb.ToString(),true);
}
private void fSystem_Load(object sender, EventArgs e)
@@ -104,14 +105,14 @@ namespace Project.Dialog
private void arLabel3_Click(object sender, EventArgs e)
{
- var file = System.IO.Path.Combine( Util.CurrentPath, "Emulator.exe");
+ var file = System.IO.Path.Combine(UTIL.CurrentPath, "Emulator.exe");
if(System.IO.File.Exists(file)==false)
{
- Util.MsgE("에물레이터 실행 파일이 없습니다", true);
+ UTIL.MsgE("에물레이터 실행 파일이 없습니다", true);
return;
}
- Util.RunProcess(file);
+ UTIL.RunProcess(file);
}
private void arLabel5_Click(object sender, EventArgs e)
@@ -122,7 +123,7 @@ namespace Project.Dialog
var file_exe = System.IO.Path.Combine(path.FullName, "amkor.exe");
if(System.IO.File.Exists(file_exe)==false)
{
- Util.MsgE("실행파일 amkor.exe 가 없습니다.");
+ UTIL.MsgE("실행파일 amkor.exe 가 없습니다.");
return;
}
@@ -146,12 +147,12 @@ namespace Project.Dialog
// 임시 폴더 삭제
Directory.Delete(tempDir, true);
- Util.MsgI("다음 패치 파일이 생성됨\n" + newfilename);
+ UTIL.MsgI("다음 패치 파일이 생성됨\n" + newfilename);
}
private void arLabel7_Click(object sender, EventArgs e)
{
- Util.SystemReboot(5,true);
+ PUB.SystemReboot(5,true);
}
}
}
diff --git a/Cs_HMI/Project/Dialog/fUpdateForm.cs b/Cs_HMI/Project/Dialog/fUpdateForm.cs
index d3f3d3e..f13e136 100644
--- a/Cs_HMI/Project/Dialog/fUpdateForm.cs
+++ b/Cs_HMI/Project/Dialog/fUpdateForm.cs
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.IO.Compression;
+using AR;
namespace Project.Dialog
{
@@ -195,7 +196,7 @@ namespace Project.Dialog
if(System.IO.File.Exists(file))
{
//이 파일을 _patch 폴더에 압축해제한다.
- var dir_path = new System.IO.DirectoryInfo(System.IO.Path.Combine(Util.CurrentPath,"_patch"));
+ var dir_path = new System.IO.DirectoryInfo(System.IO.Path.Combine(UTIL.CurrentPath ,"_patch"));
if (dir_path.Exists == true)
{
try
@@ -203,7 +204,7 @@ namespace Project.Dialog
dir_path.Delete(true);
} catch (Exception ex)
{
- Util.MsgE(ex.Message);
+ UTIL.MsgE(ex.Message);
return;
}
}
@@ -224,7 +225,7 @@ namespace Project.Dialog
}
else
{
- Util.MsgE("패치파일이 없습니다\n" + file);
+ UTIL.MsgE("패치파일이 없습니다\n" + file);
return;
}
diff --git a/Cs_HMI/Project/Dialog/fVolume.cs b/Cs_HMI/Project/Dialog/fVolume.cs
index b295573..90b49a1 100644
--- a/Cs_HMI/Project/Dialog/fVolume.cs
+++ b/Cs_HMI/Project/Dialog/fVolume.cs
@@ -65,7 +65,7 @@ namespace Project.Dialog
//if (dev == null)
//{
// trackBar1.Enabled = false;
- // Util.MsgE("사운드 장치가 없습니다", true);
+ // UTIL.MsgE("사운드 장치가 없습니다", true);
//}
//else
//{
diff --git a/Cs_HMI/Project/Manager/DataBaseManager.cs b/Cs_HMI/Project/Manager/DataBaseManager.cs
index adc17de..38a13ac 100644
--- a/Cs_HMI/Project/Manager/DataBaseManager.cs
+++ b/Cs_HMI/Project/Manager/DataBaseManager.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using AR;
namespace Project.Manager
{
@@ -51,7 +52,7 @@ namespace Project.Manager
dt = new DataSet1.ResultDataDataTable();
this.dataPath = dataPath_;
- if (dataPath_.Length == 0) dataPath = new string[]{ System.IO.Path.Combine(Util.CurrentPath, "Data")};
+ if (dataPath_.Length == 0) dataPath = new string[]{ System.IO.Path.Combine(UTIL.CurrentPath, "Data")};
//최대버퍼갯수(이 갯수를 넘어가면 실제 파일에 기록한다)
MaxBufferCount = _MaxBufferCount;
diff --git a/Cs_HMI/Project/PUB.cs b/Cs_HMI/Project/PUB.cs
index ca6e081..e90efce 100644
--- a/Cs_HMI/Project/PUB.cs
+++ b/Cs_HMI/Project/PUB.cs
@@ -22,6 +22,7 @@ namespace Project
public static bool Automodeonreboot = false;
public static bool AutRebootAlreay = false;
public static bool DriveSpeed = false;
+ public static AGVControl.MapControl mapctl;
#region "Hardware"
@@ -94,7 +95,7 @@ namespace Project
voice.SpeakAsyncCancelAll();
if (voice.State == SynthesizerState.Ready)
voice.SpeakAsync(m);
- if (addlog) PUB.log.Add("SPEAK",m);
+ if (addlog) PUB.log.Add("SPEAK", m);
}
///
@@ -111,7 +112,7 @@ namespace Project
VAR.BOOL[eVarBool.WAIT_COVER_DOWN] == false &&
VAR.BOOL[eVarBool.WAIT_COVER_UP] == false)
{
- return true;
+ return true;
}
else return false;
}
@@ -188,13 +189,13 @@ namespace Project
public static void init()
{
-
+
Result = new CResult();
//state machine
sm = new StateMachine.StateMachine();
- path = new System.IO.DirectoryInfo(Util.CurrentPath);
+ path = new System.IO.DirectoryInfo(UTIL.CurrentPath);
@@ -234,7 +235,7 @@ namespace Project
}
voice.SetOutputToDefaultAudioDevice();
- var file_version = System.IO.Path.Combine(Util.CurrentPath, "version.txt");
+ var file_version = System.IO.Path.Combine(UTIL.CurrentPath, "version.txt");
if (System.IO.File.Exists(file_version))
{
PUB.PatchVersion = System.IO.File.ReadAllText(file_version, System.Text.Encoding.UTF8);
@@ -242,16 +243,16 @@ namespace Project
else PUB.PatchVersion = string.Empty;
}
-
- public static Boolean CheckManualChargeMode(bool Prompt = true )
+
+ public static Boolean CheckManualChargeMode(bool Prompt = true)
{
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM] == true)
{
string msg = "수동 충전 상태이므로 진행 할 수 없습니다";
PUB.Speak(msg);
- if(Prompt)
- Util.MsgE(msg);
+ if (Prompt)
+ UTIL.MsgE(msg);
return false;
}
else return true;
@@ -334,13 +335,13 @@ namespace Project
var step = PUB.sm.Step.ToString();
var rtep = PUB.sm.RunStep.ToString();
var mcid = PUB.setting.MCID;
- var path = System.IO.Path.Combine(Util.CurrentPath, "Status");
+ var path = System.IO.Path.Combine(UTIL.CurrentPath, "Status");
var file = System.IO.Path.Combine(path, $"{DateTime.Now.ToString("HHmmssfff")}_{step}_{rtep}.sql");
var wdate = DateTime.Now;
try
{
var sql = "insert into AGV_History(mcid,step,runstep,remark,ip,wdate) values('{0}','{1}','{2}','{3}','{4}','{5}')";
- sql = string.Format(sql, mcid, step, rtep, remark,IP,wdate.ToString("yyyy-MM-dd HH:mm:ss"));
+ sql = string.Format(sql, mcid, step, rtep, remark, IP, wdate.ToString("yyyy-MM-dd HH:mm:ss"));
System.IO.File.WriteAllText(file, sql, System.Text.Encoding.Default);
//만들어진지 3분이 지난 파일은 삭제한다.
@@ -354,7 +355,27 @@ namespace Project
}
}
+ public static string GetResultCodeMessage(eResult err)
+ {
+ return err.ToString().ToUpper();
+ }
+
+ public static string GetErrorMessage(eECode err, params object[] values)
+ {
+ switch (err)
+ {
+ case eECode.NOTALLOWUP:
+ return "상차 허용 위치가 아닙니다";
+ case eECode.AGVCONN:
+ return Lang.AGV연결실패;
+ case eECode.PLCCONN:
+ return Lang.PLC통신실패;
+
+ default:
+ return err.ToString();
+ }
+ }
public static string IP { get; set; }
public static string MAC { get; set; }
@@ -448,23 +469,100 @@ namespace Project
}
});
}
+ public static string SelectSerialPort()
+ {
+ var f = new System.Windows.Forms.Form();
+ f.WindowState = System.Windows.Forms.FormWindowState.Normal;
+ f.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ f.Size = new System.Drawing.Size(800, 400);
+ f.MaximizeBox = false;
+ f.MinimizeBox = false;
+ f.Text = "Select Port";
+ f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ var lst = new System.Windows.Forms.ListBox();
+ lst.Font = new System.Drawing.Font("Consolas", 15, System.Drawing.FontStyle.Bold);
+ lst.Dock = System.Windows.Forms.DockStyle.Fill;
+ lst.DoubleClick += (s1, e1) =>
+ {
+ if (lst.SelectedItem != null) f.DialogResult = System.Windows.Forms.DialogResult.OK;
+ };
+ using (var searcher = new ManagementObjectSearcher("SELECT * FROM WIN32_SerialPort"))
+ {
+ var portnames = System.IO.Ports.SerialPort.GetPortNames().OrderBy(t => t);
+ var ports = searcher.Get().Cast().ToList();
+ foreach (var port in portnames)
+ {
+ var desc = "";
+ var portInfo = ports.Where(t => t["DeviceId"].ToString() == port).FirstOrDefault();
+ if (portInfo != null) desc = portInfo["Caption"].ToString();
+ lst.Items.Add(string.Format("{0} - {1}", port, desc));
+ }
+ }
+ f.Controls.Add(lst);
+ if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ var name = lst.SelectedItem.ToString().Split('-');
+ return name[0].Trim();
+ }
+ else return string.Empty;
+ }
+ public static void SystemReboot(UInt16 timeout, bool setautomode = false)
+ {
+ System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo();
+ si.FileName = @"c:\windows\system32\shutdown.exe";
+ si.Arguments = "-r -t " + timeout.ToString();
+ si.UseShellExecute = false;
+ System.Diagnostics.Process prc = new System.Diagnostics.Process();
+ prc.StartInfo = si;
+
+ PUB.AGV.AGVMoveStop("user reboot");
+
+ if (setautomode)
+ {
+ PUB.Automodeonreboot = true;
+ PUB.setting.SetAutoModeOn = true;
+ PUB.setting.AUtoRebootLastTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ PUB.setting.Save();
+ }
+
+
+ prc.Start();
+
+ }
+ public static void SystemShutdown(UInt16 timeout)
+ {
+ //System.Text.StringBuilder sb = new StringBuilder();
+ //sb.AppendLine("@echo off");
+ //sb.AppendLine("echo System OFF After " + timeout.ToString() + "Seconds");
+ //sb.AppendLine("shutdown -s -t " + timeout.ToString());
+ //string bfile = AppDomain.CurrentDomain.BaseDirectory + "Shutdown.bat";
+ //System.IO.File.WriteAllText(bfile, string.Format(sb.ToString(), AppDomain.CurrentDomain.BaseDirectory), System.Text.Encoding.Default);
+
+ System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo();
+ si.FileName = @"c:\windows\system32\shutdown.exe";
+ si.Arguments = "-s -t " + timeout.ToString();
+ si.UseShellExecute = false;
+ System.Diagnostics.Process prc = new System.Diagnostics.Process();
+ prc.StartInfo = si;
+ prc.Start();
+ }
public static void ChangeUIPopup(System.Windows.Forms.NumericUpDown valueCtl)
{
var value = valueCtl.Value.ToString();
- var f = AR.UTIL.InputBox("input", value);// new Dialog.fInput(value);
+ var f = UTIL.InputBox("input", value);// new Dialog.fInput(value);
if (f.Item1)
{
var val = decimal.Parse(f.Item2);
if (val < valueCtl.Minimum)
{
- Util.MsgE(string.Format("최소 입력값은 {0} 입니다.", valueCtl.Minimum));
+ UTIL.MsgE(string.Format("최소 입력값은 {0} 입니다.", valueCtl.Minimum));
val = valueCtl.Minimum;
}
if (val > valueCtl.Maximum)
{
- Util.MsgE(string.Format("최대 입력값은 {0} 입니다.", valueCtl.Maximum));
+ UTIL.MsgE(string.Format("최대 입력값은 {0} 입니다.", valueCtl.Maximum));
val = valueCtl.Maximum;
}
valueCtl.Value = val;
diff --git a/Cs_HMI/Project/Program.cs b/Cs_HMI/Project/Program.cs
index b11ea9b..6c4791b 100644
--- a/Cs_HMI/Project/Program.cs
+++ b/Cs_HMI/Project/Program.cs
@@ -39,7 +39,7 @@ namespace Project
string emsg = "Fatal Error(UHE)\n\n" + e.ExceptionObject.ToString();
PUB.log.AddE(emsg);
PUB.log.Flush();
- Util.SaveBugReport(emsg);
+ AR.UTIL.SaveBugReport(emsg);
var f = new fErrorException(emsg);
f.ShowDialog();
Application.ExitThread();
@@ -50,7 +50,7 @@ namespace Project
string emsg = "Fatal Error(ATE)\n\n" + e.Exception.ToString();
PUB.log.AddE(emsg);
PUB.log.Flush();
- Util.SaveBugReport(emsg);
+ AR.UTIL.SaveBugReport(emsg);
var f = new fErrorException(emsg);
f.ShowDialog();
Application.ExitThread();
diff --git a/Cs_HMI/Project/StateMachine/Display/GetErrorMessage.cs b/Cs_HMI/Project/StateMachine/Display/GetErrorMessage.cs
deleted file mode 100644
index c70b4aa..0000000
--- a/Cs_HMI/Project/StateMachine/Display/GetErrorMessage.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Drawing;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.NetworkInformation;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.Text;
-using System.Windows.Forms;
-using System.Management;
-using COMM;
-
-namespace Project
-{
- public static partial class UTIL
- {
- public static string GetResultCodeMessage(eResult err)
- {
- return err.ToString().ToUpper();
- }
-
-
- public static string GetErrorMessage(eECode err, params object[] values)
- {
- switch (err)
- {
- case eECode.NOTALLOWUP:
- return "상차 허용 위치가 아닙니다";
- case eECode.AGVCONN:
- return Lang.AGV연결실패;
- case eECode.PLCCONN:
- return Lang.PLC통신실패;
-
- default:
- return err.ToString();
- }
- }
-
- }
-}
diff --git a/Cs_HMI/Project/StateMachine/_AGV.cs b/Cs_HMI/Project/StateMachine/_AGV.cs
index a759cc0..14f8f0b 100644
--- a/Cs_HMI/Project/StateMachine/_AGV.cs
+++ b/Cs_HMI/Project/StateMachine/_AGV.cs
@@ -35,7 +35,7 @@ namespace Project
}
}
- ePosition ParsePosition(int tag, out string dirBW)
+ ePosition ParsePosition(uint tag, out string dirBW)
{
var tagstr = tag.ToString();
var tagno = tagstr.Substring(0, tagstr.Length - 1);
diff --git a/Cs_HMI/Project/StateMachine/_TMDisplay.cs b/Cs_HMI/Project/StateMachine/_TMDisplay.cs
index b4d9493..2049ebe 100644
--- a/Cs_HMI/Project/StateMachine/_TMDisplay.cs
+++ b/Cs_HMI/Project/StateMachine/_TMDisplay.cs
@@ -115,7 +115,7 @@ namespace Project
if (System.Diagnostics.Debugger.IsAttached == false)
{
PUB.Speak(Lang.자동재부팅을실행합니다);
- Util.SystemReboot(5, true);
+ PUB.SystemReboot(5, true);
}
else PUB.setting.SetAutoModeOn = true;
diff --git a/Cs_HMI/Project/StateMachine/_Xbee.cs b/Cs_HMI/Project/StateMachine/_Xbee.cs
new file mode 100644
index 0000000..36e9974
--- /dev/null
+++ b/Cs_HMI/Project/StateMachine/_Xbee.cs
@@ -0,0 +1,115 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using AR;
+using arDev;
+using COMM;
+
+namespace Project
+{
+ public partial class fMain
+ {
+
+ private void XBE_ProtocReceived(object sender, ENIG.EEProtocol.DataEventArgs e)
+ {
+ //TODO : 기능 처리필요 (XBee 메세지 데이터처리)
+ //PUB.CheckManualChargeMode() : 수동충전확인
+ //VAR.BOOL[eVarBool.FLAG_AUTORUN] : 자동실행
+ //PUB.Speak("현재 위치는 QA 입니다.") : 음성출력
+
+ //ACS 수신 데이터 처리(타 장비는 확인하지 않는다)
+ if (e.ReceivedPacket.ID == 0)
+ {
+ var data = e.ReceivedPacket.Data;
+ var dataStr = System.Text.Encoding.Default.GetString(data);
+ var cmd = (ENIGProtocol.AGVCommands)e.ReceivedPacket.Command;
+ switch (cmd)
+ {
+
+ case ENIGProtocol.AGVCommands.SetCurrent: //Set Current Position
+
+ if (uint.TryParse(dataStr, out uint tagno))
+ {
+ if (PUB.mapctl.SetCurrentPosition(tagno) == true)
+ {
+ PUB.log.AddI($"Set Position:{tagno}");
+ }
+ else PUB.log.AddE($"Position Error:{tagno}");
+ }
+ else PUB.log.AddE($"Position Param Error:{dataStr}");
+ break;
+ case ENIGProtocol.AGVCommands.Goto: //move to tag
+ if (uint.TryParse(dataStr, out uint tagno2))
+ {
+ var currPos = PUB.mapctl.agv.CurrentRFID;///.AGVMoveToRFID(;
+ if (currPos == 0) currPos = 10;
+ var pathRlt = PUB.mapctl.CalculatePath(currPos,tagno2);
+ if (pathRlt.Success == true)
+ {
+ PUB.log.AddI($"New Target:{tagno2}");
+ }
+ else PUB.log.AddE($"Path Error {pathRlt.Message} : {tagno2}");
+ }
+ else PUB.log.AddE($"Path Param Error :{dataStr}");
+ break;
+ case ENIGProtocol.AGVCommands.Stop: //stop
+ PUB.AGV.AGVMoveStop("xbee");
+ break;
+ case ENIGProtocol.AGVCommands.Reset: //Error Reset
+ PUB.AGV.AGVErrorReset();
+ break;
+
+ case ENIGProtocol.AGVCommands.Manual: //Manual Move (Direction, speed, runtime)
+ var Direction = data[0]; //0=back, 1=forward, 2=left, 3=right
+ var Speed = data[1]; //0=slow, 1=normal, 2=fast
+ var Runtime = data[2]; // running seconds
+
+ arDev.Narumi.ManulOpt opt = arDev.Narumi.ManulOpt.BS;
+ arDev.Narumi.Speed spd = arDev.Narumi.Speed.Low;
+ if (Speed == 1) spd = arDev.Narumi.Speed.Mid;
+ else if (Speed == 2) spd = arDev.Narumi.Speed.High;
+
+ //0.자동모드가 아니라면 실행하지 않는다
+ //1.입력된 파라미터로 AGV를 이동한다
+ if (Direction == 0) opt = arDev.Narumi.ManulOpt.BS;
+ else if (Direction == 1) opt = arDev.Narumi.ManulOpt.FS;
+ else if (Direction == 2) opt = arDev.Narumi.ManulOpt.LT;
+ else if (Direction == 3) opt = arDev.Narumi.ManulOpt.RT;
+
+ PUB.AGV.AGVMoveManual(opt, spd, arDev.Narumi.Sensor.PBSOn);
+ break;
+ case ENIGProtocol.AGVCommands.MarkStop: //Set MarkStop
+ var MarkStop = data[0]; //0=off, 1=on
+
+ //마크센서에서 멈추게 한다
+ PUB.AGV.AGVMoveStop("Xbee", arDev.Narumi.eStopOpt.MarkStop);
+ break;
+ case ENIGProtocol.AGVCommands.LiftControl: //Lift Control
+ var LiftCommand = data[0]; //0=stop, 1=up, 2=down
+ arDev.Narumi.LiftCommand LCmd = arDev.Narumi.LiftCommand.STP;
+ if (LiftCommand == 1) LCmd = arDev.Narumi.LiftCommand.UP;
+ else if (LiftCommand == 2) LCmd = arDev.Narumi.LiftCommand.DN;
+
+ //리프트제어
+ PUB.AGV.LiftControl(LCmd);
+ break;
+
+
+
+
+ }
+ }
+ }
+
+ private void XBE_MessageReceived(object sender, Device.Xbee.MessageArgs e)
+ {
+ if (e.IsError) PUB.log.AddE(e.Message);
+ else PUB.log.Add(e.Message);
+ }
+
+
+ }
+}
+
diff --git a/Cs_HMI/Project/Util.cs b/Cs_HMI/Project/Util.cs
deleted file mode 100644
index 142bd73..0000000
--- a/Cs_HMI/Project/Util.cs
+++ /dev/null
@@ -1,510 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Drawing;
-using System.IO;
-using System.Linq;
-using System.Management;
-using System.Net;
-using System.Text;
-using System.Windows;
-using System.Windows.Forms;
-
-namespace Project
-{
- public static class Util
- {
- #region "MessageBox"
- public static void MsgI(string m, Boolean legacy = false)
- {
- if (legacy)
- {
- MessageBox.Show(m, "확인", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- var f = new fMessageWindow("알림\n" + m);
- f.SetWindowColor(fMessageWindow.EWinColor.Information);
- f.btNo.Visible = false;
- f.btYes.Text = "확인";
- f.EnableUserClose = true;
- f.DialogMode = true;
- f.ShowDialog();
- }
- }
- public static void MsgE(string m, Boolean legacy = false)
- {
- if (legacy)
- {
- MessageBox.Show(m, "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- else
- {
- var f = new fMessageWindow("오류 알림\n" + m);
- f.SetWindowColor(fMessageWindow.EWinColor.Error);
- f.btNo.Visible = false;
- f.btYes.Text = "확인";
- f.EnableUserClose = true;
- f.DialogMode = true;
- f.ShowDialog();
- }
- }
- public static DialogResult MsgQ(string m, Boolean legacy = false, string btOK = "확인", string btCancel = "아니오")
- {
- if (legacy)
- {
- DialogResult dlg = MessageBox.Show(m, "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- return dlg;
- }
- else
- {
- var f = new fMessageWindow("선택 알림\n" + m);
- f.SetWindowColor(fMessageWindow.EWinColor.Attention);
- f.EnableUserClose = true;
- f.DialogMode = true;
- f.btNo.Text = btCancel;
- f.btYes.Text = btOK;
- var dlg = f.ShowDialog();
- return dlg;
- }
- }
-
- #endregion
-
- public static string SelectSerialPort()
- {
- var f = new System.Windows.Forms.Form();
- f.WindowState = System.Windows.Forms.FormWindowState.Normal;
- f.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- f.Size = new System.Drawing.Size(800, 400);
- f.MaximizeBox = false;
- f.MinimizeBox = false;
- f.Text = "Select Port";
- f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- var lst = new System.Windows.Forms.ListBox();
- lst.Font = new System.Drawing.Font("Consolas", 15, System.Drawing.FontStyle.Bold);
- lst.Dock = System.Windows.Forms.DockStyle.Fill;
- lst.DoubleClick += (s1, e1) =>
- {
- if (lst.SelectedItem != null) f.DialogResult = System.Windows.Forms.DialogResult.OK;
- };
- using (var searcher = new ManagementObjectSearcher("SELECT * FROM WIN32_SerialPort"))
- {
- var portnames = System.IO.Ports.SerialPort.GetPortNames().OrderBy(t => t);
- var ports = searcher.Get().Cast().ToList();
- foreach (var port in portnames)
- {
- var desc = "";
- var portInfo = ports.Where(t => t["DeviceId"].ToString() == port).FirstOrDefault();
- if (portInfo != null) desc = portInfo["Caption"].ToString();
- lst.Items.Add(string.Format("{0} - {1}", port, desc));
- }
- }
- f.Controls.Add(lst);
- if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- var name = lst.SelectedItem.ToString().Split('-');
- return name[0].Trim();
- }
- else return string.Empty;
- }
-
- public static void ScreenCaptrue(int _BitmapWidth, int _BitmapHeight, System.Drawing.Point ptSouce)
- {
- try
- {
- Bitmap bitmap = new Bitmap(_BitmapWidth, _BitmapHeight);
- Graphics _graphic = Graphics.FromImage(bitmap);
-
- _graphic.CopyFromScreen(ptSouce, new System.Drawing.Point(0, 0), new System.Drawing.Size(_BitmapWidth, _BitmapHeight));
-
- string savefile = System.IO.Path.Combine(Util.CurrentPath, "ScreenShot", DateTime.Now.ToString("yyyyMMddHHmmss") + ".png");
- System.IO.FileInfo grpath = new FileInfo(savefile);
- if (!grpath.Directory.Exists) grpath.Directory.Create();
-
- bitmap.Save(grpath.FullName, System.Drawing.Imaging.ImageFormat.Png);
- Util.MsgI("화면 캡쳐 성공\n" +
- "위치:" + grpath.Directory.FullName + "\n" +
- "파일명: " + grpath.Name);
- }
- catch (Exception ex)
- {
- Util.MsgE("화면 캡쳐 실패\n" + ex.Message);
- }
- }
-
- public static void SystemReboot(UInt16 timeout, bool setautomode = false)
- {
- System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo();
- si.FileName = @"c:\windows\system32\shutdown.exe";
- si.Arguments = "-r -t " + timeout.ToString();
- si.UseShellExecute = false;
- System.Diagnostics.Process prc = new System.Diagnostics.Process();
- prc.StartInfo = si;
-
- PUB.AGV.AGVMoveStop("user reboot");
-
- if (setautomode)
- {
- PUB.Automodeonreboot = true;
- PUB.setting.SetAutoModeOn = true;
- PUB.setting.AUtoRebootLastTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- PUB.setting.Save();
- }
-
-
- prc.Start();
-
- }
- public static void SystemShutdown(UInt16 timeout)
- {
- //System.Text.StringBuilder sb = new StringBuilder();
- //sb.AppendLine("@echo off");
- //sb.AppendLine("echo System OFF After " + timeout.ToString() + "Seconds");
- //sb.AppendLine("shutdown -s -t " + timeout.ToString());
- //string bfile = AppDomain.CurrentDomain.BaseDirectory + "Shutdown.bat";
- //System.IO.File.WriteAllText(bfile, string.Format(sb.ToString(), AppDomain.CurrentDomain.BaseDirectory), System.Text.Encoding.Default);
-
- System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo();
- si.FileName = @"c:\windows\system32\shutdown.exe";
- si.Arguments = "-s -t " + timeout.ToString();
- si.UseShellExecute = false;
- System.Diagnostics.Process prc = new System.Diagnostics.Process();
- prc.StartInfo = si;
- prc.Start();
- }
- public static void SaveBugReport(string content, string subdirName = "BugReport")
- {
- try
- {
- var path = CurrentPath + subdirName;
- if (!System.IO.Directory.Exists(path)) System.IO.Directory.CreateDirectory(path);
- var file = path + "\\" + DateTime.Now.ToString("yyyyMMdd_HHmmss_fff") + ".txt";
- System.IO.File.WriteAllText(file, content, System.Text.Encoding.UTF8);
- }
- catch
- {
- //nothing
- }
- }
-
- public static void CopyData(System.Data.DataRow drSrc, System.Data.DataRow drDes)
- {
- if (drDes == null || drSrc == null) return;
- foreach (System.Data.DataColumn col in drSrc.Table.Columns)
- {
- if (col.ColumnName.ToUpper() == "IDX") continue;
- drDes[col.ColumnName] = drSrc[col.ColumnName];
- }
-
- }
-
- ///
- /// 현재실행중인폴더를 반환합니다.
- ///
- public static string CurrentPath
- {
- get
- {
- return AppDomain.CurrentDomain.BaseDirectory;
- }
- }
- ///
- /// 콤마와 줄바꿈등을 제거합니다.
- ///
- ///
- public static string ToCSVString(string src)
- {
- string retval = src.Replace("\r", "").Replace("\n", "").Replace(",", "");
- return retval;
- }
-
- public static Boolean RunProcess(string file, string arg = "")
- {
- var fi = new System.IO.FileInfo(file);
- if (!fi.Exists)
- {
- PUB.log.AddE("Run Error : " + file);
- return false;
- }
- System.Diagnostics.Process prc = new System.Diagnostics.Process();
- System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo(file);
- si.Arguments = arg;
- prc.StartInfo = si;
- prc.Start();
- return true;
- }
-
- #region "convert"
- public static string RectToStr(Rectangle rect)
- {
- return string.Format("{0};{1};{2};{3}", rect.X, rect.Y, rect.Width, rect.Height);
- }
- public static string RectToStr(RectangleF rect)
- {
- return string.Format("{0};{1};{2};{3}", rect.X, rect.Y, rect.Width, rect.Height);
- }
- public static string PointToStr(System.Drawing.Point pt)
- {
- return string.Format("{0};{1}", pt.X, pt.Y);
- }
- public static string PointToStr(PointF pt)
- {
- return string.Format("{0};{1}", pt.X, pt.Y);
- }
- public static Rectangle StrToRect(string str)
- {
- if (str.isEmpty() || str.Split(';').Length != 4) str = "0;0;0;0";
- var roibuf1 = str.Split(';');
- return new System.Drawing.Rectangle(
- int.Parse(roibuf1[0]),
- int.Parse(roibuf1[1]),
- int.Parse(roibuf1[2]),
- int.Parse(roibuf1[3]));
- }
- public static RectangleF StrToRectF(string str)
- {
- if (str.isEmpty() || str.Split(';').Length != 4) str = "0;0;0;0";
- var roibuf1 = str.Split(';');
- return new System.Drawing.RectangleF(
- float.Parse(roibuf1[0]),
- float.Parse(roibuf1[1]),
- float.Parse(roibuf1[2]),
- float.Parse(roibuf1[3]));
- }
- public static System.Drawing.Point StrToPoint(string str)
- {
- if (str.isEmpty() || str.Split(';').Length != 2) str = "0;0";
- var roibuf1 = str.Split(';');
- return new System.Drawing.Point(
- int.Parse(roibuf1[0]),
- int.Parse(roibuf1[1]));
- }
- public static PointF StrToPointF(string str)
- {
- if (str.isEmpty() || str.Split(';').Length != 2) str = "0;0";
- var roibuf1 = str.Split(';');
- return new System.Drawing.PointF(
- float.Parse(roibuf1[0]),
- float.Parse(roibuf1[1]));
- }
- #endregion
-
- #region "NIC"
-
- ///
- /// 지정된 nic카드가 현재 목록에 존재하는지 확인한다.
- ///
- ///
- public static Boolean ExistNIC(string NICName)
- {
- if (string.IsNullOrEmpty(NICName)) return false;
- foreach (string NetName in NICCardList())
- {
- if (NetName.ToLower() == NICName.ToLower())
- {
- return true;
- }
- }
- return false;
- }
-
- ///
- /// Ehternet Card 를 사용안함으로 설정합니다.(관리자권한필요)
- ///
- ///
- public static Boolean NICDisable(string NICName)
- {
- //해당 nic 가 현재 목록에 존재하는지 확인한다.
-
- string cmd = "interface set interface " + NICName + " disable";
- Process prc = new Process();
- ProcessStartInfo si = new ProcessStartInfo("netsh", cmd);
- si.WindowStyle = ProcessWindowStyle.Hidden;
- prc.StartInfo = si;
- prc.Start();
-
- ////목록에서 사라질때까지 기다린다.
- DateTime SD = DateTime.Now;
- Boolean timeout = false;
- while ((true))
- {
-
- bool FindNetwork = false;
- foreach (string NetName in NICCardList())
- {
- if (NetName == NICName.ToLower())
- {
- FindNetwork = true;
- break; // TODO: might not be correct. Was : Exit For
- }
- }
-
- if (!FindNetwork)
- break; // TODO: might not be correct. Was : Exit While
-
- System.Threading.Thread.Sleep(1000);
- TimeSpan ts = DateTime.Now - SD;
- if (ts.TotalSeconds > 10)
- {
- timeout = true;
- break; // TODO: might not be correct. Was : Exit While
- }
- }
- return !timeout;
- }
-
- public static List NICCardList()
- {
- List Retval = new List();
- foreach (System.Net.NetworkInformation.NetworkInterface Net in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
- {
- if (Net.NetworkInterfaceType == System.Net.NetworkInformation.NetworkInterfaceType.Ethernet)
- {
- Retval.Add(Net.Name.ToUpper());
- }
- }
- return Retval;
- }
-
- ///
- /// 이더넷카드를 사용함으로 설정합니다.
- ///
- ///
- public static Boolean NICEnable(string NICName)
- {
- string cmd = "interface set interface " + NICName + " enable";
- System.Diagnostics.Process prc = new System.Diagnostics.Process();
- System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo("netsh", cmd);
- si.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
- prc.StartInfo = si;
- prc.Start();
-
-
- ////목록에생길떄까지 대기
- DateTime SD = DateTime.Now;
- while ((true))
- {
-
- bool FindNetwork = false;
- foreach (string NetName in NICCardList())
- {
- if (NetName.ToLower() == NICName.ToLower())
- {
- FindNetwork = true;
- break; // TODO: might not be correct. Was : Exit For
- }
- }
-
- if (FindNetwork)
- break; // TODO: might not be correct. Was : Exit While
-
- System.Threading.Thread.Sleep(1000);
- TimeSpan ts = DateTime.Now - SD;
- if (ts.TotalSeconds > 10)
- {
- return false;
- }
- }
-
- ////결이 완료될떄까지 기다린다.
- SD = DateTime.Now;
- while ((true))
- {
-
- bool FindNetwork = false;
- foreach (System.Net.NetworkInformation.NetworkInterface Net in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
- {
- if (Net.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.GigabitEthernet &&
- Net.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.Ethernet) continue;
- if (Net.Name.ToLower() == NICName.ToLower())
- {
- //string data = Net.GetIPProperties().GatewayAddresses[0].ToString();
-
- if (Net.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up)
- {
-
- FindNetwork = true;
- break; // TODO: might not be correct. Was : Exit For
- }
- }
- }
- if (FindNetwork)
- return true;
-
- System.Threading.Thread.Sleep(1000);
- TimeSpan ts = DateTime.Now - SD;
- if (ts.TotalSeconds > 10)
- {
- return false;
- }
- }
-
- }
-
- #endregion
-
- public static void RunExplorer(string arg)
- {
- System.Diagnostics.ProcessStartInfo si = new ProcessStartInfo("explorer");
- si.Arguments = arg;
- System.Diagnostics.Process.Start(si);
- }
-
- #region "watchdog"
- public static void WatchDog_Run()
- {
- System.IO.FileInfo fi = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "WatchCat.exe");
- if (!fi.Exists) return;
- var Exist = CheckExistProcess("watchcat");
- if (Exist) return;
- RunProcess(fi.FullName);
- }
-
- public static Boolean CheckExistProcess(string ProcessName)
- {
- foreach (var prc in System.Diagnostics.Process.GetProcesses())
- {
- if (prc.ProcessName.StartsWith("svchost")) continue;
- if (prc.ProcessName.ToUpper() == ProcessName.ToUpper()) return true;
- }
- return false;
- }
- #endregion
-
- #region "web function"
- ///
- /// URL로부터 문자열을 수신합니다.
- ///
- ///
- ///
- ///
- public static string GetStrfromurl(string url, out Boolean isError)
- {
- isError = false;
- string result = "";
- try
- {
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url));
- request.Timeout = 60000;
- request.ReadWriteTimeout = 60000;
-
- request.MaximumAutomaticRedirections = 4;
- request.MaximumResponseHeadersLength = 4;
- request.Credentials = CredentialCache.DefaultCredentials;
- var response = request.GetResponse() as HttpWebResponse;
- var txtReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
- result = txtReader.ReadToEnd();
- }
- catch (Exception ex)
- {
- isError = true;
- result = ex.Message.ToString();
- }
- return result;
- }
-
- #endregion
-
- }
-}
diff --git a/Cs_HMI/Project/Util_FG.cs b/Cs_HMI/Project/Util_FG.cs
deleted file mode 100644
index aee2af5..0000000
--- a/Cs_HMI/Project/Util_FG.cs
+++ /dev/null
@@ -1,273 +0,0 @@
-///*
-// * Created by SharpDevelop.
-// * User: amkor
-// * Date: 5/16/2018
-// * Time: 3:08 PM
-// *
-// * To change this template use Tools | Options | Coding | Edit Standard Headers.
-// */
-//using System;
-
-//namespace Project
-//{
-// public static class Util_DO
-// {
-// ///
-// /// ADLink I/O Board input status
-// ///
-// ///
-// ///
-// public static Boolean GetIOInput(eDIName pin)
-// {
-// var curValue = Pub.dio.INPUT(GetDINum(pin) - 1);
-// if (pin == eDIName.EMERGENCY ||
-// pin == eDIName.PCB_PUSHER_END ||
-// pin == eDIName.PCB_PUSHER_HOME ||
-// pin == eDIName.PCB_IN_MGZ ||
-// pin == eDIName.PCB_OVERLOAD ||
-// pin == eDIName.PCB_PUSHER_OVR)
-// {
-// return !curValue;
-// }
-// else return curValue;
-// }
-
-// ///
-// /// ADLink I/O Board Output Status
-// ///
-// ///
-// ///
-// public static Boolean GetIOOutput(eDOName pin)
-// {
-// return Pub.dio.OUTPUT(GetDONum(pin) - 1);
-// }
-
-// ///
-// /// A/D Link Digital input Pin number
-// ///
-// ///
-// ///
-// public static int GetDINum(eDIName pin)
-// {
-// return (int)pin + 1;
-// //return Pub.setting.DI[(byte)pin];
-// }
-
-// ///
-// /// adlink digital output in number
-// ///
-// ///
-// ///
-// public static int GetDONum(eDOName pin)
-// {
-// return (int)pin + 1;
-// //return Pub.setting.DO[(byte)pin];
-
-// }
-
-// ///
-// /// 도어각 닫혀있는 경우 TRUE,
-// ///
-// ///
-// public static Boolean CheckDoorSafty()
-// {
-// var door1 = CheckDoorSafty_Front();
-// var door2 = CheckDoorSafty_Rear();
-// var door3 = CheckDoorSafty_Left();
-// var door4 = CheckDoorSafty_Right();
-// if (door1 && door2 && door3 && door4) return true;
-// else return false;
-// }
-// public static Boolean CheckDoorSafty_Front()
-// {
-// var door = GetIOInput(eDIName.DOOR_FRONT) || Pub.setting.DisableDoorFront;
-// return door;
-// }
-// public static Boolean CheckDoorSafty_Rear()
-// {
-// var door = GetIOInput(eDIName.DOOR_REAR) || Pub.setting.DisableDoorRear;
-// return door;
-// }
-// public static Boolean CheckDoorSafty_Left()
-// {
-// var door = GetIOInput(eDIName.DOOR_LEFT) || Pub.setting.DisableDoorLeft;
-// return door;
-// }
-// public static Boolean CheckDoorSafty_Right()
-// {
-// var door = GetIOInput(eDIName.DOOR_RIGHT) || Pub.setting.DisableDoorRight;
-// return door;
-// }
-
-// public static Boolean checkMGZReady()
-// {
-// var ready1 = GetIOInput(eDIName.MGZ_CLAMP_RDY1);
-// var ready2 = GetIOInput(eDIName.MGZ_CLAMP_RDY2);
-// return ready1 && ready2;
-// }
-
-// public static Boolean SetAIR(Boolean ON)
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return false;
-// return Pub.dio.SetOutput(GetDONum(eDOName.MAIN_AIR) - 1, ON);
-
-// }
-// //public static Boolean SetEMGLamp(Boolean ON)
-// //{
-// // if (Pub.dio == null || !Pub.dio.initOK) return false;
-// // return Pub.dio.SetOutput(GetDONum(eDOName.em) - 1, ON);
-// //}
-// public static Boolean SetPusher(eMotDir Direction)
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return false;
-// if (Direction == eMotDir.CW)
-// {
-// if(Util_DO.GetIOInput( eDIName.MGZ_CLAMP_RDY1)==false &&
-// Util_DO.GetIOInput(eDIName.MGZ_CLAMP_RDY2)==false)
-// {
-// Pub.log.AddE("매거진이 없어서 푸셔 작동이 불가 합니다");
-// return false;
-// }
-// Pub.dio.SetOutput(GetDONum(eDOName.PCB_PUSHER_DIR) - 1, true);
-// return Pub.dio.SetOutput(GetDONum(eDOName.PCB_PUSHER_RUN) - 1, true);
-// }
-// else if (Direction == eMotDir.CCW)
-// {
-// Pub.dio.SetOutput(GetDONum(eDOName.PCB_PUSHER_DIR) - 1, false);
-// return Pub.dio.SetOutput(GetDONum(eDOName.PCB_PUSHER_RUN) - 1, true);
-// }
-// else
-// {
-// return Pub.dio.SetOutput(GetDONum(eDOName.PCB_PUSHER_RUN) - 1, false);
-// }
-// }
-
-// public static Boolean SetMGZMotor(Boolean run)
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return false;
-// if (run)
-// {
-// Pub.MGZRunTime = DateTime.Now;
-// Pub.log.Add("MGZ In Run : " + Pub.MGZRunTime.ToString());
-// return Pub.dio.SetOutput((int)eDOName.MGZ_IN, true);
-// }
-// else
-// {
-// return Pub.dio.SetOutput((int)eDOName.MGZ_IN, false);
-// }
-// }
-
-// #region "Tower Lamp"
-
-// ///
-// /// 타워램프버튼 작업
-// ///
-// ///
-// ///
-// ///
-// public static void SetTWLamp(Boolean r, Boolean g, Boolean y)
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return;
-// if (Util_DO.GetIOOutput(eDOName.TWR_GRN) != g) Pub.dio.SetOutput(GetDONum(eDOName.TWR_GRN) - 1, g);
-// if (Util_DO.GetIOOutput(eDOName.TWR_RED) != r) Pub.dio.SetOutput(GetDONum(eDOName.TWR_RED) - 1, r);
-// if (Util_DO.GetIOOutput(eDOName.TWR_YEL) != y) Pub.dio.SetOutput(GetDONum(eDOName.TWR_YEL) - 1, y);
-
-// if (Util_DO.GetIOOutput(eDOName.LED_START) != g) Pub.dio.SetOutput(GetDONum(eDOName.LED_START) - 1, g);
-// if (Util_DO.GetIOOutput(eDOName.LED_STOP) != r) Pub.dio.SetOutput(GetDONum(eDOName.LED_STOP) - 1, r);
-// if (Util_DO.GetIOOutput(eDOName.LED_RESET) != y) Pub.dio.SetOutput(GetDONum(eDOName.LED_RESET) - 1, y);
-// }
-
-// public static Boolean SetTwRed(Boolean ON)
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return false;
-// Pub.dio.SetOutput(GetDONum(eDOName.LED_STOP) - 1, ON);
-// return Pub.dio.SetOutput(GetDONum(eDOName.TWR_RED) - 1, ON);
-// }
-// public static Boolean SetTwYel(Boolean ON)
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return false;
-// Pub.dio.SetOutput(GetDONum(eDOName.LED_RESET) - 1, ON);
-// return Pub.dio.SetOutput(GetDONum(eDOName.TWR_YEL) - 1, ON);
-// }
-// public static Boolean SetTwGrn(Boolean ON)
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return false;
-// Pub.dio.SetOutput(GetDONum(eDOName.LED_START) - 1, ON);
-// return Pub.dio.SetOutput(GetDONum(eDOName.TWR_GRN) - 1, ON);
-// }
-
-// #endregion
-
-// public static void ToggleRoomLight()
-// {
-// var current = Util_DO.GetIOOutput(eDOName.ROOM_LIGHT);
-// Pub.dio.SetOutput((int)eDOName.ROOM_LIGHT, !current);
-// }
-
-
-// public static Boolean SetBrake(Boolean ON)
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return false;
-// return Pub.dio.SetOutput(GetDONum(eDOName.BRAKE_OFF) - 1, !ON);
-// }
-
-// public static Boolean SetBuzzer(Boolean ON)
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return false;
-// if (ON)
-// {
-// Pub.BuzzerTime = DateTime.Now;
-// if (Pub.setting.EnableBuzzer == false) return true; //부저기능OFF시 사용 안함
-// }
-// if (ON && Pub.setting.EnableBuzzer==false)
-// {
-// Pub.log.AddAT("buzzer Disabled");
-// ON = false;
-// }
-// return Pub.dio.SetOutput(GetDONum(eDOName.BUZZER) - 1, ON);
-// }
-// public static Boolean getBrakeOn()
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return false;
-// return !GetIOOutput(eDOName.BRAKE_OFF);
-// }
-
-// public static Boolean setGripper(Boolean close)
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return false;
-// var rlt = Pub.dio.SetOutput(GetDONum(eDOName.PCB_GRIPPER_CLOSE) - 1, close);
-// if (!rlt) Pub.log.AddE("Grip Set Error vlaue=" + close.ToString());
-// else
-// {
-// System.Threading.Thread.Sleep(Pub.setting.GripperOnOffDelay);
-// //Pub.log.Add("DELAY:GRIP:" + Pub.setting.GripperOnOffDelay);
-// }
-// return rlt;
-// }
-// public static Boolean setMGZClamp(Boolean close)
-// {
-// if (Pub.dio == null || !Pub.dio.IsInit) return false;
-// bool rlt1, rlt2;
-// if (close)
-// {
-// rlt1 = Pub.dio.SetOutput((int)eDOName.MGZ_CLAMP_OPEN, false);
-// rlt2 = Pub.dio.SetOutput((int)eDOName.MGZ_CLAMP_CLOSE, true);
-// }
-// else
-// {
-// rlt2 = Pub.dio.SetOutput((int)eDOName.MGZ_CLAMP_CLOSE, false);
-// rlt1 = Pub.dio.SetOutput((int)eDOName.MGZ_CLAMP_OPEN, true);
-// }
-
-// Pub.log.AddAT("gripper set close = " + close.ToString());
-
-// if (rlt1 == false || rlt2 == false) Pub.log.AddE("Grip Set Error vlaue=" + close.ToString());
-// else
-// {
-// System.Threading.Thread.Sleep(Pub.setting.GripperOnOffDelay);
-// // Pub.log.Add("DELAY:GRIP:" + Pub.setting.GripperOnOffDelay);
-// }
-// return rlt1 && rlt2;
-// }
-// }
-//}
diff --git a/Cs_HMI/Project/ViewForm/fAuto.cs b/Cs_HMI/Project/ViewForm/fAuto.cs
index a3bfed7..73a325b 100644
--- a/Cs_HMI/Project/ViewForm/fAuto.cs
+++ b/Cs_HMI/Project/ViewForm/fAuto.cs
@@ -10,12 +10,13 @@ using System.Windows.Forms;
using Project.StateMachine;
using COMM;
using AR;
+using System.Security.Cryptography.X509Certificates;
namespace Project.ViewForm
{
public partial class fAuto : Form
{
- AGVControl.MapControl mapctl;
+
public fAuto()
{
InitializeComponent();
@@ -26,12 +27,12 @@ namespace Project.ViewForm
this.ctlAuto1.Scean = CtlAuto.eScean.Progress;
else
this.ctlAuto1.Scean = CtlAuto.eScean.Normal;
- this.mapctl = new AGVControl.MapControl();
- this.mapctl.Dock = DockStyle.Fill;
- this.mapctl.Visible = true;
- this.mapctl.Font = this.panel1.Font;
- this.mapctl.BackColor = Color.FromArgb(32, 32, 32);
- this.panel1.Controls.Add(mapctl);
+ PUB.mapctl = new AGVControl.MapControl();
+ PUB.mapctl.Dock = DockStyle.Fill;
+ PUB.mapctl.Visible = true;
+ PUB.mapctl.Font = this.panel1.Font;
+ PUB.mapctl.BackColor = Color.FromArgb(32, 32, 32);
+ this.panel1.Controls.Add(PUB.mapctl);
}
private void fAuto_Load(object sender, EventArgs e)
{
@@ -41,7 +42,8 @@ namespace Project.ViewForm
ctlAuto1.dev_xbe = PUB.XBE;
this.timer1.Start();
PUB.AGV.DataReceive += AGV_DataReceive;
-
+
+
//auto load
var path = new System.IO.DirectoryInfo("route");
if (path.Exists == false) path.Create();
@@ -61,7 +63,8 @@ namespace Project.ViewForm
if (fi.Exists)
{
PUB.log.Add($"autoload : {fi.FullName}");
- this.mapctl.LoadFromFile(fi.FullName);
+ var errmsg = PUB.mapctl.LoadFromFile(fi.FullName);
+ if (errmsg.isEmpty() == false) AR.UTIL.MsgE(errmsg);
}
}
}
@@ -72,7 +75,8 @@ namespace Project.ViewForm
{
case arDev.Narumi.DataType.TAG:
var tagno = PUB.AGV.data.TagNo;
- this.mapctl.AGVMoveToRFID(tagno.ToString());
+ PUB.log.Add($"[auto] recv tag : {tagno}");
+ PUB.mapctl.SetCurrentPosition(tagno);
break;
}
}
diff --git a/Cs_HMI/Project/ViewForm/fManual.cs b/Cs_HMI/Project/ViewForm/fManual.cs
index 7f9d0d5..1c21c44 100644
--- a/Cs_HMI/Project/ViewForm/fManual.cs
+++ b/Cs_HMI/Project/ViewForm/fManual.cs
@@ -69,12 +69,12 @@ namespace Project.ViewForm
//후진
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
{
- Util.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
+ UTIL.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
return;
}
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
{
- Util.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
+ UTIL.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
return;
}
if (PUB.CheckManualChargeMode() == false) return;
@@ -92,12 +92,12 @@ namespace Project.ViewForm
//전진
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
{
- Util.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
+ UTIL.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
return;
}
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
{
- Util.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
+ UTIL.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
return;
}
if (PUB.CheckManualChargeMode() == false) return;
@@ -115,12 +115,12 @@ namespace Project.ViewForm
//우회전
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
{
- Util.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
+ UTIL.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
return;
}
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
{
- Util.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
+ UTIL.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
return;
}
if (PUB.CheckManualChargeMode() == false) return;
@@ -138,12 +138,12 @@ namespace Project.ViewForm
//좌회전
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
{
- Util.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
+ UTIL.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
return;
}
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
{
- Util.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
+ UTIL.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
return;
}
if (PUB.CheckManualChargeMode() == false) return;
@@ -160,19 +160,19 @@ namespace Project.ViewForm
{
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
{
- Util.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
+ UTIL.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
return;
}
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
{
- Util.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
+ UTIL.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
return;
}
if (PUB.CheckManualChargeMode() == false) return;
PUB.sm.SetNewStep(StateMachine.eSMStep.IDLE);
if (PUB.AGV.system1.agv_run == false && PUB.AGV.system1.agv_run_manual == false)
{
- var dlg = Util.MsgQ("자동 진행을 시작할까요?\n우측 옵션을 확인 하세요");
+ var dlg = UTIL.MsgQ("자동 진행을 시작할까요?\n우측 옵션을 확인 하세요");
if (dlg != DialogResult.Yes) return;
var opt = makeopt();
PUB.AGV.AGVMoveSet(opt);
@@ -301,7 +301,7 @@ namespace Project.ViewForm
private void btchargeOff_Click(object sender, EventArgs e)
{
- if (Util.MsgQ("충전 해제 명령을 전송 할까요?") == DialogResult.Yes)
+ if (UTIL.MsgQ("충전 해제 명령을 전송 할까요?") == DialogResult.Yes)
PUB.AGV.AGVCharge(PUB.setting.ChargerID, false);
}
@@ -309,10 +309,10 @@ namespace Project.ViewForm
{
if (PUB.AGV.signal.mark_sensor == false)
{
- Util.MsgE("마크센서가 확인되지 않아 충전을 시작할 수 없습니다");
+ UTIL.MsgE("마크센서가 확인되지 않아 충전을 시작할 수 없습니다");
return;
}
- var dlg = Util.MsgQ("충전 시작 명령을 전송 할까요?");
+ var dlg = UTIL.MsgQ("충전 시작 명령을 전송 할까요?");
if (dlg != DialogResult.Yes) return;
PUB.AGV.AGVCharge(PUB.setting.ChargerID, true);
}
diff --git a/Cs_HMI/Project/fMain.cs b/Cs_HMI/Project/fMain.cs
index 5658023..4145aa1 100644
--- a/Cs_HMI/Project/fMain.cs
+++ b/Cs_HMI/Project/fMain.cs
@@ -11,6 +11,7 @@ using COMM;
using System.CodeDom;
using AR;
using Project.StateMachine;
+using System.Security.Cryptography.X509Certificates;
namespace Project
{
@@ -112,14 +113,14 @@ namespace Project
_STEP_CLOSING_START(PUB.sm.Step);
PUB.sm.Stop();
- var patchfile = new System.IO.FileInfo(System.IO.Path.Combine(Util.CurrentPath, "SWPatch.exe"));
+ var patchfile = new System.IO.FileInfo(System.IO.Path.Combine(UTIL.CurrentPath, "SWPatch.exe"));
if (patchfile.Exists == false)
{
- Util.MsgE("패치파일(" + patchfile.Name + ")이 없습니다.\n프로그램을 다시 실행해주세요", true);
+ UTIL.MsgE("패치파일(" + patchfile.Name + ")이 없습니다.\n프로그램을 다시 실행해주세요", true);
}
else
{
- Util.RunProcess(patchfile.FullName);
+ UTIL.RunProcess(patchfile.FullName);
}
}
else if (forceClose == true)
@@ -130,19 +131,19 @@ namespace Project
_STEP_CLOSING_START(PUB.sm.Step);
PUB.sm.Stop();
-
+
}
else
{
if (PUB.sm.Step == eSMStep.RUN)
{
- Util.MsgE("동작 중에는 종료 할 수 없습니다.");
+ UTIL.MsgE("동작 중에는 종료 할 수 없습니다.");
e.Cancel = true;
return;
}
if (PUB.sm.Step < eSMStep.CLOSING)
{
- var rlt = Util.MsgQ("종료하시겠습니까");
+ var rlt = UTIL.MsgQ("종료하시겠습니까");
if (rlt == System.Windows.Forms.DialogResult.Yes)
{
//비젼의 측정상태가 변경된 경우
@@ -193,7 +194,9 @@ namespace Project
//지그비통신
PUB.XBE = new Device.Xbee();
- //PUB.XBE.Message += Xbee_Message;
+ PUB.XBE.MessageReceived += XBE_MessageReceived;
+ PUB.XBE.ProtocReceived += XBE_ProtocReceived;
+
//HWState.setTitle(1, 3, Pub.setting.Port_Xbee);
//HWState.setTitle(1, 0, Pub.setting.Address_RFID);
@@ -253,6 +256,7 @@ namespace Project
}
+
private void Counter_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
@@ -293,17 +297,17 @@ namespace Project
#endregion
-
+
private void CtlPos1_ItemClick(object sender, CtlPos.ItemClickEventArgs e)
{
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM] == true)
{
- Util.MsgE("수동 충전 상태이므로 진행 할 수 없습니다");
+ UTIL.MsgE("수동 충전 상태이므로 진행 할 수 없습니다");
return;
}
- if (VAR.BOOL[eVarBool.EMERGENCY]==true)
+ if (VAR.BOOL[eVarBool.EMERGENCY] == true)
{
- var dlgE = Util.MsgQ("비상정지 상태입니다.\n오류를 먼저 소거하고 실행 할까요?");
+ var dlgE = UTIL.MsgQ("비상정지 상태입니다.\n오류를 먼저 소거하고 실행 할까요?");
if (dlgE == DialogResult.Yes) PUB.AGV.AGVErrorReset();
else return;
}
@@ -511,7 +515,7 @@ namespace Project
PUB.AGV.AGVErrorReset();
if (Prompt)
{
- if (Util.MsgQ("AGV상태를 자동으로 전환 할까요?") != DialogResult.Yes) return;
+ if (UTIL.MsgQ("AGV상태를 자동으로 전환 할까요?") != DialogResult.Yes) return;
}
//충전상태확인
if (PUB.CheckManualChargeMode() == false) return;
@@ -656,15 +660,15 @@ namespace Project
private void arLabel3_Click(object sender, EventArgs e)
{
- string file = System.IO.Path.Combine(Util.CurrentPath, "manual.pdf");
+ string file = System.IO.Path.Combine(UTIL.CurrentPath, "manual.pdf");
if (System.IO.File.Exists(file) == false)
{
- Util.MsgE("사용설명서 파일이 존재하지 않습니다\n" +
+ UTIL.MsgE("사용설명서 파일이 존재하지 않습니다\n" +
"문의 : T8567 (장비기술 1파트)\n" +
"파일명 : " + file);
return;
}
- Util.RunExplorer(file);
+ UTIL.RunExplorer(file);
}
private void btClose_Click(object sender, EventArgs e)
@@ -680,7 +684,7 @@ namespace Project
private void arLabel5_Click(object sender, EventArgs e)
{
//SetScreen(form_setup);
-
+
var popmsg = PUB.popup.Visible;
PUB.popup.Visible = false;
@@ -688,7 +692,7 @@ namespace Project
using (var f = new fSetup())
if (f.ShowDialog() == DialogResult.OK)
{
-
+
//AGV정보 싱크
PUB.sm.ResetRunStepSeq();
@@ -705,7 +709,7 @@ namespace Project
//if (Pub.sm.Step != eSMStep.IDLE)
//{
- var dlg = Util.MsgQ(
+ var dlg = UTIL.MsgQ(
"프로그램 상태를 초기화 하시겠습니까?\n" +
"진행 중인 사항은 모두 취소 됩니다");
if (dlg != System.Windows.Forms.DialogResult.Yes) return;
@@ -725,12 +729,12 @@ namespace Project
private void btCapture_Click(object sender, EventArgs e)
{
- Util.ScreenCaptrue(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height, new Point(0, 0));
+ UTIL.ScreenCapture(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height, new Point(0, 0));
}
private void btOpenDir_Click(object sender, EventArgs e)
{
- Util.RunExplorer(Util.CurrentPath);
+ UTIL.RunExplorer(UTIL.CurrentPath);
}
private void button4_Click(object sender, EventArgs e)
@@ -792,14 +796,14 @@ namespace Project
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
{
- Util.MsgE("수동 충전 상태이므로 진행 할 수 없습니다");
+ UTIL.MsgE("수동 충전 상태이므로 진행 할 수 없습니다");
return;
}
//충전을 시작해라ㅏ
if (bCharge == true)
{
- var dlg = Util.MsgQ("충전을 중지할까요?");
+ var dlg = UTIL.MsgQ("충전을 중지할까요?");
if (dlg == DialogResult.Yes)
{
PUB.sm.ClearRunStep();
@@ -810,7 +814,7 @@ namespace Project
}
else
{
- var dlg = Util.MsgQ("충전을 시작할까요?");
+ var dlg = UTIL.MsgQ("충전을 시작할까요?");
if (dlg == DialogResult.Yes)
{
PUB.sm.ClearRunStep();
@@ -850,7 +854,7 @@ namespace Project
if (bCharge == true)
{
- var dlg = Util.MsgQ("홈(QC) 이동을 취소 할까요?");
+ var dlg = UTIL.MsgQ("홈(QC) 이동을 취소 할까요?");
if (dlg == DialogResult.Yes)
{
PUB.sm.ClearRunStep();
@@ -862,7 +866,7 @@ namespace Project
}
else
{
- var dlg = Util.MsgQ("홈(QC) 이동을 실행 할까요?");
+ var dlg = UTIL.MsgQ("홈(QC) 이동을 실행 할까요?");
if (dlg == DialogResult.Yes)
{
PUB.sm.ClearRunStep();
@@ -949,7 +953,7 @@ namespace Project
{
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
{
- var dlg = Util.MsgQ("수동 충전을 해제 할까요?");
+ var dlg = UTIL.MsgQ("수동 충전을 해제 할까요?");
if (dlg != DialogResult.Yes) return;
VAR.BOOL[eVarBool.FLAG_CHARGEONM] = false;
PUB.log.Add("수동 충전 실행");
@@ -958,10 +962,10 @@ namespace Project
{
if (PUB.AGV.system1.Battery_charging)
{
- Util.MsgE("현재 자동 충전 중이라 진행 할 수 없습니다");
+ UTIL.MsgE("현재 자동 충전 중이라 진행 할 수 없습니다");
return;
}
- var dlg = Util.MsgQ("수동 충전을 진행 할까요?");
+ var dlg = UTIL.MsgQ("수동 충전을 진행 할까요?");
if (dlg != DialogResult.Yes) return;
VAR.BOOL[eVarBool.FLAG_CHARGEONM] = true;
PUB.log.Add("수동 충전 실행");
diff --git a/Cs_HMI/Project/fSetup.cs b/Cs_HMI/Project/fSetup.cs
index b89780d..f3b0958 100644
--- a/Cs_HMI/Project/fSetup.cs
+++ b/Cs_HMI/Project/fSetup.cs
@@ -211,7 +211,7 @@ namespace Project
{
if (PUB.CheckPassword() == false)
{
- Util.MsgE("암호가 일치하지 않습니다");
+ UTIL.MsgE("암호가 일치하지 않습니다");
return;
}
@@ -469,7 +469,7 @@ namespace Project
" * [충전] 탭에서 설정값을 확인할 수 있습니다";
else if (tagStr == "2") msg += "[배경음악]\n" +
" * 이동시 음악을 플레이 합니다";
- var dlg = Util.MsgQ(msg);
+ var dlg = UTIL.MsgQ(msg);
if (dlg == DialogResult.Yes)
{
SetColorValue(button, true);
@@ -483,7 +483,7 @@ namespace Project
//포트를 선택한 후 표시해준다.
var but = sender as Button;
var tagStr = but.Tag.ToString();
- var newPort = Util.SelectSerialPort();
+ var newPort = PUB.SelectSerialPort();
if (newPort.isEmpty()) return;
if (tagStr == "XBE") tbPortXBE.Text = newPort;
@@ -523,7 +523,7 @@ namespace Project
{
if (System.IO.File.Exists(tbMusic.Text) == false)
{
- Util.MsgE("파일이 없습니다");
+ UTIL.MsgE("파일이 없습니다");
return;
}
try
@@ -535,7 +535,7 @@ namespace Project
}
catch (Exception ex)
{
- Util.MsgE("music open error\n\n" + ex.Message);
+ UTIL.MsgE("music open error\n\n" + ex.Message);
}
}
diff --git a/Cs_HMI/Project/sample.route b/Cs_HMI/Project/sample.route
index 113664f..46d1fba 100644
--- a/Cs_HMI/Project/sample.route
+++ b/Cs_HMI/Project/sample.route
@@ -1,83 +1,109 @@
[RFID_POINTS]
-100,486,T0002
-164,494,T0003
-229,493,T0004
-309,489,T0005
-370,490,T0006
-437,486,T0007
-483,459,T0008
-511,421,T0009
-543,371,T0010
-569,329,T0011
-608,289,T0012
-661,279,T0013
-700,297,T0014
-698,349,T0015
-698,391,T0016
-699,449,T0017
-691,491,T0018
-569,275,T0019
-518,264,T0020
-454,264,T0021
-388,261,T0022
-314,258,T0023
-639,234,T0024
-621,182,T0025
-629,143,T0026
-657,101,T0027
-627,82,T0028
-560,73,T0029
-499,65,T0030
-432,65,T0031
-264,232,T0032
-363,60,T0033
-654,508,T0034
-96,542,T0050
-159,542,T0051
-226,542,T0061
-309,541,T0070
-369,542,T0071
-483,165,T0010
-735,163,T0011
-523,170,T0001
-565,175,T0002
-597,182,T0003
-665,181,T0004
-700,176,T0005
-721,170,T0006
-[MAGNET_LINES]
-99,485,220,492
-220,492,375,488
-375,488,457,479
-457,479,512,432
-512,432,552,353
-552,353,602,291
-602,291,651,278
-651,278,700,289
-700,289,704,380
-704,380,700,469
-700,469,688,488
-666,277,637,229
-637,229,625,170
-625,170,654,94
-654,94,624,78
-624,78,484,63
-484,63,365,64
-608,287,523,267
-523,267,409,260
-409,260,275,258
-99,486,95,542
-161,495,161,543
-230,496,228,537
-228,537,228,544
-306,488,306,543
-373,489,371,544
-655,508,691,486
-481,164,624,183
-624,183,706,181
-706,181,743,161
+100,486,0002
+164,494,0003
+229,493,0004
+309,489,0005
+370,490,0006
+437,486,0007
+483,459,0008
+511,421,0009
+543,371,0010
+569,329,0011
+608,289,0012
+661,279,0013
+700,297,0014
+698,349,0015
+698,391,0016
+699,449,0017
+691,491,0018
+569,275,0019
+518,264,0020
+454,264,0021
+388,261,0022
+314,258,0023
+639,234,0024
+621,182,0025
+629,143,0026
+657,101,0027
+627,82,0028
+560,73,0029
+499,65,0030
+432,65,0031
+264,232,0032
+363,60,0033
+654,508,0034
+96,542,0050
+159,542,0051
+226,542,0061
+309,541,0070
+369,542,0071
+483,165,0010
+735,163,0011
+523,170,0001
+565,175,0002
+597,182,0003
+665,181,0004
+700,176,0005
+721,170,0006
+
+[RFID_LINES]
+96,542,100,486,0005,0002,False,56.14267
+100,486,164,494,0002,0003,False,64.49806
+164,494,229,493,0003,0004,False,65.00769
+229,493,309,489,0004,0005,False,80.09994
+309,489,370,490,0005,0006,False,61.0082
+370,490,437,486,0006,0007,False,67.11929
+437,486,483,459,0007,0008,False,53.33854
+483,459,511,421,0008,0009,False,47.20169
+511,421,543,371,0009,0010,False,59.36329
+543,371,569,329,0010,0011,False,49.39635
+569,329,608,289,0011,0012,False,55.86591
+608,289,661,279,0012,0013,False,53.93515
+661,279,700,297,0013,0014,False,42.95346
+700,297,698,349,0014,0015,False,52.03845
+698,349,698,391,0015,0016,False,42
+698,391,699,449,0016,0017,False,58.00862
+699,449,691,491,0017,0018,False,42.75512
+691,491,654,508,0018,0034,False,40.71855
+159,542,164,494,0006,0003,False,48.25971
+226,542,229,493,0007,0004,False,49.09175
+309,541,309,489,0008,0005,False,52
+369,542,370,490,0009,0006,False,52.00961
+370,490,370,490,0006,0006,False,0
+608,289,569,275,0012,0019,False,41.4367
+569,275,518,264,0019,0020,False,52.17279
+518,264,454,264,0020,0021,False,64
+454,264,388,261,0021,0022,False,66.06815
+388,261,314,258,0022,0023,False,74.06078
+661,279,639,234,0013,0024,False,50.08992
+639,234,621,182,0024,0025,False,55.02727
+621,182,629,143,0025,0026,False,39.81206
+629,143,657,101,0026,0027,False,50.47772
+657,101,627,82,0027,0028,False,35.51056
+627,82,560,73,0028,0029,False,67.60178
+560,73,499,65,0029,0030,False,61.52235
+483,165,523,170,0010,0001,False,40.31129
+523,170,565,175,0001,0002,False,42.29657
+565,175,597,182,0002,0003,False,32.75668
+597,182,621,182,0003,0025,False,24
+621,182,665,181,0025,0004,False,44.01136
+665,181,700,176,0004,0005,False,35.35534
+700,176,721,170,0005,0006,False,21.84033
+721,170,735,163,0006,0011,False,15.65248
+735,163,721,170,0011,0006,False,15.65248
+721,170,735,163,0006,0011,False,15.65248
+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]
-179,251,-1,-16777216,Arial,12,TOPS-2
+179,251,-1,-16777216,Arial,12,OPS-2
239,52,-256,-65408,Arial,12,SSOTRON-3
617,527,-16711936,-16777216,Arial,12,SSOTRON-1
87,551,-16777216,16777215,Arial,12,B1
@@ -88,57 +114,3 @@
453,128,-16777216,-8323073,Arial,12,CHG1
725,124,-16777216,-8323073,Arial,12,CHG2
[CUSTOM_LINES]
-[RFID_LINES]
-96,542,100,486,T0005,T0002,True,56.14267
-100,486,164,494,T0002,T0003,True,64.49806
-164,494,229,493,T0003,T0004,True,65.00769
-229,493,309,489,T0004,T0005,True,80.09994
-309,489,370,490,T0005,T0006,True,61.0082
-370,490,437,486,T0006,T0007,True,67.11929
-437,486,483,459,T0007,T0008,True,53.33854
-483,459,511,421,T0008,T0009,True,47.20169
-511,421,543,371,T0009,T0010,True,59.36329
-543,371,569,329,T0010,T0011,True,49.39635
-569,329,608,289,T0011,T0012,True,55.86591
-608,289,661,279,T0012,T0013,True,53.93515
-661,279,700,297,T0013,T0014,True,42.95346
-700,297,698,349,T0014,T0015,True,52.03845
-698,349,698,391,T0015,T0016,True,42
-698,391,699,449,T0016,T0017,True,58.00862
-699,449,691,491,T0017,T0018,True,42.75512
-691,491,654,508,T0018,T0034,True,40.71855
-159,542,164,494,T0006,T0003,True,48.25971
-226,542,229,493,T0007,T0004,True,49.09175
-309,541,309,489,T0008,T0005,True,52
-369,542,370,490,T0009,T0006,True,52.00961
-370,490,370,490,T0006,T0006,True,0
-608,289,569,275,T0012,T0019,True,41.4367
-569,275,518,264,T0019,T0020,True,52.17279
-518,264,454,264,T0020,T0021,True,64
-454,264,388,261,T0021,T0022,True,66.06815
-388,261,314,258,T0022,T0023,True,74.06078
-661,279,639,234,T0013,T0024,True,50.08992
-639,234,621,182,T0024,T0025,True,55.02727
-621,182,629,143,T0025,T0026,True,39.81206
-629,143,657,101,T0026,T0027,True,50.47772
-657,101,627,82,T0027,T0028,True,35.51056
-627,82,560,73,T0028,T0029,True,67.60178
-560,73,499,65,T0029,T0030,True,61.52235
-483,165,523,170,T0010,T0001,True,40.31129
-523,170,565,175,T0001,T0002,True,42.29657
-565,175,597,182,T0002,T0003,True,32.75668
-597,182,621,182,T0003,T0025,True,24
-621,182,665,181,T0025,T0004,True,44.01136
-665,181,700,176,T0004,T0005,True,35.35534
-700,176,721,170,T0005,T0006,True,21.84033
-721,170,735,163,T0006,T0011,True,15.65248
-735,163,721,170,T0011,T0006,True,15.65248
-721,170,735,163,T0006,T0011,True,15.65248
-314,258,388,261,T0023,T0022,True,74.06078
-388,261,454,264,T0022,T0021,True,66.06815
-454,264,518,264,T0021,T0020,True,64
-518,264,569,275,T0020,T0019,True,52.17279
-569,275,608,289,T0019,T0012,True,41.4367
-264,232,314,258,T0032,T0023,True,56.35601
-363,60,432,65,T0033,T0031,True,69.18092
-432,65,499,65,T0031,T0030,True,67
diff --git a/Cs_HMI/SubProject/AGV/Narumi.cs b/Cs_HMI/SubProject/AGV/Narumi.cs
index 5ed0bf9..fa3067c 100644
--- a/Cs_HMI/SubProject/AGV/Narumi.cs
+++ b/Cs_HMI/SubProject/AGV/Narumi.cs
@@ -388,7 +388,7 @@ namespace arDev
{
//221123 chi 숫자로변경
var tagnostr = rcvdNow.Substring(3);
- if (int.TryParse(tagnostr, out int tagnoint))
+ if (uint.TryParse(tagnostr, out uint tagnoint))
{
var Changed = !old_TagString.Equals(tagnostr);
data.TagString = tagnostr;
diff --git a/Cs_HMI/SubProject/AGV/Structure/AgvData.cs b/Cs_HMI/SubProject/AGV/Structure/AgvData.cs
index 8faa844..e0e3f9e 100644
--- a/Cs_HMI/SubProject/AGV/Structure/AgvData.cs
+++ b/Cs_HMI/SubProject/AGV/Structure/AgvData.cs
@@ -15,7 +15,7 @@ namespace arDev
public string TagString { get; set; } = string.Empty;
- public int TagNo { get; set; } = -1;
+ public uint TagNo { get; set; } = 0;
public string CallString { get; set; } = string.Empty;
public int CallNo { get; set; } = -1;
public string CCAString { get; set; } = string.Empty;
diff --git a/Cs_HMI/SubProject/AGVControl/MapControl.cs b/Cs_HMI/SubProject/AGVControl/MapControl.cs
index 83c46e3..6ee69bd 100644
--- a/Cs_HMI/SubProject/AGVControl/MapControl.cs
+++ b/Cs_HMI/SubProject/AGVControl/MapControl.cs
@@ -5,6 +5,9 @@ using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.IO;
using System.Linq;
+using System.Net.NetworkInformation;
+using System.Security.Cryptography;
+using System.Security.Permissions;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using AGVControl.Models;
@@ -18,7 +21,7 @@ namespace AGVControl
private List mapTexts;
private List customLines;
private List rfidLines;
- private AGV agv;
+ public AGV agv;
private float zoom = 1.0f;
private PointF offset = PointF.Empty;
private Point lastMousePosition;
@@ -200,12 +203,12 @@ namespace AGVControl
);
}
- public RFIDPoint FindRFIDPoint(string rfidValue)
+ public RFIDPoint FindRFIDPoint(uint rfidValue)
{
- return rfidPoints.FirstOrDefault(r => r.RFIDValue.ToUpper() == rfidValue.ToUpper());
+ return rfidPoints.FirstOrDefault(r => r.RFIDValue == rfidValue);
}
- public bool AGVMoveToRFID(string rfidValue)
+ public bool SetCurrentPosition(uint rfidValue)
{
var rfidPoint = FindRFIDPoint(rfidValue);
if (rfidPoint != null)
@@ -538,7 +541,7 @@ namespace AGVControl
return neighbors.Distinct().ToList();
}
- public void SetPath(List rfids)
+ public void SetPath(List rfids)
{
if (rfids == null || rfids.Count == 0)
return;
@@ -563,6 +566,62 @@ namespace AGVControl
public string RFIDStartNo { get; set; } = string.Empty;
public int RFIDLastNumber = 0;
string filename = string.Empty;
+
+
+
+
+ public struct PathResult
+ {
+ public bool Success { get; set; }
+ public string Message { get; set; }
+ public List Path { get; set; }
+ }
+ public PathResult CalculatePath(uint tagStrt, uint tagEnd)
+ {
+ var retval = new PathResult
+ {
+ Message = string.Empty,
+ Success = false,
+ Path = new List(),
+ };
+
+ var sp = tagStrt; //만약시작위치가 없다면 항상 충전기 기준으로 한다
+ var ep = tagEnd;
+
+ var startPoint = FindRFIDPoint(sp);
+ var endPoint = FindRFIDPoint(ep);
+
+ if (startPoint == null || endPoint == null)
+ {
+ retval.Message = "유효한 RFID 값을 입력해주세요.";
+ return retval;
+ }
+
+ var path = CalculatePath(startPoint.Location, endPoint.Location);
+ if (path != null && path.Count > 0)
+ {
+ DrawPath(path);
+
+ // 경로 상의 모든 RFID 값을 가져옴
+ var rfidPath = new List();
+ foreach (var point in path)
+ {
+ var rfid = GetRFIDPoints()
+ .FirstOrDefault(r => r.Location == point);
+ if (rfid != null)
+ {
+ rfidPath.Add(rfid.RFIDValue);
+ }
+ }
+ retval.Success = true;
+ }
+ else
+ {
+ retval.Message = "경로를 찾을 수 없습니다";
+ }
+ return retval;
+ }
+
private void MapControl_MouseClick(object sender, MouseEventArgs e)
{
var mapPoint = ScreenToMap(e.Location);
@@ -596,45 +655,34 @@ namespace AGVControl
var startRFID = input1.Item2;
var endRFID = input2.Item2;
- var startPoint = FindRFIDPoint(startRFID);
- var endPoint = FindRFIDPoint(endRFID);
- if (startPoint == null || endPoint == null)
+ var valid1 = uint.TryParse(input1.Item2, out uint vstart);
+ var valid2 = uint.TryParse(input2.Item2, out uint vend);
+
+ if (valid1 == false || valid2 == false)
{
- MessageBox.Show("유효한 RFID 값을 입력해주세요.", "경로 계산", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ MessageBox.Show("RFID값은 정수로 입력하세요", "경로 계산", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
- var path = CalculatePath(startPoint.Location, endPoint.Location);
- if (path != null && path.Count > 0)
+ var rlt = CalculatePath(vstart, vend);
+
+ if (rlt.Success == false)
{
- DrawPath(path);
-
- // 경로 상의 모든 RFID 값을 가져옴
- var rfidPath = new List();
- foreach (var point in path)
- {
- var rfid = GetRFIDPoints()
- .FirstOrDefault(r => r.Location == point);
- if (rfid != null)
- {
- rfidPath.Add(rfid.RFIDValue);
- }
- }
-
- MessageBox.Show($"경로가 계산되었습니다.\nRFID 순서: {string.Join(" -> ", rfidPath)}",
- "경로 계산", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ MessageBox.Show(rlt.Message, "경로 계산", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
}
else
{
- MessageBox.Show("경로를 찾을 수 없습니다.", "경로 계산", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ MessageBox.Show($"경로가 계산되었습니다.\nRFID 순서: {string.Join(" -> ", rlt.Path)}",
+ "경로 계산", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
break;
case "pos":
var tag = AR.UTIL.InputBox("input rfid tag value");
- if (tag.Item1 && tag.Item2 != "")
+ if (tag.Item1 && tag.Item2 != "" && uint.TryParse(tag.Item2, out uint val) == true)
{
- var targetRFID = AGVMoveToRFID(tag.Item2);
+ var targetRFID = SetCurrentPosition(val);
}
break;
case "save":
@@ -693,27 +741,30 @@ namespace AGVControl
case eMouseMode.addrfidpoint:
if (string.IsNullOrEmpty(this.RFIDStartNo) == false)
{
-
- AddRFIDPoint(mapPoint, RFIDStartNo);
-
- // 숫자로 끝나는 RFID 값인 경우 자동 증가
- if (Regex.IsMatch(RFIDStartNo, @"^[A-Za-z]+\d+$"))
+ if (uint.TryParse(this.RFIDStartNo, out uint rfidvalue))
{
- // 마지막 숫자 부분 추출
- Match match = Regex.Match(RFIDStartNo, @"\d+$");
- if (match.Success)
- {
- int currentNumber = int.Parse(match.Value);
- if (currentNumber > this.RFIDLastNumber)
- {
- RFIDLastNumber = currentNumber;
- }
- RFIDLastNumber++;
+ AddRFIDPoint(mapPoint, rfidvalue);
- // 숫자 부분을 새로운 번호로 교체
- RFIDStartNo = RFIDStartNo.Substring(0, match.Index) + RFIDLastNumber.ToString("D4");
+ // 숫자로 끝나는 RFID 값인 경우 자동 증가
+ if (Regex.IsMatch(RFIDStartNo, @"^[A-Za-z]+\d+$"))
+ {
+ // 마지막 숫자 부분 추출
+ Match match = Regex.Match(RFIDStartNo, @"\d+$");
+ if (match.Success)
+ {
+ int currentNumber = int.Parse(match.Value);
+ if (currentNumber > this.RFIDLastNumber)
+ {
+ RFIDLastNumber = currentNumber;
+ }
+ RFIDLastNumber++;
+
+ // 숫자 부분을 새로운 번호로 교체
+ RFIDStartNo = RFIDStartNo.Substring(0, match.Index) + RFIDLastNumber.ToString("D4");
+ }
}
}
+
}
break;
case eMouseMode.addtext:
@@ -815,7 +866,7 @@ namespace AGVControl
nearbyPoints.Sort((a, b) => a.ProjectionRatio.CompareTo(b.ProjectionRatio));
// 이전 RFID 값과 위치를 저장
- string prevRFID = line.StartRFID;
+ uint prevRFID = line.StartRFID;
Point prevPoint = line.StartPoint;
// 정렬된 포인트들을 순차적으로 연결
@@ -1155,7 +1206,7 @@ namespace AGVControl
foreach (var rfid in rfidPoints)
{
var MarkerSize = 5;
- g.FillEllipse(Brushes.Green, rfid.Location.X - (MarkerSize/2f), rfid.Location.Y -(MarkerSize/2f), MarkerSize, MarkerSize);
+ g.FillEllipse(Brushes.Green, rfid.Location.X - (MarkerSize / 2f), rfid.Location.Y - (MarkerSize / 2f), MarkerSize, MarkerSize);
//g.DrawString(rfid.RFIDValue, Font, Brushes.WhiteSmoke, rfid.Location.X + 5, rfid.Location.Y - 5);
}
@@ -1163,15 +1214,13 @@ namespace AGVControl
foreach (var rfid in rfidPoints)
{
//g.FillEllipse(Brushes.Green, rfid.Location.X - 3, rfid.Location.Y - 3, 6, 6);
- var fsize = g.MeasureString(rfid.RFIDValue, Font);
- g.DrawString(rfid.RFIDValue, Font, Brushes.WhiteSmoke,
+ var tagstr = $"{rfid.RFIDValue}";
+ var fsize = g.MeasureString(tagstr, Font);
+ g.DrawString(tagstr, Font, Brushes.WhiteSmoke,
(rfid.Location.X - fsize.Width / 2f),
(rfid.Location.Y + 2));
}
- //var rfidpts = rfidPoints.Select(t => t.Location).ToArray();
- //g.DrawLines(new Pen(Color.FromArgb(100, Color.Magenta), 10), rfidpts);
-
}
private void DrawAGV(Graphics g)
@@ -1252,7 +1301,7 @@ namespace AGVControl
{
using (Pen linePen = new Pen(Color.FromArgb(50, Color.Wheat), 2))
{
- if (!line.IsBidirectional)
+ if (line.IsBidirectional)
{
// 단방향 화살표 그리기
var arrowSize = 10;
@@ -1345,7 +1394,7 @@ namespace AGVControl
this.Invalidate();
}
- public void AddRFIDLine(Point startPoint, Point endPoint, string startRFID, string endRFID, bool isBidirectional = true)
+ public void AddRFIDLine(Point startPoint, Point endPoint, uint startRFID, uint endRFID, bool isBidirectional = false)
{
// 시작점과 끝점 사이의 모든 RFID 포인트 찾기
var allPoints = new List<(RFIDPoint Point, float Distance)>();
@@ -1447,7 +1496,7 @@ namespace AGVControl
this.Invalidate();
}
- public void AddRFIDPoint(Point mapLocation, string rfidValue)
+ public void AddRFIDPoint(Point mapLocation, uint rfidValue)
{
// 이미 맵 좌표로 변환된 위치를 사용
var rfidPoint = new RFIDPoint
@@ -1490,19 +1539,12 @@ namespace AGVControl
lines.Add($"{point.Location.X},{point.Location.Y},{point.RFIDValue}");
}
- // 자석선 저장
- lines.Add("[MAGNET_LINES]");
- foreach (var line in magnetLines)
+ // RFID 라인 저장
+ lines.Add("[RFID_LINES]");
+ foreach (var line in rfidLines)
{
- var branchInfo = "";
- foreach (var branch in line.BranchPoints)
- {
- if (line.BranchDirections.ContainsKey(branch))
- {
- branchInfo += $"|{branch.X},{branch.Y},{(int)line.BranchDirections[branch]}";
- }
- }
- lines.Add($"{line.StartPoint.X},{line.StartPoint.Y},{line.EndPoint.X},{line.EndPoint.Y}{branchInfo}");
+ lines.Add($"{line.StartPoint.X},{line.StartPoint.Y},{line.EndPoint.X},{line.EndPoint.Y}," +
+ $"{line.StartRFID},{line.EndRFID},{line.IsBidirectional},{line.Distance}");
}
// 텍스트 저장
@@ -1519,24 +1561,19 @@ namespace AGVControl
lines.Add($"{line.StartPoint.X},{line.StartPoint.Y},{line.EndPoint.X},{line.EndPoint.Y},{line.LineColor.ToArgb()},{line.LineWidth}");
}
- // RFID 라인 저장
- lines.Add("[RFID_LINES]");
- foreach (var line in rfidLines)
- {
- lines.Add($"{line.StartPoint.X},{line.StartPoint.Y},{line.EndPoint.X},{line.EndPoint.Y}," +
- $"{line.StartRFID},{line.EndRFID},{line.IsBidirectional},{line.Distance}");
- }
File.WriteAllLines(filename, lines);
}
- public void LoadFromFile(string filename)
+ public string LoadFromFile(string filename)
{
ClearMap();
var lines = File.ReadAllLines(filename);
var section = "";
+ var sb = new System.Text.StringBuilder();
+
foreach (var line in lines)
{
if (line.StartsWith("[") && line.EndsWith("]"))
@@ -1551,9 +1588,28 @@ namespace AGVControl
var rfidParts = line.Split(',');
if (rfidParts.Length >= 3)
{
- AddRFIDPoint(
- new Point(int.Parse(rfidParts[0]), int.Parse(rfidParts[1])),
- rfidParts[2]
+ var validX = int.TryParse(rfidParts[0], out int valX);
+ var validY = int.TryParse(rfidParts[1], out int valY);
+ var validN = uint.TryParse(rfidParts[2], out uint valRfid);
+
+ if (validX && validY && validN)
+ {
+ AddRFIDPoint(new Point(valX, valY), valRfid);
+ }
+ else sb.AppendLine($"[{section}] {line}");
+ }
+ break;
+
+ case "[RFID_LINES]":
+ var rfidLineParts = line.Split(',');
+ if (rfidLineParts.Length >= 8)
+ {
+ AddRFIDLine(
+ new Point(int.Parse(rfidLineParts[0]), int.Parse(rfidLineParts[1])),
+ new Point(int.Parse(rfidLineParts[2]), int.Parse(rfidLineParts[3])),
+ uint.Parse(rfidLineParts[4]),
+ uint.Parse(rfidLineParts[5]),
+ (rfidLineParts[6].ToLower() == "true")
);
}
break;
@@ -1618,23 +1674,13 @@ namespace AGVControl
}
break;
- case "[RFID_LINES]":
- var rfidLineParts = line.Split(',');
- if (rfidLineParts.Length >= 8)
- {
- AddRFIDLine(
- new Point(int.Parse(rfidLineParts[0]), int.Parse(rfidLineParts[1])),
- new Point(int.Parse(rfidLineParts[2]), int.Parse(rfidLineParts[3])),
- rfidLineParts[4],
- rfidLineParts[5],
- bool.Parse(rfidLineParts[6])
- );
- }
- break;
+
}
}
this.Invalidate();
+
+ return sb.ToString();
}
private void DeleteNearbyRFIDLine(Point clickPoint)
diff --git a/Cs_HMI/SubProject/AGVControl/Models/AGV.cs b/Cs_HMI/SubProject/AGVControl/Models/AGV.cs
index cc25d3b..82423e4 100644
--- a/Cs_HMI/SubProject/AGVControl/Models/AGV.cs
+++ b/Cs_HMI/SubProject/AGVControl/Models/AGV.cs
@@ -7,7 +7,7 @@ namespace AGVControl.Models
public class AGV
{
public Point CurrentPosition { get; set; }
- public string CurrentRFID { get; set; }
+ public uint CurrentRFID { get; set; }
public Direction CurrentDirection { get; set; }
public bool IsMoving { get; set; }
public List CurrentPath { get; set; }
diff --git a/Cs_HMI/SubProject/AGVControl/Models/RFIDLine.cs b/Cs_HMI/SubProject/AGVControl/Models/RFIDLine.cs
index b72f3b7..91bc5ed 100644
--- a/Cs_HMI/SubProject/AGVControl/Models/RFIDLine.cs
+++ b/Cs_HMI/SubProject/AGVControl/Models/RFIDLine.cs
@@ -8,13 +8,13 @@ namespace AGVControl.Models
{
public Point StartPoint { get; set; }
public Point EndPoint { get; set; }
- public string StartRFID { get; set; }
- public string EndRFID { get; set; }
+ public uint StartRFID { get; set; }
+ public uint EndRFID { get; set; }
public bool IsBidirectional { get; set; } = true; // 양방향 이동 가능 여부
public float Distance { get; set; } // 두 RFID 포인트 사이의 거리
- public List ConnectedRFIDs { get; set; } = new List(); // 연결된 모든 RFID 값들
- public Dictionary NextRFID { get; set; } = new Dictionary(); // 각 RFID의 다음 RFID
- public Dictionary PrevRFID { get; set; } = new Dictionary(); // 각 RFID의 이전 RFID
+ public List ConnectedRFIDs { get; set; } = new List(); // 연결된 모든 RFID 값들
+ public Dictionary NextRFID { get; set; } = new Dictionary(); // 각 RFID의 다음 RFID
+ public Dictionary PrevRFID { get; set; } = new Dictionary(); // 각 RFID의 이전 RFID
}
}
\ No newline at end of file
diff --git a/Cs_HMI/SubProject/AGVControl/Models/RFIDPoint.cs b/Cs_HMI/SubProject/AGVControl/Models/RFIDPoint.cs
index e16153a..b8855f6 100644
--- a/Cs_HMI/SubProject/AGVControl/Models/RFIDPoint.cs
+++ b/Cs_HMI/SubProject/AGVControl/Models/RFIDPoint.cs
@@ -6,7 +6,7 @@ namespace AGVControl.Models
public class RFIDPoint
{
public Point Location { get; set; }
- public string RFIDValue { get; set; }
+ public uint RFIDValue { get; set; }
public string NextRFID { get; set; } // 다음 RFID 포인트의 값
public bool IsBidirectional { get; set; } // 양방향 연결 여부
}
diff --git a/Emulator/AGVEmulator.sln b/Emulator/AGVEmulator.sln
index a11e8bd..4c3a2ae 100644
--- a/Emulator/AGVEmulator.sln
+++ b/Emulator/AGVEmulator.sln
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33801.468
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGVEmulator", "AGVEmulator\AGVEmulator.csproj", "{9312AB43-72F6-4365-A266-E767215FA7F5}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnigEmulator", "AGVEmulator\EnigEmulator.csproj", "{9312AB43-72F6-4365-A266-E767215FA7F5}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ENIGProtocol", "..\Cs_HMI\SubProject\EnigProtocol\enigprotocol\ENIGProtocol.csproj", "{FDB05AF0-DBF8-4CD2-BC02-BE251D8C5575}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
{9312AB43-72F6-4365-A266-E767215FA7F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9312AB43-72F6-4365-A266-E767215FA7F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9312AB43-72F6-4365-A266-E767215FA7F5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FDB05AF0-DBF8-4CD2-BC02-BE251D8C5575}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FDB05AF0-DBF8-4CD2-BC02-BE251D8C5575}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FDB05AF0-DBF8-4CD2-BC02-BE251D8C5575}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FDB05AF0-DBF8-4CD2-BC02-BE251D8C5575}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Emulator/AGVEmulator/DevCAL.cs b/Emulator/AGVEmulator/DevCAL.cs
deleted file mode 100644
index bcf0953..0000000
--- a/Emulator/AGVEmulator/DevCAL.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AGVEmulator
-{
- class DevCAL : AR.Dev.RS232
- {
- public override bool ProcessRecvData(byte[] data)
- {
- var sample = "02 30 31 32 01 03";
- var barr = sample.Split(' ').ToList().Select(t => Convert.ToByte(t, 16)).ToArray();
- var sendstr = System.Text.Encoding.Default.GetString(barr);
- //RaiseMessage(MessageType.Normal, "Tx:" + barr.HexString());
- //WriteData(barr);
- return true;
- }
-
- protected override bool CustomParser(byte[] buf, out byte[] remainBuffer)
- {
-
- List remain = new List();
- bool retval = false;
- foreach (var b in buf)
- {
- if (retval)
- {
- remain.Add(b);
- continue;
- }
-
- if (b == 0x02) //stx
- {
- tempBuffer.Clear();
- tempBuffer.Add(b);
- }
- else if (b == 0x03) //etx
- {
- tempBuffer.Add(b);
- retval = true;
- }
- else
- {
- if (tempBuffer.Count > 0 && tempBuffer[0] == 0xDD)
- {
- tempBuffer.Add(b);
- if (tempBuffer.Count > 10)
- {
- RaiseMessage(MessageType.Error, "buffer over");
- tempBuffer.Clear();
- retval = false;
- }
- }
- else
- {
- //trash
- }
- }
- }
- remainBuffer = remain.ToArray();
- return retval;
- }
- }
-}
diff --git a/Emulator/AGVEmulator/DevPLC.cs b/Emulator/AGVEmulator/DevPLC.cs
deleted file mode 100644
index 585b384..0000000
--- a/Emulator/AGVEmulator/DevPLC.cs
+++ /dev/null
@@ -1,298 +0,0 @@
-using System;
-using static AGVEmulator.DevBMS;
-using System.Collections.Generic;
-using System.Linq;
-using System.Diagnostics.Contracts;
-using arCtl;
-using System.Xml.Schema;
-using System.Drawing;
-
-namespace AGVEmulator
-{
- class DevPLC : AR.Dev.RS232
- {
- byte runtime = 0;
-
-
- public enum eCommand : byte
- {
- LOAD = 0, //EEPROM 불러오기
- SAVE, //EEPROM 저장
- RESET, //초기화
- PINGCHK,
- SET_PINMODE, //PINMODE 설정
- SET_DOUTPUT, //디지털출력설정(포트번호,값[1,0])
- SET_AOUTPUT, //아날로그출력설정(포트GET_SETTING = 50, //셋팅값 요청
- SET_FLAG,
- SET_EEPROM,
- SET_MANUALSPEED,
- GET_SETTING = 50,
- GUIDE_MOT = 90, //가이드커버(양쪽) 0=멈춤,1=UP,2=DN 아스키코드표 90=Z
- SET_EEP_DIREV,
- };
-
- public enum DOName
- {
- PINO_GUIDEMOTOR_LDIR,
- PINO_GUIDEMOTOR_LRUN,
- PINO_GUIDEMOTOR_RDIR,
- PINO_GUIDEMOTOR_RRUN,
- PINO_EMPTY_26,
- PINO_EMPTY_27,
- PINO_EMPTY_28,
- PINO_EMPTY_29,
- }
-
- public enum DIName
- {
- PINI_EMG,
- PINI_BTN_1,
- PINI_BTN_2,
- PINI_BTN_3,
- PINI_BTN_4,
- PINI_OVERLOADL,
- PINI_OVERLOADR,
- PINI_EMPTY_36,
- PINI_EMPTY_37,
- PINI_EMPTY_38,
- PINI_BTN_ZUP,
- PINI_BTN_ZDN,
- PINI_LIMIT_LU,
- PINI_LIMIT_LD,
- PINI_LIMIT_RU,
- PINI_LIMIT_RD,
- PINI_STOP,
- }
-
- public class ValueChangedArgs : EventArgs
- {
- public int Idx { get; set; }
- public bool Value { get; set; }
- public bool IsOut { get; set; }
- public ValueChangedArgs(int idx, bool val, bool isOut)
- {
- this.Idx = idx;
- this.Value = val;
- this.IsOut = isOut;
- }
- }
-
- public class RequestBatteryDataArgs : EventArgs
- {
- public UInt32 IOValue { get; set; }
- public UInt32 FGValue { get; set; }
- public RequestBatteryDataArgs()
- {
- this.IOValue = 0x00;
- this.FGValue = 0xFF;
- }
- }
- public event EventHandler RequestData;
- public event EventHandler ValueChanged;
-
- public override bool ProcessRecvData(byte[] data)
- {
- //dd로 시작하고 34개의 데이터
- // var sample = "DD 03 00 1B 0A 65 00 00 21 63 29 04 00 00 2C 92 00 00 00 00 00 00 28 51 03 08 02 0B 69 0B 66 FC 9C 77";
- // var barr = sample.Split(' ').ToList().Select(t => Convert.ToByte(t, 16)).ToArray();
- var datalne = data[2];
- byte[] buffer = new byte[datalen];
- Array.Copy(data, 3, buffer, 0, buffer.Length);
-
- var cmd = (eCommand)buffer[0];
- if (cmd == eCommand.GUIDE_MOT)
- {
- var p1 = (char)buffer[1];
- var p2 = (char)buffer[2];
-
- switch (p1)
- {
- case 'A': //all
- if (p2 == 'P')
- {
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, true, true));
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, true, true));
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LDIR, true, true));
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RDIR, true, true));
- }
- else if (p2 == 'N')
- {
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, true, true));
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, true, true));
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LDIR, false, true));
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RDIR, false, true));
- }
- else if(p2 == 'S')
- {
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, false, true));
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, false, true));
- }
- break;
- case 'L':
- if (p2 == 'P')
- {
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, true, true));
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LDIR, true, true));
- }
- else if (p2 == 'N')
- {
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, true, true));
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LDIR, false, true));
- }
- else if (p2 == 'S')
- {
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, false, true));
- }
- break;
- case 'R':
- if (p2 == 'P')
- {
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, true, true));
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RDIR, true, true));
- }
- else if (p2 == 'N')
- {
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, true, true));
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RDIR, false, true));
- }
- else if (p2 == 'S')
- {
- ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, false, true));
- }
- break;
- }
- }
-
-
- return true;
- }
-
- public override void AutoSendData()
- {
- //if (_device.DtrEnable == false) return;
-
- List barr = new List();
- barr.Add((byte)'@');
- barr.Add((byte)'@');
- barr.Add(10);
- barr.Add((byte)'I');
-
- //입/출력포트 각 16접 데이터 입력
- UInt32 iovalue = 0;
- //플래그 각 16접 데이터 입력
- UInt32 fgvalue = 0;
-
-
- if (RequestData != null)
- {
- var p = new RequestBatteryDataArgs();
- RequestData.Invoke(this, p);
- iovalue = p.IOValue;
- fgvalue = p.FGValue;
- }
-
-
- var arr_volt = BitConverter.GetBytes(iovalue).ToArray();
- foreach (var b in arr_volt)
- barr.Add(b);
-
-
- arr_volt = BitConverter.GetBytes(fgvalue).ToArray();
- foreach (var b in arr_volt)
- barr.Add(b);
-
-
- if (runtime < 255) runtime += 1;
- else runtime = 0;
- barr.Add(runtime);
-
- //체크섬무시
- barr.Add((byte)'*');
- //barr.Add((byte)'*');
-
- barr.Add(0x0D);
- barr.Add(0x0A);
-
- RaiseMessage(MessageType.Normal, "Tx:" + barr.ToArray().HexString());
- WriteData(barr.ToArray());
- }
-
- bool findstx2 = false;
- byte datalen = 0;
- protected override bool CustomParser(byte[] buf, out byte[] remainBuffer)
- {
- //DD A5 03 00 FF FD 77 0D
- //remainBuffer = new byte[] { };
- List remain = new List();
- bool retval = false;
- foreach (var b in buf)
- {
- if (retval)
- {
- remain.Add(b);
- continue;
- }
-
-
- if (findSTX == false)
- {
- if (b == '@')
- {
- tempBuffer.Clear();
- tempBuffer.Add(b);
- findSTX = true;
- findstx2 = false;
- datalen = 0;
- }
- }
- else if (findstx2 == false)
- {
- if (b == '@')
- {
- tempBuffer.Add(b);
- findstx2 = true;
- datalen = 0;
- }
- else
- {
- tempBuffer.Clear();
- findSTX = false;
- findstx2 = false;
- }
- }
- else if (datalen == 0)
- {
- tempBuffer.Add(b);
- datalen = b;
- }
- else
- {
- //데이터길이가 만족한 상태
- tempBuffer.Add(b);
- var maxlen = datalen + 3 + 3;
-
- if (tempBuffer.Count == maxlen)
- {
- if (tempBuffer[tempBuffer.Count - 1] == 0x0A && tempBuffer[tempBuffer.Count - 2] == 0x0D)
- {
- //무조건 맞는걸로 하자 체크섬은 체크하지 말자
- retval = true;
- }
- }
- else if (tempBuffer.Count > maxlen)
- {
- RaiseMessage(MessageType.Error, $"buffer over({maxlen})");
- findstx2 = false;
- findSTX = false;
- datalen = 0;
- tempBuffer.Clear();
- }
- }
-
-
- }
- remainBuffer = remain.ToArray();
- return retval;
- }
- }
-}
diff --git a/Emulator/AGVEmulator/DevXBE.cs b/Emulator/AGVEmulator/DevXBE.cs
new file mode 100644
index 0000000..4564afa
--- /dev/null
+++ b/Emulator/AGVEmulator/DevXBE.cs
@@ -0,0 +1,87 @@
+using ENIG;
+using System;
+using System.Collections.Generic;
+using System.IO.Ports;
+using System.Linq;
+using System.Text;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
+
+namespace AGVEmulator
+{
+ public class DevXBE : AR.Dev.RS232
+ {
+ private EEProtocol proto;
+ public event EventHandler ProtocReceived;
+
+ public DevXBE()
+ {
+ proto = new EEProtocol();
+ proto.OnDataReceived += Proto_OnDataReceived;
+ proto.OnMessage += Proto_OnMessage;
+ }
+ ~DevXBE()
+ {
+ proto.OnDataReceived -= Proto_OnDataReceived;
+ proto.OnMessage -= Proto_OnMessage;
+ }
+
+ public override bool ProcessRecvData(byte[] data)
+ {
+ return true;
+ }
+
+ protected override bool CustomParser(byte[] buf, out byte[] remainBuffer)
+ {
+ //여기서 최초데이터를 파싱한다
+ remainBuffer = null;
+ this.proto.ProcessReceivedData(buf);
+ return false;
+
+ }
+
+
+ private void Proto_OnDataReceived(object sender, EEProtocol.DataEventArgs e)
+ {
+ var hexstrRaw = e.ReceivedPacket.RawData.HexString();
+ var hexstr = e.ReceivedPacket.Data.HexString();
+ var cmd = e.ReceivedPacket.Command.ToString("X2");
+ var id = e.ReceivedPacket.ID.ToString("X2");
+
+ var dataStr = System.Text.Encoding.Default.GetString(e.ReceivedPacket.Data);
+ RaiseMessage(MessageType.Recv, $"ID:{id},CMD:{cmd},DATA:{hexstr}");
+ ProtocReceived?.Invoke(this, e);
+ }
+ private void Proto_OnMessage(object sender, EEProtocol.MessageEventArgs e)
+ {
+ RaiseMessage(e.IsError, e.Message);
+ }
+
+ ///
+ /// 목적지 태그번호 전송
+ ///
+ public void SendGotoTag(uint tag)
+ {
+ Send(ENIGProtocol.AGVCommands.Goto, tag.ToString("0000"));
+ }
+ public void SendCurrentPos(uint tag)
+ {
+ Send(ENIGProtocol.AGVCommands.SetCurrent, tag.ToString("0000"));
+ }
+ private void Send(ENIGProtocol.AGVCommands Command, string datastr)
+ {
+ byte id = 0;
+ byte cmd = (byte)Command; //move to target
+ byte[] data = null;
+ if (datastr != null && string.IsNullOrEmpty(datastr) == false)
+ data = System.Text.Encoding.Default.GetBytes(datastr);
+ var packet = proto.CreatePacket(id, cmd, data);
+ if (WriteData(packet, false))
+ {
+ var hexstr = System.Text.Encoding.Default.GetString(data);
+ RaiseMessage(MessageType.Send, $"ID:{id},CMD:{cmd},DATA:{hexstr}");
+ }
+ }
+
+
+ }
+}
diff --git a/Emulator/AGVEmulator/AGVEmulator.csproj b/Emulator/AGVEmulator/EnigEmulator.csproj
similarity index 86%
rename from Emulator/AGVEmulator/AGVEmulator.csproj
rename to Emulator/AGVEmulator/EnigEmulator.csproj
index 8b91560..e293b68 100644
--- a/Emulator/AGVEmulator/AGVEmulator.csproj
+++ b/Emulator/AGVEmulator/EnigEmulator.csproj
@@ -7,7 +7,7 @@
{9312AB43-72F6-4365-A266-E767215FA7F5}
WinExe
AGVEmulator
- AGVEmulator
+ EnigEmulator
v4.8
512
true
@@ -61,8 +61,7 @@
-
-
+
Form
@@ -72,6 +71,15 @@
+
+ Form
+
+
+ Form
+
+
+ Form
+
UserControl
@@ -117,5 +125,11 @@
True
+
+
+ {fdb05af0-dbf8-4cd2-bc02-be251d8c5575}
+ ENIGProtocol
+
+
\ No newline at end of file
diff --git a/Emulator/AGVEmulator/Form1.Designer.cs b/Emulator/AGVEmulator/Form1.Designer.cs
index c96319e..de44c3e 100644
--- a/Emulator/AGVEmulator/Form1.Designer.cs
+++ b/Emulator/AGVEmulator/Form1.Designer.cs
@@ -30,42 +30,46 @@ namespace AGVEmulator
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- arFrame.Control.ColorListItem colorListItem1 = new arFrame.Control.ColorListItem();
- arFrame.Control.ColorListItem colorListItem2 = new arFrame.Control.ColorListItem();
- arFrame.Control.ColorListItem colorListItem3 = new arFrame.Control.ColorListItem();
- arFrame.Control.ColorListItem colorListItem4 = new arFrame.Control.ColorListItem();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata29 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata30 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata31 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata32 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata33 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata34 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata35 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata36 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata37 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata38 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata39 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata40 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata41 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata42 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata43 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata44 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata45 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata46 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata47 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata48 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata49 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata50 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata51 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata52 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata53 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata54 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata55 = new AGVEmulator.UC.AgvViewer.ptdata();
+ AGVEmulator.UC.AgvViewer.ptdata ptdata56 = new AGVEmulator.UC.AgvViewer.ptdata();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
- AGVEmulator.UC.AgvViewer.ptdata ptdata1 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata2 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata3 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata4 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata5 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata6 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata7 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata8 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata9 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata10 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata11 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata12 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata13 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata14 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata15 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata16 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata17 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata18 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata19 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata20 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata21 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata22 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata23 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata24 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata25 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata26 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata27 = new AGVEmulator.UC.AgvViewer.ptdata();
- AGVEmulator.UC.AgvViewer.ptdata ptdata28 = new AGVEmulator.UC.AgvViewer.ptdata();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rtBMS = new arCtl.LogTextBox();
this.panel1 = new System.Windows.Forms.Panel();
+ this.btc8 = new System.Windows.Forms.Label();
+ this.btc4 = new System.Windows.Forms.Label();
+ this.btc7 = new System.Windows.Forms.Label();
+ this.btc3 = new System.Windows.Forms.Label();
+ this.btc6 = new System.Windows.Forms.Label();
+ this.btc2 = new System.Windows.Forms.Label();
+ this.btc5 = new System.Windows.Forms.Label();
+ this.btc1 = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
@@ -74,6 +78,7 @@ namespace AGVEmulator
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.trackBar1 = new System.Windows.Forms.TrackBar();
+ this.serBMS = new AGVEmulator.SerialConn();
this.rtAGV = new arCtl.LogTextBox();
this.panel4 = new System.Windows.Forms.Panel();
this.groupBox9 = new System.Windows.Forms.GroupBox();
@@ -115,74 +120,38 @@ namespace AGVEmulator
this.button4 = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.rtCAL = new arCtl.LogTextBox();
- this.panel2 = new System.Windows.Forms.Panel();
- this.radioButton20 = new System.Windows.Forms.RadioButton();
- this.radioButton21 = new System.Windows.Forms.RadioButton();
- this.radioButton18 = new System.Windows.Forms.RadioButton();
- this.radioButton19 = new System.Windows.Forms.RadioButton();
- this.nudBMSKitNo = new System.Windows.Forms.NumericUpDown();
- this.label9 = new System.Windows.Forms.Label();
- this.radioButton6 = new System.Windows.Forms.RadioButton();
- this.radioButton5 = new System.Windows.Forms.RadioButton();
- this.radioButton4 = new System.Windows.Forms.RadioButton();
- this.radioButton3 = new System.Windows.Forms.RadioButton();
- this.radioButton2 = new System.Windows.Forms.RadioButton();
- this.radioButton1 = new System.Windows.Forms.RadioButton();
- this.button3 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
- this.rtPLC = new arCtl.LogTextBox();
- this.panel3 = new System.Windows.Forms.Panel();
- this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
- this.gvdPLCInOut = new arFrame.Control.GridView();
- this.gvdPLCFlag = new arFrame.Control.GridView();
- this.label7 = new System.Windows.Forms.Label();
- this.label8 = new System.Windows.Forms.Label();
- this.panel5 = new System.Windows.Forms.Panel();
- this.button11 = new System.Windows.Forms.Button();
- this.button12 = new System.Windows.Forms.Button();
- this.button13 = new System.Windows.Forms.Button();
- this.button10 = new System.Windows.Forms.Button();
- this.button9 = new System.Windows.Forms.Button();
- this.btPLCemg = new System.Windows.Forms.Button();
- this.button7 = new System.Windows.Forms.Button();
- this.checkBox2 = new System.Windows.Forms.CheckBox();
- this.button6 = new System.Windows.Forms.Button();
- this.button8 = new System.Windows.Forms.Button();
- this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+ this.serCAL = new AGVEmulator.SerialConn();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.rtAGVPro = new arCtl.LogTextBox();
this.panel12 = new System.Windows.Forms.Panel();
- this.tabPage3 = new System.Windows.Forms.TabPage();
+ this.agvViewer1 = new AGVEmulator.UC.AgvViewer();
+ this.serAGV = new AGVEmulator.SerialConn();
this.tabPage2 = new System.Windows.Forms.TabPage();
+ this.tabPage3 = new System.Windows.Forms.TabPage();
+ this.panel3 = new System.Windows.Forms.Panel();
+ this.nudTagNo = new System.Windows.Forms.NumericUpDown();
+ this.btacsgoto = new System.Windows.Forms.Button();
+ this.button7 = new System.Windows.Forms.Button();
+ this.button8 = new System.Windows.Forms.Button();
+ this.button9 = new System.Windows.Forms.Button();
+ this.button10 = new System.Windows.Forms.Button();
+ this.button11 = new System.Windows.Forms.Button();
+ this.button12 = new System.Windows.Forms.Button();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel8 = new System.Windows.Forms.ToolStripStatusLabel();
this.sbAGV = new System.Windows.Forms.ToolStripStatusLabel();
- this.toolStripStatusLabel6 = new System.Windows.Forms.ToolStripStatusLabel();
- this.sbPLC = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel();
this.sbBMS = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.sbCAL = new System.Windows.Forms.ToolStripStatusLabel();
- this.btc1 = new System.Windows.Forms.Label();
- this.btc5 = new System.Windows.Forms.Label();
- this.btc6 = new System.Windows.Forms.Label();
- this.btc2 = new System.Windows.Forms.Label();
- this.btc7 = new System.Windows.Forms.Label();
- this.btc3 = new System.Windows.Forms.Label();
- this.btc8 = new System.Windows.Forms.Label();
- this.btc4 = new System.Windows.Forms.Label();
- this.agvViewer1 = new AGVEmulator.UC.AgvViewer();
- this.serAGV = new AGVEmulator.SerialConn();
- this.serPLC = new AGVEmulator.SerialConn();
- this.serBMS = new AGVEmulator.SerialConn();
- this.serCAL = new AGVEmulator.SerialConn();
+ this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
+ this.button1 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
@@ -201,20 +170,17 @@ namespace AGVEmulator
this.panel10.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.groupBox3.SuspendLayout();
- this.panel2.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nudBMSKitNo)).BeginInit();
- this.panel3.SuspendLayout();
- this.tableLayoutPanel2.SuspendLayout();
- this.panel5.SuspendLayout();
- this.tableLayoutPanel1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.panel12.SuspendLayout();
- this.tabPage3.SuspendLayout();
this.tabPage2.SuspendLayout();
+ this.tabPage3.SuspendLayout();
+ this.panel3.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).BeginInit();
this.toolStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.SuspendLayout();
//
// groupBox1
@@ -225,7 +191,7 @@ namespace AGVEmulator
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(3, 3);
this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(564, 610);
+ this.groupBox1.Size = new System.Drawing.Size(1140, 616);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "BMS";
@@ -246,7 +212,7 @@ namespace AGVEmulator
this.rtBMS.MaxTextLength = ((uint)(4000u));
this.rtBMS.MessageInterval = 50;
this.rtBMS.Name = "rtBMS";
- this.rtBMS.Size = new System.Drawing.Size(558, 403);
+ this.rtBMS.Size = new System.Drawing.Size(1134, 409);
this.rtBMS.TabIndex = 2;
this.rtBMS.Text = "";
//
@@ -271,9 +237,97 @@ namespace AGVEmulator
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(3, 101);
this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(558, 103);
+ this.panel1.Size = new System.Drawing.Size(1134, 103);
this.panel1.TabIndex = 4;
//
+ // btc8
+ //
+ this.btc8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.btc8.ForeColor = System.Drawing.Color.White;
+ this.btc8.Location = new System.Drawing.Point(335, 69);
+ this.btc8.Name = "btc8";
+ this.btc8.Size = new System.Drawing.Size(50, 24);
+ this.btc8.TabIndex = 12;
+ this.btc8.Text = "3338";
+ this.btc8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // btc4
+ //
+ this.btc4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.btc4.ForeColor = System.Drawing.Color.White;
+ this.btc4.Location = new System.Drawing.Point(279, 69);
+ this.btc4.Name = "btc4";
+ this.btc4.Size = new System.Drawing.Size(50, 24);
+ this.btc4.TabIndex = 13;
+ this.btc4.Text = "3338";
+ this.btc4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // btc7
+ //
+ this.btc7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.btc7.ForeColor = System.Drawing.Color.White;
+ this.btc7.Location = new System.Drawing.Point(335, 50);
+ this.btc7.Name = "btc7";
+ this.btc7.Size = new System.Drawing.Size(50, 24);
+ this.btc7.TabIndex = 10;
+ this.btc7.Text = "3338";
+ this.btc7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // btc3
+ //
+ this.btc3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.btc3.ForeColor = System.Drawing.Color.White;
+ this.btc3.Location = new System.Drawing.Point(279, 50);
+ this.btc3.Name = "btc3";
+ this.btc3.Size = new System.Drawing.Size(50, 24);
+ this.btc3.TabIndex = 11;
+ this.btc3.Text = "3338";
+ this.btc3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // btc6
+ //
+ this.btc6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.btc6.ForeColor = System.Drawing.Color.White;
+ this.btc6.Location = new System.Drawing.Point(335, 27);
+ this.btc6.Name = "btc6";
+ this.btc6.Size = new System.Drawing.Size(50, 24);
+ this.btc6.TabIndex = 8;
+ this.btc6.Text = "3338";
+ this.btc6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // btc2
+ //
+ this.btc2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.btc2.ForeColor = System.Drawing.Color.White;
+ this.btc2.Location = new System.Drawing.Point(279, 27);
+ this.btc2.Name = "btc2";
+ this.btc2.Size = new System.Drawing.Size(50, 24);
+ this.btc2.TabIndex = 9;
+ this.btc2.Text = "3338";
+ this.btc2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // btc5
+ //
+ this.btc5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.btc5.ForeColor = System.Drawing.Color.White;
+ this.btc5.Location = new System.Drawing.Point(335, 7);
+ this.btc5.Name = "btc5";
+ this.btc5.Size = new System.Drawing.Size(50, 24);
+ this.btc5.TabIndex = 7;
+ this.btc5.Text = "3338";
+ this.btc5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // btc1
+ //
+ this.btc1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.btc1.ForeColor = System.Drawing.Color.White;
+ this.btc1.Location = new System.Drawing.Point(279, 7);
+ this.btc1.Name = "btc1";
+ this.btc1.Size = new System.Drawing.Size(50, 24);
+ this.btc1.TabIndex = 7;
+ this.btc1.Text = "3338";
+ this.btc1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
// checkBox1
//
this.checkBox1.AutoSize = true;
@@ -360,6 +414,18 @@ namespace AGVEmulator
this.trackBar1.Value = 7000;
this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll);
//
+ // serBMS
+ //
+ this.serBMS.BaudRate = 9600;
+ this.serBMS.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.serBMS.dev = null;
+ this.serBMS.Dock = System.Windows.Forms.DockStyle.Top;
+ this.serBMS.Location = new System.Drawing.Point(3, 17);
+ this.serBMS.Name = "serBMS";
+ this.serBMS.PortName = "COM40";
+ this.serBMS.Size = new System.Drawing.Size(1134, 84);
+ this.serBMS.TabIndex = 1;
+ //
// rtAGV
//
this.rtAGV.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24)))));
@@ -389,7 +455,6 @@ namespace AGVEmulator
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(1140, 280);
this.panel4.TabIndex = 3;
- this.panel4.Paint += new System.Windows.Forms.PaintEventHandler(this.panel4_Paint);
//
// groupBox9
//
@@ -406,7 +471,6 @@ namespace AGVEmulator
this.groupBox9.TabIndex = 13;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "Status";
- this.groupBox9.Enter += new System.EventHandler(this.groupBox9_Enter);
//
// groupBox10
//
@@ -824,15 +888,14 @@ namespace AGVEmulator
// groupBox3
//
this.groupBox3.Controls.Add(this.rtCAL);
- this.groupBox3.Controls.Add(this.panel2);
this.groupBox3.Controls.Add(this.serCAL);
- this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox3.Location = new System.Drawing.Point(573, 3);
+ this.groupBox3.Dock = System.Windows.Forms.DockStyle.Left;
+ this.groupBox3.Location = new System.Drawing.Point(0, 0);
this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(564, 610);
+ this.groupBox3.Size = new System.Drawing.Size(782, 622);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
- this.groupBox3.Text = "Call button ( custom button)";
+ this.groupBox3.Text = "ACS";
//
// rtCAL
//
@@ -845,483 +908,26 @@ namespace AGVEmulator
this.rtCAL.EnableGubunColor = true;
this.rtCAL.Font = new System.Drawing.Font("Consolas", 9F);
this.rtCAL.ListFormat = "[{0}] {1}";
- this.rtCAL.Location = new System.Drawing.Point(3, 204);
+ this.rtCAL.Location = new System.Drawing.Point(3, 101);
this.rtCAL.MaxListCount = ((ushort)(200));
this.rtCAL.MaxTextLength = ((uint)(4000u));
this.rtCAL.MessageInterval = 50;
this.rtCAL.Name = "rtCAL";
- this.rtCAL.Size = new System.Drawing.Size(558, 403);
+ this.rtCAL.Size = new System.Drawing.Size(776, 518);
this.rtCAL.TabIndex = 2;
this.rtCAL.Text = "";
//
- // panel2
- //
- this.panel2.Controls.Add(this.radioButton20);
- this.panel2.Controls.Add(this.radioButton21);
- this.panel2.Controls.Add(this.radioButton18);
- this.panel2.Controls.Add(this.radioButton19);
- this.panel2.Controls.Add(this.nudBMSKitNo);
- this.panel2.Controls.Add(this.label9);
- this.panel2.Controls.Add(this.radioButton6);
- this.panel2.Controls.Add(this.radioButton5);
- this.panel2.Controls.Add(this.radioButton4);
- this.panel2.Controls.Add(this.radioButton3);
- this.panel2.Controls.Add(this.radioButton2);
- this.panel2.Controls.Add(this.radioButton1);
- this.panel2.Controls.Add(this.button3);
- this.panel2.Controls.Add(this.button2);
- this.panel2.Controls.Add(this.button1);
- this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
- this.panel2.Location = new System.Drawing.Point(3, 101);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(558, 103);
- this.panel2.TabIndex = 3;
- //
- // radioButton20
- //
- this.radioButton20.AutoSize = true;
- this.radioButton20.Location = new System.Drawing.Point(331, 11);
- this.radioButton20.Name = "radioButton20";
- this.radioButton20.Size = new System.Drawing.Size(29, 16);
- this.radioButton20.TabIndex = 12;
- this.radioButton20.Text = "9";
- this.radioButton20.UseVisualStyleBackColor = true;
- this.radioButton20.Click += new System.EventHandler(this.radioButton20_Click);
- //
- // radioButton21
- //
- this.radioButton21.AutoSize = true;
- this.radioButton21.Checked = true;
- this.radioButton21.Location = new System.Drawing.Point(296, 11);
- this.radioButton21.Name = "radioButton21";
- this.radioButton21.Size = new System.Drawing.Size(29, 16);
- this.radioButton21.TabIndex = 11;
- this.radioButton21.TabStop = true;
- this.radioButton21.Text = "8";
- this.radioButton21.UseVisualStyleBackColor = true;
- this.radioButton21.Click += new System.EventHandler(this.radioButton20_Click);
- //
- // radioButton18
- //
- this.radioButton18.AutoSize = true;
- this.radioButton18.Location = new System.Drawing.Point(261, 11);
- this.radioButton18.Name = "radioButton18";
- this.radioButton18.Size = new System.Drawing.Size(29, 16);
- this.radioButton18.TabIndex = 10;
- this.radioButton18.Text = "7";
- this.radioButton18.UseVisualStyleBackColor = true;
- this.radioButton18.Click += new System.EventHandler(this.radioButton20_Click);
- //
- // radioButton19
- //
- this.radioButton19.AutoSize = true;
- this.radioButton19.Location = new System.Drawing.Point(226, 11);
- this.radioButton19.Name = "radioButton19";
- this.radioButton19.Size = new System.Drawing.Size(29, 16);
- this.radioButton19.TabIndex = 9;
- this.radioButton19.Text = "6";
- this.radioButton19.UseVisualStyleBackColor = true;
- this.radioButton19.Click += new System.EventHandler(this.radioButton20_Click);
- //
- // nudBMSKitNo
- //
- this.nudBMSKitNo.Font = new System.Drawing.Font("Microsoft Sans Serif", 50F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
- this.nudBMSKitNo.Location = new System.Drawing.Point(435, 7);
- this.nudBMSKitNo.Name = "nudBMSKitNo";
- this.nudBMSKitNo.Size = new System.Drawing.Size(120, 83);
- this.nudBMSKitNo.TabIndex = 8;
- this.nudBMSKitNo.Tag = "1";
- this.nudBMSKitNo.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
- this.nudBMSKitNo.Value = new decimal(new int[] {
- 8,
- 0,
- 0,
- 0});
- //
- // label9
- //
- this.label9.AutoSize = true;
- this.label9.Location = new System.Drawing.Point(390, 16);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(39, 12);
- this.label9.TabIndex = 7;
- this.label9.Text = "Kit No";
- //
- // radioButton6
- //
- this.radioButton6.AutoSize = true;
- this.radioButton6.Location = new System.Drawing.Point(191, 11);
- this.radioButton6.Name = "radioButton6";
- this.radioButton6.Size = new System.Drawing.Size(29, 16);
- this.radioButton6.TabIndex = 6;
- this.radioButton6.Text = "5";
- this.radioButton6.UseVisualStyleBackColor = true;
- this.radioButton6.Click += new System.EventHandler(this.radioButton20_Click);
- //
- // radioButton5
- //
- this.radioButton5.AutoSize = true;
- this.radioButton5.Location = new System.Drawing.Point(156, 11);
- this.radioButton5.Name = "radioButton5";
- this.radioButton5.Size = new System.Drawing.Size(29, 16);
- this.radioButton5.TabIndex = 5;
- this.radioButton5.Text = "4";
- this.radioButton5.UseVisualStyleBackColor = true;
- this.radioButton5.Click += new System.EventHandler(this.radioButton20_Click);
- //
- // radioButton4
- //
- this.radioButton4.AutoSize = true;
- this.radioButton4.Location = new System.Drawing.Point(121, 11);
- this.radioButton4.Name = "radioButton4";
- this.radioButton4.Size = new System.Drawing.Size(29, 16);
- this.radioButton4.TabIndex = 4;
- this.radioButton4.Text = "3";
- this.radioButton4.UseVisualStyleBackColor = true;
- this.radioButton4.Click += new System.EventHandler(this.radioButton20_Click);
- //
- // radioButton3
- //
- this.radioButton3.AutoSize = true;
- this.radioButton3.Location = new System.Drawing.Point(86, 11);
- this.radioButton3.Name = "radioButton3";
- this.radioButton3.Size = new System.Drawing.Size(29, 16);
- this.radioButton3.TabIndex = 3;
- this.radioButton3.Text = "2";
- this.radioButton3.UseVisualStyleBackColor = true;
- this.radioButton3.Click += new System.EventHandler(this.radioButton20_Click);
- //
- // radioButton2
- //
- this.radioButton2.AutoSize = true;
- this.radioButton2.Location = new System.Drawing.Point(51, 11);
- this.radioButton2.Name = "radioButton2";
- this.radioButton2.Size = new System.Drawing.Size(29, 16);
- this.radioButton2.TabIndex = 2;
- this.radioButton2.Text = "1";
- this.radioButton2.UseVisualStyleBackColor = true;
- this.radioButton2.Click += new System.EventHandler(this.radioButton20_Click);
- //
- // radioButton1
- //
- this.radioButton1.AutoSize = true;
- this.radioButton1.Location = new System.Drawing.Point(16, 11);
- this.radioButton1.Name = "radioButton1";
- this.radioButton1.Size = new System.Drawing.Size(29, 16);
- this.radioButton1.TabIndex = 1;
- this.radioButton1.Text = "0";
- this.radioButton1.UseVisualStyleBackColor = true;
- this.radioButton1.Click += new System.EventHandler(this.radioButton20_Click);
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(246, 34);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(96, 59);
- this.button3.TabIndex = 0;
- this.button3.Tag = "0";
- this.button3.Text = "Blue\r\n(Cancel)";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button1_Click);
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(131, 34);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(96, 59);
- this.button2.TabIndex = 0;
- this.button2.Tag = "2";
- this.button2.Text = "White\r\n(Spare)";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button1_Click);
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(16, 34);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(96, 59);
- this.button1.TabIndex = 0;
- this.button1.Tag = "1";
- this.button1.Text = "Green\r\n(Call)";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // rtPLC
- //
- this.rtPLC.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24)))));
- this.rtPLC.ColorList = new arCtl.sLogMessageColor[0];
- this.rtPLC.DateFormat = "ss.fff";
- this.rtPLC.DefaultColor = System.Drawing.Color.LightGray;
- this.rtPLC.Dock = System.Windows.Forms.DockStyle.Fill;
- this.rtPLC.EnableDisplayTimer = false;
- this.rtPLC.EnableGubunColor = true;
- this.rtPLC.Font = new System.Drawing.Font("Consolas", 9F);
- this.rtPLC.ListFormat = "[{0}] {1}";
- this.rtPLC.Location = new System.Drawing.Point(0, 302);
- this.rtPLC.MaxListCount = ((ushort)(200));
- this.rtPLC.MaxTextLength = ((uint)(4000u));
- this.rtPLC.MessageInterval = 50;
- this.rtPLC.Name = "rtPLC";
- this.rtPLC.Size = new System.Drawing.Size(1146, 320);
- this.rtPLC.TabIndex = 2;
- this.rtPLC.Text = "";
- //
- // panel3
- //
- this.panel3.Controls.Add(this.tableLayoutPanel2);
- this.panel3.Controls.Add(this.panel5);
- this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
- this.panel3.Location = new System.Drawing.Point(0, 84);
- this.panel3.Name = "panel3";
- this.panel3.Size = new System.Drawing.Size(1146, 218);
- this.panel3.TabIndex = 3;
- //
- // tableLayoutPanel2
- //
- this.tableLayoutPanel2.ColumnCount = 2;
- this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 77.68595F));
- this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 22.31405F));
- this.tableLayoutPanel2.Controls.Add(this.gvdPLCInOut, 0, 1);
- this.tableLayoutPanel2.Controls.Add(this.gvdPLCFlag, 0, 1);
- this.tableLayoutPanel2.Controls.Add(this.label7, 0, 0);
- this.tableLayoutPanel2.Controls.Add(this.label8, 1, 0);
- this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
- this.tableLayoutPanel2.Name = "tableLayoutPanel2";
- this.tableLayoutPanel2.RowCount = 2;
- this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tableLayoutPanel2.Size = new System.Drawing.Size(818, 218);
- this.tableLayoutPanel2.TabIndex = 9;
- //
- // gvdPLCInOut
- //
- this.gvdPLCInOut.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
- this.gvdPLCInOut.BorderSize = 1;
- colorListItem1.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
- colorListItem1.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
- colorListItem1.Remark = "";
- colorListItem2.BackColor1 = System.Drawing.Color.Orange;
- colorListItem2.BackColor2 = System.Drawing.Color.DarkOrange;
- colorListItem2.Remark = "";
- this.gvdPLCInOut.ColorList = new arFrame.Control.ColorListItem[] {
- colorListItem1,
- colorListItem2};
- this.gvdPLCInOut.Cursor = System.Windows.Forms.Cursors.Arrow;
- this.gvdPLCInOut.Dock = System.Windows.Forms.DockStyle.Fill;
- this.gvdPLCInOut.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.gvdPLCInOut.FontPin = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold);
- this.gvdPLCInOut.ForeColor = System.Drawing.Color.White;
- this.gvdPLCInOut.ForeColorPin = System.Drawing.Color.WhiteSmoke;
- this.gvdPLCInOut.Location = new System.Drawing.Point(3, 23);
- this.gvdPLCInOut.MatrixSize = new System.Drawing.Point(8, 3);
- this.gvdPLCInOut.MenuBorderSize = 1;
- this.gvdPLCInOut.MenuGap = 5;
- this.gvdPLCInOut.MinimumSize = new System.Drawing.Size(100, 50);
- this.gvdPLCInOut.Name = "gvdPLCInOut";
- this.gvdPLCInOut.Names = null;
- this.gvdPLCInOut.ShadowColor = System.Drawing.Color.Black;
- this.gvdPLCInOut.showDebugInfo = false;
- this.gvdPLCInOut.ShowIndexString = true;
- this.gvdPLCInOut.Size = new System.Drawing.Size(629, 192);
- this.gvdPLCInOut.TabIndex = 12;
- this.gvdPLCInOut.Tags = null;
- this.gvdPLCInOut.Text = "gridView1";
- this.gvdPLCInOut.TextAttachToImage = true;
- this.gvdPLCInOut.Titles = null;
- this.gvdPLCInOut.Values = null;
- //
- // gvdPLCFlag
- //
- this.gvdPLCFlag.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
- this.gvdPLCFlag.BorderSize = 1;
- colorListItem3.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
- colorListItem3.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
- colorListItem3.Remark = "";
- colorListItem4.BackColor1 = System.Drawing.Color.Orange;
- colorListItem4.BackColor2 = System.Drawing.Color.DarkOrange;
- colorListItem4.Remark = "";
- this.gvdPLCFlag.ColorList = new arFrame.Control.ColorListItem[] {
- colorListItem3,
- colorListItem4};
- this.gvdPLCFlag.Cursor = System.Windows.Forms.Cursors.Arrow;
- this.gvdPLCFlag.Dock = System.Windows.Forms.DockStyle.Fill;
- this.gvdPLCFlag.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.gvdPLCFlag.FontPin = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold);
- this.gvdPLCFlag.ForeColor = System.Drawing.Color.White;
- this.gvdPLCFlag.ForeColorPin = System.Drawing.Color.WhiteSmoke;
- this.gvdPLCFlag.Location = new System.Drawing.Point(638, 23);
- this.gvdPLCFlag.MatrixSize = new System.Drawing.Point(8, 4);
- this.gvdPLCFlag.MenuBorderSize = 1;
- this.gvdPLCFlag.MenuGap = 5;
- this.gvdPLCFlag.MinimumSize = new System.Drawing.Size(100, 50);
- this.gvdPLCFlag.Name = "gvdPLCFlag";
- this.gvdPLCFlag.Names = null;
- this.gvdPLCFlag.ShadowColor = System.Drawing.Color.Black;
- this.gvdPLCFlag.showDebugInfo = false;
- this.gvdPLCFlag.ShowIndexString = true;
- this.gvdPLCFlag.Size = new System.Drawing.Size(177, 192);
- this.gvdPLCFlag.TabIndex = 11;
- this.gvdPLCFlag.Tags = null;
- this.gvdPLCFlag.Text = "gridView1";
- this.gvdPLCFlag.TextAttachToImage = true;
- this.gvdPLCFlag.Titles = null;
- this.gvdPLCFlag.Values = null;
- //
- // label7
- //
- this.label7.Dock = System.Windows.Forms.DockStyle.Fill;
- this.label7.Location = new System.Drawing.Point(3, 0);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(629, 20);
- this.label7.TabIndex = 13;
- this.label7.Text = "I/O";
- this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // label8
- //
- this.label8.Dock = System.Windows.Forms.DockStyle.Fill;
- this.label8.Location = new System.Drawing.Point(638, 0);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(177, 20);
- this.label8.TabIndex = 13;
- this.label8.Text = "FLAG";
- this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // panel5
- //
- this.panel5.Controls.Add(this.button11);
- this.panel5.Controls.Add(this.button12);
- this.panel5.Controls.Add(this.button13);
- this.panel5.Controls.Add(this.button10);
- this.panel5.Controls.Add(this.button9);
- this.panel5.Controls.Add(this.btPLCemg);
- this.panel5.Controls.Add(this.button7);
- this.panel5.Controls.Add(this.checkBox2);
- this.panel5.Controls.Add(this.button6);
- this.panel5.Controls.Add(this.button8);
- this.panel5.Dock = System.Windows.Forms.DockStyle.Right;
- this.panel5.Location = new System.Drawing.Point(818, 0);
- this.panel5.Name = "panel5";
- this.panel5.Size = new System.Drawing.Size(328, 218);
- this.panel5.TabIndex = 8;
- //
- // button11
- //
- this.button11.Location = new System.Drawing.Point(178, 156);
- this.button11.Name = "button11";
- this.button11.Size = new System.Drawing.Size(76, 54);
- this.button11.TabIndex = 13;
- this.button11.Text = "But #3";
- this.button11.UseVisualStyleBackColor = true;
- this.button11.Click += new System.EventHandler(this.button11_Click);
- //
- // button12
- //
- this.button12.Location = new System.Drawing.Point(178, 96);
- this.button12.Name = "button12";
- this.button12.Size = new System.Drawing.Size(76, 54);
- this.button12.TabIndex = 12;
- this.button12.Text = "But #2";
- this.button12.UseVisualStyleBackColor = true;
- this.button12.Click += new System.EventHandler(this.button12_Click);
- //
- // button13
- //
- this.button13.Location = new System.Drawing.Point(178, 35);
- this.button13.Name = "button13";
- this.button13.Size = new System.Drawing.Size(76, 54);
- this.button13.TabIndex = 11;
- this.button13.Text = "But #1";
- this.button13.UseVisualStyleBackColor = true;
- this.button13.Click += new System.EventHandler(this.button13_Click);
- //
- // button10
- //
- this.button10.Location = new System.Drawing.Point(96, 156);
- this.button10.Name = "button10";
- this.button10.Size = new System.Drawing.Size(76, 54);
- this.button10.TabIndex = 10;
- this.button10.Text = "Limit - R";
- this.button10.UseVisualStyleBackColor = true;
- this.button10.Click += new System.EventHandler(this.button10_Click);
- //
- // button9
- //
- this.button9.Location = new System.Drawing.Point(96, 96);
- this.button9.Name = "button9";
- this.button9.Size = new System.Drawing.Size(76, 54);
- this.button9.TabIndex = 9;
- this.button9.Text = "Limit - L";
- this.button9.UseVisualStyleBackColor = true;
- this.button9.Click += new System.EventHandler(this.button9_Click);
- //
- // btPLCemg
- //
- this.btPLCemg.Location = new System.Drawing.Point(96, 35);
- this.btPLCemg.Name = "btPLCemg";
- this.btPLCemg.Size = new System.Drawing.Size(76, 54);
- this.btPLCemg.TabIndex = 8;
- this.btPLCemg.Text = "Emg";
- this.btPLCemg.UseVisualStyleBackColor = true;
- this.btPLCemg.Click += new System.EventHandler(this.btPLCemg_Click);
- //
- // button7
- //
- this.button7.Location = new System.Drawing.Point(14, 36);
- this.button7.Name = "button7";
- this.button7.Size = new System.Drawing.Size(76, 54);
- this.button7.TabIndex = 4;
- this.button7.Text = "UP";
- this.button7.UseVisualStyleBackColor = true;
- this.button7.Click += new System.EventHandler(this.button7_Click);
- //
- // checkBox2
- //
- this.checkBox2.AutoSize = true;
- this.checkBox2.Checked = true;
- this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox2.Location = new System.Drawing.Point(15, 13);
- this.checkBox2.Name = "checkBox2";
- this.checkBox2.Size = new System.Drawing.Size(81, 16);
- this.checkBox2.TabIndex = 7;
- this.checkBox2.Text = "I/O Status";
- this.checkBox2.UseVisualStyleBackColor = true;
- //
- // button6
- //
- this.button6.Location = new System.Drawing.Point(14, 96);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(76, 54);
- this.button6.TabIndex = 3;
- this.button6.Text = "STOP";
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // button8
- //
- this.button8.Location = new System.Drawing.Point(14, 156);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(76, 54);
- this.button8.TabIndex = 5;
- this.button8.Text = "DOWN";
- this.button8.UseVisualStyleBackColor = true;
- this.button8.Click += new System.EventHandler(this.button8_Click);
- //
- // tableLayoutPanel1
- //
- this.tableLayoutPanel1.ColumnCount = 2;
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0);
- this.tableLayoutPanel1.Controls.Add(this.groupBox3, 1, 0);
- this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
- this.tableLayoutPanel1.Name = "tableLayoutPanel1";
- this.tableLayoutPanel1.RowCount = 1;
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tableLayoutPanel1.Size = new System.Drawing.Size(1140, 616);
- this.tableLayoutPanel1.TabIndex = 2;
+ // serCAL
+ //
+ this.serCAL.BaudRate = 9600;
+ this.serCAL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.serCAL.dev = null;
+ this.serCAL.Dock = System.Windows.Forms.DockStyle.Top;
+ this.serCAL.Location = new System.Drawing.Point(3, 17);
+ this.serCAL.Name = "serCAL";
+ this.serCAL.PortName = "COM50";
+ this.serCAL.Size = new System.Drawing.Size(776, 84);
+ this.serCAL.TabIndex = 1;
//
// timer1
//
@@ -1331,8 +937,8 @@ namespace AGVEmulator
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
- this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage2);
+ this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 25);
this.tabControl1.Name = "tabControl1";
@@ -1398,29 +1004,275 @@ namespace AGVEmulator
this.panel12.Size = new System.Drawing.Size(1140, 120);
this.panel12.TabIndex = 5;
//
- // tabPage3
+ // agvViewer1
//
- this.tabPage3.Controls.Add(this.rtPLC);
- this.tabPage3.Controls.Add(this.panel3);
- this.tabPage3.Controls.Add(this.serPLC);
- this.tabPage3.Location = new System.Drawing.Point(4, 22);
- this.tabPage3.Name = "tabPage3";
- this.tabPage3.Size = new System.Drawing.Size(1146, 622);
- this.tabPage3.TabIndex = 2;
- this.tabPage3.Text = "PLC";
- this.tabPage3.UseVisualStyleBackColor = true;
+ this.agvViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.agvViewer1.FontMrk = new System.Drawing.Font("Arial Rounded MT Bold", 7F);
+ this.agvViewer1.FontTag = new System.Drawing.Font("Arial Rounded MT Bold", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.agvViewer1.lastmark = "";
+ this.agvViewer1.lastmarkdir = "";
+ this.agvViewer1.lasttag = "";
+ this.agvViewer1.lasttagdir = "";
+ ptdata29.active = false;
+ ptdata29.data = "NOT";
+ ptdata29.pos = 30F;
+ ptdata30.active = false;
+ ptdata30.data = "QA";
+ ptdata30.pos = 200F;
+ ptdata31.active = false;
+ ptdata31.data = "CHG";
+ ptdata31.pos = 300F;
+ ptdata32.active = false;
+ ptdata32.data = "QC";
+ ptdata32.pos = 400F;
+ ptdata33.active = false;
+ ptdata33.data = "#FVI-1";
+ ptdata33.pos = 500F;
+ ptdata34.active = false;
+ ptdata34.data = "#FVI-2";
+ ptdata34.pos = 600F;
+ ptdata35.active = false;
+ ptdata35.data = "#FVI-3";
+ ptdata35.pos = 700F;
+ ptdata36.active = false;
+ ptdata36.data = "#FVI-4";
+ ptdata36.pos = 800F;
+ ptdata37.active = false;
+ ptdata37.data = "#FVI-5";
+ ptdata37.pos = 900F;
+ ptdata38.active = false;
+ ptdata38.data = "POT";
+ ptdata38.pos = 970F;
+ this.agvViewer1.listMRK = new AGVEmulator.UC.AgvViewer.ptdata[] {
+ ptdata29,
+ ptdata30,
+ ptdata31,
+ ptdata32,
+ ptdata33,
+ ptdata34,
+ ptdata35,
+ ptdata36,
+ ptdata37,
+ ptdata38};
+ ptdata39.active = false;
+ ptdata39.data = "9000";
+ ptdata39.pos = 80F;
+ ptdata40.active = false;
+ ptdata40.data = "9001";
+ ptdata40.pos = 120F;
+ ptdata41.active = false;
+ ptdata41.data = "9010";
+ ptdata41.pos = 180F;
+ ptdata42.active = false;
+ ptdata42.data = "9011";
+ ptdata42.pos = 220F;
+ ptdata43.active = false;
+ ptdata43.data = "9020";
+ ptdata43.pos = 280F;
+ ptdata44.active = false;
+ ptdata44.data = "9021";
+ ptdata44.pos = 320F;
+ ptdata45.active = false;
+ ptdata45.data = "9030";
+ ptdata45.pos = 380F;
+ ptdata46.active = false;
+ ptdata46.data = "9031";
+ ptdata46.pos = 420F;
+ ptdata47.active = false;
+ ptdata47.data = "9040";
+ ptdata47.pos = 480F;
+ ptdata48.active = false;
+ ptdata48.data = "9041";
+ ptdata48.pos = 520F;
+ ptdata49.active = false;
+ ptdata49.data = "9050";
+ ptdata49.pos = 580F;
+ ptdata50.active = false;
+ ptdata50.data = "9051";
+ ptdata50.pos = 620F;
+ ptdata51.active = false;
+ ptdata51.data = "9060";
+ ptdata51.pos = 680F;
+ ptdata52.active = false;
+ ptdata52.data = "9061";
+ ptdata52.pos = 720F;
+ ptdata53.active = false;
+ ptdata53.data = "9070";
+ ptdata53.pos = 780F;
+ ptdata54.active = false;
+ ptdata54.data = "9071";
+ ptdata54.pos = 820F;
+ ptdata55.active = false;
+ ptdata55.data = "9000";
+ ptdata55.pos = 10F;
+ ptdata56.active = false;
+ ptdata56.data = "9001";
+ ptdata56.pos = 50F;
+ this.agvViewer1.listTAG = new AGVEmulator.UC.AgvViewer.ptdata[] {
+ ptdata39,
+ ptdata40,
+ ptdata41,
+ ptdata42,
+ ptdata43,
+ ptdata44,
+ ptdata45,
+ ptdata46,
+ ptdata47,
+ ptdata48,
+ ptdata49,
+ ptdata50,
+ ptdata51,
+ ptdata52,
+ ptdata53,
+ ptdata54,
+ ptdata55,
+ ptdata56};
+ this.agvViewer1.Location = new System.Drawing.Point(241, 0);
+ this.agvViewer1.Name = "agvViewer1";
+ this.agvViewer1.Size = new System.Drawing.Size(899, 120);
+ this.agvViewer1.StopbyMark = false;
+ this.agvViewer1.TabIndex = 0;
+ this.agvViewer1.Text = "agvViewer1";
+ this.agvViewer1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.agvViewer1_MouseDown);
+ //
+ // serAGV
+ //
+ this.serAGV.BaudRate = 9600;
+ this.serAGV.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.serAGV.dev = null;
+ this.serAGV.Dock = System.Windows.Forms.DockStyle.Left;
+ this.serAGV.Location = new System.Drawing.Point(0, 0);
+ this.serAGV.Name = "serAGV";
+ this.serAGV.PortName = "COM20";
+ this.serAGV.Size = new System.Drawing.Size(241, 120);
+ this.serAGV.TabIndex = 0;
//
// tabPage2
//
- this.tabPage2.Controls.Add(this.tableLayoutPanel1);
+ this.tabPage2.Controls.Add(this.groupBox1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1146, 622);
this.tabPage2.TabIndex = 1;
- this.tabPage2.Text = "BMS & CALL";
+ this.tabPage2.Text = "BMS";
this.tabPage2.UseVisualStyleBackColor = true;
//
+ // tabPage3
+ //
+ this.tabPage3.Controls.Add(this.panel3);
+ this.tabPage3.Controls.Add(this.groupBox3);
+ this.tabPage3.Location = new System.Drawing.Point(4, 22);
+ this.tabPage3.Name = "tabPage3";
+ this.tabPage3.Size = new System.Drawing.Size(1146, 622);
+ this.tabPage3.TabIndex = 2;
+ this.tabPage3.Text = "ACS";
+ this.tabPage3.UseVisualStyleBackColor = true;
+ //
+ // panel3
+ //
+ this.panel3.Controls.Add(this.numericUpDown2);
+ this.panel3.Controls.Add(this.button1);
+ this.panel3.Controls.Add(this.nudTagNo);
+ this.panel3.Controls.Add(this.btacsgoto);
+ this.panel3.Controls.Add(this.button7);
+ this.panel3.Controls.Add(this.button8);
+ this.panel3.Controls.Add(this.button9);
+ this.panel3.Controls.Add(this.button10);
+ this.panel3.Controls.Add(this.button11);
+ this.panel3.Controls.Add(this.button12);
+ this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.panel3.Location = new System.Drawing.Point(782, 0);
+ this.panel3.Name = "panel3";
+ this.panel3.Size = new System.Drawing.Size(364, 622);
+ this.panel3.TabIndex = 15;
+ //
+ // nudTagNo
+ //
+ this.nudTagNo.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
+ this.nudTagNo.Location = new System.Drawing.Point(15, 250);
+ this.nudTagNo.Maximum = new decimal(new int[] {
+ 9999999,
+ 0,
+ 0,
+ 0});
+ this.nudTagNo.Name = "nudTagNo";
+ this.nudTagNo.Size = new System.Drawing.Size(130, 38);
+ this.nudTagNo.TabIndex = 9;
+ this.nudTagNo.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.nudTagNo.Value = new decimal(new int[] {
+ 9900,
+ 0,
+ 0,
+ 0});
+ //
+ // btacsgoto
+ //
+ this.btacsgoto.Location = new System.Drawing.Point(151, 250);
+ this.btacsgoto.Name = "btacsgoto";
+ this.btacsgoto.Size = new System.Drawing.Size(86, 38);
+ this.btacsgoto.TabIndex = 8;
+ this.btacsgoto.Tag = "--";
+ this.btacsgoto.Text = "Goto";
+ this.btacsgoto.UseVisualStyleBackColor = true;
+ this.btacsgoto.Click += new System.EventHandler(this.button6_Click);
+ //
+ // button7
+ //
+ this.button7.Location = new System.Drawing.Point(83, 72);
+ this.button7.Name = "button7";
+ this.button7.Size = new System.Drawing.Size(62, 54);
+ this.button7.TabIndex = 7;
+ this.button7.Text = "--";
+ this.button7.UseVisualStyleBackColor = true;
+ //
+ // button8
+ //
+ this.button8.Location = new System.Drawing.Point(83, 132);
+ this.button8.Name = "button8";
+ this.button8.Size = new System.Drawing.Size(62, 54);
+ this.button8.TabIndex = 6;
+ this.button8.Tag = "--";
+ this.button8.Text = "--";
+ this.button8.UseVisualStyleBackColor = true;
+ //
+ // button9
+ //
+ this.button9.Location = new System.Drawing.Point(15, 130);
+ this.button9.Name = "button9";
+ this.button9.Size = new System.Drawing.Size(62, 54);
+ this.button9.TabIndex = 5;
+ this.button9.Tag = "--";
+ this.button9.Text = "--";
+ this.button9.UseVisualStyleBackColor = true;
+ //
+ // button10
+ //
+ this.button10.Location = new System.Drawing.Point(15, 70);
+ this.button10.Name = "button10";
+ this.button10.Size = new System.Drawing.Size(62, 54);
+ this.button10.TabIndex = 3;
+ this.button10.Text = "--";
+ this.button10.UseVisualStyleBackColor = true;
+ //
+ // button11
+ //
+ this.button11.Location = new System.Drawing.Point(15, 10);
+ this.button11.Name = "button11";
+ this.button11.Size = new System.Drawing.Size(62, 54);
+ this.button11.TabIndex = 2;
+ this.button11.Text = "--";
+ this.button11.UseVisualStyleBackColor = true;
+ //
+ // button12
+ //
+ this.button12.Location = new System.Drawing.Point(83, 10);
+ this.button12.Name = "button12";
+ this.button12.Size = new System.Drawing.Size(62, 54);
+ this.button12.TabIndex = 1;
+ this.button12.Text = "--";
+ this.button12.UseVisualStyleBackColor = true;
+ //
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -1455,8 +1307,6 @@ namespace AGVEmulator
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel8,
this.sbAGV,
- this.toolStripStatusLabel6,
- this.sbPLC,
this.toolStripStatusLabel4,
this.sbBMS,
this.toolStripStatusLabel2,
@@ -1479,18 +1329,6 @@ namespace AGVEmulator
this.sbAGV.Size = new System.Drawing.Size(19, 17);
this.sbAGV.Text = "●";
//
- // toolStripStatusLabel6
- //
- this.toolStripStatusLabel6.Name = "toolStripStatusLabel6";
- this.toolStripStatusLabel6.Size = new System.Drawing.Size(28, 17);
- this.toolStripStatusLabel6.Text = "PLC";
- //
- // sbPLC
- //
- this.sbPLC.Name = "sbPLC";
- this.sbPLC.Size = new System.Drawing.Size(19, 17);
- this.sbPLC.Text = "●";
- //
// toolStripStatusLabel4
//
this.toolStripStatusLabel4.Name = "toolStripStatusLabel4";
@@ -1506,8 +1344,8 @@ namespace AGVEmulator
// toolStripStatusLabel2
//
this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
- this.toolStripStatusLabel2.Size = new System.Drawing.Size(35, 17);
- this.toolStripStatusLabel2.Text = "CALL";
+ this.toolStripStatusLabel2.Size = new System.Drawing.Size(30, 17);
+ this.toolStripStatusLabel2.Text = "ACS";
//
// sbCAL
//
@@ -1515,275 +1353,35 @@ namespace AGVEmulator
this.sbCAL.Size = new System.Drawing.Size(19, 17);
this.sbCAL.Text = "●";
//
- // btc1
+ // numericUpDown2
//
- this.btc1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.btc1.ForeColor = System.Drawing.Color.White;
- this.btc1.Location = new System.Drawing.Point(279, 7);
- this.btc1.Name = "btc1";
- this.btc1.Size = new System.Drawing.Size(50, 24);
- this.btc1.TabIndex = 7;
- this.btc1.Text = "3338";
- this.btc1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.numericUpDown2.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
+ this.numericUpDown2.Location = new System.Drawing.Point(15, 206);
+ this.numericUpDown2.Maximum = new decimal(new int[] {
+ 9999999,
+ 0,
+ 0,
+ 0});
+ this.numericUpDown2.Name = "numericUpDown2";
+ this.numericUpDown2.Size = new System.Drawing.Size(130, 38);
+ this.numericUpDown2.TabIndex = 11;
+ this.numericUpDown2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.numericUpDown2.Value = new decimal(new int[] {
+ 9900,
+ 0,
+ 0,
+ 0});
//
- // btc5
+ // button1
//
- this.btc5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.btc5.ForeColor = System.Drawing.Color.White;
- this.btc5.Location = new System.Drawing.Point(335, 7);
- this.btc5.Name = "btc5";
- this.btc5.Size = new System.Drawing.Size(50, 24);
- this.btc5.TabIndex = 7;
- this.btc5.Text = "3338";
- this.btc5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // btc6
- //
- this.btc6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.btc6.ForeColor = System.Drawing.Color.White;
- this.btc6.Location = new System.Drawing.Point(335, 27);
- this.btc6.Name = "btc6";
- this.btc6.Size = new System.Drawing.Size(50, 24);
- this.btc6.TabIndex = 8;
- this.btc6.Text = "3338";
- this.btc6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // btc2
- //
- this.btc2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.btc2.ForeColor = System.Drawing.Color.White;
- this.btc2.Location = new System.Drawing.Point(279, 27);
- this.btc2.Name = "btc2";
- this.btc2.Size = new System.Drawing.Size(50, 24);
- this.btc2.TabIndex = 9;
- this.btc2.Text = "3338";
- this.btc2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // btc7
- //
- this.btc7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.btc7.ForeColor = System.Drawing.Color.White;
- this.btc7.Location = new System.Drawing.Point(335, 50);
- this.btc7.Name = "btc7";
- this.btc7.Size = new System.Drawing.Size(50, 24);
- this.btc7.TabIndex = 10;
- this.btc7.Text = "3338";
- this.btc7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // btc3
- //
- this.btc3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.btc3.ForeColor = System.Drawing.Color.White;
- this.btc3.Location = new System.Drawing.Point(279, 50);
- this.btc3.Name = "btc3";
- this.btc3.Size = new System.Drawing.Size(50, 24);
- this.btc3.TabIndex = 11;
- this.btc3.Text = "3338";
- this.btc3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // btc8
- //
- this.btc8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.btc8.ForeColor = System.Drawing.Color.White;
- this.btc8.Location = new System.Drawing.Point(335, 69);
- this.btc8.Name = "btc8";
- this.btc8.Size = new System.Drawing.Size(50, 24);
- this.btc8.TabIndex = 12;
- this.btc8.Text = "3338";
- this.btc8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // btc4
- //
- this.btc4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.btc4.ForeColor = System.Drawing.Color.White;
- this.btc4.Location = new System.Drawing.Point(279, 69);
- this.btc4.Name = "btc4";
- this.btc4.Size = new System.Drawing.Size(50, 24);
- this.btc4.TabIndex = 13;
- this.btc4.Text = "3338";
- this.btc4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // agvViewer1
- //
- this.agvViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.agvViewer1.FontMrk = new System.Drawing.Font("Arial Rounded MT Bold", 7F);
- this.agvViewer1.FontTag = new System.Drawing.Font("Arial Rounded MT Bold", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.agvViewer1.lastmark = "";
- this.agvViewer1.lastmarkdir = "";
- this.agvViewer1.lasttag = "";
- this.agvViewer1.lasttagdir = "";
- ptdata1.active = false;
- ptdata1.data = "NOT";
- ptdata1.pos = 30F;
- ptdata2.active = false;
- ptdata2.data = "QA";
- ptdata2.pos = 200F;
- ptdata3.active = false;
- ptdata3.data = "CHG";
- ptdata3.pos = 300F;
- ptdata4.active = false;
- ptdata4.data = "QC";
- ptdata4.pos = 400F;
- ptdata5.active = false;
- ptdata5.data = "#FVI-1";
- ptdata5.pos = 500F;
- ptdata6.active = false;
- ptdata6.data = "#FVI-2";
- ptdata6.pos = 600F;
- ptdata7.active = false;
- ptdata7.data = "#FVI-3";
- ptdata7.pos = 700F;
- ptdata8.active = false;
- ptdata8.data = "#FVI-4";
- ptdata8.pos = 800F;
- ptdata9.active = false;
- ptdata9.data = "#FVI-5";
- ptdata9.pos = 900F;
- ptdata10.active = false;
- ptdata10.data = "POT";
- ptdata10.pos = 970F;
- this.agvViewer1.listMRK = new AGVEmulator.UC.AgvViewer.ptdata[] {
- ptdata1,
- ptdata2,
- ptdata3,
- ptdata4,
- ptdata5,
- ptdata6,
- ptdata7,
- ptdata8,
- ptdata9,
- ptdata10};
- ptdata11.active = false;
- ptdata11.data = "9000";
- ptdata11.pos = 80F;
- ptdata12.active = false;
- ptdata12.data = "9001";
- ptdata12.pos = 120F;
- ptdata13.active = false;
- ptdata13.data = "9010";
- ptdata13.pos = 180F;
- ptdata14.active = false;
- ptdata14.data = "9011";
- ptdata14.pos = 220F;
- ptdata15.active = false;
- ptdata15.data = "9020";
- ptdata15.pos = 280F;
- ptdata16.active = false;
- ptdata16.data = "9021";
- ptdata16.pos = 320F;
- ptdata17.active = false;
- ptdata17.data = "9030";
- ptdata17.pos = 380F;
- ptdata18.active = false;
- ptdata18.data = "9031";
- ptdata18.pos = 420F;
- ptdata19.active = false;
- ptdata19.data = "9040";
- ptdata19.pos = 480F;
- ptdata20.active = false;
- ptdata20.data = "9041";
- ptdata20.pos = 520F;
- ptdata21.active = false;
- ptdata21.data = "9050";
- ptdata21.pos = 580F;
- ptdata22.active = false;
- ptdata22.data = "9051";
- ptdata22.pos = 620F;
- ptdata23.active = false;
- ptdata23.data = "9060";
- ptdata23.pos = 680F;
- ptdata24.active = false;
- ptdata24.data = "9061";
- ptdata24.pos = 720F;
- ptdata25.active = false;
- ptdata25.data = "9070";
- ptdata25.pos = 780F;
- ptdata26.active = false;
- ptdata26.data = "9071";
- ptdata26.pos = 820F;
- ptdata27.active = false;
- ptdata27.data = "9000";
- ptdata27.pos = 10F;
- ptdata28.active = false;
- ptdata28.data = "9001";
- ptdata28.pos = 50F;
- this.agvViewer1.listTAG = new AGVEmulator.UC.AgvViewer.ptdata[] {
- ptdata11,
- ptdata12,
- ptdata13,
- ptdata14,
- ptdata15,
- ptdata16,
- ptdata17,
- ptdata18,
- ptdata19,
- ptdata20,
- ptdata21,
- ptdata22,
- ptdata23,
- ptdata24,
- ptdata25,
- ptdata26,
- ptdata27,
- ptdata28};
- this.agvViewer1.Location = new System.Drawing.Point(241, 0);
- this.agvViewer1.Name = "agvViewer1";
- this.agvViewer1.Size = new System.Drawing.Size(899, 120);
- this.agvViewer1.StopbyMark = false;
- this.agvViewer1.TabIndex = 0;
- this.agvViewer1.Text = "agvViewer1";
- this.agvViewer1.Click += new System.EventHandler(this.agvViewer1_Click);
- this.agvViewer1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.agvViewer1_MouseDown);
- //
- // serAGV
- //
- this.serAGV.BaudRate = 9600;
- this.serAGV.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.serAGV.dev = null;
- this.serAGV.Dock = System.Windows.Forms.DockStyle.Left;
- this.serAGV.Location = new System.Drawing.Point(0, 0);
- this.serAGV.Name = "serAGV";
- this.serAGV.PortName = "COM20";
- this.serAGV.Size = new System.Drawing.Size(241, 120);
- this.serAGV.TabIndex = 0;
- this.serAGV.Load += new System.EventHandler(this.serAGV_Load);
- //
- // serPLC
- //
- this.serPLC.BaudRate = 9600;
- this.serPLC.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.serPLC.dev = null;
- this.serPLC.Dock = System.Windows.Forms.DockStyle.Top;
- this.serPLC.Location = new System.Drawing.Point(0, 0);
- this.serPLC.Name = "serPLC";
- this.serPLC.PortName = "COM30";
- this.serPLC.Size = new System.Drawing.Size(1146, 84);
- this.serPLC.TabIndex = 1;
- //
- // serBMS
- //
- this.serBMS.BaudRate = 9600;
- this.serBMS.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.serBMS.dev = null;
- this.serBMS.Dock = System.Windows.Forms.DockStyle.Top;
- this.serBMS.Location = new System.Drawing.Point(3, 17);
- this.serBMS.Name = "serBMS";
- this.serBMS.PortName = "COM40";
- this.serBMS.Size = new System.Drawing.Size(558, 84);
- this.serBMS.TabIndex = 1;
- this.serBMS.Load += new System.EventHandler(this.serBMS_Load);
- //
- // serCAL
- //
- this.serCAL.BaudRate = 9600;
- this.serCAL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.serCAL.dev = null;
- this.serCAL.Dock = System.Windows.Forms.DockStyle.Top;
- this.serCAL.Location = new System.Drawing.Point(3, 17);
- this.serCAL.Name = "serCAL";
- this.serCAL.PortName = "COM50";
- this.serCAL.Size = new System.Drawing.Size(558, 84);
- this.serCAL.TabIndex = 1;
+ this.button1.Location = new System.Drawing.Point(151, 206);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(86, 38);
+ this.button1.TabIndex = 10;
+ this.button1.Tag = "--";
+ this.button1.Text = "Set";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
@@ -1823,24 +1421,19 @@ namespace AGVEmulator
this.panel10.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.groupBox3.ResumeLayout(false);
- this.panel2.ResumeLayout(false);
- this.panel2.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nudBMSKitNo)).EndInit();
- this.panel3.ResumeLayout(false);
- this.tableLayoutPanel2.ResumeLayout(false);
- this.panel5.ResumeLayout(false);
- this.panel5.PerformLayout();
- this.tableLayoutPanel1.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tableLayoutPanel3.ResumeLayout(false);
this.panel12.ResumeLayout(false);
- this.tabPage3.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
+ this.tabPage3.ResumeLayout(false);
+ this.panel3.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.nudTagNo)).EndInit();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -1853,23 +1446,12 @@ namespace AGVEmulator
private SerialConn serAGV;
private SerialConn serBMS;
private SerialConn serCAL;
- private SerialConn serPLC;
- private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private arCtl.LogTextBox rtBMS;
private arCtl.LogTextBox rtAGV;
private arCtl.LogTextBox rtCAL;
- private arCtl.LogTextBox rtPLC;
private System.Windows.Forms.Panel panel4;
- private System.Windows.Forms.Panel panel2;
- private System.Windows.Forms.Panel panel3;
- private System.Windows.Forms.Button button3;
- private System.Windows.Forms.Button button2;
- private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
- private System.Windows.Forms.Button button8;
- private System.Windows.Forms.Button button6;
- private System.Windows.Forms.Button button7;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TrackBar trackBar1;
private System.Windows.Forms.Label label1;
@@ -1879,30 +1461,10 @@ namespace AGVEmulator
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.CheckBox checkBox1;
- private System.Windows.Forms.RadioButton radioButton1;
- private System.Windows.Forms.RadioButton radioButton6;
- private System.Windows.Forms.RadioButton radioButton5;
- private System.Windows.Forms.RadioButton radioButton4;
- private System.Windows.Forms.RadioButton radioButton3;
- private System.Windows.Forms.RadioButton radioButton2;
- private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
- private System.Windows.Forms.TabPage tabPage3;
- private System.Windows.Forms.Panel panel5;
- private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
- private arFrame.Control.GridView gvdPLCInOut;
- private arFrame.Control.GridView gvdPLCFlag;
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.Button btPLCemg;
- private System.Windows.Forms.Button button10;
- private System.Windows.Forms.Button button9;
- private System.Windows.Forms.Button button11;
- private System.Windows.Forms.Button button12;
- private System.Windows.Forms.Button button13;
private System.Windows.Forms.CheckBox checkBox3;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton radioButton7;
@@ -1938,24 +1500,16 @@ namespace AGVEmulator
private System.Windows.Forms.Button button17;
private System.Windows.Forms.Button button18;
private System.Windows.Forms.NumericUpDown numericUpDown1;
- private System.Windows.Forms.Label label9;
- private System.Windows.Forms.NumericUpDown nudBMSKitNo;
private System.Windows.Forms.Panel panel12;
private UC.AgvViewer agvViewer1;
private System.Windows.Forms.Panel panel13;
private System.Windows.Forms.CheckBox chkSimulation;
- private System.Windows.Forms.RadioButton radioButton20;
- private System.Windows.Forms.RadioButton radioButton21;
- private System.Windows.Forms.RadioButton radioButton18;
- private System.Windows.Forms.RadioButton radioButton19;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton toolStripButton1;
private System.Windows.Forms.ToolStripButton toolStripButton2;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel8;
private System.Windows.Forms.ToolStripStatusLabel sbAGV;
- private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel6;
- private System.Windows.Forms.ToolStripStatusLabel sbPLC;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4;
private System.Windows.Forms.ToolStripStatusLabel sbBMS;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
@@ -1968,6 +1522,18 @@ namespace AGVEmulator
private System.Windows.Forms.Label btc2;
private System.Windows.Forms.Label btc5;
private System.Windows.Forms.Label btc1;
+ private System.Windows.Forms.TabPage tabPage3;
+ private System.Windows.Forms.Panel panel3;
+ private System.Windows.Forms.NumericUpDown nudTagNo;
+ private System.Windows.Forms.Button btacsgoto;
+ private System.Windows.Forms.Button button7;
+ private System.Windows.Forms.Button button8;
+ private System.Windows.Forms.Button button9;
+ private System.Windows.Forms.Button button10;
+ private System.Windows.Forms.Button button11;
+ private System.Windows.Forms.Button button12;
+ private System.Windows.Forms.NumericUpDown numericUpDown2;
+ private System.Windows.Forms.Button button1;
}
}
diff --git a/Emulator/AGVEmulator/Form1.cs b/Emulator/AGVEmulator/Form1.cs
index 3a62d6e..999d35c 100644
--- a/Emulator/AGVEmulator/Form1.cs
+++ b/Emulator/AGVEmulator/Form1.cs
@@ -16,11 +16,10 @@ namespace AGVEmulator
{
public partial class Form1 : Form
{
- arUtil.Log logPLC, logAGV, logBMS, logCAL;
+ arUtil.Log logAGV, logBMS, logCAL;
DevBMS BMS;
DevAGV AGV;
- DevPLC PLC;
- DevCAL CAL;
+ DevXBE XBE;
float BMS_MaxA = 80f;
@@ -34,17 +33,18 @@ namespace AGVEmulator
public Form1()
{
InitializeComponent();
- logPLC = new arUtil.Log();
+ this.Text = $"{Application.ProductName} ver.{Application.ProductVersion}";
+ // logPLC = new arUtil.Log();
logAGV = new arUtil.Log();
logBMS = new arUtil.Log();
logCAL = new arUtil.Log();
- logPLC.FileNameFormat = "{yyyyMMdd}_PLC";
+ // logPLC.FileNameFormat = "{yyyyMMdd}_PLC";
logAGV.FileNameFormat = "{yyyyMMdd}_AGV";
logBMS.FileNameFormat = "{yyyyMMdd}_BMS";
logCAL.FileNameFormat = "{yyyyMMdd}_CAL";
- logPLC.RaiseMsg += (s1, e1, d1) => { this.rtPLC.AddMsg(s1, e1, d1); };
+ // logPLC.RaiseMsg += (s1, e1, d1) => { this.rtPLC.AddMsg(s1, e1, d1); };
logAGV.RaiseMsg += (s1, e1, d1) =>
{
if (d1.StartsWith("Tx"))
@@ -65,7 +65,7 @@ namespace AGVEmulator
new arCtl.sLogMessageColor("TX", Color.Orange),
};
- rtPLC.ColorList = logcolor;
+ //rtPLC.ColorList = logcolor;
rtAGV.ColorList = logcolor;
rtBMS.ColorList = logcolor;
rtCAL.ColorList = logcolor;
@@ -75,77 +75,40 @@ namespace AGVEmulator
BMS = new DevBMS();
AGV = new DevAGV();
- PLC = new DevPLC();
- CAL = new DevCAL();
+ XBE = new DevXBE();
this.serAGV.dev = AGV;
- this.serPLC.dev = PLC;
this.serBMS.dev = BMS;
- this.serCAL.dev = CAL;
+ this.serCAL.dev = XBE;
- BMS.Message += Bms_Message;
- AGV.Message += Bms_Message;
- PLC.Message += Bms_Message;
- CAL.Message += Bms_Message;
+ BMS.Message += BMS_Message;
+ AGV.Message += AGV_Message;
+ XBE.Message += CAL_Message;
BMS.RequestBatteryData += Bms_RequestBatteryData;
BMS.RequestVoltageData += BMS_RequestVoltageData;
- PLC.RequestData += Plc_RequestData;
- PLC.ValueChanged += Plc_ValueChanged;
+ XBE.ProtocReceived += CAL_ProtocReceived;
AGV.RequestStatusData += Agv_RequestStatusData;
AGV.ValueChanged += Agv_ValueChanged;
AGV.StsValueChanged += Agv_StsValueChanged;
AGV.Command += Agv_Command;
-
}
-
-
Random rnd;
private void Form1_Load(object sender, EventArgs e)
{
rnd = new Random(3000);
serAGV.BaudRate = 57600;
- serPLC.BaudRate = 57600;
+ // serPLC.BaudRate = 57600;
trackBar1_Scroll(null, null);
timer1.Start();
//plc inout 이름 설정
List titles = new List();
List values = new List();
- for (int i = 0; i < 16; i++)
- {
- var pin = (DevPLC.DIName)i;
- titles.Add(pin.ToString());
- values.Add(false);
- }
- for (int i = 0; i < 8; i++)
- {
- var pin = (DevPLC.DOName)i;
- titles.Add(pin.ToString());
- values.Add(false);
- }
- this.gvdPLCInOut.setTitle(titles.ToArray());
- this.gvdPLCInOut.setValue(values.ToArray());
- titles.Clear();
- values.Clear();
- for (int i = 0; i < 32; i++)
- {
- titles.Add(i.ToString());
- values.Add(false);
- }
- this.gvdPLCFlag.setTitle(titles.ToArray());
- this.gvdPLCFlag.setValue(values.ToArray());
- this.gvdPLCInOut.ItemClick += GvdPLCInOut_ItemClick;
- this.gvdPLCFlag.ItemClick += GvdPLCFlag_ItemClick;
- this.gvdPLCFlag.ColorList = new arFrame.Control.ColorListItem[] {
- new arFrame.Control.ColorListItem(){ BackColor1 = Color.DimGray, BackColor2 = Color.Gray },
- new arFrame.Control.ColorListItem(){ BackColor1 = Color.Green, BackColor2 = Color.Lime },
- new arFrame.Control.ColorListItem(){ BackColor1 = Color.Red, BackColor2 = Color.Tomato },
- };
- this.gvdPLCInOut.ColorList = this.gvdPLCFlag.ColorList;
+
var arrs = Enum.GetNames(typeof(DevAGV.esystemflag0));
foreach (var item in arrs)
@@ -256,15 +219,7 @@ namespace AGVEmulator
agvViewer1.MarkTouched += AgvViewer1_MarkTouched;
agvViewer1.Command += AgvViewer1_Command;
}
- private void Agv_Command(object sender, commandargs e)
- {
- switch (e.Command.ToLower())
- {
- case "stopmark":
- agvViewer1.StopbyMark = true;
- break;
- }
- }
+
void MakeViewer()
{
//태그목록
@@ -385,143 +340,8 @@ namespace AGVEmulator
button18.PerformClick();
}
- private void Agv_StsValueChanged(object sender, DevAGV.StsValueChangedArgs e)
- {
- Console.WriteLine($"STS [{e.vtype}] VAL={e.Value}");
- if (this.InvokeRequired)
- {
- this.BeginInvoke(new EventHandler(Agv_StsValueChanged), sender, e);
- return;
- }
- switch (e.vtype)
- {
- case DevAGV.estsvaluetype.direction:
- foreach (RadioButton c in this.groupBox5.Controls)
- {
- if (c.Text[0].Equals(e.Value))
- {
- c.Checked = true;
+
- }
- else
- {
- c.Checked = false;
- }
- c.Refresh();
- }
- groupBox5.Refresh();
- break;
- case DevAGV.estsvaluetype.bunki:
- foreach (RadioButton c in this.groupBox2.Controls)
- {
- if (c.Text[0].Equals(e.Value))
- {
- c.Checked = true;
- c.Refresh();
- break;
- }
- }
- break;
- case DevAGV.estsvaluetype.speed:
- foreach (RadioButton c in this.groupBox4.Controls)
- {
- if (c.Text[0].Equals(e.Value))
- {
- c.Checked = true;
- c.Refresh();
- break;
- }
- }
- break;
- case DevAGV.estsvaluetype.sensor:
- foreach (RadioButton c in this.groupBox8.Controls)
- {
- if (c.Text.Equals(e.Value))
- {
- c.Checked = true;
- c.Refresh();
- break;
- }
- }
- break;
- }
- }
-
- private void Agv_ValueChanged(object sender, DevAGV.ValueChangedArgs e)
- {
- if (this.InvokeRequired)
- {
- this.Invoke(new EventHandler(Agv_ValueChanged), sender, e);
- return;
- }
-
- //내부값이 바뀌었다면 컨트롤을 변경해준다.
- switch (e.vtype)
- {
-
- case DevAGV.evaluetype.system0:
- foreach (CheckBox c in panel6.Controls)
- {
- var idx = int.Parse(c.Tag.ToString());
- if (idx == e.Idx)
- {
- c.Checked = e.Value;
- break;
- }
- }
- break;
- case DevAGV.evaluetype.system1:
-
- var v = (DevAGV.esystemflag1)e.Idx;
- if (e.Value)
- {
- if (v == esystemflag1.agv_run)
- {
- agvViewer1.wat.Restart();
- }
- if (v == esystemflag1.agv_stop)
- {
- agvViewer1.wat.Stop();
- }
- }
-
-
- foreach (CheckBox c in panel7.Controls)
- {
- var idx = int.Parse(c.Tag.ToString());
- if (idx == e.Idx)
- {
- c.Checked = e.Value;
- break;
- }
- }
- break;
- case DevAGV.evaluetype.error:
- foreach (CheckBox c in panel9.Controls)
- {
- var idx = int.Parse(c.Tag.ToString());
- if (idx == e.Idx)
- {
- c.Checked = e.Value;
- break;
- }
- }
- break;
- case DevAGV.evaluetype.signal:
- foreach (CheckBox c in panel8.Controls)
- {
- var idx = int.Parse(c.Tag.ToString());
- if (idx == e.Idx)
- {
- c.Checked = e.Value;
- break;
- }
- }
- break;
-
-
- }
- }
char GetGroupItemCheckbox(GroupBox grp)
{
@@ -544,60 +364,7 @@ namespace AGVEmulator
int PLC_LeftDir = 0;
int PLC_RightDir = 0;
- private void Plc_ValueChanged(object sender, DevPLC.ValueChangedArgs e)
- {
- if (e.IsOut)
- {
- this.gvdPLCInOut.setValue(e.Idx + 16, e.Value);
- var doname = (DevPLC.DOName)e.Idx;
- switch (doname)
- {
- case DevPLC.DOName.PINO_GUIDEMOTOR_RRUN:
- break;
- case DevPLC.DOName.PINO_GUIDEMOTOR_LRUN:
- break;
- }
- }
- else
- {
- this.gvdPLCInOut.setValue(e.Idx, e.Value);
-
- }
- this.gvdPLCInOut.Invalidate();
- }
-
- private void Plc_RequestData(object sender, DevPLC.RequestBatteryDataArgs e)
- {
- var idx = 0;
- UInt32 val = 0;
- foreach (var data in gvdPLCInOut.Values)
- {
- SetBit(ref val, idx++, (data > 0));
- }
- e.IOValue = val;
- idx = 0;
- val = 0;
- foreach (var data in gvdPLCFlag.Values)
- {
- SetBit(ref val, idx++, (data > 0));
- }
- e.FGValue = val;
- }
-
- public void SetBit(ref UInt32 _value, int idx, Boolean value)
- {
- if (value)
- {
- var offset = (UInt32)(1 << idx);
- _value = _value | offset;
- }
- else
- {
- var offset = (UInt32)(~(1 << idx));
- _value = _value & offset;
- }
- }
public void SetBit(ref UInt16 _value, int idx, Boolean value)
{
if (value)
@@ -644,76 +411,8 @@ namespace AGVEmulator
- private void Agv_RequestStatusData(object sender, DevAGV.RequestStatusDataArgs e)
- {
- //UInt16 system0 = 0xFFFF;
- //UInt16 system1 = 0xFFFF;
- //UInt16 error = 0xFFFF;
- //byte signal = 0xFF;
-
- aaplycheckboxbit(ref AGV.system0, panel6);
- aaplycheckboxbit(ref AGV.system1, panel7);
- aaplycheckboxbit(ref AGV.error, panel9);
- aaplycheckboxbit(ref AGV.signal, panel8);
-
- if (this.agvViewer1.StopbyMark) AGV.sts_speed = 'S';
- else AGV.sts_speed = GetGroupItemCheckbox(groupBox4);
- AGV.sts_bunki = GetGroupItemCheckbox(groupBox2);
- AGV.sts_dir = GetGroupItemCheckbox(groupBox5);
- AGV.sts_sensor = GetGroupItemCheckbox(groupBox8);
-
- //this.Invoke(new Action(() =>
- //{
- // e.system0 = system0;
- // e.system1 = system1;
- // e.error = error;
- // e.signal = signal;
- // e.speed = GetGroupItemCheckbox(groupBox4);
- // e.bunki = GetGroupItemCheckbox(groupBox2);
- // e.direction = GetGroupItemCheckbox(groupBox5);
- // e.sensor = GetGroupItemCheckbox(groupBox8);
-
- // e.volt = 23.4f;
- //}));
- }
- private void BMS_RequestVoltageData(object sender, DevBMS.RequestVoltageDataArgs e)
- {
-
- //cell전압값추가
- for (int i = 0; i < cellvolt.Length; i++)
- {
- this.cellvolt[i] = (UInt16)rnd.Next(3300, 3350);
- }
- Array.Copy(this.cellvolt, 0, e.cellVolt, 0, 8);
- this.btc1.Invoke(new Action(() => {
- var idx = 0;
- btc1.Text = (this.cellvolt[idx++] / 1000f).ToString();
- btc2.Text = (this.cellvolt[idx++] / 1000f).ToString();
- btc3.Text = (this.cellvolt[idx++] / 1000f).ToString();
- btc4.Text = (this.cellvolt[idx++] / 1000f).ToString();
- btc5.Text = (this.cellvolt[idx++] / 1000f).ToString();
- btc6.Text = (this.cellvolt[idx++] / 1000f).ToString();
- btc7.Text = (this.cellvolt[idx++] / 1000f).ToString();
- btc8.Text = (this.cellvolt[idx++] / 1000f).ToString();
- }));
-
- }
- private void Bms_RequestBatteryData(object sender, DevBMS.RequestBatteryDataArgs e)
- {
- if (checkBox1.Checked)
- this.trackBar1.Invoke(new Action(() =>
- {
- this.trackBar1.Value -= 1;
- trackBar1_Scroll(null, null);
- }));
-
- e.CurA = (int)BMS_CurA;
- e.MaxA = (int)BMS_MaxA;
- e.Remain = BMS_Remain;
- e.Volt = BMS_Volt;
-
- }
-
+
+
private void button5_Click(object sender, EventArgs e)
{
AGV.WriteData("ACK");
@@ -724,43 +423,7 @@ namespace AGVEmulator
AGV.WriteData("NAK");
}
- private void button7_Click(object sender, EventArgs e)
- {
- var pinL = DevPLC.DOName.PINO_GUIDEMOTOR_LRUN;
- var pinR = DevPLC.DOName.PINO_GUIDEMOTOR_RRUN;
- var pinDL = DevPLC.DOName.PINO_GUIDEMOTOR_LDIR;
- var pinDR = DevPLC.DOName.PINO_GUIDEMOTOR_RDIR;
- this.gvdPLCInOut.setValue((int)pinDL + 16, true);
- this.gvdPLCInOut.setValue((int)pinDR + 16, true);
- this.gvdPLCInOut.setValue((int)pinL + 16, true);
- this.gvdPLCInOut.setValue((int)pinR + 16, true);
- this.gvdPLCInOut.Invalidate();
- }
-
- private void button6_Click(object sender, EventArgs e)
- {
- var pinL = DevPLC.DOName.PINO_GUIDEMOTOR_LRUN;
- var pinR = DevPLC.DOName.PINO_GUIDEMOTOR_RRUN;
- var cur = gvdPLCInOut.Values[(int)pinL + 16];
- this.gvdPLCInOut.setValue((int)pinL + 16, false);
- this.gvdPLCInOut.setValue((int)pinR + 16, false);
- this.gvdPLCInOut.Invalidate();
- }
-
- private void button8_Click(object sender, EventArgs e)
- {
- var pinL = DevPLC.DOName.PINO_GUIDEMOTOR_LRUN;
- var pinR = DevPLC.DOName.PINO_GUIDEMOTOR_RRUN;
- var pinDL = DevPLC.DOName.PINO_GUIDEMOTOR_LDIR;
- var pinDR = DevPLC.DOName.PINO_GUIDEMOTOR_RDIR;
-
- this.gvdPLCInOut.setValue((int)pinDL + 16, false);
- this.gvdPLCInOut.setValue((int)pinDR + 16, false);
- this.gvdPLCInOut.setValue((int)pinL + 16, true);
- this.gvdPLCInOut.setValue((int)pinR + 16, true);
- this.gvdPLCInOut.Invalidate();
- }
private void trackBar1_Scroll(object sender, EventArgs e)
{
@@ -780,14 +443,14 @@ namespace AGVEmulator
{
timer1.Stop();
sbAGV.ForeColor = AGV.IsOpen ? Color.ForestGreen : Color.Red;
- sbPLC.ForeColor = PLC.IsOpen ? Color.ForestGreen : Color.Red;
+ // sbPLC.ForeColor = PLC.IsOpen ? Color.ForestGreen : Color.Red;
sbBMS.ForeColor = BMS.IsOpen ? Color.ForestGreen : Color.Red;
- sbCAL.ForeColor = CAL.IsOpen ? Color.ForestGreen : Color.Red;
+ sbCAL.ForeColor = XBE.IsOpen ? Color.ForestGreen : Color.Red;
- if (checkBox2.Checked && PLC != null && PLC.IsOpen) PLC.AutoSendData(); //자동전송해야함
+ //if (checkBox2.Checked && PLC != null && PLC.IsOpen) PLC.AutoSendData(); //자동전송해야함
if (checkBox3.Checked && AGV != null && AGV.IsOpen) AGV.AutoSendData(); //자동전송해야함
if (BMS != null && BMS.IsOpen) BMS.AutoSendData(); //자동전송해야함
- if (CAL != null && CAL.IsOpen) CAL.AutoSendData(); //자동전송해야함
+ if (XBE != null && XBE.IsOpen) XBE.AutoSendData(); //자동전송해야함
if (chkSimulation.Checked && AGV.GetAGV(esystemflag1.agv_run))
{
@@ -805,202 +468,23 @@ namespace AGVEmulator
agvViewer1.Invalidate();
}
- UpdatePLC();
- label7.Text = $"I/O L({PLC_LeftPosition}),R({PLC_RightPosition})";
timer1.Start();
}
- void UpdatePLC()
- {
- //plc값을 업데이트해준다.
- var LRun = gvdPLCInOut.getValue((int)DevPLC.DOName.PINO_GUIDEMOTOR_LRUN + 16) == 1;
- var RRun = gvdPLCInOut.getValue((int)DevPLC.DOName.PINO_GUIDEMOTOR_RRUN + 16) == 1;
- var LDir = gvdPLCInOut.getValue((int)DevPLC.DOName.PINO_GUIDEMOTOR_LDIR + 16) == 1;
- var RDir = gvdPLCInOut.getValue((int)DevPLC.DOName.PINO_GUIDEMOTOR_RDIR + 16) == 1;
-
- if (LRun == false) this.PLC_LeftDir = 0;
- else if (LDir == true) this.PLC_LeftDir = 1;
- else this.PLC_LeftDir = -1;
-
- if (RRun == false) this.PLC_RightDir = 0;
- else if (RDir == true) this.PLC_RightDir = 1;
- else this.PLC_RightDir = -1;
-
- this.PLC_LeftPosition += this.PLC_LeftDir;
- this.PLC_RightPosition += this.PLC_RightDir;
-
- var maxvalue = 20;
- if (PLC_LeftPosition >= maxvalue)
- {
- PLC_LeftPosition = maxvalue;
- PLC_LeftDir = 0;//멈춤
- var idx = (int)DevPLC.DOName.PINO_GUIDEMOTOR_LRUN;
- gvdPLCInOut.setValue(idx + 16, false);
- idx = (int)DevPLC.DIName.PINI_LIMIT_LD;
- gvdPLCInOut.setValue(idx, false);
- idx = (int)DevPLC.DIName.PINI_LIMIT_LU;
- gvdPLCInOut.setValue(idx, true);
- }
- else if (PLC_LeftPosition <= 0)
- {
- PLC_LeftPosition = 0;
- PLC_LeftDir = 0;
- var idx = (int)DevPLC.DOName.PINO_GUIDEMOTOR_LRUN;
- gvdPLCInOut.setValue(idx + 16, false);
- idx = (int)DevPLC.DIName.PINI_LIMIT_LU;
- gvdPLCInOut.setValue(idx, false);
- idx = (int)DevPLC.DIName.PINI_LIMIT_LD;
- gvdPLCInOut.setValue(idx, true);
- }
- else if (PLC_LeftPosition > 5 && PLC_LeftPosition < maxvalue - 5)
- {
- if (gvdPLCInOut.getValue((int)DevPLC.DIName.PINI_LIMIT_LD) > 0)
- gvdPLCInOut.setValue((int)DevPLC.DIName.PINI_LIMIT_LD, false);
- if (gvdPLCInOut.getValue((int)DevPLC.DIName.PINI_LIMIT_LU) > 0)
- gvdPLCInOut.setValue((int)DevPLC.DIName.PINI_LIMIT_LU, false);
- }
-
- if (PLC_RightPosition >= maxvalue)
- {
- PLC_RightPosition = maxvalue;
- PLC_RightDir = 0;//멈춤
- var idx = (int)DevPLC.DOName.PINO_GUIDEMOTOR_RRUN;
- gvdPLCInOut.setValue(idx + 16, false);
- idx = (int)DevPLC.DIName.PINI_LIMIT_RD;
- gvdPLCInOut.setValue(idx, false);
- idx = (int)DevPLC.DIName.PINI_LIMIT_RU;
- gvdPLCInOut.setValue(idx, true);
- }
- else if (PLC_RightPosition <= 0)
- {
- PLC_RightPosition = 0;
- PLC_RightDir = 0;
- var idx = (int)DevPLC.DOName.PINO_GUIDEMOTOR_RRUN;
- gvdPLCInOut.setValue(idx + 16, false);
- idx = (int)DevPLC.DIName.PINI_LIMIT_RU;
- gvdPLCInOut.setValue(idx, false);
- idx = (int)DevPLC.DIName.PINI_LIMIT_RD;
- gvdPLCInOut.setValue(idx, true);
- }
- else if (PLC_RightPosition > 5 && PLC_RightPosition < maxvalue - 5)
- {
- if (gvdPLCInOut.getValue((int)DevPLC.DIName.PINI_LIMIT_RD) > 0)
- gvdPLCInOut.setValue((int)DevPLC.DIName.PINI_LIMIT_RD, false);
- if (gvdPLCInOut.getValue((int)DevPLC.DIName.PINI_LIMIT_RU) > 0)
- gvdPLCInOut.setValue((int)DevPLC.DIName.PINI_LIMIT_RU, false);
- }
- }
- private void Bms_Message(object sender, AR.Dev.RS232.MessageEventArgs e)
- {
- var dev = sender as AR.Dev.RS232;
- if (dev is DevBMS)
- {
- logBMS.Add(e.Message);
- }
- else if (dev is DevAGV)
- {
- logAGV.Add(e.Message);
- }
- else if (dev is DevPLC)
- {
- logPLC.Add(e.Message);
- }
- else if (dev is DevCAL)
- {
- if (e.MsgType == AR.Dev.RS232.MessageType.Send)
- logCAL.Add(">> " + e.Data.HexString());
- else if (e.MsgType == AR.Dev.RS232.MessageType.Recv)
- logCAL.Add("<< " + e.Data.HexString());
- else logCAL.Add(e.Message);
- }
- }
+
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
timer1.Stop();
- logPLC.Flush();
logAGV.Flush();
logBMS.Flush();
logCAL.Flush();
}
- private void btPLCemg_Click(object sender, EventArgs e)
- {
- var pin = DevPLC.DIName.PINI_EMG;
- var cur = gvdPLCInOut.Values[(int)pin];
- this.gvdPLCInOut.setValue((int)pin, cur == 0);
- this.gvdPLCInOut.Invalidate();
- }
- private void button9_Click(object sender, EventArgs e)
- {
- var pinL = DevPLC.DIName.PINI_LIMIT_LU;
- var pinR = DevPLC.DIName.PINI_LIMIT_RU;
- var cur = gvdPLCInOut.Values[(int)pinL];
- this.gvdPLCInOut.setValue((int)pinL, cur == 0);
- this.gvdPLCInOut.setValue((int)pinR, cur == 0);
-
- pinL = DevPLC.DIName.PINI_LIMIT_LD;
- pinR = DevPLC.DIName.PINI_LIMIT_RD;
- this.gvdPLCInOut.setValue((int)pinL, false);
- this.gvdPLCInOut.setValue((int)pinR, false);
- this.gvdPLCInOut.Invalidate();
- }
-
- private void button10_Click(object sender, EventArgs e)
- {
- var pinL = DevPLC.DIName.PINI_LIMIT_LD;
- var pinR = DevPLC.DIName.PINI_LIMIT_RD;
- var cur = gvdPLCInOut.Values[(int)pinL];
- this.gvdPLCInOut.setValue((int)pinL, cur == 0);
- this.gvdPLCInOut.setValue((int)pinR, cur == 0);
-
-
- pinL = DevPLC.DIName.PINI_LIMIT_LU;
- pinR = DevPLC.DIName.PINI_LIMIT_RU;
- this.gvdPLCInOut.setValue((int)pinL, false);
- this.gvdPLCInOut.setValue((int)pinR, false);
-
-
- this.gvdPLCInOut.Invalidate();
- }
-
- private void button13_Click(object sender, EventArgs e)
- {
- var pinL = DevPLC.DIName.PINI_BTN_1;
- var cur = gvdPLCInOut.Values[(int)pinL];
- this.gvdPLCInOut.setValue((int)pinL, cur == 0);
- this.gvdPLCInOut.Invalidate();
- }
-
- private void button12_Click(object sender, EventArgs e)
- {
- var pinL = DevPLC.DIName.PINI_BTN_2;
- var cur = gvdPLCInOut.Values[(int)pinL];
- this.gvdPLCInOut.setValue((int)pinL, cur == 0);
- this.gvdPLCInOut.Invalidate();
- }
-
- private void button11_Click(object sender, EventArgs e)
- {
- var pinL = DevPLC.DIName.PINI_BTN_3;
- var cur = gvdPLCInOut.Values[(int)pinL];
- this.gvdPLCInOut.setValue((int)pinL, cur == 0);
- this.gvdPLCInOut.Invalidate();
- }
-
- private void panel4_Paint(object sender, PaintEventArgs e)
- {
-
- }
-
- private void groupBox9_Enter(object sender, EventArgs e)
- {
-
- }
private void button14_Click(object sender, EventArgs e)
{
@@ -1069,29 +553,6 @@ namespace AGVEmulator
AGV.SendTag(numericUpDown1.Value.ToString());
}
- private void button1_Click(object sender, EventArgs e)
- {
- var bt = sender as Button;
- var kitno = nudBMSKitNo.Value.ToString()[0];
- var value = bt.Tag.ToString()[0];
- var barr = new List();
- barr.Add(0x02);
- barr.Add((byte)kitno);
- barr.Add((byte)value);
- barr.Add(0x03);
- CAL.WriteData(barr.ToArray());
- }
-
- private void serAGV_Load(object sender, EventArgs e)
- {
-
- }
-
- private void agvViewer1_Click(object sender, EventArgs e)
- {
-
- }
-
private void agvViewer1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
@@ -1104,17 +565,21 @@ namespace AGVEmulator
}
}
- private void radioButton20_Click(object sender, EventArgs e)
+ private void button6_Click(object sender, EventArgs e)
{
- var rad = sender as RadioButton;
- var kitno = int.Parse(rad.Text);
- nudBMSKitNo.Value = (decimal)kitno;
+ var tagno =(uint) nudTagNo.Value;
+ this.XBE.SendGotoTag(tagno);
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ var tagno = (uint)numericUpDown2.Value;
+ this.XBE.SendCurrentPos(tagno);
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
serAGV.Connect();
- serPLC.Connect();
serBMS.Connect();
serCAL.Connect();
}
@@ -1122,33 +587,10 @@ namespace AGVEmulator
private void toolStripButton2_Click(object sender, EventArgs e)
{
serAGV.Disconnect();
- serPLC.Disconnect();
serBMS.Disconnect();
serCAL.Disconnect();
}
- private void serBMS_Load(object sender, EventArgs e)
- {
- }
-
- void checkboxevent()
- {
-
- }
-
- private void GvdPLCFlag_ItemClick(object sender, arFrame.Control.GridView.ItemClickEventArgs e)
- {
- var newvalue = gvdPLCFlag.Values[e.idx];
- this.gvdPLCFlag.setValue(e.idx, (ushort)(newvalue == 0 ? 1 : 0));
- this.gvdPLCFlag.Invalidate();
- }
-
- private void GvdPLCInOut_ItemClick(object sender, arFrame.Control.GridView.ItemClickEventArgs e)
- {
- var newvalue = gvdPLCInOut.Values[e.idx];
- this.gvdPLCInOut.setValue(e.idx, (ushort)(newvalue == 0 ? 1 : 0));
- this.gvdPLCInOut.Invalidate();
- }
}
}
diff --git a/Emulator/AGVEmulator/Properties/AssemblyInfo.cs b/Emulator/AGVEmulator/Properties/AssemblyInfo.cs
index abd4775..9f52bd4 100644
--- a/Emulator/AGVEmulator/Properties/AssemblyInfo.cs
+++ b/Emulator/AGVEmulator/Properties/AssemblyInfo.cs
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
-[assembly: Guid("9312ab43-72f6-4365-a266-e767215fa7f5")]
+[assembly: Guid("9312ab43-72f6-FF65-a266-e767215fa7f5")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
diff --git a/Emulator/AGVEmulator/RS232.cs b/Emulator/AGVEmulator/RS232.cs
index 04dba53..ee2306d 100644
--- a/Emulator/AGVEmulator/RS232.cs
+++ b/Emulator/AGVEmulator/RS232.cs
@@ -305,6 +305,10 @@ namespace AR.Dev
///
public event EventHandler Message;
+ public void RaiseMessage(bool iserr, string message)
+ {
+ Message?.Invoke(this, new MessageEventArgs(message, iserr));
+ }
#endregion
#region "Event Args"
@@ -428,7 +432,7 @@ namespace AR.Dev
///
/// 포트에 쓰기(barcode_DataReceived 이벤트로 메세지수신)
///
- public Boolean WriteData(byte[] data)
+ public Boolean WriteData(byte[] data, bool useLog=true)
{
Boolean bRet = false;
@@ -457,7 +461,7 @@ namespace AR.Dev
//_device.Write(data, 0, data.Length);
//171113
- this.Message?.Invoke(this, new MessageEventArgs(data, false));
+ if(useLog) this.Message?.Invoke(this, new MessageEventArgs(data, false));
bRet = true;
WriteError = 0;
diff --git a/Emulator/AGVEmulator/RunCode/_AGV.cs b/Emulator/AGVEmulator/RunCode/_AGV.cs
new file mode 100644
index 0000000..8bc4e4b
--- /dev/null
+++ b/Emulator/AGVEmulator/RunCode/_AGV.cs
@@ -0,0 +1,214 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using static AGVEmulator.DevAGV;
+
+
+namespace AGVEmulator
+{
+ public partial class Form1
+ {
+ private void Agv_Command(object sender, commandargs e)
+ {
+ switch (e.Command.ToLower())
+ {
+ case "stopmark":
+ agvViewer1.StopbyMark = true;
+ break;
+ }
+ }
+ private void Agv_StsValueChanged(object sender, DevAGV.StsValueChangedArgs e)
+ {
+ Console.WriteLine($"STS [{e.vtype}] VAL={e.Value}");
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new EventHandler(Agv_StsValueChanged), sender, e);
+ return;
+ }
+ switch (e.vtype)
+ {
+ case DevAGV.estsvaluetype.direction:
+ foreach (RadioButton c in this.groupBox5.Controls)
+ {
+ if (c.Text[0].Equals(e.Value))
+ {
+ c.Checked = true;
+
+ }
+ else
+ {
+ c.Checked = false;
+ }
+ c.Refresh();
+ }
+ groupBox5.Refresh();
+ break;
+ case DevAGV.estsvaluetype.bunki:
+ foreach (RadioButton c in this.groupBox2.Controls)
+ {
+ if (c.Text[0].Equals(e.Value))
+ {
+ c.Checked = true;
+ c.Refresh();
+ break;
+ }
+ }
+ break;
+ case DevAGV.estsvaluetype.speed:
+ foreach (RadioButton c in this.groupBox4.Controls)
+ {
+ if (c.Text[0].Equals(e.Value))
+ {
+ c.Checked = true;
+ c.Refresh();
+ break;
+ }
+ }
+ break;
+ case DevAGV.estsvaluetype.sensor:
+ foreach (RadioButton c in this.groupBox8.Controls)
+ {
+ if (c.Text.Equals(e.Value))
+ {
+ c.Checked = true;
+ c.Refresh();
+ break;
+ }
+ }
+ break;
+ }
+ }
+
+ private void Agv_ValueChanged(object sender, DevAGV.ValueChangedArgs e)
+ {
+ if (this.InvokeRequired)
+ {
+ this.Invoke(new EventHandler(Agv_ValueChanged), sender, e);
+ return;
+ }
+
+ //내부값이 바뀌었다면 컨트롤을 변경해준다.
+ switch (e.vtype)
+ {
+
+ case DevAGV.evaluetype.system0:
+ foreach (CheckBox c in panel6.Controls)
+ {
+ var idx = int.Parse(c.Tag.ToString());
+ if (idx == e.Idx)
+ {
+ c.Checked = e.Value;
+ break;
+ }
+ }
+ break;
+ case DevAGV.evaluetype.system1:
+
+ var v = (DevAGV.esystemflag1)e.Idx;
+ if (e.Value)
+ {
+ if (v == esystemflag1.agv_run)
+ {
+ agvViewer1.wat.Restart();
+ }
+ if (v == esystemflag1.agv_stop)
+ {
+ agvViewer1.wat.Stop();
+ }
+ }
+
+
+ foreach (CheckBox c in panel7.Controls)
+ {
+ var idx = int.Parse(c.Tag.ToString());
+ if (idx == e.Idx)
+ {
+ c.Checked = e.Value;
+ break;
+ }
+ }
+ break;
+ case DevAGV.evaluetype.error:
+ foreach (CheckBox c in panel9.Controls)
+ {
+ var idx = int.Parse(c.Tag.ToString());
+ if (idx == e.Idx)
+ {
+ c.Checked = e.Value;
+ break;
+ }
+ }
+ break;
+ case DevAGV.evaluetype.signal:
+ foreach (CheckBox c in panel8.Controls)
+ {
+ var idx = int.Parse(c.Tag.ToString());
+ if (idx == e.Idx)
+ {
+ c.Checked = e.Value;
+ break;
+ }
+ }
+ break;
+
+
+ }
+ }
+
+ private void Agv_RequestStatusData(object sender, DevAGV.RequestStatusDataArgs e)
+ {
+ //UInt16 system0 = 0xFFFF;
+ //UInt16 system1 = 0xFFFF;
+ //UInt16 error = 0xFFFF;
+ //byte signal = 0xFF;
+
+ aaplycheckboxbit(ref AGV.system0, panel6);
+ aaplycheckboxbit(ref AGV.system1, panel7);
+ aaplycheckboxbit(ref AGV.error, panel9);
+ aaplycheckboxbit(ref AGV.signal, panel8);
+
+ if (this.agvViewer1.StopbyMark) AGV.sts_speed = 'S';
+ else AGV.sts_speed = GetGroupItemCheckbox(groupBox4);
+ AGV.sts_bunki = GetGroupItemCheckbox(groupBox2);
+ AGV.sts_dir = GetGroupItemCheckbox(groupBox5);
+ AGV.sts_sensor = GetGroupItemCheckbox(groupBox8);
+
+ //this.Invoke(new Action(() =>
+ //{
+ // e.system0 = system0;
+ // e.system1 = system1;
+ // e.error = error;
+ // e.signal = signal;
+ // e.speed = GetGroupItemCheckbox(groupBox4);
+ // e.bunki = GetGroupItemCheckbox(groupBox2);
+ // e.direction = GetGroupItemCheckbox(groupBox5);
+ // e.sensor = GetGroupItemCheckbox(groupBox8);
+
+ // e.volt = 23.4f;
+ //}));
+ }
+ private void AGV_Message(object sender, AR.Dev.RS232.MessageEventArgs e)
+ {
+ var dev = sender as AR.Dev.RS232;
+ if (dev is DevBMS)
+ {
+ logBMS.Add(e.Message);
+ }
+ else if (dev is DevAGV)
+ {
+ logAGV.Add(e.Message);
+ }
+ else if (dev is DevXBE)
+ {
+ if (e.MsgType == AR.Dev.RS232.MessageType.Send)
+ logCAL.Add(">> " + e.Data.HexString());
+ else if (e.MsgType == AR.Dev.RS232.MessageType.Recv)
+ logCAL.Add("<< " + e.Data.HexString());
+ else logCAL.Add(e.Message);
+ }
+ }
+ }
+}
diff --git a/Emulator/AGVEmulator/RunCode/_BMS.cs b/Emulator/AGVEmulator/RunCode/_BMS.cs
new file mode 100644
index 0000000..b1cd756
--- /dev/null
+++ b/Emulator/AGVEmulator/RunCode/_BMS.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+
+namespace AGVEmulator
+{
+ public partial class Form1
+ {
+ private void BMS_Message(object sender, AR.Dev.RS232.MessageEventArgs e)
+ {
+
+ logBMS.Add(e.Message);
+
+ }
+
+ private void BMS_RequestVoltageData(object sender, DevBMS.RequestVoltageDataArgs e)
+ {
+
+ //cell전압값추가
+ for (int i = 0; i < cellvolt.Length; i++)
+ {
+ this.cellvolt[i] = (UInt16)rnd.Next(3300, 3350);
+ }
+ Array.Copy(this.cellvolt, 0, e.cellVolt, 0, 8);
+ this.btc1.Invoke(new Action(() =>
+ {
+ var idx = 0;
+ btc1.Text = (this.cellvolt[idx++] / 1000f).ToString();
+ btc2.Text = (this.cellvolt[idx++] / 1000f).ToString();
+ btc3.Text = (this.cellvolt[idx++] / 1000f).ToString();
+ btc4.Text = (this.cellvolt[idx++] / 1000f).ToString();
+ btc5.Text = (this.cellvolt[idx++] / 1000f).ToString();
+ btc6.Text = (this.cellvolt[idx++] / 1000f).ToString();
+ btc7.Text = (this.cellvolt[idx++] / 1000f).ToString();
+ btc8.Text = (this.cellvolt[idx++] / 1000f).ToString();
+ }));
+
+ }
+ private void Bms_RequestBatteryData(object sender, DevBMS.RequestBatteryDataArgs e)
+ {
+ if (checkBox1.Checked)
+ this.trackBar1.Invoke(new Action(() =>
+ {
+ this.trackBar1.Value -= 1;
+ trackBar1_Scroll(null, null);
+ }));
+
+ e.CurA = (int)BMS_CurA;
+ e.MaxA = (int)BMS_MaxA;
+ e.Remain = BMS_Remain;
+ e.Volt = BMS_Volt;
+
+ }
+
+ }
+}
diff --git a/Emulator/AGVEmulator/RunCode/_XBEE.cs b/Emulator/AGVEmulator/RunCode/_XBEE.cs
new file mode 100644
index 0000000..7fe38dd
--- /dev/null
+++ b/Emulator/AGVEmulator/RunCode/_XBEE.cs
@@ -0,0 +1,40 @@
+using ENIG;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+
+namespace AGVEmulator
+{
+ public partial class Form1
+ {
+
+ private void CAL_Message(object sender, AR.Dev.RS232.MessageEventArgs e)
+ {
+
+ if (e.MsgType == AR.Dev.RS232.MessageType.Send)
+ logCAL.Add(">> " + System.Text.Encoding.Default.GetString(e.Data));
+ else if (e.MsgType == AR.Dev.RS232.MessageType.Recv)
+ logCAL.Add("<< " + System.Text.Encoding.Default.GetString( e.Data));
+ else logCAL.Add(e.Message);
+
+ }
+ private void CAL_ProtocReceived(object sender, ENIG.EEProtocol.DataEventArgs e)
+ {
+ //throw new NotImplementedException();
+ var dev = (DeviceType)e.ReceivedPacket.ID;
+ if (dev == DeviceType.AGV1 || dev == DeviceType.AGV2)
+ {
+ //agv에서 들어오는 데이터
+ var cmd = e.ReceivedPacket.Command;
+ if(cmd == 3)
+ {
+ //status
+ }
+ }
+ }
+ }
+}