..
This commit is contained in:
@@ -173,7 +173,7 @@
|
|||||||
<DependentUpon>DataSet1.xsd</DependentUpon>
|
<DependentUpon>DataSet1.xsd</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Device\CFlag.cs" />
|
<Compile Include="Device\CFlag.cs" />
|
||||||
<Compile Include="Device\Xbee.cs" />
|
<Compile Include="Device\xbee.cs" />
|
||||||
<Compile Include="Device\Socket.cs" />
|
<Compile Include="Device\Socket.cs" />
|
||||||
<Compile Include="Dialog\fCounter.cs">
|
<Compile Include="Dialog\fCounter.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
@@ -264,7 +264,6 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="PUB.cs" />
|
<Compile Include="PUB.cs" />
|
||||||
<Compile Include="CSetting.cs" />
|
<Compile Include="CSetting.cs" />
|
||||||
<Compile Include="StateMachine\Display\GetErrorMessage.cs" />
|
|
||||||
<Compile Include="StateMachine\Step\_SM_RUN_CHGOFF.cs">
|
<Compile Include="StateMachine\Step\_SM_RUN_CHGOFF.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -298,6 +297,9 @@
|
|||||||
<Compile Include="StateMachine\Step\_SM_RUN_INIT.cs">
|
<Compile Include="StateMachine\Step\_SM_RUN_INIT.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="StateMachine\_Xbee.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="StateMachine\_DIO.cs">
|
<Compile Include="StateMachine\_DIO.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -328,8 +330,6 @@
|
|||||||
<Compile Include="StateMachine\DisplayTextHandler.cs">
|
<Compile Include="StateMachine\DisplayTextHandler.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Util.cs" />
|
|
||||||
<Compile Include="Util_FG.cs" />
|
|
||||||
<Compile Include="ViewForm\fBms.cs">
|
<Compile Include="ViewForm\fBms.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -547,7 +547,9 @@
|
|||||||
<Name>ENIGProtocol</Name>
|
<Name>ENIGProtocol</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<Folder Include="StateMachine\Display\" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>rem xcopy "$(TargetDir)*.exe" "\\192.168.1.80\Amkor\AGV2" /Y
|
<PostBuildEvent>rem xcopy "$(TargetDir)*.exe" "\\192.168.1.80\Amkor\AGV2" /Y
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Drawing.Design;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.IO.Ports;
|
using System.IO.Ports;
|
||||||
|
using AR;
|
||||||
|
|
||||||
namespace Project
|
namespace Project
|
||||||
{
|
{
|
||||||
@@ -413,7 +414,7 @@ namespace Project
|
|||||||
|
|
||||||
if (Language.isEmpty()) Language = "Kor";
|
if (Language.isEmpty()) Language = "Kor";
|
||||||
if (Password_Setup.isEmpty()) Password_Setup = "0000";
|
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;
|
if (musicvol == 0) musicvol = 50;
|
||||||
|
|
||||||
|
|
||||||
@@ -565,7 +566,7 @@ namespace Project
|
|||||||
|
|
||||||
public CounterSetting()
|
public CounterSetting()
|
||||||
{
|
{
|
||||||
this.filename = Util.CurrentPath + "counter.xml";
|
this.filename = AR.UTIL.CurrentPath + "counter.xml";
|
||||||
}
|
}
|
||||||
public override void AfterLoad()
|
public override void AfterLoad()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
// SrcText = s;
|
// SrcText = s;
|
||||||
// Check_error(SrcText);
|
// Check_error(SrcText);
|
||||||
// if (this.isError)
|
// 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 = "";
|
// protected string Buffer1 = "";
|
||||||
@@ -395,7 +395,7 @@
|
|||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
|
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
|
||||||
// Util.MsgE(Param1, MsgBoxStyle.Information, "확인");
|
// UTIL.MsgE(Param1, MsgBoxStyle.Information, "확인");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// break;
|
// break;
|
||||||
@@ -718,7 +718,7 @@
|
|||||||
// case "SAVE1":
|
// case "SAVE1":
|
||||||
// {
|
// {
|
||||||
// if (ParamList.Count < 1)
|
// if (ParamList.Count < 1)
|
||||||
// Util.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
|
// UTIL.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
|
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
|
||||||
@@ -731,7 +731,7 @@
|
|||||||
// case "SAVE2":
|
// case "SAVE2":
|
||||||
// {
|
// {
|
||||||
// if (ParamList.Count < 1)
|
// if (ParamList.Count < 1)
|
||||||
// Util.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
|
// UTIL.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
|
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
|
||||||
@@ -744,7 +744,7 @@
|
|||||||
// case "SAVE3":
|
// case "SAVE3":
|
||||||
// {
|
// {
|
||||||
// if (ParamList.Count < 1)
|
// if (ParamList.Count < 1)
|
||||||
// Util.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
|
// UTIL.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
|
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
|
||||||
@@ -757,7 +757,7 @@
|
|||||||
// case "SAVE4":
|
// case "SAVE4":
|
||||||
// {
|
// {
|
||||||
// if (ParamList.Count < 1)
|
// if (ParamList.Count < 1)
|
||||||
// Util.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
|
// UTIL.MsgE("SAVE1 함수에 1개의 파라미터가 없습니다");
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
|
// object Param1 = RunParam(ParamList[0].ToString(), NEwValue.ToString());
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Drawing;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Project.StateMachine;
|
using Project.StateMachine;
|
||||||
|
using AR;
|
||||||
|
|
||||||
namespace Project
|
namespace Project
|
||||||
{
|
{
|
||||||
@@ -174,7 +175,7 @@ namespace Project
|
|||||||
public void SetResultMessage(eResult code, eECode err, eNextStep systempause, params object[] args)
|
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);
|
var codeMSg = $"[E{(int)err}] ";// + Util.GetResultCodeMessage(code);
|
||||||
if (err == eECode.MESSAGE_ERROR)
|
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;
|
var msg = codeMSg + erMsg;
|
||||||
|
|
||||||
this.ResultCode = code;
|
this.ResultCode = code;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using System.Security.Cryptography;
|
|||||||
using AR;
|
using AR;
|
||||||
using System.IO.Ports;
|
using System.IO.Ports;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Project.Device
|
namespace Project.Device
|
||||||
{
|
{
|
||||||
@@ -21,6 +22,20 @@ namespace Project.Device
|
|||||||
public DateTime LastStatusSendTime = DateTime.Now;
|
public DateTime LastStatusSendTime = DateTime.Now;
|
||||||
private EEProtocol proto;
|
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<MessageArgs> MessageReceived;
|
||||||
|
public event EventHandler<EEProtocol.DataEventArgs> ProtocReceived;
|
||||||
|
|
||||||
public Xbee()
|
public Xbee()
|
||||||
{
|
{
|
||||||
this.DataReceived += Xbee_DataReceived;
|
this.DataReceived += Xbee_DataReceived;
|
||||||
@@ -78,100 +93,15 @@ namespace Project.Device
|
|||||||
var id = e.ReceivedPacket.ID.ToString("X2");
|
var id = e.ReceivedPacket.ID.ToString("X2");
|
||||||
PUB.logxbee.Add("RX", $"{hexstrRaw}\nID:{id},CMD:{cmd},DATA:{hexstr}");
|
PUB.logxbee.Add("RX", $"{hexstrRaw}\nID:{id},CMD:{cmd},DATA:{hexstr}");
|
||||||
|
|
||||||
//TODO : 기능 처리필요 (XBee 메세지 데이터처리)
|
ProtocReceived?.Invoke(this, e);
|
||||||
//PUB.CheckManualChargeMode() : 수동충전확인
|
|
||||||
//VAR.BOOL[eVarBool.FLAG_AUTORUN] : 자동실행
|
|
||||||
//PUB.Speak("현재 위치는 QA 입니다.") : 음성출력
|
|
||||||
|
|
||||||
//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)
|
private void Proto_OnMessage(object sender, EEProtocol.MessageEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.IsError) PUB.log.AddE(e.Message);
|
MessageReceived?.Invoke(this, new MessageArgs(e.IsError, e.Message));
|
||||||
else PUB.log.Add(e.Message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using AR;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
|
|
||||||
namespace Project.Dialog
|
namespace Project.Dialog
|
||||||
@@ -22,12 +23,12 @@ namespace Project.Dialog
|
|||||||
|
|
||||||
private void button1_Click(object sender, EventArgs e)
|
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)
|
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)
|
private void button3_Click(object sender, EventArgs e)
|
||||||
@@ -65,7 +66,7 @@ namespace Project.Dialog
|
|||||||
private void arLabel9_Click(object sender, EventArgs e)
|
private void arLabel9_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
shutdown = true;
|
shutdown = true;
|
||||||
Util.SystemShutdown(10);
|
PUB.SystemShutdown(10);
|
||||||
this.Close();
|
this.Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -73,7 +74,7 @@ namespace Project.Dialog
|
|||||||
private void arLabel10_Click(object sender, EventArgs e)
|
private void arLabel10_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
shutdown = true;
|
shutdown = true;
|
||||||
Util.SystemReboot(10);
|
PUB.SystemReboot(10);
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +94,7 @@ namespace Project.Dialog
|
|||||||
if (prc.ProcessName.StartsWith("svchost")) continue;
|
if (prc.ProcessName.StartsWith("svchost")) continue;
|
||||||
sb.Append(" " + prc.ProcessName);
|
sb.Append(" " + prc.ProcessName);
|
||||||
}
|
}
|
||||||
Util.MsgI(sb.ToString(),true);
|
UTIL.MsgI(sb.ToString(),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fSystem_Load(object sender, EventArgs e)
|
private void fSystem_Load(object sender, EventArgs e)
|
||||||
@@ -104,14 +105,14 @@ namespace Project.Dialog
|
|||||||
|
|
||||||
private void arLabel3_Click(object sender, EventArgs e)
|
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)
|
if(System.IO.File.Exists(file)==false)
|
||||||
{
|
{
|
||||||
Util.MsgE("에물레이터 실행 파일이 없습니다", true);
|
UTIL.MsgE("에물레이터 실행 파일이 없습니다", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.RunProcess(file);
|
UTIL.RunProcess(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void arLabel5_Click(object sender, EventArgs e)
|
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");
|
var file_exe = System.IO.Path.Combine(path.FullName, "amkor.exe");
|
||||||
if(System.IO.File.Exists(file_exe)==false)
|
if(System.IO.File.Exists(file_exe)==false)
|
||||||
{
|
{
|
||||||
Util.MsgE("실행파일 amkor.exe 가 없습니다.");
|
UTIL.MsgE("실행파일 amkor.exe 가 없습니다.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,12 +147,12 @@ namespace Project.Dialog
|
|||||||
// 임시 폴더 삭제
|
// 임시 폴더 삭제
|
||||||
Directory.Delete(tempDir, true);
|
Directory.Delete(tempDir, true);
|
||||||
|
|
||||||
Util.MsgI("다음 패치 파일이 생성됨\n" + newfilename);
|
UTIL.MsgI("다음 패치 파일이 생성됨\n" + newfilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void arLabel7_Click(object sender, EventArgs e)
|
private void arLabel7_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Util.SystemReboot(5,true);
|
PUB.SystemReboot(5,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
|
using AR;
|
||||||
|
|
||||||
namespace Project.Dialog
|
namespace Project.Dialog
|
||||||
{
|
{
|
||||||
@@ -195,7 +196,7 @@ namespace Project.Dialog
|
|||||||
if(System.IO.File.Exists(file))
|
if(System.IO.File.Exists(file))
|
||||||
{
|
{
|
||||||
//이 파일을 _patch 폴더에 압축해제한다.
|
//이 파일을 _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)
|
if (dir_path.Exists == true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -203,7 +204,7 @@ namespace Project.Dialog
|
|||||||
dir_path.Delete(true);
|
dir_path.Delete(true);
|
||||||
} catch (Exception ex)
|
} catch (Exception ex)
|
||||||
{
|
{
|
||||||
Util.MsgE(ex.Message);
|
UTIL.MsgE(ex.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,7 +225,7 @@ namespace Project.Dialog
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util.MsgE("패치파일이 없습니다\n" + file);
|
UTIL.MsgE("패치파일이 없습니다\n" + file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace Project.Dialog
|
|||||||
//if (dev == null)
|
//if (dev == null)
|
||||||
//{
|
//{
|
||||||
// trackBar1.Enabled = false;
|
// trackBar1.Enabled = false;
|
||||||
// Util.MsgE("사운드 장치가 없습니다", true);
|
// UTIL.MsgE("사운드 장치가 없습니다", true);
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using AR;
|
||||||
|
|
||||||
namespace Project.Manager
|
namespace Project.Manager
|
||||||
{
|
{
|
||||||
@@ -51,7 +52,7 @@ namespace Project.Manager
|
|||||||
dt = new DataSet1.ResultDataDataTable();
|
dt = new DataSet1.ResultDataDataTable();
|
||||||
|
|
||||||
this.dataPath = dataPath_;
|
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;
|
MaxBufferCount = _MaxBufferCount;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace Project
|
|||||||
public static bool Automodeonreboot = false;
|
public static bool Automodeonreboot = false;
|
||||||
public static bool AutRebootAlreay = false;
|
public static bool AutRebootAlreay = false;
|
||||||
public static bool DriveSpeed = false;
|
public static bool DriveSpeed = false;
|
||||||
|
public static AGVControl.MapControl mapctl;
|
||||||
|
|
||||||
#region "Hardware"
|
#region "Hardware"
|
||||||
|
|
||||||
@@ -194,7 +195,7 @@ namespace Project
|
|||||||
//state machine
|
//state machine
|
||||||
sm = new StateMachine.StateMachine();
|
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();
|
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))
|
if (System.IO.File.Exists(file_version))
|
||||||
{
|
{
|
||||||
PUB.PatchVersion = System.IO.File.ReadAllText(file_version, System.Text.Encoding.UTF8);
|
PUB.PatchVersion = System.IO.File.ReadAllText(file_version, System.Text.Encoding.UTF8);
|
||||||
@@ -251,7 +252,7 @@ namespace Project
|
|||||||
string msg = "수동 충전 상태이므로 진행 할 수 없습니다";
|
string msg = "수동 충전 상태이므로 진행 할 수 없습니다";
|
||||||
PUB.Speak(msg);
|
PUB.Speak(msg);
|
||||||
if (Prompt)
|
if (Prompt)
|
||||||
Util.MsgE(msg);
|
UTIL.MsgE(msg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else return true;
|
else return true;
|
||||||
@@ -334,7 +335,7 @@ namespace Project
|
|||||||
var step = PUB.sm.Step.ToString();
|
var step = PUB.sm.Step.ToString();
|
||||||
var rtep = PUB.sm.RunStep.ToString();
|
var rtep = PUB.sm.RunStep.ToString();
|
||||||
var mcid = PUB.setting.MCID;
|
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 file = System.IO.Path.Combine(path, $"{DateTime.Now.ToString("HHmmssfff")}_{step}_{rtep}.sql");
|
||||||
var wdate = DateTime.Now;
|
var wdate = DateTime.Now;
|
||||||
try
|
try
|
||||||
@@ -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 IP { get; set; }
|
||||||
public static string MAC { 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<ManagementBaseObject>().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)
|
public static void ChangeUIPopup(System.Windows.Forms.NumericUpDown valueCtl)
|
||||||
{
|
{
|
||||||
var value = valueCtl.Value.ToString();
|
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)
|
if (f.Item1)
|
||||||
{
|
{
|
||||||
var val = decimal.Parse(f.Item2);
|
var val = decimal.Parse(f.Item2);
|
||||||
if (val < valueCtl.Minimum)
|
if (val < valueCtl.Minimum)
|
||||||
{
|
{
|
||||||
Util.MsgE(string.Format("최소 입력값은 {0} 입니다.", valueCtl.Minimum));
|
UTIL.MsgE(string.Format("최소 입력값은 {0} 입니다.", valueCtl.Minimum));
|
||||||
val = valueCtl.Minimum;
|
val = valueCtl.Minimum;
|
||||||
}
|
}
|
||||||
if (val > valueCtl.Maximum)
|
if (val > valueCtl.Maximum)
|
||||||
{
|
{
|
||||||
Util.MsgE(string.Format("최대 입력값은 {0} 입니다.", valueCtl.Maximum));
|
UTIL.MsgE(string.Format("최대 입력값은 {0} 입니다.", valueCtl.Maximum));
|
||||||
val = valueCtl.Maximum;
|
val = valueCtl.Maximum;
|
||||||
}
|
}
|
||||||
valueCtl.Value = val;
|
valueCtl.Value = val;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Project
|
|||||||
string emsg = "Fatal Error(UHE)\n\n" + e.ExceptionObject.ToString();
|
string emsg = "Fatal Error(UHE)\n\n" + e.ExceptionObject.ToString();
|
||||||
PUB.log.AddE(emsg);
|
PUB.log.AddE(emsg);
|
||||||
PUB.log.Flush();
|
PUB.log.Flush();
|
||||||
Util.SaveBugReport(emsg);
|
AR.UTIL.SaveBugReport(emsg);
|
||||||
var f = new fErrorException(emsg);
|
var f = new fErrorException(emsg);
|
||||||
f.ShowDialog();
|
f.ShowDialog();
|
||||||
Application.ExitThread();
|
Application.ExitThread();
|
||||||
@@ -50,7 +50,7 @@ namespace Project
|
|||||||
string emsg = "Fatal Error(ATE)\n\n" + e.Exception.ToString();
|
string emsg = "Fatal Error(ATE)\n\n" + e.Exception.ToString();
|
||||||
PUB.log.AddE(emsg);
|
PUB.log.AddE(emsg);
|
||||||
PUB.log.Flush();
|
PUB.log.Flush();
|
||||||
Util.SaveBugReport(emsg);
|
AR.UTIL.SaveBugReport(emsg);
|
||||||
var f = new fErrorException(emsg);
|
var f = new fErrorException(emsg);
|
||||||
f.ShowDialog();
|
f.ShowDialog();
|
||||||
Application.ExitThread();
|
Application.ExitThread();
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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 tagstr = tag.ToString();
|
||||||
var tagno = tagstr.Substring(0, tagstr.Length - 1);
|
var tagno = tagstr.Substring(0, tagstr.Length - 1);
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace Project
|
|||||||
if (System.Diagnostics.Debugger.IsAttached == false)
|
if (System.Diagnostics.Debugger.IsAttached == false)
|
||||||
{
|
{
|
||||||
PUB.Speak(Lang.자동재부팅을실행합니다);
|
PUB.Speak(Lang.자동재부팅을실행합니다);
|
||||||
Util.SystemReboot(5, true);
|
PUB.SystemReboot(5, true);
|
||||||
}
|
}
|
||||||
else PUB.setting.SetAutoModeOn = true;
|
else PUB.setting.SetAutoModeOn = true;
|
||||||
|
|
||||||
|
|||||||
115
Cs_HMI/Project/StateMachine/_Xbee.cs
Normal file
115
Cs_HMI/Project/StateMachine/_Xbee.cs
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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<ManagementBaseObject>().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];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 현재실행중인폴더를 반환합니다.
|
|
||||||
/// </summary>
|
|
||||||
public static string CurrentPath
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return AppDomain.CurrentDomain.BaseDirectory;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 콤마와 줄바꿈등을 제거합니다.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
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"
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 지정된 nic카드가 현재 목록에 존재하는지 확인한다.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ehternet Card 를 사용안함으로 설정합니다.(관리자권한필요)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="NicName"></param>
|
|
||||||
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<String> NICCardList()
|
|
||||||
{
|
|
||||||
List<String> Retval = new List<string>();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 이더넷카드를 사용함으로 설정합니다.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="NicName"></param>
|
|
||||||
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"
|
|
||||||
/// <summary>
|
|
||||||
/// URL로부터 문자열을 수신합니다.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="url"></param>
|
|
||||||
/// <param name="isError"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
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
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
// {
|
|
||||||
// /// <summary>
|
|
||||||
// /// ADLink I/O Board input status
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="pin"></param>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// 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;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// ADLink I/O Board Output Status
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="pin"></param>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// public static Boolean GetIOOutput(eDOName pin)
|
|
||||||
// {
|
|
||||||
// return Pub.dio.OUTPUT(GetDONum(pin) - 1);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// A/D Link Digital input Pin number
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="pin"></param>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// public static int GetDINum(eDIName pin)
|
|
||||||
// {
|
|
||||||
// return (int)pin + 1;
|
|
||||||
// //return Pub.setting.DI[(byte)pin];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// adlink digital output in number
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="pin"></param>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// public static int GetDONum(eDOName pin)
|
|
||||||
// {
|
|
||||||
// return (int)pin + 1;
|
|
||||||
// //return Pub.setting.DO[(byte)pin];
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// 도어각 닫혀있는 경우 TRUE,
|
|
||||||
// /// </summary>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// 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"
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// 타워램프버튼 작업
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="g"></param>
|
|
||||||
// /// <param name="r"></param>
|
|
||||||
// /// <param name="y"></param>
|
|
||||||
// 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;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
@@ -10,12 +10,13 @@ using System.Windows.Forms;
|
|||||||
using Project.StateMachine;
|
using Project.StateMachine;
|
||||||
using COMM;
|
using COMM;
|
||||||
using AR;
|
using AR;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
|
||||||
namespace Project.ViewForm
|
namespace Project.ViewForm
|
||||||
{
|
{
|
||||||
public partial class fAuto : Form
|
public partial class fAuto : Form
|
||||||
{
|
{
|
||||||
AGVControl.MapControl mapctl;
|
|
||||||
public fAuto()
|
public fAuto()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -26,12 +27,12 @@ namespace Project.ViewForm
|
|||||||
this.ctlAuto1.Scean = CtlAuto.eScean.Progress;
|
this.ctlAuto1.Scean = CtlAuto.eScean.Progress;
|
||||||
else
|
else
|
||||||
this.ctlAuto1.Scean = CtlAuto.eScean.Normal;
|
this.ctlAuto1.Scean = CtlAuto.eScean.Normal;
|
||||||
this.mapctl = new AGVControl.MapControl();
|
PUB.mapctl = new AGVControl.MapControl();
|
||||||
this.mapctl.Dock = DockStyle.Fill;
|
PUB.mapctl.Dock = DockStyle.Fill;
|
||||||
this.mapctl.Visible = true;
|
PUB.mapctl.Visible = true;
|
||||||
this.mapctl.Font = this.panel1.Font;
|
PUB.mapctl.Font = this.panel1.Font;
|
||||||
this.mapctl.BackColor = Color.FromArgb(32, 32, 32);
|
PUB.mapctl.BackColor = Color.FromArgb(32, 32, 32);
|
||||||
this.panel1.Controls.Add(mapctl);
|
this.panel1.Controls.Add(PUB.mapctl);
|
||||||
}
|
}
|
||||||
private void fAuto_Load(object sender, EventArgs e)
|
private void fAuto_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -42,6 +43,7 @@ namespace Project.ViewForm
|
|||||||
this.timer1.Start();
|
this.timer1.Start();
|
||||||
PUB.AGV.DataReceive += AGV_DataReceive;
|
PUB.AGV.DataReceive += AGV_DataReceive;
|
||||||
|
|
||||||
|
|
||||||
//auto load
|
//auto load
|
||||||
var path = new System.IO.DirectoryInfo("route");
|
var path = new System.IO.DirectoryInfo("route");
|
||||||
if (path.Exists == false) path.Create();
|
if (path.Exists == false) path.Create();
|
||||||
@@ -61,7 +63,8 @@ namespace Project.ViewForm
|
|||||||
if (fi.Exists)
|
if (fi.Exists)
|
||||||
{
|
{
|
||||||
PUB.log.Add($"autoload : {fi.FullName}");
|
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:
|
case arDev.Narumi.DataType.TAG:
|
||||||
var tagno = PUB.AGV.data.TagNo;
|
var tagno = PUB.AGV.data.TagNo;
|
||||||
this.mapctl.AGVMoveToRFID(tagno.ToString());
|
PUB.log.Add($"[auto] recv tag : {tagno}");
|
||||||
|
PUB.mapctl.SetCurrentPosition(tagno);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,12 +69,12 @@ namespace Project.ViewForm
|
|||||||
//후진
|
//후진
|
||||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
|
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
|
||||||
{
|
{
|
||||||
Util.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
|
UTIL.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
||||||
{
|
{
|
||||||
Util.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
|
UTIL.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PUB.CheckManualChargeMode() == false) return;
|
if (PUB.CheckManualChargeMode() == false) return;
|
||||||
@@ -92,12 +92,12 @@ namespace Project.ViewForm
|
|||||||
//전진
|
//전진
|
||||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
|
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
|
||||||
{
|
{
|
||||||
Util.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
|
UTIL.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
||||||
{
|
{
|
||||||
Util.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
|
UTIL.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PUB.CheckManualChargeMode() == false) return;
|
if (PUB.CheckManualChargeMode() == false) return;
|
||||||
@@ -115,12 +115,12 @@ namespace Project.ViewForm
|
|||||||
//우회전
|
//우회전
|
||||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
|
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
|
||||||
{
|
{
|
||||||
Util.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
|
UTIL.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
||||||
{
|
{
|
||||||
Util.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
|
UTIL.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PUB.CheckManualChargeMode() == false) return;
|
if (PUB.CheckManualChargeMode() == false) return;
|
||||||
@@ -138,12 +138,12 @@ namespace Project.ViewForm
|
|||||||
//좌회전
|
//좌회전
|
||||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
|
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
|
||||||
{
|
{
|
||||||
Util.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
|
UTIL.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
||||||
{
|
{
|
||||||
Util.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
|
UTIL.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PUB.CheckManualChargeMode() == false) return;
|
if (PUB.CheckManualChargeMode() == false) return;
|
||||||
@@ -160,19 +160,19 @@ namespace Project.ViewForm
|
|||||||
{
|
{
|
||||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
|
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
|
||||||
{
|
{
|
||||||
Util.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
|
UTIL.MsgE("자동 충전 중입니다\n충전을 해제 하세요");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
||||||
{
|
{
|
||||||
Util.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
|
UTIL.MsgE("수동 충전 중입니다\b충전을 해제 하세요");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PUB.CheckManualChargeMode() == false) return;
|
if (PUB.CheckManualChargeMode() == false) return;
|
||||||
PUB.sm.SetNewStep(StateMachine.eSMStep.IDLE);
|
PUB.sm.SetNewStep(StateMachine.eSMStep.IDLE);
|
||||||
if (PUB.AGV.system1.agv_run == false && PUB.AGV.system1.agv_run_manual == false)
|
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;
|
if (dlg != DialogResult.Yes) return;
|
||||||
var opt = makeopt();
|
var opt = makeopt();
|
||||||
PUB.AGV.AGVMoveSet(opt);
|
PUB.AGV.AGVMoveSet(opt);
|
||||||
@@ -301,7 +301,7 @@ namespace Project.ViewForm
|
|||||||
|
|
||||||
private void btchargeOff_Click(object sender, EventArgs e)
|
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);
|
PUB.AGV.AGVCharge(PUB.setting.ChargerID, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,10 +309,10 @@ namespace Project.ViewForm
|
|||||||
{
|
{
|
||||||
if (PUB.AGV.signal.mark_sensor == false)
|
if (PUB.AGV.signal.mark_sensor == false)
|
||||||
{
|
{
|
||||||
Util.MsgE("마크센서가 확인되지 않아 충전을 시작할 수 없습니다");
|
UTIL.MsgE("마크센서가 확인되지 않아 충전을 시작할 수 없습니다");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var dlg = Util.MsgQ("충전 시작 명령을 전송 할까요?");
|
var dlg = UTIL.MsgQ("충전 시작 명령을 전송 할까요?");
|
||||||
if (dlg != DialogResult.Yes) return;
|
if (dlg != DialogResult.Yes) return;
|
||||||
PUB.AGV.AGVCharge(PUB.setting.ChargerID, true);
|
PUB.AGV.AGVCharge(PUB.setting.ChargerID, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using COMM;
|
|||||||
using System.CodeDom;
|
using System.CodeDom;
|
||||||
using AR;
|
using AR;
|
||||||
using Project.StateMachine;
|
using Project.StateMachine;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
|
||||||
namespace Project
|
namespace Project
|
||||||
{
|
{
|
||||||
@@ -112,14 +113,14 @@ namespace Project
|
|||||||
_STEP_CLOSING_START(PUB.sm.Step);
|
_STEP_CLOSING_START(PUB.sm.Step);
|
||||||
PUB.sm.Stop();
|
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)
|
if (patchfile.Exists == false)
|
||||||
{
|
{
|
||||||
Util.MsgE("패치파일(" + patchfile.Name + ")이 없습니다.\n프로그램을 다시 실행해주세요", true);
|
UTIL.MsgE("패치파일(" + patchfile.Name + ")이 없습니다.\n프로그램을 다시 실행해주세요", true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util.RunProcess(patchfile.FullName);
|
UTIL.RunProcess(patchfile.FullName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (forceClose == true)
|
else if (forceClose == true)
|
||||||
@@ -136,13 +137,13 @@ namespace Project
|
|||||||
{
|
{
|
||||||
if (PUB.sm.Step == eSMStep.RUN)
|
if (PUB.sm.Step == eSMStep.RUN)
|
||||||
{
|
{
|
||||||
Util.MsgE("동작 중에는 종료 할 수 없습니다.");
|
UTIL.MsgE("동작 중에는 종료 할 수 없습니다.");
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PUB.sm.Step < eSMStep.CLOSING)
|
if (PUB.sm.Step < eSMStep.CLOSING)
|
||||||
{
|
{
|
||||||
var rlt = Util.MsgQ("종료하시겠습니까");
|
var rlt = UTIL.MsgQ("종료하시겠습니까");
|
||||||
if (rlt == System.Windows.Forms.DialogResult.Yes)
|
if (rlt == System.Windows.Forms.DialogResult.Yes)
|
||||||
{
|
{
|
||||||
//비젼의 측정상태가 변경된 경우
|
//비젼의 측정상태가 변경된 경우
|
||||||
@@ -193,7 +194,9 @@ namespace Project
|
|||||||
|
|
||||||
//지그비통신
|
//지그비통신
|
||||||
PUB.XBE = new Device.Xbee();
|
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, 3, Pub.setting.Port_Xbee);
|
||||||
//HWState.setTitle(1, 0, Pub.setting.Address_RFID);
|
//HWState.setTitle(1, 0, Pub.setting.Address_RFID);
|
||||||
|
|
||||||
@@ -254,6 +257,7 @@ namespace Project
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Counter_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
private void Counter_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
//수량에 변화가 잇다면 업데이트 한다
|
//수량에 변화가 잇다면 업데이트 한다
|
||||||
@@ -298,12 +302,12 @@ namespace Project
|
|||||||
{
|
{
|
||||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM] == true)
|
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM] == true)
|
||||||
{
|
{
|
||||||
Util.MsgE("수동 충전 상태이므로 진행 할 수 없습니다");
|
UTIL.MsgE("수동 충전 상태이므로 진행 할 수 없습니다");
|
||||||
return;
|
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();
|
if (dlgE == DialogResult.Yes) PUB.AGV.AGVErrorReset();
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
@@ -511,7 +515,7 @@ namespace Project
|
|||||||
PUB.AGV.AGVErrorReset();
|
PUB.AGV.AGVErrorReset();
|
||||||
if (Prompt)
|
if (Prompt)
|
||||||
{
|
{
|
||||||
if (Util.MsgQ("AGV상태를 자동으로 전환 할까요?") != DialogResult.Yes) return;
|
if (UTIL.MsgQ("AGV상태를 자동으로 전환 할까요?") != DialogResult.Yes) return;
|
||||||
}
|
}
|
||||||
//충전상태확인
|
//충전상태확인
|
||||||
if (PUB.CheckManualChargeMode() == false) return;
|
if (PUB.CheckManualChargeMode() == false) return;
|
||||||
@@ -656,15 +660,15 @@ namespace Project
|
|||||||
|
|
||||||
private void arLabel3_Click(object sender, EventArgs e)
|
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)
|
if (System.IO.File.Exists(file) == false)
|
||||||
{
|
{
|
||||||
Util.MsgE("사용설명서 파일이 존재하지 않습니다\n" +
|
UTIL.MsgE("사용설명서 파일이 존재하지 않습니다\n" +
|
||||||
"문의 : T8567 (장비기술 1파트)\n" +
|
"문의 : T8567 (장비기술 1파트)\n" +
|
||||||
"파일명 : " + file);
|
"파일명 : " + file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Util.RunExplorer(file);
|
UTIL.RunExplorer(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btClose_Click(object sender, EventArgs e)
|
private void btClose_Click(object sender, EventArgs e)
|
||||||
@@ -705,7 +709,7 @@ namespace Project
|
|||||||
|
|
||||||
//if (Pub.sm.Step != eSMStep.IDLE)
|
//if (Pub.sm.Step != eSMStep.IDLE)
|
||||||
//{
|
//{
|
||||||
var dlg = Util.MsgQ(
|
var dlg = UTIL.MsgQ(
|
||||||
"프로그램 상태를 초기화 하시겠습니까?\n" +
|
"프로그램 상태를 초기화 하시겠습니까?\n" +
|
||||||
"진행 중인 사항은 모두 취소 됩니다");
|
"진행 중인 사항은 모두 취소 됩니다");
|
||||||
if (dlg != System.Windows.Forms.DialogResult.Yes) return;
|
if (dlg != System.Windows.Forms.DialogResult.Yes) return;
|
||||||
@@ -725,12 +729,12 @@ namespace Project
|
|||||||
|
|
||||||
private void btCapture_Click(object sender, EventArgs e)
|
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)
|
private void btOpenDir_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Util.RunExplorer(Util.CurrentPath);
|
UTIL.RunExplorer(UTIL.CurrentPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button4_Click(object sender, EventArgs e)
|
private void button4_Click(object sender, EventArgs e)
|
||||||
@@ -792,14 +796,14 @@ namespace Project
|
|||||||
|
|
||||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
||||||
{
|
{
|
||||||
Util.MsgE("수동 충전 상태이므로 진행 할 수 없습니다");
|
UTIL.MsgE("수동 충전 상태이므로 진행 할 수 없습니다");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//충전을 시작해라ㅏ
|
//충전을 시작해라ㅏ
|
||||||
if (bCharge == true)
|
if (bCharge == true)
|
||||||
{
|
{
|
||||||
var dlg = Util.MsgQ("충전을 중지할까요?");
|
var dlg = UTIL.MsgQ("충전을 중지할까요?");
|
||||||
if (dlg == DialogResult.Yes)
|
if (dlg == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
PUB.sm.ClearRunStep();
|
PUB.sm.ClearRunStep();
|
||||||
@@ -810,7 +814,7 @@ namespace Project
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var dlg = Util.MsgQ("충전을 시작할까요?");
|
var dlg = UTIL.MsgQ("충전을 시작할까요?");
|
||||||
if (dlg == DialogResult.Yes)
|
if (dlg == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
PUB.sm.ClearRunStep();
|
PUB.sm.ClearRunStep();
|
||||||
@@ -850,7 +854,7 @@ namespace Project
|
|||||||
|
|
||||||
if (bCharge == true)
|
if (bCharge == true)
|
||||||
{
|
{
|
||||||
var dlg = Util.MsgQ("홈(QC) 이동을 취소 할까요?");
|
var dlg = UTIL.MsgQ("홈(QC) 이동을 취소 할까요?");
|
||||||
if (dlg == DialogResult.Yes)
|
if (dlg == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
PUB.sm.ClearRunStep();
|
PUB.sm.ClearRunStep();
|
||||||
@@ -862,7 +866,7 @@ namespace Project
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var dlg = Util.MsgQ("홈(QC) 이동을 실행 할까요?");
|
var dlg = UTIL.MsgQ("홈(QC) 이동을 실행 할까요?");
|
||||||
if (dlg == DialogResult.Yes)
|
if (dlg == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
PUB.sm.ClearRunStep();
|
PUB.sm.ClearRunStep();
|
||||||
@@ -949,7 +953,7 @@ namespace Project
|
|||||||
{
|
{
|
||||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
||||||
{
|
{
|
||||||
var dlg = Util.MsgQ("수동 충전을 해제 할까요?");
|
var dlg = UTIL.MsgQ("수동 충전을 해제 할까요?");
|
||||||
if (dlg != DialogResult.Yes) return;
|
if (dlg != DialogResult.Yes) return;
|
||||||
VAR.BOOL[eVarBool.FLAG_CHARGEONM] = false;
|
VAR.BOOL[eVarBool.FLAG_CHARGEONM] = false;
|
||||||
PUB.log.Add("수동 충전 실행");
|
PUB.log.Add("수동 충전 실행");
|
||||||
@@ -958,10 +962,10 @@ namespace Project
|
|||||||
{
|
{
|
||||||
if (PUB.AGV.system1.Battery_charging)
|
if (PUB.AGV.system1.Battery_charging)
|
||||||
{
|
{
|
||||||
Util.MsgE("현재 자동 충전 중이라 진행 할 수 없습니다");
|
UTIL.MsgE("현재 자동 충전 중이라 진행 할 수 없습니다");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var dlg = Util.MsgQ("수동 충전을 진행 할까요?");
|
var dlg = UTIL.MsgQ("수동 충전을 진행 할까요?");
|
||||||
if (dlg != DialogResult.Yes) return;
|
if (dlg != DialogResult.Yes) return;
|
||||||
VAR.BOOL[eVarBool.FLAG_CHARGEONM] = true;
|
VAR.BOOL[eVarBool.FLAG_CHARGEONM] = true;
|
||||||
PUB.log.Add("수동 충전 실행");
|
PUB.log.Add("수동 충전 실행");
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ namespace Project
|
|||||||
{
|
{
|
||||||
if (PUB.CheckPassword() == false)
|
if (PUB.CheckPassword() == false)
|
||||||
{
|
{
|
||||||
Util.MsgE("암호가 일치하지 않습니다");
|
UTIL.MsgE("암호가 일치하지 않습니다");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,7 +469,7 @@ namespace Project
|
|||||||
" * [충전] 탭에서 설정값을 확인할 수 있습니다";
|
" * [충전] 탭에서 설정값을 확인할 수 있습니다";
|
||||||
else if (tagStr == "2") msg += "[배경음악]\n" +
|
else if (tagStr == "2") msg += "[배경음악]\n" +
|
||||||
" * 이동시 음악을 플레이 합니다";
|
" * 이동시 음악을 플레이 합니다";
|
||||||
var dlg = Util.MsgQ(msg);
|
var dlg = UTIL.MsgQ(msg);
|
||||||
if (dlg == DialogResult.Yes)
|
if (dlg == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
SetColorValue(button, true);
|
SetColorValue(button, true);
|
||||||
@@ -483,7 +483,7 @@ namespace Project
|
|||||||
//포트를 선택한 후 표시해준다.
|
//포트를 선택한 후 표시해준다.
|
||||||
var but = sender as Button;
|
var but = sender as Button;
|
||||||
var tagStr = but.Tag.ToString();
|
var tagStr = but.Tag.ToString();
|
||||||
var newPort = Util.SelectSerialPort();
|
var newPort = PUB.SelectSerialPort();
|
||||||
if (newPort.isEmpty()) return;
|
if (newPort.isEmpty()) return;
|
||||||
|
|
||||||
if (tagStr == "XBE") tbPortXBE.Text = newPort;
|
if (tagStr == "XBE") tbPortXBE.Text = newPort;
|
||||||
@@ -523,7 +523,7 @@ namespace Project
|
|||||||
{
|
{
|
||||||
if (System.IO.File.Exists(tbMusic.Text) == false)
|
if (System.IO.File.Exists(tbMusic.Text) == false)
|
||||||
{
|
{
|
||||||
Util.MsgE("파일이 없습니다");
|
UTIL.MsgE("파일이 없습니다");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
@@ -535,7 +535,7 @@ namespace Project
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Util.MsgE("music open error\n\n" + ex.Message);
|
UTIL.MsgE("music open error\n\n" + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,83 +1,109 @@
|
|||||||
[RFID_POINTS]
|
[RFID_POINTS]
|
||||||
100,486,T0002
|
100,486,0002
|
||||||
164,494,T0003
|
164,494,0003
|
||||||
229,493,T0004
|
229,493,0004
|
||||||
309,489,T0005
|
309,489,0005
|
||||||
370,490,T0006
|
370,490,0006
|
||||||
437,486,T0007
|
437,486,0007
|
||||||
483,459,T0008
|
483,459,0008
|
||||||
511,421,T0009
|
511,421,0009
|
||||||
543,371,T0010
|
543,371,0010
|
||||||
569,329,T0011
|
569,329,0011
|
||||||
608,289,T0012
|
608,289,0012
|
||||||
661,279,T0013
|
661,279,0013
|
||||||
700,297,T0014
|
700,297,0014
|
||||||
698,349,T0015
|
698,349,0015
|
||||||
698,391,T0016
|
698,391,0016
|
||||||
699,449,T0017
|
699,449,0017
|
||||||
691,491,T0018
|
691,491,0018
|
||||||
569,275,T0019
|
569,275,0019
|
||||||
518,264,T0020
|
518,264,0020
|
||||||
454,264,T0021
|
454,264,0021
|
||||||
388,261,T0022
|
388,261,0022
|
||||||
314,258,T0023
|
314,258,0023
|
||||||
639,234,T0024
|
639,234,0024
|
||||||
621,182,T0025
|
621,182,0025
|
||||||
629,143,T0026
|
629,143,0026
|
||||||
657,101,T0027
|
657,101,0027
|
||||||
627,82,T0028
|
627,82,0028
|
||||||
560,73,T0029
|
560,73,0029
|
||||||
499,65,T0030
|
499,65,0030
|
||||||
432,65,T0031
|
432,65,0031
|
||||||
264,232,T0032
|
264,232,0032
|
||||||
363,60,T0033
|
363,60,0033
|
||||||
654,508,T0034
|
654,508,0034
|
||||||
96,542,T0050
|
96,542,0050
|
||||||
159,542,T0051
|
159,542,0051
|
||||||
226,542,T0061
|
226,542,0061
|
||||||
309,541,T0070
|
309,541,0070
|
||||||
369,542,T0071
|
369,542,0071
|
||||||
483,165,T0010
|
483,165,0010
|
||||||
735,163,T0011
|
735,163,0011
|
||||||
523,170,T0001
|
523,170,0001
|
||||||
565,175,T0002
|
565,175,0002
|
||||||
597,182,T0003
|
597,182,0003
|
||||||
665,181,T0004
|
665,181,0004
|
||||||
700,176,T0005
|
700,176,0005
|
||||||
721,170,T0006
|
721,170,0006
|
||||||
[MAGNET_LINES]
|
|
||||||
99,485,220,492
|
[RFID_LINES]
|
||||||
220,492,375,488
|
96,542,100,486,0005,0002,False,56.14267
|
||||||
375,488,457,479
|
100,486,164,494,0002,0003,False,64.49806
|
||||||
457,479,512,432
|
164,494,229,493,0003,0004,False,65.00769
|
||||||
512,432,552,353
|
229,493,309,489,0004,0005,False,80.09994
|
||||||
552,353,602,291
|
309,489,370,490,0005,0006,False,61.0082
|
||||||
602,291,651,278
|
370,490,437,486,0006,0007,False,67.11929
|
||||||
651,278,700,289
|
437,486,483,459,0007,0008,False,53.33854
|
||||||
700,289,704,380
|
483,459,511,421,0008,0009,False,47.20169
|
||||||
704,380,700,469
|
511,421,543,371,0009,0010,False,59.36329
|
||||||
700,469,688,488
|
543,371,569,329,0010,0011,False,49.39635
|
||||||
666,277,637,229
|
569,329,608,289,0011,0012,False,55.86591
|
||||||
637,229,625,170
|
608,289,661,279,0012,0013,False,53.93515
|
||||||
625,170,654,94
|
661,279,700,297,0013,0014,False,42.95346
|
||||||
654,94,624,78
|
700,297,698,349,0014,0015,False,52.03845
|
||||||
624,78,484,63
|
698,349,698,391,0015,0016,False,42
|
||||||
484,63,365,64
|
698,391,699,449,0016,0017,False,58.00862
|
||||||
608,287,523,267
|
699,449,691,491,0017,0018,False,42.75512
|
||||||
523,267,409,260
|
691,491,654,508,0018,0034,False,40.71855
|
||||||
409,260,275,258
|
159,542,164,494,0006,0003,False,48.25971
|
||||||
99,486,95,542
|
226,542,229,493,0007,0004,False,49.09175
|
||||||
161,495,161,543
|
309,541,309,489,0008,0005,False,52
|
||||||
230,496,228,537
|
369,542,370,490,0009,0006,False,52.00961
|
||||||
228,537,228,544
|
370,490,370,490,0006,0006,False,0
|
||||||
306,488,306,543
|
608,289,569,275,0012,0019,False,41.4367
|
||||||
373,489,371,544
|
569,275,518,264,0019,0020,False,52.17279
|
||||||
655,508,691,486
|
518,264,454,264,0020,0021,False,64
|
||||||
481,164,624,183
|
454,264,388,261,0021,0022,False,66.06815
|
||||||
624,183,706,181
|
388,261,314,258,0022,0023,False,74.06078
|
||||||
706,181,743,161
|
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]
|
[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
|
239,52,-256,-65408,Arial,12,SSOTRON-3
|
||||||
617,527,-16711936,-16777216,Arial,12,SSOTRON-1
|
617,527,-16711936,-16777216,Arial,12,SSOTRON-1
|
||||||
87,551,-16777216,16777215,Arial,12,B1
|
87,551,-16777216,16777215,Arial,12,B1
|
||||||
@@ -88,57 +114,3 @@
|
|||||||
453,128,-16777216,-8323073,Arial,12,CHG1
|
453,128,-16777216,-8323073,Arial,12,CHG1
|
||||||
725,124,-16777216,-8323073,Arial,12,CHG2
|
725,124,-16777216,-8323073,Arial,12,CHG2
|
||||||
[CUSTOM_LINES]
|
[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
|
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ namespace arDev
|
|||||||
{
|
{
|
||||||
//221123 chi 숫자로변경
|
//221123 chi 숫자로변경
|
||||||
var tagnostr = rcvdNow.Substring(3);
|
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);
|
var Changed = !old_TagString.Equals(tagnostr);
|
||||||
data.TagString = tagnostr;
|
data.TagString = tagnostr;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace arDev
|
|||||||
|
|
||||||
|
|
||||||
public string TagString { get; set; } = string.Empty;
|
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 string CallString { get; set; } = string.Empty;
|
||||||
public int CallNo { get; set; } = -1;
|
public int CallNo { get; set; } = -1;
|
||||||
public string CCAString { get; set; } = string.Empty;
|
public string CCAString { get; set; } = string.Empty;
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ using System.Drawing.Design;
|
|||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Security.Permissions;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using AGVControl.Models;
|
using AGVControl.Models;
|
||||||
@@ -18,7 +21,7 @@ namespace AGVControl
|
|||||||
private List<MapText> mapTexts;
|
private List<MapText> mapTexts;
|
||||||
private List<CustomLine> customLines;
|
private List<CustomLine> customLines;
|
||||||
private List<RFIDLine> rfidLines;
|
private List<RFIDLine> rfidLines;
|
||||||
private AGV agv;
|
public AGV agv;
|
||||||
private float zoom = 1.0f;
|
private float zoom = 1.0f;
|
||||||
private PointF offset = PointF.Empty;
|
private PointF offset = PointF.Empty;
|
||||||
private Point lastMousePosition;
|
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);
|
var rfidPoint = FindRFIDPoint(rfidValue);
|
||||||
if (rfidPoint != null)
|
if (rfidPoint != null)
|
||||||
@@ -538,7 +541,7 @@ namespace AGVControl
|
|||||||
|
|
||||||
return neighbors.Distinct().ToList();
|
return neighbors.Distinct().ToList();
|
||||||
}
|
}
|
||||||
public void SetPath(List<string> rfids)
|
public void SetPath(List<uint> rfids)
|
||||||
{
|
{
|
||||||
if (rfids == null || rfids.Count == 0)
|
if (rfids == null || rfids.Count == 0)
|
||||||
return;
|
return;
|
||||||
@@ -563,6 +566,62 @@ namespace AGVControl
|
|||||||
public string RFIDStartNo { get; set; } = string.Empty;
|
public string RFIDStartNo { get; set; } = string.Empty;
|
||||||
public int RFIDLastNumber = 0;
|
public int RFIDLastNumber = 0;
|
||||||
string filename = string.Empty;
|
string filename = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public struct PathResult
|
||||||
|
{
|
||||||
|
public bool Success { get; set; }
|
||||||
|
public string Message { get; set; }
|
||||||
|
public List<Point> Path { get; set; }
|
||||||
|
}
|
||||||
|
public PathResult CalculatePath(uint tagStrt, uint tagEnd)
|
||||||
|
{
|
||||||
|
var retval = new PathResult
|
||||||
|
{
|
||||||
|
Message = string.Empty,
|
||||||
|
Success = false,
|
||||||
|
Path = new List<Point>(),
|
||||||
|
};
|
||||||
|
|
||||||
|
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<uint>();
|
||||||
|
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)
|
private void MapControl_MouseClick(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
var mapPoint = ScreenToMap(e.Location);
|
var mapPoint = ScreenToMap(e.Location);
|
||||||
@@ -596,45 +655,34 @@ namespace AGVControl
|
|||||||
|
|
||||||
var startRFID = input1.Item2;
|
var startRFID = input1.Item2;
|
||||||
var endRFID = input2.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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = CalculatePath(startPoint.Location, endPoint.Location);
|
var rlt = CalculatePath(vstart, vend);
|
||||||
if (path != null && path.Count > 0)
|
|
||||||
{
|
|
||||||
DrawPath(path);
|
|
||||||
|
|
||||||
// 경로 상의 모든 RFID 값을 가져옴
|
if (rlt.Success == false)
|
||||||
var rfidPath = new List<string>();
|
|
||||||
foreach (var point in path)
|
|
||||||
{
|
{
|
||||||
var rfid = GetRFIDPoints()
|
MessageBox.Show(rlt.Message, "경로 계산", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
.FirstOrDefault(r => r.Location == point);
|
return;
|
||||||
if (rfid != null)
|
|
||||||
{
|
|
||||||
rfidPath.Add(rfid.RFIDValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageBox.Show($"경로가 계산되었습니다.\nRFID 순서: {string.Join(" -> ", rfidPath)}",
|
|
||||||
"경로 계산", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("경로를 찾을 수 없습니다.", "경로 계산", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
MessageBox.Show($"경로가 계산되었습니다.\nRFID 순서: {string.Join(" -> ", rlt.Path)}",
|
||||||
|
"경로 계산", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "pos":
|
case "pos":
|
||||||
var tag = AR.UTIL.InputBox("input rfid tag value");
|
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;
|
break;
|
||||||
case "save":
|
case "save":
|
||||||
@@ -693,8 +741,9 @@ namespace AGVControl
|
|||||||
case eMouseMode.addrfidpoint:
|
case eMouseMode.addrfidpoint:
|
||||||
if (string.IsNullOrEmpty(this.RFIDStartNo) == false)
|
if (string.IsNullOrEmpty(this.RFIDStartNo) == false)
|
||||||
{
|
{
|
||||||
|
if (uint.TryParse(this.RFIDStartNo, out uint rfidvalue))
|
||||||
AddRFIDPoint(mapPoint, RFIDStartNo);
|
{
|
||||||
|
AddRFIDPoint(mapPoint, rfidvalue);
|
||||||
|
|
||||||
// 숫자로 끝나는 RFID 값인 경우 자동 증가
|
// 숫자로 끝나는 RFID 값인 경우 자동 증가
|
||||||
if (Regex.IsMatch(RFIDStartNo, @"^[A-Za-z]+\d+$"))
|
if (Regex.IsMatch(RFIDStartNo, @"^[A-Za-z]+\d+$"))
|
||||||
@@ -715,6 +764,8 @@ namespace AGVControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case eMouseMode.addtext:
|
case eMouseMode.addtext:
|
||||||
var text = new MapText
|
var text = new MapText
|
||||||
@@ -815,7 +866,7 @@ namespace AGVControl
|
|||||||
nearbyPoints.Sort((a, b) => a.ProjectionRatio.CompareTo(b.ProjectionRatio));
|
nearbyPoints.Sort((a, b) => a.ProjectionRatio.CompareTo(b.ProjectionRatio));
|
||||||
|
|
||||||
// 이전 RFID 값과 위치를 저장
|
// 이전 RFID 값과 위치를 저장
|
||||||
string prevRFID = line.StartRFID;
|
uint prevRFID = line.StartRFID;
|
||||||
Point prevPoint = line.StartPoint;
|
Point prevPoint = line.StartPoint;
|
||||||
|
|
||||||
// 정렬된 포인트들을 순차적으로 연결
|
// 정렬된 포인트들을 순차적으로 연결
|
||||||
@@ -1163,15 +1214,13 @@ namespace AGVControl
|
|||||||
foreach (var rfid in rfidPoints)
|
foreach (var rfid in rfidPoints)
|
||||||
{
|
{
|
||||||
//g.FillEllipse(Brushes.Green, rfid.Location.X - 3, rfid.Location.Y - 3, 6, 6);
|
//g.FillEllipse(Brushes.Green, rfid.Location.X - 3, rfid.Location.Y - 3, 6, 6);
|
||||||
var fsize = g.MeasureString(rfid.RFIDValue, Font);
|
var tagstr = $"{rfid.RFIDValue}";
|
||||||
g.DrawString(rfid.RFIDValue, Font, Brushes.WhiteSmoke,
|
var fsize = g.MeasureString(tagstr, Font);
|
||||||
|
g.DrawString(tagstr, Font, Brushes.WhiteSmoke,
|
||||||
(rfid.Location.X - fsize.Width / 2f),
|
(rfid.Location.X - fsize.Width / 2f),
|
||||||
(rfid.Location.Y + 2));
|
(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)
|
private void DrawAGV(Graphics g)
|
||||||
@@ -1252,7 +1301,7 @@ namespace AGVControl
|
|||||||
{
|
{
|
||||||
using (Pen linePen = new Pen(Color.FromArgb(50, Color.Wheat), 2))
|
using (Pen linePen = new Pen(Color.FromArgb(50, Color.Wheat), 2))
|
||||||
{
|
{
|
||||||
if (!line.IsBidirectional)
|
if (line.IsBidirectional)
|
||||||
{
|
{
|
||||||
// 단방향 화살표 그리기
|
// 단방향 화살표 그리기
|
||||||
var arrowSize = 10;
|
var arrowSize = 10;
|
||||||
@@ -1345,7 +1394,7 @@ namespace AGVControl
|
|||||||
this.Invalidate();
|
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 포인트 찾기
|
// 시작점과 끝점 사이의 모든 RFID 포인트 찾기
|
||||||
var allPoints = new List<(RFIDPoint Point, float Distance)>();
|
var allPoints = new List<(RFIDPoint Point, float Distance)>();
|
||||||
@@ -1447,7 +1496,7 @@ namespace AGVControl
|
|||||||
this.Invalidate();
|
this.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRFIDPoint(Point mapLocation, string rfidValue)
|
public void AddRFIDPoint(Point mapLocation, uint rfidValue)
|
||||||
{
|
{
|
||||||
// 이미 맵 좌표로 변환된 위치를 사용
|
// 이미 맵 좌표로 변환된 위치를 사용
|
||||||
var rfidPoint = new RFIDPoint
|
var rfidPoint = new RFIDPoint
|
||||||
@@ -1490,19 +1539,12 @@ namespace AGVControl
|
|||||||
lines.Add($"{point.Location.X},{point.Location.Y},{point.RFIDValue}");
|
lines.Add($"{point.Location.X},{point.Location.Y},{point.RFIDValue}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 자석선 저장
|
// RFID 라인 저장
|
||||||
lines.Add("[MAGNET_LINES]");
|
lines.Add("[RFID_LINES]");
|
||||||
foreach (var line in magnetLines)
|
foreach (var line in rfidLines)
|
||||||
{
|
{
|
||||||
var branchInfo = "";
|
lines.Add($"{line.StartPoint.X},{line.StartPoint.Y},{line.EndPoint.X},{line.EndPoint.Y}," +
|
||||||
foreach (var branch in line.BranchPoints)
|
$"{line.StartRFID},{line.EndRFID},{line.IsBidirectional},{line.Distance}");
|
||||||
{
|
|
||||||
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}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 텍스트 저장
|
// 텍스트 저장
|
||||||
@@ -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}");
|
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);
|
File.WriteAllLines(filename, lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadFromFile(string filename)
|
public string LoadFromFile(string filename)
|
||||||
{
|
{
|
||||||
ClearMap();
|
ClearMap();
|
||||||
|
|
||||||
var lines = File.ReadAllLines(filename);
|
var lines = File.ReadAllLines(filename);
|
||||||
var section = "";
|
var section = "";
|
||||||
|
|
||||||
|
var sb = new System.Text.StringBuilder();
|
||||||
|
|
||||||
foreach (var line in lines)
|
foreach (var line in lines)
|
||||||
{
|
{
|
||||||
if (line.StartsWith("[") && line.EndsWith("]"))
|
if (line.StartsWith("[") && line.EndsWith("]"))
|
||||||
@@ -1551,9 +1588,28 @@ namespace AGVControl
|
|||||||
var rfidParts = line.Split(',');
|
var rfidParts = line.Split(',');
|
||||||
if (rfidParts.Length >= 3)
|
if (rfidParts.Length >= 3)
|
||||||
{
|
{
|
||||||
AddRFIDPoint(
|
var validX = int.TryParse(rfidParts[0], out int valX);
|
||||||
new Point(int.Parse(rfidParts[0]), int.Parse(rfidParts[1])),
|
var validY = int.TryParse(rfidParts[1], out int valY);
|
||||||
rfidParts[2]
|
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;
|
break;
|
||||||
@@ -1618,23 +1674,13 @@ namespace AGVControl
|
|||||||
}
|
}
|
||||||
break;
|
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();
|
this.Invalidate();
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteNearbyRFIDLine(Point clickPoint)
|
private void DeleteNearbyRFIDLine(Point clickPoint)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace AGVControl.Models
|
|||||||
public class AGV
|
public class AGV
|
||||||
{
|
{
|
||||||
public Point CurrentPosition { get; set; }
|
public Point CurrentPosition { get; set; }
|
||||||
public string CurrentRFID { get; set; }
|
public uint CurrentRFID { get; set; }
|
||||||
public Direction CurrentDirection { get; set; }
|
public Direction CurrentDirection { get; set; }
|
||||||
public bool IsMoving { get; set; }
|
public bool IsMoving { get; set; }
|
||||||
public List<Point> CurrentPath { get; set; }
|
public List<Point> CurrentPath { get; set; }
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ namespace AGVControl.Models
|
|||||||
{
|
{
|
||||||
public Point StartPoint { get; set; }
|
public Point StartPoint { get; set; }
|
||||||
public Point EndPoint { get; set; }
|
public Point EndPoint { get; set; }
|
||||||
public string StartRFID { get; set; }
|
public uint StartRFID { get; set; }
|
||||||
public string EndRFID { get; set; }
|
public uint EndRFID { get; set; }
|
||||||
public bool IsBidirectional { get; set; } = true; // 양방향 이동 가능 여부
|
public bool IsBidirectional { get; set; } = true; // 양방향 이동 가능 여부
|
||||||
public float Distance { get; set; } // 두 RFID 포인트 사이의 거리
|
public float Distance { get; set; } // 두 RFID 포인트 사이의 거리
|
||||||
|
|
||||||
public List<string> ConnectedRFIDs { get; set; } = new List<string>(); // 연결된 모든 RFID 값들
|
public List<uint> ConnectedRFIDs { get; set; } = new List<uint>(); // 연결된 모든 RFID 값들
|
||||||
public Dictionary<string, string> NextRFID { get; set; } = new Dictionary<string, string>(); // 각 RFID의 다음 RFID
|
public Dictionary<uint, uint> NextRFID { get; set; } = new Dictionary<uint, uint>(); // 각 RFID의 다음 RFID
|
||||||
public Dictionary<string, string> PrevRFID { get; set; } = new Dictionary<string, string>(); // 각 RFID의 이전 RFID
|
public Dictionary<uint, uint> PrevRFID { get; set; } = new Dictionary<uint, uint>(); // 각 RFID의 이전 RFID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ namespace AGVControl.Models
|
|||||||
public class RFIDPoint
|
public class RFIDPoint
|
||||||
{
|
{
|
||||||
public Point Location { get; set; }
|
public Point Location { get; set; }
|
||||||
public string RFIDValue { get; set; }
|
public uint RFIDValue { get; set; }
|
||||||
public string NextRFID { get; set; } // 다음 RFID 포인트의 값
|
public string NextRFID { get; set; } // 다음 RFID 포인트의 값
|
||||||
public bool IsBidirectional { get; set; } // 양방향 연결 여부
|
public bool IsBidirectional { get; set; } // 양방향 연결 여부
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.6.33801.468
|
VisualStudioVersion = 17.6.33801.468
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{9312AB43-72F6-4365-A266-E767215FA7F5}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -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<byte> remain = new List<byte>();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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<RequestBatteryDataArgs> RequestData;
|
|
||||||
public event EventHandler<ValueChangedArgs> 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<byte> barr = new List<byte>();
|
|
||||||
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<byte> remain = new List<byte>();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
87
Emulator/AGVEmulator/DevXBE.cs
Normal file
87
Emulator/AGVEmulator/DevXBE.cs
Normal file
@@ -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<EEProtocol.DataEventArgs> 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 목적지 태그번호 전송
|
||||||
|
/// </summary>
|
||||||
|
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}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<ProjectGuid>{9312AB43-72F6-4365-A266-E767215FA7F5}</ProjectGuid>
|
<ProjectGuid>{9312AB43-72F6-4365-A266-E767215FA7F5}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>AGVEmulator</RootNamespace>
|
<RootNamespace>AGVEmulator</RootNamespace>
|
||||||
<AssemblyName>AGVEmulator</AssemblyName>
|
<AssemblyName>EnigEmulator</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
@@ -61,8 +61,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="DevAGV.cs" />
|
<Compile Include="DevAGV.cs" />
|
||||||
<Compile Include="DevBMS.cs" />
|
<Compile Include="DevBMS.cs" />
|
||||||
<Compile Include="DevCAL.cs" />
|
<Compile Include="DevXBE.cs" />
|
||||||
<Compile Include="DevPLC.cs" />
|
|
||||||
<Compile Include="Form1.cs">
|
<Compile Include="Form1.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -72,6 +71,15 @@
|
|||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="RS232.cs" />
|
<Compile Include="RS232.cs" />
|
||||||
|
<Compile Include="RunCode\_AGV.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="RunCode\_XBEE.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="RunCode\_BMS.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="UC\SerialConn.cs">
|
<Compile Include="UC\SerialConn.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -117,5 +125,11 @@
|
|||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\Cs_HMI\SubProject\EnigProtocol\enigprotocol\ENIGProtocol.csproj">
|
||||||
|
<Project>{fdb05af0-dbf8-4cd2-bc02-be251d8c5575}</Project>
|
||||||
|
<Name>ENIGProtocol</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
1392
Emulator/AGVEmulator/Form1.Designer.cs
generated
1392
Emulator/AGVEmulator/Form1.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@@ -16,11 +16,10 @@ namespace AGVEmulator
|
|||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class Form1 : Form
|
||||||
{
|
{
|
||||||
arUtil.Log logPLC, logAGV, logBMS, logCAL;
|
arUtil.Log logAGV, logBMS, logCAL;
|
||||||
DevBMS BMS;
|
DevBMS BMS;
|
||||||
DevAGV AGV;
|
DevAGV AGV;
|
||||||
DevPLC PLC;
|
DevXBE XBE;
|
||||||
DevCAL CAL;
|
|
||||||
|
|
||||||
|
|
||||||
float BMS_MaxA = 80f;
|
float BMS_MaxA = 80f;
|
||||||
@@ -34,17 +33,18 @@ namespace AGVEmulator
|
|||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
logPLC = new arUtil.Log();
|
this.Text = $"{Application.ProductName} ver.{Application.ProductVersion}";
|
||||||
|
// logPLC = new arUtil.Log();
|
||||||
logAGV = new arUtil.Log();
|
logAGV = new arUtil.Log();
|
||||||
logBMS = new arUtil.Log();
|
logBMS = new arUtil.Log();
|
||||||
logCAL = new arUtil.Log();
|
logCAL = new arUtil.Log();
|
||||||
|
|
||||||
logPLC.FileNameFormat = "{yyyyMMdd}_PLC";
|
// logPLC.FileNameFormat = "{yyyyMMdd}_PLC";
|
||||||
logAGV.FileNameFormat = "{yyyyMMdd}_AGV";
|
logAGV.FileNameFormat = "{yyyyMMdd}_AGV";
|
||||||
logBMS.FileNameFormat = "{yyyyMMdd}_BMS";
|
logBMS.FileNameFormat = "{yyyyMMdd}_BMS";
|
||||||
logCAL.FileNameFormat = "{yyyyMMdd}_CAL";
|
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) =>
|
logAGV.RaiseMsg += (s1, e1, d1) =>
|
||||||
{
|
{
|
||||||
if (d1.StartsWith("Tx"))
|
if (d1.StartsWith("Tx"))
|
||||||
@@ -65,7 +65,7 @@ namespace AGVEmulator
|
|||||||
new arCtl.sLogMessageColor("TX", Color.Orange),
|
new arCtl.sLogMessageColor("TX", Color.Orange),
|
||||||
};
|
};
|
||||||
|
|
||||||
rtPLC.ColorList = logcolor;
|
//rtPLC.ColorList = logcolor;
|
||||||
rtAGV.ColorList = logcolor;
|
rtAGV.ColorList = logcolor;
|
||||||
rtBMS.ColorList = logcolor;
|
rtBMS.ColorList = logcolor;
|
||||||
rtCAL.ColorList = logcolor;
|
rtCAL.ColorList = logcolor;
|
||||||
@@ -75,77 +75,40 @@ namespace AGVEmulator
|
|||||||
|
|
||||||
BMS = new DevBMS();
|
BMS = new DevBMS();
|
||||||
AGV = new DevAGV();
|
AGV = new DevAGV();
|
||||||
PLC = new DevPLC();
|
XBE = new DevXBE();
|
||||||
CAL = new DevCAL();
|
|
||||||
this.serAGV.dev = AGV;
|
this.serAGV.dev = AGV;
|
||||||
this.serPLC.dev = PLC;
|
|
||||||
this.serBMS.dev = BMS;
|
this.serBMS.dev = BMS;
|
||||||
this.serCAL.dev = CAL;
|
this.serCAL.dev = XBE;
|
||||||
|
|
||||||
BMS.Message += Bms_Message;
|
BMS.Message += BMS_Message;
|
||||||
AGV.Message += Bms_Message;
|
AGV.Message += AGV_Message;
|
||||||
PLC.Message += Bms_Message;
|
XBE.Message += CAL_Message;
|
||||||
CAL.Message += Bms_Message;
|
|
||||||
|
|
||||||
BMS.RequestBatteryData += Bms_RequestBatteryData;
|
BMS.RequestBatteryData += Bms_RequestBatteryData;
|
||||||
BMS.RequestVoltageData += BMS_RequestVoltageData;
|
BMS.RequestVoltageData += BMS_RequestVoltageData;
|
||||||
PLC.RequestData += Plc_RequestData;
|
XBE.ProtocReceived += CAL_ProtocReceived;
|
||||||
PLC.ValueChanged += Plc_ValueChanged;
|
|
||||||
AGV.RequestStatusData += Agv_RequestStatusData;
|
AGV.RequestStatusData += Agv_RequestStatusData;
|
||||||
AGV.ValueChanged += Agv_ValueChanged;
|
AGV.ValueChanged += Agv_ValueChanged;
|
||||||
AGV.StsValueChanged += Agv_StsValueChanged;
|
AGV.StsValueChanged += Agv_StsValueChanged;
|
||||||
AGV.Command += Agv_Command;
|
AGV.Command += Agv_Command;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Random rnd;
|
Random rnd;
|
||||||
private void Form1_Load(object sender, EventArgs e)
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
rnd = new Random(3000);
|
rnd = new Random(3000);
|
||||||
|
|
||||||
serAGV.BaudRate = 57600;
|
serAGV.BaudRate = 57600;
|
||||||
serPLC.BaudRate = 57600;
|
// serPLC.BaudRate = 57600;
|
||||||
trackBar1_Scroll(null, null);
|
trackBar1_Scroll(null, null);
|
||||||
timer1.Start();
|
timer1.Start();
|
||||||
|
|
||||||
//plc inout 이름 설정
|
//plc inout 이름 설정
|
||||||
List<string> titles = new List<string>();
|
List<string> titles = new List<string>();
|
||||||
List<bool> values = new List<bool>();
|
List<bool> values = new List<bool>();
|
||||||
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));
|
var arrs = Enum.GetNames(typeof(DevAGV.esystemflag0));
|
||||||
foreach (var item in arrs)
|
foreach (var item in arrs)
|
||||||
@@ -256,15 +219,7 @@ namespace AGVEmulator
|
|||||||
agvViewer1.MarkTouched += AgvViewer1_MarkTouched;
|
agvViewer1.MarkTouched += AgvViewer1_MarkTouched;
|
||||||
agvViewer1.Command += AgvViewer1_Command;
|
agvViewer1.Command += AgvViewer1_Command;
|
||||||
}
|
}
|
||||||
private void Agv_Command(object sender, commandargs e)
|
|
||||||
{
|
|
||||||
switch (e.Command.ToLower())
|
|
||||||
{
|
|
||||||
case "stopmark":
|
|
||||||
agvViewer1.StopbyMark = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void MakeViewer()
|
void MakeViewer()
|
||||||
{
|
{
|
||||||
//태그목록
|
//태그목록
|
||||||
@@ -385,143 +340,8 @@ namespace AGVEmulator
|
|||||||
button18.PerformClick();
|
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<StsValueChangedArgs>(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<ValueChangedArgs>(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)
|
char GetGroupItemCheckbox(GroupBox grp)
|
||||||
{
|
{
|
||||||
@@ -544,60 +364,7 @@ namespace AGVEmulator
|
|||||||
int PLC_LeftDir = 0;
|
int PLC_LeftDir = 0;
|
||||||
int PLC_RightDir = 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)
|
public void SetBit(ref UInt16 _value, int idx, Boolean value)
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
@@ -644,75 +411,7 @@ 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)
|
private void button5_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -724,43 +423,7 @@ namespace AGVEmulator
|
|||||||
AGV.WriteData("NAK");
|
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)
|
private void trackBar1_Scroll(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -780,14 +443,14 @@ namespace AGVEmulator
|
|||||||
{
|
{
|
||||||
timer1.Stop();
|
timer1.Stop();
|
||||||
sbAGV.ForeColor = AGV.IsOpen ? Color.ForestGreen : Color.Red;
|
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;
|
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 (checkBox3.Checked && AGV != null && AGV.IsOpen) AGV.AutoSendData(); //자동전송해야함
|
||||||
if (BMS != null && BMS.IsOpen) BMS.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))
|
if (chkSimulation.Checked && AGV.GetAGV(esystemflag1.agv_run))
|
||||||
{
|
{
|
||||||
@@ -805,202 +468,23 @@ namespace AGVEmulator
|
|||||||
agvViewer1.Invalidate();
|
agvViewer1.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdatePLC();
|
|
||||||
label7.Text = $"I/O L({PLC_LeftPosition}),R({PLC_RightPosition})";
|
|
||||||
|
|
||||||
timer1.Start();
|
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)
|
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
|
||||||
{
|
{
|
||||||
timer1.Stop();
|
timer1.Stop();
|
||||||
logPLC.Flush();
|
|
||||||
logAGV.Flush();
|
logAGV.Flush();
|
||||||
logBMS.Flush();
|
logBMS.Flush();
|
||||||
logCAL.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)
|
private void button14_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -1069,29 +553,6 @@ namespace AGVEmulator
|
|||||||
AGV.SendTag(numericUpDown1.Value.ToString());
|
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<byte>();
|
|
||||||
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)
|
private void agvViewer1_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Button == MouseButtons.Left)
|
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 tagno =(uint) nudTagNo.Value;
|
||||||
var kitno = int.Parse(rad.Text);
|
this.XBE.SendGotoTag(tagno);
|
||||||
nudBMSKitNo.Value = (decimal)kitno;
|
}
|
||||||
|
|
||||||
|
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)
|
private void toolStripButton1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
serAGV.Connect();
|
serAGV.Connect();
|
||||||
serPLC.Connect();
|
|
||||||
serBMS.Connect();
|
serBMS.Connect();
|
||||||
serCAL.Connect();
|
serCAL.Connect();
|
||||||
}
|
}
|
||||||
@@ -1122,33 +587,10 @@ namespace AGVEmulator
|
|||||||
private void toolStripButton2_Click(object sender, EventArgs e)
|
private void toolStripButton2_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
serAGV.Disconnect();
|
serAGV.Disconnect();
|
||||||
serPLC.Disconnect();
|
|
||||||
serBMS.Disconnect();
|
serBMS.Disconnect();
|
||||||
serCAL.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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||||
[assembly: Guid("9312ab43-72f6-4365-a266-e767215fa7f5")]
|
[assembly: Guid("9312ab43-72f6-FF65-a266-e767215fa7f5")]
|
||||||
|
|
||||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -305,6 +305,10 @@ namespace AR.Dev
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<MessageEventArgs> Message;
|
public event EventHandler<MessageEventArgs> Message;
|
||||||
|
|
||||||
|
public void RaiseMessage(bool iserr, string message)
|
||||||
|
{
|
||||||
|
Message?.Invoke(this, new MessageEventArgs(message, iserr));
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Event Args"
|
#region "Event Args"
|
||||||
@@ -428,7 +432,7 @@ namespace AR.Dev
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 포트에 쓰기(barcode_DataReceived 이벤트로 메세지수신)
|
/// 포트에 쓰기(barcode_DataReceived 이벤트로 메세지수신)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Boolean WriteData(byte[] data)
|
public Boolean WriteData(byte[] data, bool useLog=true)
|
||||||
{
|
{
|
||||||
Boolean bRet = false;
|
Boolean bRet = false;
|
||||||
|
|
||||||
@@ -457,7 +461,7 @@ namespace AR.Dev
|
|||||||
//_device.Write(data, 0, data.Length);
|
//_device.Write(data, 0, data.Length);
|
||||||
|
|
||||||
//171113
|
//171113
|
||||||
this.Message?.Invoke(this, new MessageEventArgs(data, false));
|
if(useLog) this.Message?.Invoke(this, new MessageEventArgs(data, false));
|
||||||
|
|
||||||
bRet = true;
|
bRet = true;
|
||||||
WriteError = 0;
|
WriteError = 0;
|
||||||
|
|||||||
214
Emulator/AGVEmulator/RunCode/_AGV.cs
Normal file
214
Emulator/AGVEmulator/RunCode/_AGV.cs
Normal file
@@ -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<StsValueChangedArgs>(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<ValueChangedArgs>(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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
60
Emulator/AGVEmulator/RunCode/_BMS.cs
Normal file
60
Emulator/AGVEmulator/RunCode/_BMS.cs
Normal file
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
40
Emulator/AGVEmulator/RunCode/_XBEE.cs
Normal file
40
Emulator/AGVEmulator/RunCode/_XBEE.cs
Normal file
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user