..
This commit is contained in:
@@ -158,7 +158,10 @@
|
||||
<DependentUpon>DataSet1.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Device\CFlag.cs" />
|
||||
<Compile Include="Device\Xbee.cs" />
|
||||
<Compile Include="Device\Xbee _OLD.cs" />
|
||||
<Compile Include="Device\Xbee.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Device\Socket.cs" />
|
||||
<Compile Include="Dialog\fCounter.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -492,6 +495,10 @@
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Protocol\enigprotocol\ENIGProtocol.csproj">
|
||||
<Project>{16bd025d-cb0f-4a4b-a452-8fe629f02f0c}</Project>
|
||||
<Name>ENIGProtocol</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SubProject\AGVControl\agvControl.csproj">
|
||||
<Project>{8cb883c0-99c3-4dd4-b017-f9b92010a806}</Project>
|
||||
<Name>agvControl</Name>
|
||||
|
||||
@@ -92,8 +92,8 @@ namespace Project
|
||||
[Category("Commnunication Setting"), DisplayName("RFID PortName"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
|
||||
public string Port_AGV { get; set; }
|
||||
|
||||
[Category("Commnunication Setting"), DisplayName("PLC #1 PortName"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
|
||||
public string Port_PLC { get; set; }
|
||||
[Category("Commnunication Setting"), DisplayName("Xbee ID"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
|
||||
public byte XBE_ID { get; set; }
|
||||
|
||||
|
||||
[Category("Commnunication Setting"), DisplayName("BMS PortName"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
|
||||
@@ -103,7 +103,7 @@ namespace Project
|
||||
|
||||
public int Baud_AGV { get; set; }
|
||||
public int Baud_BAT { get; set; }
|
||||
public int Baud_PLC { get; set; }
|
||||
//public int Baud_PLC { get; set; }
|
||||
public int Baud_XBE { get; set; }
|
||||
|
||||
//public int QueryInterval_BAT { get; set; }
|
||||
@@ -284,7 +284,7 @@ namespace Project
|
||||
//public Single interval_bms { get; set; }
|
||||
public Single interval_xbe { get; set; }
|
||||
public int interval_bms { get; set; }
|
||||
public byte interval_iostate { get; set; }
|
||||
//public byte interval_iostate { get; set; }
|
||||
//public Boolean Enable_AutoZDnUp { get; set; }
|
||||
public int doorSoundTerm { get; set; }
|
||||
public int musicvol { get; set; }
|
||||
@@ -378,7 +378,7 @@ namespace Project
|
||||
if (ChargeSearchTime == 0) ChargeSearchTime = 25;
|
||||
//최대 충전진행 시간(기본 1시간)
|
||||
if (ChargeMaxTime == 0) ChargeMaxTime = 3600;
|
||||
if (interval_iostate == 0 || interval_iostate == 255) interval_iostate = 100;
|
||||
// if (interval_iostate == 0 || interval_iostate == 255) interval_iostate = 100;
|
||||
if (ZSpeed == 0) ZSpeed = 20;
|
||||
if (interval_xbe == 0) interval_xbe = 5.0f;
|
||||
if (HomePositionValue == 0) HomePositionValue = 4;
|
||||
@@ -418,12 +418,12 @@ namespace Project
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(Port_AGV)) Port_AGV = "COM1";
|
||||
if (string.IsNullOrEmpty(Port_PLC)) Port_PLC = "COM2";
|
||||
// if (string.IsNullOrEmpty(Port_PLC)) Port_PLC = "COM2";
|
||||
if (string.IsNullOrEmpty(Port_XBE)) Port_XBE = "COM4";
|
||||
if (string.IsNullOrEmpty(Port_BAT)) Port_BAT = "COM7";
|
||||
|
||||
if (Baud_AGV == 0) Baud_AGV = 57600;
|
||||
if (Baud_PLC == 0) Baud_PLC = 19200;
|
||||
//if (Baud_PLC == 0) Baud_PLC = 19200;
|
||||
if (Baud_XBE == 0) Baud_XBE = 9600;
|
||||
if (Baud_BAT == 0) Baud_BAT = 9600;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using COMM;
|
||||
using System.Diagnostics;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -42,7 +43,7 @@ namespace Project
|
||||
#endregion
|
||||
|
||||
public arDev.BMS dev_bms { private get; set; } = null;
|
||||
public arDev.FakePLC dev_plc { private get; set; } = null;
|
||||
// public arDev.FakePLC dev_plc { private get; set; } = null;
|
||||
public arDev.Narumi dev_agv { private get; set; } = null;
|
||||
public Device.Xbee dev_xbe { private get; set; } = null;
|
||||
|
||||
@@ -124,7 +125,6 @@ namespace Project
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color BorderColor { get; set; }
|
||||
private int _itemgap = 0;
|
||||
public int ItemGap { get { return _itemgap; } set { _itemgap = value; Invalidate(); } }
|
||||
@@ -138,8 +138,8 @@ namespace Project
|
||||
{
|
||||
get
|
||||
{
|
||||
if (COMM.VAR.BOOL == null) return true;
|
||||
else return COMM.VAR.BOOL[eVarBool.FLAG_AUTORUN];
|
||||
if (VAR.BOOL == null) return true;
|
||||
else return VAR.BOOL[eVarBool.FLAG_AUTORUN];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ namespace Project
|
||||
//상태메세지표시
|
||||
string stmsg = string.Empty;
|
||||
|
||||
if (COMM.VAR.STR != null && COMM.VAR.STR[eVarString.StatusMessage].isEmpty() == false) stmsg = VAR.STR[eVarString.StatusMessage];
|
||||
if (VAR.STR != null && VAR.STR[eVarString.StatusMessage].isEmpty() == false) stmsg = VAR.STR[eVarString.StatusMessage];
|
||||
else stmsg = "STATUS MESSAGE DEMO";
|
||||
if (nextstop) stmsg += "|MARK-STOP";
|
||||
|
||||
@@ -665,39 +665,39 @@ namespace Project
|
||||
|
||||
}
|
||||
|
||||
public bool LimitLU
|
||||
{
|
||||
get
|
||||
{
|
||||
if (dev_plc == null) return true;
|
||||
return dev_plc.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU);
|
||||
}
|
||||
//public bool LimitLU
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (dev_plc == null) return true;
|
||||
// return dev_plc.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU);
|
||||
// }
|
||||
|
||||
}
|
||||
public bool LimitLD
|
||||
{
|
||||
get
|
||||
{
|
||||
if (dev_plc == null) return false;
|
||||
return dev_plc.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LD);
|
||||
}
|
||||
}
|
||||
public bool LimitRU
|
||||
{
|
||||
get
|
||||
{
|
||||
if (dev_plc == null) return false;
|
||||
return dev_plc.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU);
|
||||
}
|
||||
}
|
||||
public bool LimitRD
|
||||
{
|
||||
get
|
||||
{
|
||||
if (dev_plc == null) return true;
|
||||
return dev_plc.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RD);
|
||||
}
|
||||
}
|
||||
//}
|
||||
//public bool LimitLD
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (dev_plc == null) return false;
|
||||
// return dev_plc.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LD);
|
||||
// }
|
||||
//}
|
||||
//public bool LimitRU
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (dev_plc == null) return false;
|
||||
// return dev_plc.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU);
|
||||
// }
|
||||
//}
|
||||
//public bool LimitRD
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (dev_plc == null) return true;
|
||||
// return dev_plc.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RD);
|
||||
// }
|
||||
//}
|
||||
|
||||
void DrawMC(Graphics g)
|
||||
{
|
||||
@@ -794,11 +794,11 @@ namespace Project
|
||||
var coverLYOffset = 0;
|
||||
var coverRYOffset = 0;
|
||||
|
||||
if (LimitRD == true) coverRYOffset = 20;
|
||||
else if (LimitRU == true) coverRYOffset = coverYOffset;
|
||||
//if (LimitRD == true) coverRYOffset = 20;
|
||||
//else if (LimitRU == true) coverRYOffset = coverYOffset;
|
||||
|
||||
if (LimitLD == true) coverLYOffset = 20;
|
||||
else if (LimitLU == true) coverLYOffset = coverYOffset;
|
||||
//if (LimitLD == true) coverLYOffset = 20;
|
||||
//else if (LimitLU == true) coverLYOffset = coverYOffset;
|
||||
|
||||
var PtsCoverBack = new PointF[] {
|
||||
new PointF( PtsBack[0].X+coverPadding, PtsBack[0].Y+coverLYOffset ),
|
||||
@@ -814,17 +814,17 @@ namespace Project
|
||||
new PointF( PtsFront[3].X+coverPadding, PtsFront[3].Y+coverRYOffset )
|
||||
};
|
||||
|
||||
if (LimitLU == true)
|
||||
{
|
||||
g.FillPolygon(new SolidBrush(Color.FromArgb(100, Color.Red)), PtsCoverBack);
|
||||
g.DrawPolygon(new Pen(Color.DarkRed, 2), PtsCoverBack);
|
||||
}
|
||||
else if (LimitLD == true)
|
||||
{
|
||||
g.FillPolygon(new SolidBrush(Color.FromArgb(100, Color.Blue)), PtsCoverBack);
|
||||
g.DrawPolygon(new Pen(Color.DarkBlue, 2), PtsCoverBack);
|
||||
}
|
||||
else
|
||||
//if (LimitLU == true)
|
||||
//{
|
||||
// g.FillPolygon(new SolidBrush(Color.FromArgb(100, Color.Red)), PtsCoverBack);
|
||||
// g.DrawPolygon(new Pen(Color.DarkRed, 2), PtsCoverBack);
|
||||
//}
|
||||
//else if (LimitLD == true)
|
||||
//{
|
||||
// g.FillPolygon(new SolidBrush(Color.FromArgb(100, Color.Blue)), PtsCoverBack);
|
||||
// g.DrawPolygon(new Pen(Color.DarkBlue, 2), PtsCoverBack);
|
||||
//}
|
||||
//else
|
||||
{
|
||||
g.FillPolygon(new SolidBrush(Color.FromArgb(100, Color.Gray)), PtsCoverBack);
|
||||
g.DrawPolygon(Pens.DimGray, PtsCoverBack);
|
||||
@@ -835,17 +835,17 @@ namespace Project
|
||||
g.FillPolygon(new SolidBrush(Color.FromArgb(50, Color.White)), PtsFront);
|
||||
// g.DrawPolygon(Pens.Black, PtsFront);
|
||||
|
||||
if (LimitRU == true)
|
||||
{
|
||||
g.FillPolygon(new SolidBrush(Color.FromArgb(150, Color.Red)), PtsCoverFront);
|
||||
g.DrawPolygon(new Pen(Color.DarkRed, 2), PtsCoverFront);
|
||||
}
|
||||
else if (LimitRD == true)
|
||||
{
|
||||
g.FillPolygon(new SolidBrush(Color.FromArgb(150, Color.Blue)), PtsCoverFront);
|
||||
g.DrawPolygon(new Pen(Color.DarkBlue, 2), PtsCoverFront);
|
||||
}
|
||||
else
|
||||
//if (LimitRU == true)
|
||||
//{
|
||||
// g.FillPolygon(new SolidBrush(Color.FromArgb(150, Color.Red)), PtsCoverFront);
|
||||
// g.DrawPolygon(new Pen(Color.DarkRed, 2), PtsCoverFront);
|
||||
//}
|
||||
//else if (LimitRD == true)
|
||||
//{
|
||||
// g.FillPolygon(new SolidBrush(Color.FromArgb(150, Color.Blue)), PtsCoverFront);
|
||||
// g.DrawPolygon(new Pen(Color.DarkBlue, 2), PtsCoverFront);
|
||||
//}
|
||||
//else
|
||||
{
|
||||
g.FillPolygon(new SolidBrush(Color.FromArgb(150, Color.Gray)), PtsCoverFront);
|
||||
g.DrawPolygon(Pens.DimGray, PtsCoverFront);
|
||||
|
||||
402
Cs_HMI/Project/Device/Xbee _OLD.cs
Normal file
402
Cs_HMI/Project/Device/Xbee _OLD.cs
Normal file
@@ -0,0 +1,402 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.ComponentModel;
|
||||
//using System.Threading;
|
||||
//using COMM;
|
||||
//using System.Runtime.Remoting.Messaging;
|
||||
//using AR;
|
||||
|
||||
//namespace Project.Device
|
||||
//{
|
||||
// public class Xbee_OLD : arDev.arRS232
|
||||
// {
|
||||
// public Xbee_OLD()
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// public string buffer = string.Empty;
|
||||
// public System.Text.StringBuilder newbuffer = new StringBuilder();
|
||||
// protected override bool CustomParser(byte[] buf, out byte[] remainBuffer)
|
||||
// {
|
||||
// //일반 kit 명령은 0x02 kit번호, kit값 0x03
|
||||
// //상태 명령은 0x04 메세지데이터 0x05
|
||||
|
||||
// Console.WriteLine("custom parse len=" + buf.Length.ToString());
|
||||
|
||||
// List<byte> sparebuffer = new List<byte>();
|
||||
// Boolean bComplete = false;
|
||||
// for (int i = 0; i < buf.Length; i++)
|
||||
// {
|
||||
// var incomByte = buf[i];
|
||||
// if (bComplete == true) sparebuffer.Add(incomByte);
|
||||
// else
|
||||
// {
|
||||
// if (findSTX == false)
|
||||
// {
|
||||
// if (incomByte != 0x02)
|
||||
// {
|
||||
// //버리는데이터
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// findSTX = true;
|
||||
// tempBuffer.Clear();
|
||||
// tempBuffer.Add(incomByte);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// tempBuffer.Add(incomByte);
|
||||
|
||||
// if (incomByte == 0x03)
|
||||
// {
|
||||
// //데이터가 맞게 수신됨
|
||||
// LastReceiveBuffer = tempBuffer.ToArray();
|
||||
// bComplete = true;
|
||||
// findSTX = false;
|
||||
// }
|
||||
// else if (tempBuffer.Count > 30)
|
||||
// {
|
||||
// tempBuffer.Clear();
|
||||
// findSTX = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// remainBuffer = sparebuffer.ToArray();
|
||||
// return bComplete;
|
||||
// }
|
||||
|
||||
|
||||
// public override bool ProcessRecvData(byte[] data)
|
||||
// {
|
||||
// var kitno = (char)(data[1]);
|
||||
// var kitval = (char)(data[2]);
|
||||
// NewMsgEvent(kitno, kitval);
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public void NewMsgEvent(char kitNo, char kitVal)
|
||||
// {
|
||||
// //대상위치 확인
|
||||
// ePosition kitPos = ePosition.NONE;
|
||||
// if (kitNo == '9') kitPos = ePosition.QC;
|
||||
// else if (kitNo == '1') kitPos = ePosition.F1;
|
||||
// else if (kitNo == '2') kitPos = ePosition.F2;
|
||||
// else if (kitNo == '3') kitPos = ePosition.F3;
|
||||
// else if (kitNo == '4') kitPos = ePosition.F4;
|
||||
// else
|
||||
// {
|
||||
// if (kitNo == '0') return;
|
||||
// PUB.log.Add($"비허가 키트번호 무시 번호={kitNo},값={kitVal}");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// //if (kitNo= 'F')
|
||||
// //{
|
||||
// // PUB.Speak("알 수 없는 키트번호 입니다");
|
||||
// // PUB.logsys.Add($"키트번호별위치확인실패 값={kitNo}");
|
||||
// // return;
|
||||
// //}
|
||||
|
||||
// //(ePosition)int.Parse(kitNo.ToString());
|
||||
// PUB.logxbee.Add(string.Format("Xbee:newMsgEvent:{0},{1}=>{2}", kitNo, kitVal, kitPos));
|
||||
// if (PUB.CheckManualChargeMode() == false)
|
||||
// {
|
||||
// PUB.log.Add($"수동 충전 중이라 콜 기능을 취소 합니다");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// bool FixButton = kitPos == ePosition.NONE;
|
||||
// if (kitPos == ePosition.NONE)
|
||||
// {
|
||||
// if (kitVal == '1') kitPos = ePosition.QC;
|
||||
// else if (kitVal == '2') kitPos = ePosition.CHARGE;
|
||||
// else if (kitVal == '4') kitPos = ePosition.QC;
|
||||
// //else if (kitVal == '3') kitPos = ePosition.QA;
|
||||
// else
|
||||
// {
|
||||
// PUB.log.Add($"AGV버튼 이벤트 실행 값:{kitVal} 취소");
|
||||
// return;
|
||||
// }
|
||||
// kitVal = '1'; //버튼은 무조건 ON상태로 한다
|
||||
// }
|
||||
|
||||
// //자동상태가 아니라면 오류처리
|
||||
// if (VAR.BOOL[eVarBool.FLAG_AUTORUN] == false || PUB.sm.Step != StateMachine.eSMStep.RUN)
|
||||
// {
|
||||
// PUB.log.AddE("'자동실행' 상태가 아니므로 콜/취소 작업을 할 수 없습니다 콜:" + kitPos.ToString() + ",값=" + kitVal.ToString());
|
||||
// PUB.Speak(Lang.자동운전상태가아닙니다);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// //충전기를 제외하고 '1'의 값은 호출을 원하는값이다.('0'=취소)
|
||||
// if (kitVal == '1')
|
||||
// {
|
||||
// //qA혹은 Pack 에서 해당 버튼을 눌렀을때의 처리방법
|
||||
// //if (PUB.Result.CurrentPos == ePosition.QA && kitPos == ePosition.QA)
|
||||
// //{
|
||||
// // PUB.logsys.AddE("QA위치에서 QA버튼을 눌렀음 명령 취소함");
|
||||
// // PUB.Speak("현재 위치는 QA 입니다.");
|
||||
// // return;
|
||||
// //}
|
||||
|
||||
// //상/하차 작업중이 아니라면 콜을 받는다
|
||||
// if (PUB.sm.RunStep != StateMachine.ERunStep.GOUP && PUB.sm.RunStep != StateMachine.ERunStep.GODOWN)
|
||||
// {
|
||||
// //call을 받으려면 대상위 (2=QC,3,4,5,6,7)
|
||||
// //콜을 요청하는 곳 (2=QC,3=FVI-1,4,5,6,7==FVI-5)
|
||||
// //1번은 충전기
|
||||
|
||||
// //콜버튼으로 대상위치를 다시 결정한다.
|
||||
// //대상번호는 콜번호에서 +2을 하면 된다.
|
||||
// //대상번호 PK=1,QA2=2,QA1=3,QC=4
|
||||
// //QC의경우 콜Kit번호는 2이므로, 이동대상은 +2인 4가 되어야 함
|
||||
// //콜번호와 RFID대상번호는 2의 오차가 발생함, 현재 설치된 RFID를 모두 변경할 수 없어서 이렇게 운용함
|
||||
|
||||
|
||||
// RaiseMessage(MessageType.Normal, string.Format("CALL확정 Kit={0},대상위치={1}", kitNo, kitPos));
|
||||
|
||||
// PUB.AGV.data.CallNo = int.Parse(kitNo.ToString());
|
||||
// PUB.AGV.data.CallString = kitNo.ToString();
|
||||
|
||||
// PUB.Result.CommandKit = kitNo;
|
||||
// PUB.Result.TargetPos = kitPos;
|
||||
// SendToKit(kitNo, '1', (PUB.IsCanCALL() ? '1' : '0')); //콜확정을 클라이언트에 알림
|
||||
|
||||
// PUB.Speak(kitPos.ToString() + Lang.위치로이동합니다);
|
||||
|
||||
// //상태머신을 변경한다 (충전 OFF상태로 간다, 충전상태가 아니면 바로 이동하게됨)
|
||||
// //Pub.sm.ResetRunStep();
|
||||
// //Pub.sm.setNewStep(StateMachine.eSMStep.RUN);
|
||||
|
||||
// //qa, pack 은 하차 전용이다
|
||||
// PUB.sm.ClearRunStep();
|
||||
// PUB.sm.SetNewRunStep(StateMachine.ERunStep.GOUP);
|
||||
// PUB.sm.SetNewStep(StateMachine.eSMStep.RUN);
|
||||
// }
|
||||
// else if (PUB.sm.RunStep == StateMachine.ERunStep.GODOWN && VAR.BOOL[eVarBool.WAIT_COVER_DOWN] == false && VAR.BOOL[eVarBool.WAIT_COVER_UP] == false)
|
||||
// {
|
||||
// //하차중에 받을 수 있게하자 (단 FVi1 이하일때에는 무시하자) 230710 - 김수곤
|
||||
// if (PUB.Result.TargetPos == ePosition.QC && PUB.Result.CurrentPos < ePosition.F1)
|
||||
// {
|
||||
// PUB.log.Add($"하차중이지만 FVI #1 아래에 있으니 콜을 취소 합니다");
|
||||
// SendToKit(kitNo, '0', '0');
|
||||
// RaiseMessage(MessageType.Normal, $"QC 추가 콜이지만 위치가 #1번 이하이므로 취소 됩니다. Kit={kitNo},현재={PUB.Result.CurrentPos},대상={PUB.Result.TargetPos}");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// RaiseMessage(MessageType.Normal, string.Format("CALL확정(추가) Kit={0},대상위치={1}", kitNo, kitPos));
|
||||
|
||||
// PUB.AGV.data.CallNo = int.Parse(kitNo.ToString());
|
||||
// PUB.AGV.data.CallString = kitNo.ToString();
|
||||
|
||||
// PUB.Result.CommandKit = kitNo;
|
||||
// PUB.Result.TargetPos = kitPos;
|
||||
|
||||
// SendToKit(kitNo, '1', (PUB.IsCanCALL() ? '1' : '0')); //콜확정을 클라이언트에 알림
|
||||
|
||||
// PUB.Speak(kitPos.ToString() + Lang.위치로이동합니다);
|
||||
|
||||
// //상태머신을 변경한다 (충전 OFF상태로 간다, 충전상태가 아니면 바로 이동하게됨)
|
||||
// //Pub.sm.ResetRunStep();
|
||||
// //Pub.sm.setNewStep(StateMachine.eSMStep.RUN);
|
||||
|
||||
// //qa, pack 은 하차 전용이다
|
||||
// PUB.sm.ClearRunStep();
|
||||
// PUB.sm.SetNewRunStep(StateMachine.ERunStep.GOUP);
|
||||
// PUB.sm.SetNewStep(StateMachine.eSMStep.RUN);
|
||||
// }
|
||||
|
||||
// }
|
||||
// //else if (PUB.sm.RunStep == StateMachine.ERunStep.GODOWN && PUB.Result.CurrentPos == ePosition.QA)
|
||||
// //{
|
||||
// // RaiseMessage(MessageType.Normal, string.Format("CALL확정 Kit={0},대상위치={1}", kitNo, kitPos));
|
||||
|
||||
// // PUB.Result.CommandKit = kitNo;
|
||||
// // PUB.Result.TargetPos = kitPos;
|
||||
// // SendToKit(kitNo, '1'); //콜확정을 클라이언트에 알림
|
||||
|
||||
// // PUB.Speak(kitPos.ToString() + "위치로 이동 합니다");
|
||||
|
||||
// // //상태머신을 변경한다 (충전 OFF상태로 간다, 충전상태가 아니면 바로 이동하게됨)
|
||||
// // // Pub.sm.ResetRunStep();
|
||||
// // // Pub.sm.setNewStep(StateMachine.eSMStep.RUN);
|
||||
|
||||
// // //qa => pack 은 하차 전용이다
|
||||
// // //QA에서 PACK이동시에는 바로 N극 멈춤 기능을 사용해도도된다.(자재가 있으며, 커버가 내려가 있으므로 느리게 동작해야함)
|
||||
// // PUB.sm.ClearRunStep();
|
||||
// // PUB.sm.SetNewRunStep(StateMachine.ERunStep.GODOWN);
|
||||
// // PUB.sm.SetNewStep(StateMachine.ESMStep.RUN);
|
||||
|
||||
// // PUB.AGV.AGVMoveStop("xbee_newmsgevent", arDev.Narumi.eStopOpt.MarkStop);// (arDev.Narumi.eAgvCmd.MoveStop,.SetNextStop_Mark(true, "xbee godn,qa,pack");
|
||||
// // PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Up);
|
||||
// //}
|
||||
// else if (PUB.Result.TargetPos == kitPos) ////현재 지정된 클라이언트가 또 눌렀다
|
||||
// {
|
||||
// PUB.Result.TargetPos = kitPos;
|
||||
// PUB.AGV.data.CallNo = int.Parse(kitNo.ToString());
|
||||
// PUB.AGV.data.CallString = kitNo.ToString();
|
||||
|
||||
// //상차 대기 중이라면 커버를 자동 올려준다
|
||||
// //이것은 QC만 가능하다
|
||||
// //QC가 QA혹은 PACK으로 보낼때 사용함
|
||||
// if (kitPos == ePosition.QC &&
|
||||
// VAR.BOOL[eVarBool.FLAG_LIMITLOW] == true)
|
||||
// {
|
||||
// RaiseMessage(MessageType.Normal, "QC위치에서 자동으로 커버를 올립니다");
|
||||
// //PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Up);
|
||||
// PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.UP);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //커버대기상태라면 커버를 자동으로 처리해준다.
|
||||
// if (PUB.sm.Step == StateMachine.eSMStep.RUN && (PUB.sm.RunStep == StateMachine.ERunStep.GOUP || PUB.sm.RunStep == StateMachine.ERunStep.GODOWN))
|
||||
// {
|
||||
|
||||
// if (VAR.BOOL[eVarBool.WAIT_COVER_DOWN] == true)
|
||||
// {
|
||||
// //var ld = PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LD);
|
||||
// //var rd = PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RD);
|
||||
// //if (ld == false || rd == false)
|
||||
// //{
|
||||
// // PUB.log.Add("사용자 콜버튼 추가 동작 - Z내림");
|
||||
// // PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Down);
|
||||
// // PUB.Speak(Lang.커버를내립니다);
|
||||
// //}
|
||||
// }
|
||||
// else if (VAR.BOOL[eVarBool.WAIT_COVER_UP] == true)
|
||||
// {
|
||||
// //var lu = PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU);
|
||||
// //var ru = PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU);
|
||||
|
||||
// //if (lu == false || ru == false)
|
||||
// //{
|
||||
// // PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Up);
|
||||
// // PUB.log.Add("사용자 콜버튼 추가 동작 - Z올림");
|
||||
// // PUB.Speak(Lang.커버를올립니다);
|
||||
// //}
|
||||
// }
|
||||
// else RaiseMessage(MessageType.Normal, string.Format("이미 CALL이 확정되었습니다 No={0},Pos={1}", kitNo, kitPos));
|
||||
// }
|
||||
// else RaiseMessage(MessageType.Normal, string.Format("이미 CALL이 확정되었습니다 No={0},Pos={1}", kitNo, kitPos));
|
||||
// }
|
||||
// SendToKit(kitNo, '1', (PUB.IsCanCALL() ? '1' : '0')); //콜확정을 클라이언트에 알림
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //다른대상이 이미 선택된 상태이므로 CANCEL 한다.
|
||||
// SendToKit(kitNo, '0', (PUB.IsCanCALL() ? '1' : '0'));
|
||||
// RaiseMessage(MessageType.Normal, string.Format("다른 CALL이 확정된 상태입니다. 요청KIT={2},확정KIT={0},위치={1}", PUB.Result.TargetPos - 2, PUB.Result.TargetPos, kitNo));
|
||||
// }
|
||||
// }
|
||||
// else if (kitVal == '0') //캔슬버튼을 눌렀다
|
||||
// {
|
||||
// //목표번호가 캔슬버튼을 눌렀다
|
||||
// if (PUB.Result.TargetPos == kitPos)
|
||||
// {
|
||||
// //상차가 완료되면 TargetPos 가 변경되어 ,더이상 해당 버튼으로는 취소하지 못한다
|
||||
// PUB.AGV.data.CallNo = 0;
|
||||
// PUB.AGV.data.CallString = "--";
|
||||
|
||||
// SendToKit(kitNo, '0', (PUB.IsCanCALL() ? '1' : '0'));
|
||||
// RaiseMessage(MessageType.Normal, string.Format("콜 취소 Kit={0}", kitNo));
|
||||
// if (PUB.sm.RunStep != StateMachine.ERunStep.GOHOME)
|
||||
// {
|
||||
// PUB.Result.CommandKit = kitNo;
|
||||
// PUB.Result.TargetPos = ePosition.QC;
|
||||
// PUB.sm.ClearRunStep();
|
||||
// PUB.sm.SetNewRunStep(StateMachine.ERunStep.GOHOME);
|
||||
// PUB.sm.SetNewStep(StateMachine.eSMStep.RUN);
|
||||
// RaiseMessage(MessageType.Normal, string.Format("콜 취소로 인해 홈으로 이동합니다 Kit={0}", kitNo));
|
||||
// }
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //다른놈이 취소 버튼을 눌렀다. ㅋㅋ
|
||||
// //아무~ 의미 없다.
|
||||
// SendToKit(kitNo, '0', (PUB.IsCanCALL() ? '1' : '0'));
|
||||
// RaiseMessage(MessageType.Normal, string.Format("해당 콜취소는 유효하지 않습니다 요청KIT={0},확정KIT={1}", kitNo, PUB.Result.TargetPos - 2));
|
||||
// }
|
||||
// }
|
||||
// else if (kitVal == '2') //BACKWORK시에만 이 값이 전송되게 한다
|
||||
// {
|
||||
// //QA 이동 명령
|
||||
// //발동조건 1. QC 위치에서 GOUP(대기 혹은 상차완료)상태일때 (일반적인경우)
|
||||
// //발동조건 2. QC 위치에서 IDLE 상태일때 (GOUP상태로 하지 않고 바로 싫어버린경우)
|
||||
// //발동조건 3. 충전중일때
|
||||
|
||||
// //if (kitPos != ePosition.QC)
|
||||
// //{
|
||||
// // RaiseMessage(MessageType.Error, $"back 버튼은 QC버튼만 사용 가능 합니다");
|
||||
// // return;
|
||||
// //}
|
||||
|
||||
// //if (kitPos == ePosition.QC && PUB.Result.CurrentPos != ePosition.QC)
|
||||
// //{
|
||||
// // RaiseMessage(MessageType.Error, string.Format("QC의 QA버튼은 홈위치에 있어야 사용이 가능 합니다"));
|
||||
// // return;
|
||||
// //}
|
||||
|
||||
// ////명령송신은 QC로 고정한다
|
||||
// //PUB.Result.CommandKit = '2';
|
||||
// //PUB.Result.TargetPos = ePosition.QA;
|
||||
// //PUB.sm.ClearRunStep();
|
||||
// //PUB.sm.SetNewRunStep(StateMachine.ERunStep.GODOWN);
|
||||
// //PUB.sm.SetNewStep(StateMachine.ESMStep.RUN);
|
||||
// //RaiseMessage(MessageType.Normal, string.Format("후진하차 모드 대상위치={0}", ePosition.QA));
|
||||
// //PUB.logsys.AddI("QC의 QA리모콘 버튼 작업 입니다");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// public void SendToKit(char kitNo, char Value, char enbcall)
|
||||
// {
|
||||
// List<byte> buffer = new List<byte>
|
||||
// {
|
||||
// 0x02,
|
||||
// (byte)kitNo,
|
||||
// (byte)Value,
|
||||
// (byte)enbcall,
|
||||
// 0x03
|
||||
// };
|
||||
// WriteData(buffer.ToArray());
|
||||
// //RaiseMessage(MessageType.Normal, $"지그비전송 {kitNo}:{Value}:{enbcall}");
|
||||
// }
|
||||
|
||||
// public string GetStatusString()
|
||||
// {
|
||||
// return DateTime.Now.ToString();
|
||||
// }
|
||||
|
||||
// public void SendStatus(String StatusString)
|
||||
// {
|
||||
|
||||
// ////IO
|
||||
|
||||
// char kitno = '0';
|
||||
// char kitval = '1';
|
||||
// if (PUB.Result.TargetPos == ePosition.F1) kitno = '1';
|
||||
// else if (PUB.Result.TargetPos == ePosition.F2) kitno = '2';
|
||||
// else if (PUB.Result.TargetPos == ePosition.F3) kitno = '3';
|
||||
// else if (PUB.Result.TargetPos == ePosition.F4) kitno = '4';
|
||||
// else if (PUB.Result.TargetPos == ePosition.QC) kitno = '9';
|
||||
// else
|
||||
// {
|
||||
// //충전기 충전하는 것으로한다
|
||||
// if (VAR.BOOL[eVarBool.FLAG_CHARGEONA] == false && VAR.BOOL[eVarBool.FLAG_CHARGEONM] == false)
|
||||
// kitval = '0';
|
||||
// }
|
||||
|
||||
// //콜가능여부도 전송한다
|
||||
// var enbcall = PUB.IsCanCALL() ? '1' : '0';
|
||||
// SendToKit(kitno, kitval, enbcall);
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -6,395 +6,173 @@ using System.ComponentModel;
|
||||
using System.Threading;
|
||||
using COMM;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using ENIG;
|
||||
using System.Security.Cryptography;
|
||||
using AR;
|
||||
using System.Web.Compilation;
|
||||
|
||||
namespace Project.Device
|
||||
{
|
||||
public class Xbee : arDev.arRS232
|
||||
public class Xbee : System.IO.Ports.SerialPort
|
||||
{
|
||||
public Xbee()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string buffer = string.Empty;
|
||||
public System.Text.StringBuilder newbuffer = new StringBuilder();
|
||||
protected override bool CustomParser(byte[] buf, out byte[] remainBuffer)
|
||||
public string errorMessage = string.Empty;
|
||||
public DateTime LastStatusSendTime = DateTime.Now;
|
||||
private EEProtocol proto;
|
||||
|
||||
public Xbee()
|
||||
{
|
||||
//일반 kit 명령은 0x02 kit번호, kit값 0x03
|
||||
//상태 명령은 0x04 메세지데이터 0x05
|
||||
this.DataReceived += Xbee_DataReceived;
|
||||
proto = new EEProtocol();
|
||||
proto.OnDataReceived += Proto_OnDataReceived;
|
||||
proto.OnMessage += Proto_OnMessage;
|
||||
}
|
||||
~Xbee()
|
||||
{
|
||||
this.DataReceived -= Xbee_DataReceived;
|
||||
proto.OnDataReceived -= Proto_OnDataReceived;
|
||||
proto.OnMessage -= Proto_OnMessage;
|
||||
}
|
||||
|
||||
Console.WriteLine("custom parse len=" + buf.Length.ToString());
|
||||
|
||||
List<byte> sparebuffer = new List<byte>();
|
||||
Boolean bComplete = false;
|
||||
for (int i = 0; i < buf.Length; i++)
|
||||
/// <summary>
|
||||
/// AGV상태를 Xbee 로 전송한다
|
||||
/// </summary>
|
||||
public void SendStatus()
|
||||
{
|
||||
/*
|
||||
Mode[1] : 0=manual, 1=auto
|
||||
RunSt[1] : 0=stop, 1=run, 2=error
|
||||
Diection[1] : 0=straight, 1=left, 2=right, 3=markstop
|
||||
Inposition[1] : 0=off, 1=on : 목적위치에 도달완료 시 설정 이동 이동시 OFF됨
|
||||
ChargeSt[1] : 0=off, 1=on
|
||||
CartSt[1] : 0=off, 1=on, 2=unknown
|
||||
LiftSt[1] : 0=down , 1=up, 2=unknown
|
||||
LastTag[6] : "000000"
|
||||
*/
|
||||
try
|
||||
{
|
||||
var incomByte = buf[i];
|
||||
if (bComplete == true) sparebuffer.Add(incomByte);
|
||||
byte[] data = new byte[13]; // 총 13바이트 데이터
|
||||
|
||||
// Mode
|
||||
data[0] = (byte)(VAR.BOOL[eVarBool.FLAG_AUTORUN] ? 1 : 0);
|
||||
|
||||
// RunSt
|
||||
if (PUB.AGV.error.Emergency)
|
||||
data[1] = 2; // error
|
||||
else if (PUB.AGV.system1.agv_run)
|
||||
data[1] = 1; // run
|
||||
else
|
||||
{
|
||||
if (findSTX == false)
|
||||
{
|
||||
if (incomByte != 0x02)
|
||||
{
|
||||
//버리는데이터
|
||||
}
|
||||
else
|
||||
{
|
||||
findSTX = true;
|
||||
tempBuffer.Clear();
|
||||
tempBuffer.Add(incomByte);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tempBuffer.Add(incomByte);
|
||||
data[1] = 0; // stop
|
||||
|
||||
if (incomByte == 0x03)
|
||||
{
|
||||
//데이터가 맞게 수신됨
|
||||
LastReceiveBuffer = tempBuffer.ToArray();
|
||||
bComplete = true;
|
||||
findSTX = false;
|
||||
}
|
||||
else if (tempBuffer.Count > 30)
|
||||
{
|
||||
tempBuffer.Clear();
|
||||
findSTX = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
remainBuffer = sparebuffer.ToArray();
|
||||
return bComplete;
|
||||
}
|
||||
|
||||
|
||||
public override bool ProcessRecvData(byte[] data)
|
||||
{
|
||||
var kitno = (char)(data[1]);
|
||||
var kitval = (char)(data[2]);
|
||||
NewMsgEvent(kitno, kitval);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void NewMsgEvent(char kitNo, char kitVal)
|
||||
{
|
||||
//대상위치 확인
|
||||
ePosition kitPos = ePosition.NONE;
|
||||
if (kitNo == '9') kitPos = ePosition.QC;
|
||||
else if (kitNo == '1') kitPos = ePosition.F1;
|
||||
else if (kitNo == '2') kitPos = ePosition.F2;
|
||||
else if (kitNo == '3') kitPos = ePosition.F3;
|
||||
else if (kitNo == '4') kitPos = ePosition.F4;
|
||||
else
|
||||
{
|
||||
if (kitNo == '0') return;
|
||||
PUB.log.Add($"비허가 키트번호 무시 번호={kitNo},값={kitVal}");
|
||||
return;
|
||||
}
|
||||
|
||||
//if (kitNo= 'F')
|
||||
//{
|
||||
// PUB.Speak("알 수 없는 키트번호 입니다");
|
||||
// PUB.logsys.Add($"키트번호별위치확인실패 값={kitNo}");
|
||||
// return;
|
||||
//}
|
||||
|
||||
//(ePosition)int.Parse(kitNo.ToString());
|
||||
PUB.logcal.Add(string.Format("Xbee:newMsgEvent:{0},{1}=>{2}", kitNo, kitVal, kitPos));
|
||||
if (PUB.CheckManualChargeMode() == false)
|
||||
{
|
||||
PUB.log.Add($"수동 충전 중이라 콜 기능을 취소 합니다");
|
||||
return;
|
||||
}
|
||||
|
||||
bool FixButton = kitPos == ePosition.NONE;
|
||||
if (kitPos == ePosition.NONE)
|
||||
{
|
||||
if (kitVal == '1') kitPos = ePosition.QC;
|
||||
else if (kitVal == '2') kitPos = ePosition.CHARGE;
|
||||
else if (kitVal == '4') kitPos = ePosition.QC;
|
||||
//else if (kitVal == '3') kitPos = ePosition.QA;
|
||||
// Direction
|
||||
if (PUB.AGV.system1.stop_by_front_detect)
|
||||
data[2] = 3; // markstop
|
||||
else if (VAR.BOOL[eVarBool.FLAG_LEFT_RUN])
|
||||
data[2] = 1; // left
|
||||
else if (VAR.BOOL[eVarBool.FLAG_RIGHT_RUN])
|
||||
data[2] = 2; // right
|
||||
else
|
||||
{
|
||||
PUB.log.Add($"AGV버튼 이벤트 실행 값:{kitVal} 취소");
|
||||
return;
|
||||
}
|
||||
kitVal = '1'; //버튼은 무조건 ON상태로 한다
|
||||
}
|
||||
data[2] = 0; // straight
|
||||
|
||||
//자동상태가 아니라면 오류처리
|
||||
if (VAR.BOOL[eVarBool.FLAG_AUTORUN] == false || PUB.sm.Step != StateMachine.eSMStep.RUN)
|
||||
{
|
||||
PUB.log.AddE("'자동실행' 상태가 아니므로 콜/취소 작업을 할 수 없습니다 콜:" + kitPos.ToString() + ",값=" + kitVal.ToString());
|
||||
PUB.Speak(Lang.자동운전상태가아닙니다);
|
||||
return;
|
||||
}
|
||||
// Inposition
|
||||
data[3] = (byte)(PUB.AGV.system1.agv_stop ? 1 : 0);
|
||||
|
||||
//충전기를 제외하고 '1'의 값은 호출을 원하는값이다.('0'=취소)
|
||||
if (kitVal == '1')
|
||||
{
|
||||
//qA혹은 Pack 에서 해당 버튼을 눌렀을때의 처리방법
|
||||
//if (PUB.Result.CurrentPos == ePosition.QA && kitPos == ePosition.QA)
|
||||
//{
|
||||
// PUB.logsys.AddE("QA위치에서 QA버튼을 눌렀음 명령 취소함");
|
||||
// PUB.Speak("현재 위치는 QA 입니다.");
|
||||
// return;
|
||||
//}
|
||||
// ChargeSt
|
||||
data[4] = (byte)((VAR.BOOL[eVarBool.FLAG_CHARGEONA] || VAR.BOOL[eVarBool.FLAG_CHARGEONM]) ? 1 : 0);
|
||||
|
||||
//상/하차 작업중이 아니라면 콜을 받는다
|
||||
if (PUB.sm.RunStep != StateMachine.ERunStep.GOUP && PUB.sm.RunStep != StateMachine.ERunStep.GODOWN)
|
||||
{
|
||||
//call을 받으려면 대상위 (2=QC,3,4,5,6,7)
|
||||
//콜을 요청하는 곳 (2=QC,3=FVI-1,4,5,6,7==FVI-5)
|
||||
//1번은 충전기
|
||||
|
||||
//콜버튼으로 대상위치를 다시 결정한다.
|
||||
//대상번호는 콜번호에서 +2을 하면 된다.
|
||||
//대상번호 PK=1,QA2=2,QA1=3,QC=4
|
||||
//QC의경우 콜Kit번호는 2이므로, 이동대상은 +2인 4가 되어야 함
|
||||
//콜번호와 RFID대상번호는 2의 오차가 발생함, 현재 설치된 RFID를 모두 변경할 수 없어서 이렇게 운용함
|
||||
|
||||
|
||||
RaiseMessage(MessageType.Normal, string.Format("CALL확정 Kit={0},대상위치={1}", kitNo, kitPos));
|
||||
|
||||
PUB.AGV.data.CallNo = int.Parse(kitNo.ToString());
|
||||
PUB.AGV.data.CallString = kitNo.ToString();
|
||||
|
||||
PUB.Result.CommandKit = kitNo;
|
||||
PUB.Result.TargetPos = kitPos;
|
||||
SendToKit(kitNo, '1', (PUB.IsCanCALL() ? '1' : '0')); //콜확정을 클라이언트에 알림
|
||||
|
||||
PUB.Speak(kitPos.ToString() + Lang.위치로이동합니다);
|
||||
|
||||
//상태머신을 변경한다 (충전 OFF상태로 간다, 충전상태가 아니면 바로 이동하게됨)
|
||||
//Pub.sm.ResetRunStep();
|
||||
//Pub.sm.setNewStep(StateMachine.eSMStep.RUN);
|
||||
|
||||
//qa, pack 은 하차 전용이다
|
||||
PUB.sm.ClearRunStep();
|
||||
PUB.sm.SetNewRunStep(StateMachine.ERunStep.GOUP);
|
||||
PUB.sm.SetNewStep(StateMachine.eSMStep.RUN);
|
||||
}
|
||||
else if (PUB.sm.RunStep == StateMachine.ERunStep.GODOWN && VAR.BOOL[eVarBool.WAIT_COVER_DOWN] == false && VAR.BOOL[eVarBool.WAIT_COVER_UP] == false)
|
||||
{
|
||||
//하차중에 받을 수 있게하자 (단 FVi1 이하일때에는 무시하자) 230710 - 김수곤
|
||||
if (PUB.Result.TargetPos == ePosition.QC && PUB.Result.CurrentPos < ePosition.F1)
|
||||
{
|
||||
PUB.log.Add($"하차중이지만 FVI #1 아래에 있으니 콜을 취소 합니다");
|
||||
SendToKit(kitNo, '0', '0');
|
||||
RaiseMessage(MessageType.Normal, $"QC 추가 콜이지만 위치가 #1번 이하이므로 취소 됩니다. Kit={kitNo},현재={PUB.Result.CurrentPos},대상={PUB.Result.TargetPos}");
|
||||
}
|
||||
else
|
||||
{
|
||||
RaiseMessage(MessageType.Normal, string.Format("CALL확정(추가) Kit={0},대상위치={1}", kitNo, kitPos));
|
||||
|
||||
PUB.AGV.data.CallNo = int.Parse(kitNo.ToString());
|
||||
PUB.AGV.data.CallString = kitNo.ToString();
|
||||
|
||||
PUB.Result.CommandKit = kitNo;
|
||||
PUB.Result.TargetPos = kitPos;
|
||||
|
||||
SendToKit(kitNo, '1', (PUB.IsCanCALL() ? '1' : '0')); //콜확정을 클라이언트에 알림
|
||||
|
||||
PUB.Speak(kitPos.ToString() + Lang.위치로이동합니다);
|
||||
|
||||
//상태머신을 변경한다 (충전 OFF상태로 간다, 충전상태가 아니면 바로 이동하게됨)
|
||||
//Pub.sm.ResetRunStep();
|
||||
//Pub.sm.setNewStep(StateMachine.eSMStep.RUN);
|
||||
|
||||
//qa, pack 은 하차 전용이다
|
||||
PUB.sm.ClearRunStep();
|
||||
PUB.sm.SetNewRunStep(StateMachine.ERunStep.GOUP);
|
||||
PUB.sm.SetNewStep(StateMachine.eSMStep.RUN);
|
||||
}
|
||||
|
||||
}
|
||||
//else if (PUB.sm.RunStep == StateMachine.ERunStep.GODOWN && PUB.Result.CurrentPos == ePosition.QA)
|
||||
//{
|
||||
// RaiseMessage(MessageType.Normal, string.Format("CALL확정 Kit={0},대상위치={1}", kitNo, kitPos));
|
||||
|
||||
// PUB.Result.CommandKit = kitNo;
|
||||
// PUB.Result.TargetPos = kitPos;
|
||||
// SendToKit(kitNo, '1'); //콜확정을 클라이언트에 알림
|
||||
|
||||
// PUB.Speak(kitPos.ToString() + "위치로 이동 합니다");
|
||||
|
||||
// //상태머신을 변경한다 (충전 OFF상태로 간다, 충전상태가 아니면 바로 이동하게됨)
|
||||
// // Pub.sm.ResetRunStep();
|
||||
// // Pub.sm.setNewStep(StateMachine.eSMStep.RUN);
|
||||
|
||||
// //qa => pack 은 하차 전용이다
|
||||
// //QA에서 PACK이동시에는 바로 N극 멈춤 기능을 사용해도도된다.(자재가 있으며, 커버가 내려가 있으므로 느리게 동작해야함)
|
||||
// PUB.sm.ClearRunStep();
|
||||
// PUB.sm.SetNewRunStep(StateMachine.ERunStep.GODOWN);
|
||||
// PUB.sm.SetNewStep(StateMachine.ESMStep.RUN);
|
||||
|
||||
// PUB.AGV.AGVMoveStop("xbee_newmsgevent", arDev.Narumi.eStopOpt.MarkStop);// (arDev.Narumi.eAgvCmd.MoveStop,.SetNextStop_Mark(true, "xbee godn,qa,pack");
|
||||
// PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Up);
|
||||
//}
|
||||
else if (PUB.Result.TargetPos == kitPos) ////현재 지정된 클라이언트가 또 눌렀다
|
||||
{
|
||||
PUB.Result.TargetPos = kitPos;
|
||||
PUB.AGV.data.CallNo = int.Parse(kitNo.ToString());
|
||||
PUB.AGV.data.CallString = kitNo.ToString();
|
||||
|
||||
//상차 대기 중이라면 커버를 자동 올려준다
|
||||
//이것은 QC만 가능하다
|
||||
//QC가 QA혹은 PACK으로 보낼때 사용함
|
||||
if (kitPos == ePosition.QC &&
|
||||
VAR.BOOL[eVarBool.FLAG_LIMITLOW] == true)
|
||||
{
|
||||
RaiseMessage(MessageType.Normal, "QC위치에서 자동으로 커버를 올립니다");
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Up);
|
||||
}
|
||||
else
|
||||
{
|
||||
//커버대기상태라면 커버를 자동으로 처리해준다.
|
||||
if (PUB.sm.Step == StateMachine.eSMStep.RUN && (PUB.sm.RunStep == StateMachine.ERunStep.GOUP || PUB.sm.RunStep == StateMachine.ERunStep.GODOWN))
|
||||
{
|
||||
|
||||
if (VAR.BOOL[eVarBool.WAIT_COVER_DOWN] == true)
|
||||
{
|
||||
var ld = PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LD);
|
||||
var rd = PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RD);
|
||||
if (ld == false || rd == false)
|
||||
{
|
||||
PUB.log.Add("사용자 콜버튼 추가 동작 - Z내림");
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Down);
|
||||
PUB.Speak(Lang.커버를내립니다);
|
||||
}
|
||||
}
|
||||
else if (VAR.BOOL[eVarBool.WAIT_COVER_UP] == true)
|
||||
{
|
||||
var lu = PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU);
|
||||
var ru = PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU);
|
||||
|
||||
if (lu == false || ru == false)
|
||||
{
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Up);
|
||||
PUB.log.Add("사용자 콜버튼 추가 동작 - Z올림");
|
||||
PUB.Speak(Lang.커버를올립니다);
|
||||
}
|
||||
}
|
||||
else RaiseMessage(MessageType.Normal, string.Format("이미 CALL이 확정되었습니다 No={0},Pos={1}", kitNo, kitPos));
|
||||
}
|
||||
else RaiseMessage(MessageType.Normal, string.Format("이미 CALL이 확정되었습니다 No={0},Pos={1}", kitNo, kitPos));
|
||||
}
|
||||
SendToKit(kitNo, '1', (PUB.IsCanCALL() ? '1' : '0')); //콜확정을 클라이언트에 알림
|
||||
}
|
||||
// CartSt
|
||||
if(PUB.AGV.signal.cart_detect1 && PUB.AGV.signal.cart_detect2)
|
||||
data[5] = 1; // 센서두개가 모두 감지되는 경우
|
||||
else if(PUB.AGV.signal.cart_detect1==false && PUB.AGV.signal.cart_detect2==false)
|
||||
data[5] = 0; // 센서두개가 모두 감지되지 않는 경우
|
||||
else
|
||||
{
|
||||
//다른대상이 이미 선택된 상태이므로 CANCEL 한다.
|
||||
SendToKit(kitNo, '0', (PUB.IsCanCALL() ? '1' : '0'));
|
||||
RaiseMessage(MessageType.Normal, string.Format("다른 CALL이 확정된 상태입니다. 요청KIT={2},확정KIT={0},위치={1}", PUB.Result.TargetPos - 2, PUB.Result.TargetPos, kitNo));
|
||||
}
|
||||
}
|
||||
else if (kitVal == '0') //캔슬버튼을 눌렀다
|
||||
{
|
||||
//목표번호가 캔슬버튼을 눌렀다
|
||||
if (PUB.Result.TargetPos == kitPos)
|
||||
{
|
||||
//상차가 완료되면 TargetPos 가 변경되어 ,더이상 해당 버튼으로는 취소하지 못한다
|
||||
PUB.AGV.data.CallNo = 0;
|
||||
PUB.AGV.data.CallString = "--";
|
||||
data[5] = 2; // 센서하나만 감지되는 경우
|
||||
|
||||
SendToKit(kitNo, '0', (PUB.IsCanCALL() ? '1' : '0'));
|
||||
RaiseMessage(MessageType.Normal, string.Format("콜 취소 Kit={0}", kitNo));
|
||||
if (PUB.sm.RunStep != StateMachine.ERunStep.GOHOME)
|
||||
{
|
||||
PUB.Result.CommandKit = kitNo;
|
||||
PUB.Result.TargetPos = ePosition.QC;
|
||||
PUB.sm.ClearRunStep();
|
||||
PUB.sm.SetNewRunStep(StateMachine.ERunStep.GOHOME);
|
||||
PUB.sm.SetNewStep(StateMachine.eSMStep.RUN);
|
||||
RaiseMessage(MessageType.Normal, string.Format("콜 취소로 인해 홈으로 이동합니다 Kit={0}", kitNo));
|
||||
}
|
||||
|
||||
}
|
||||
// LiftSt
|
||||
if(PUB.AGV.signal.lift_up)
|
||||
data[6] = 1; // 위로 올라가는 경우
|
||||
else if(PUB.AGV.signal.lift_down)
|
||||
data[6] = 0; // 아래로 내려가는 경우
|
||||
else
|
||||
{
|
||||
//다른놈이 취소 버튼을 눌렀다. ㅋㅋ
|
||||
//아무~ 의미 없다.
|
||||
SendToKit(kitNo, '0', (PUB.IsCanCALL() ? '1' : '0'));
|
||||
RaiseMessage(MessageType.Normal, string.Format("해당 콜취소는 유효하지 않습니다 요청KIT={0},확정KIT={1}", kitNo, PUB.Result.TargetPos - 2));
|
||||
}
|
||||
data[6] = 2; // unknown (기본값)
|
||||
|
||||
// LastTag
|
||||
string lastTag = PUB.AGV.data.TagNo.ToString("000000") ?? "000000";
|
||||
byte[] tagBytes = Encoding.ASCII.GetBytes(lastTag.PadRight(6, '0'));
|
||||
Array.Copy(tagBytes, 0, data, 7, 6);
|
||||
|
||||
// 데이터 전송
|
||||
var packet = proto.CreatePacket(PUB.setting.XBE_ID, 9, data);
|
||||
Send(packet);
|
||||
LastStatusSendTime = DateTime.Now;
|
||||
}
|
||||
else if (kitVal == '2') //BACKWORK시에만 이 값이 전송되게 한다
|
||||
catch (Exception ex)
|
||||
{
|
||||
//QA 이동 명령
|
||||
//발동조건 1. QC 위치에서 GOUP(대기 혹은 상차완료)상태일때 (일반적인경우)
|
||||
//발동조건 2. QC 위치에서 IDLE 상태일때 (GOUP상태로 하지 않고 바로 싫어버린경우)
|
||||
//발동조건 3. 충전중일때
|
||||
|
||||
//if (kitPos != ePosition.QC)
|
||||
//{
|
||||
// RaiseMessage(MessageType.Error, $"back 버튼은 QC버튼만 사용 가능 합니다");
|
||||
// return;
|
||||
//}
|
||||
|
||||
//if (kitPos == ePosition.QC && PUB.Result.CurrentPos != ePosition.QC)
|
||||
//{
|
||||
// RaiseMessage(MessageType.Error, string.Format("QC의 QA버튼은 홈위치에 있어야 사용이 가능 합니다"));
|
||||
// return;
|
||||
//}
|
||||
|
||||
////명령송신은 QC로 고정한다
|
||||
//PUB.Result.CommandKit = '2';
|
||||
//PUB.Result.TargetPos = ePosition.QA;
|
||||
//PUB.sm.ClearRunStep();
|
||||
//PUB.sm.SetNewRunStep(StateMachine.ERunStep.GODOWN);
|
||||
//PUB.sm.SetNewStep(StateMachine.ESMStep.RUN);
|
||||
//RaiseMessage(MessageType.Normal, string.Format("후진하차 모드 대상위치={0}", ePosition.QA));
|
||||
//PUB.logsys.AddI("QC의 QA리모콘 버튼 작업 입니다");
|
||||
errorMessage = ex.Message;
|
||||
PUB.logxbee.AddE(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SendToKit(char kitNo, char Value, char enbcall)
|
||||
/// <summary>
|
||||
/// 지그비장치에 데이터를 전송합니다
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public bool Send(byte[] data)
|
||||
{
|
||||
List<byte> buffer = new List<byte>
|
||||
try
|
||||
{
|
||||
0x02,
|
||||
(byte)kitNo,
|
||||
(byte)Value,
|
||||
(byte)enbcall,
|
||||
0x03
|
||||
};
|
||||
WriteData(buffer.ToArray());
|
||||
//RaiseMessage(MessageType.Normal, $"지그비전송 {kitNo}:{Value}:{enbcall}");
|
||||
}
|
||||
|
||||
public string GetStatusString()
|
||||
{
|
||||
return DateTime.Now.ToString();
|
||||
}
|
||||
|
||||
public void SendStatus(String StatusString)
|
||||
{
|
||||
|
||||
////IO
|
||||
|
||||
char kitno = '0';
|
||||
char kitval = '1';
|
||||
if (PUB.Result.TargetPos == ePosition.F1) kitno = '1';
|
||||
else if (PUB.Result.TargetPos == ePosition.F2) kitno = '2';
|
||||
else if (PUB.Result.TargetPos == ePosition.F3) kitno = '3';
|
||||
else if (PUB.Result.TargetPos == ePosition.F4) kitno = '4';
|
||||
else if (PUB.Result.TargetPos == ePosition.QC) kitno = '9';
|
||||
else
|
||||
this.Write(data, 0, data.Length);
|
||||
return true;
|
||||
}catch (Exception ex)
|
||||
{
|
||||
//충전기 충전하는 것으로한다
|
||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA] == false && VAR.BOOL[eVarBool.FLAG_CHARGEONM] == false)
|
||||
kitval = '0';
|
||||
errorMessage = ex.Message;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//콜가능여부도 전송한다
|
||||
var enbcall = PUB.IsCanCALL() ? '1' : '0';
|
||||
SendToKit(kitno, kitval, enbcall);
|
||||
public new bool Open()
|
||||
{
|
||||
try{
|
||||
this.Open();
|
||||
return true;
|
||||
}catch (Exception ex)
|
||||
{
|
||||
errorMessage = ex.Message;
|
||||
PUB.logxbee.AddE(errorMessage);
|
||||
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");
|
||||
PUB.logxbee.Add("RX", $"{hexstrRaw}\nID:{id},CMD:{cmd},DATA:{hexstr}");
|
||||
|
||||
//TODO : 기능 처리필요 (XBee 메세지 데이터처리)
|
||||
//PUB.CheckManualChargeMode() : 수동충전확인
|
||||
//VAR.BOOL[eVarBool.FLAG_AUTORUN] : 자동실행
|
||||
//PUB.Speak("현재 위치는 QA 입니다.") : 음성출력
|
||||
|
||||
}
|
||||
private void Proto_OnMessage(object sender, EEProtocol.MessageEventArgs e)
|
||||
{
|
||||
if (e.IsError) PUB.log.AddE(e.Message);
|
||||
else PUB.log.Add(e.Message);
|
||||
}
|
||||
|
||||
|
||||
private void Xbee_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
|
||||
{
|
||||
var dev = sender as System.IO.Ports.SerialPort;
|
||||
var buffer = new byte[dev.BytesToRead];
|
||||
dev.Read(buffer, 0, buffer.Length);
|
||||
proto.ProcessReceivedData(buffer);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Project.Dialog
|
||||
PUB.logagv.RaiseMsg -= Log_RaiseMsgagv;
|
||||
PUB.logplc.RaiseMsg -= Log_RaiseMsgplc;
|
||||
PUB.logbms.RaiseMsg -= Log_RaiseMsgbms;
|
||||
PUB.logcal.RaiseMsg -= Log_RaiseMsgcal;
|
||||
PUB.logxbee.RaiseMsg -= Log_RaiseMsgcal;
|
||||
}
|
||||
|
||||
private void fLog_Load(object sender, EventArgs e)
|
||||
@@ -49,7 +49,7 @@ namespace Project.Dialog
|
||||
PUB.logagv.RaiseMsg += Log_RaiseMsgagv;
|
||||
PUB.logplc.RaiseMsg += Log_RaiseMsgplc;
|
||||
PUB.logbms.RaiseMsg += Log_RaiseMsgbms;
|
||||
PUB.logcal.RaiseMsg += Log_RaiseMsgcal;
|
||||
PUB.logxbee.RaiseMsg += Log_RaiseMsgcal;
|
||||
}
|
||||
|
||||
private void Log_RaiseMsg(DateTime LogTime, string TypeStr, string Message)
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Net;
|
||||
using System.Management;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -28,7 +29,7 @@ namespace Project
|
||||
/// <summary>
|
||||
/// 읽기/쓰기용이며 구동모터 와 비상정지가 연결됨(USB-ATMEGA 2560)
|
||||
/// </summary>
|
||||
public static arDev.FakePLC PLC;
|
||||
//public static arDev.FakePLC PLC;
|
||||
|
||||
///// <summary>
|
||||
///// 읽기전용이며 Z축 모터와 외부 버튼이 연결됨(USB-ATMEGA 2560)
|
||||
@@ -122,7 +123,7 @@ namespace Project
|
||||
/// <summary>
|
||||
/// 시스템로그
|
||||
/// </summary>
|
||||
public static arUtil.Log log, logagv, logplc, logbms, logcal;
|
||||
public static arUtil.Log log, logagv, logplc, logbms, logxbee;
|
||||
|
||||
public static Boolean bPlayMusic = false;
|
||||
|
||||
@@ -158,12 +159,12 @@ namespace Project
|
||||
logagv = new arUtil.Log();
|
||||
logplc = new arUtil.Log();
|
||||
logbms = new arUtil.Log();
|
||||
logcal = new arUtil.Log();
|
||||
logxbee = new arUtil.Log();
|
||||
|
||||
logagv.FileNameFormat = "{yyyyMMdd}_agv";
|
||||
logplc.FileNameFormat = "{yyyyMMdd}_plc";
|
||||
logbms.FileNameFormat = "{yyyyMMdd}_bms";
|
||||
logcal.FileNameFormat = "{yyyyMMdd}_cal";
|
||||
logxbee.FileNameFormat = "{yyyyMMdd}_cal";
|
||||
|
||||
//popupmessage
|
||||
popup = new MessageWindow();
|
||||
@@ -255,7 +256,7 @@ namespace Project
|
||||
/// <returns></returns>
|
||||
public static Boolean HasHWError()
|
||||
{
|
||||
if (PUB.PLC.IsValid == false) return true;
|
||||
//if (PUB.PLC.IsValid == false) return true;
|
||||
if (PUB.AGV.IsOpen == false) return true;
|
||||
if (PUB.XBE.IsOpen == false) return true;
|
||||
return false;
|
||||
|
||||
145
Cs_HMI/Project/StateMachine/AGVPosition.cs
Normal file
145
Cs_HMI/Project/StateMachine/AGVPosition.cs
Normal file
@@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Project.StateMachine
|
||||
{
|
||||
public class AGVPosition
|
||||
{
|
||||
public enum PositionType
|
||||
{
|
||||
None,
|
||||
Tops1,
|
||||
Sstron1,
|
||||
Sstron2,
|
||||
Path
|
||||
}
|
||||
|
||||
public class Position
|
||||
{
|
||||
public int RFID { get; set; }
|
||||
public PositionType Type { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Direction { get; set; }
|
||||
public List<int> ConnectedPositions { get; set; }
|
||||
|
||||
public Position(int rfid, PositionType type, string name, string direction)
|
||||
{
|
||||
RFID = rfid;
|
||||
Type = type;
|
||||
Name = name;
|
||||
Direction = direction;
|
||||
ConnectedPositions = new List<int>();
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<int, Position> positionMap;
|
||||
private static AGVPosition instance;
|
||||
|
||||
private AGVPosition()
|
||||
{
|
||||
positionMap = new Dictionary<int, Position>();
|
||||
InitializePositions();
|
||||
}
|
||||
|
||||
public static AGVPosition Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new AGVPosition();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializePositions()
|
||||
{
|
||||
// Tops 1 관련 위치
|
||||
AddPosition(100, PositionType.Tops1, "Tops 1", "0");
|
||||
AddPosition(101, PositionType.Path, "Tops1-Sstron1 Path 1", "0");
|
||||
AddPosition(102, PositionType.Path, "Tops1-Sstron1 Path 2", "0");
|
||||
|
||||
// Sstron 1 관련 위치
|
||||
AddPosition(200, PositionType.Sstron1, "Sstron 1", "0");
|
||||
AddPosition(201, PositionType.Path, "Sstron1-Sstron2 Path 1", "0");
|
||||
AddPosition(202, PositionType.Path, "Sstron1-Sstron2 Path 2", "0");
|
||||
|
||||
// Sstron 2 관련 위치
|
||||
AddPosition(300, PositionType.Sstron2, "Sstron 2", "0");
|
||||
|
||||
// 경로 연결 설정
|
||||
ConnectPositions(100, 101);
|
||||
ConnectPositions(101, 102);
|
||||
ConnectPositions(102, 200);
|
||||
ConnectPositions(200, 201);
|
||||
ConnectPositions(201, 202);
|
||||
ConnectPositions(202, 300);
|
||||
}
|
||||
|
||||
private void AddPosition(int rfid, PositionType type, string name, string direction)
|
||||
{
|
||||
positionMap[rfid] = new Position(rfid, type, name, direction);
|
||||
}
|
||||
|
||||
private void ConnectPositions(int pos1, int pos2)
|
||||
{
|
||||
if (positionMap.ContainsKey(pos1) && positionMap.ContainsKey(pos2))
|
||||
{
|
||||
positionMap[pos1].ConnectedPositions.Add(pos2);
|
||||
positionMap[pos2].ConnectedPositions.Add(pos1);
|
||||
}
|
||||
}
|
||||
|
||||
public Position GetPosition(int rfid)
|
||||
{
|
||||
if (positionMap.ContainsKey(rfid))
|
||||
{
|
||||
return positionMap[rfid];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<int> FindPath(int startRfid, int endRfid)
|
||||
{
|
||||
if (!positionMap.ContainsKey(startRfid) || !positionMap.ContainsKey(endRfid))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var visited = new HashSet<int>();
|
||||
var path = new List<int>();
|
||||
if (FindPathDFS(startRfid, endRfid, visited, path))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool FindPathDFS(int current, int end, HashSet<int> visited, List<int> path)
|
||||
{
|
||||
if (current == end)
|
||||
{
|
||||
path.Add(current);
|
||||
return true;
|
||||
}
|
||||
|
||||
visited.Add(current);
|
||||
path.Add(current);
|
||||
|
||||
foreach (var next in positionMap[current].ConnectedPositions)
|
||||
{
|
||||
if (!visited.Contains(next))
|
||||
{
|
||||
if (FindPathDFS(next, end, visited, path))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
path.RemoveAt(path.Count - 1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
107
Cs_HMI/Project/StateMachine/AGVProtocolHandler.cs
Normal file
107
Cs_HMI/Project/StateMachine/AGVProtocolHandler.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Project.StateMachine
|
||||
{
|
||||
public class AGVProtocolHandler
|
||||
{
|
||||
private static AGVProtocolHandler instance;
|
||||
private AGVStateManager stateManager;
|
||||
|
||||
private AGVProtocolHandler()
|
||||
{
|
||||
stateManager = AGVStateManager.Instance;
|
||||
}
|
||||
|
||||
public static AGVProtocolHandler Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new AGVProtocolHandler();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ProcessProtocol(string protocol)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 프로토콜 형식: COMMAND:DESTINATION
|
||||
var parts = protocol.Split(':');
|
||||
if (parts.Length != 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var command = parts[0].ToUpper();
|
||||
var destination = parts[1].ToUpper();
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case "MOVE_TO":
|
||||
return HandleMoveToCommand(destination);
|
||||
case "PICKUP":
|
||||
return HandlePickupCommand(destination);
|
||||
case "DROPOFF":
|
||||
return HandleDropoffCommand(destination);
|
||||
case "EMERGENCY_STOP":
|
||||
return HandleEmergencyStopCommand();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool HandleMoveToCommand(string destination)
|
||||
{
|
||||
switch (destination)
|
||||
{
|
||||
case "T1":
|
||||
return stateManager.ProcessCommand(AGVStateManager.AGVCommand.MoveToTops1);
|
||||
case "S1":
|
||||
return stateManager.ProcessCommand(AGVStateManager.AGVCommand.MoveToSstron1);
|
||||
case "S2":
|
||||
return stateManager.ProcessCommand(AGVStateManager.AGVCommand.MoveToSstron2);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool HandlePickupCommand(string destination)
|
||||
{
|
||||
if (destination != "T1")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return stateManager.ProcessCommand(AGVStateManager.AGVCommand.PickupCart);
|
||||
}
|
||||
|
||||
private bool HandleDropoffCommand(string destination)
|
||||
{
|
||||
if (destination != "S1" && destination != "S2")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return stateManager.ProcessCommand(AGVStateManager.AGVCommand.DropoffCart);
|
||||
}
|
||||
|
||||
private bool HandleEmergencyStopCommand()
|
||||
{
|
||||
return stateManager.ProcessCommand(AGVStateManager.AGVCommand.EmergencyStop);
|
||||
}
|
||||
|
||||
public string GetCurrentStatus()
|
||||
{
|
||||
var state = stateManager.CurrentState;
|
||||
return $"Current State: {state}";
|
||||
}
|
||||
}
|
||||
}
|
||||
159
Cs_HMI/Project/StateMachine/AGVStateManager.cs
Normal file
159
Cs_HMI/Project/StateMachine/AGVStateManager.cs
Normal file
@@ -0,0 +1,159 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Project.StateMachine
|
||||
{
|
||||
public class AGVStateManager
|
||||
{
|
||||
public enum AGVState
|
||||
{
|
||||
Idle,
|
||||
Moving,
|
||||
Loading,
|
||||
Unloading,
|
||||
Error
|
||||
}
|
||||
|
||||
public enum AGVCommand
|
||||
{
|
||||
MoveToTops1,
|
||||
MoveToSstron1,
|
||||
MoveToSstron2,
|
||||
PickupCart,
|
||||
DropoffCart,
|
||||
EmergencyStop
|
||||
}
|
||||
|
||||
private AGVState currentState;
|
||||
private static AGVStateManager instance;
|
||||
private AGVPosition positionManager;
|
||||
|
||||
private AGVStateManager()
|
||||
{
|
||||
currentState = AGVState.Idle;
|
||||
positionManager = AGVPosition.Instance;
|
||||
}
|
||||
|
||||
public static AGVStateManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new AGVStateManager();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public AGVState CurrentState
|
||||
{
|
||||
get { return currentState; }
|
||||
}
|
||||
|
||||
public bool ProcessCommand(AGVCommand command)
|
||||
{
|
||||
switch (command)
|
||||
{
|
||||
case AGVCommand.MoveToTops1:
|
||||
return HandleMoveCommand(100); // Tops 1 RFID
|
||||
case AGVCommand.MoveToSstron1:
|
||||
return HandleMoveCommand(200); // Sstron 1 RFID
|
||||
case AGVCommand.MoveToSstron2:
|
||||
return HandleMoveCommand(300); // Sstron 2 RFID
|
||||
case AGVCommand.PickupCart:
|
||||
return HandlePickupCommand();
|
||||
case AGVCommand.DropoffCart:
|
||||
return HandleDropoffCommand();
|
||||
case AGVCommand.EmergencyStop:
|
||||
return HandleEmergencyStop();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool HandleMoveCommand(int targetRfid)
|
||||
{
|
||||
if (currentState != AGVState.Idle && currentState != AGVState.Moving)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 현재 위치에서 목표 위치까지의 경로를 찾음
|
||||
var currentRfid = GetCurrentRfid(); // 실제 구현에서는 현재 RFID 값을 가져와야 함
|
||||
var path = positionManager.FindPath(currentRfid, targetRfid);
|
||||
|
||||
if (path == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
currentState = AGVState.Moving;
|
||||
// 경로를 따라 이동하는 로직 구현
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool HandlePickupCommand()
|
||||
{
|
||||
if (currentState != AGVState.Moving)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 현재 위치가 Tops 1인지 확인
|
||||
var currentRfid = GetCurrentRfid();
|
||||
var position = positionManager.GetPosition(currentRfid);
|
||||
|
||||
if (position == null || position.Type != AGVPosition.PositionType.Tops1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
currentState = AGVState.Loading;
|
||||
// 카트 적재 로직 구현
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool HandleDropoffCommand()
|
||||
{
|
||||
if (currentState != AGVState.Moving)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 현재 위치가 Sstron 1 또는 Sstron 2인지 확인
|
||||
var currentRfid = GetCurrentRfid();
|
||||
var position = positionManager.GetPosition(currentRfid);
|
||||
|
||||
if (position == null ||
|
||||
(position.Type != AGVPosition.PositionType.Sstron1 &&
|
||||
position.Type != AGVPosition.PositionType.Sstron2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
currentState = AGVState.Unloading;
|
||||
// 카트 하역 로직 구현
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool HandleEmergencyStop()
|
||||
{
|
||||
currentState = AGVState.Error;
|
||||
// 비상 정지 로직 구현
|
||||
return true;
|
||||
}
|
||||
|
||||
private int GetCurrentRfid()
|
||||
{
|
||||
// 실제 구현에서는 AGV의 현재 RFID 값을 반환해야 함
|
||||
// 예시로 100(Tops 1)을 반환
|
||||
return 100;
|
||||
}
|
||||
|
||||
public void UpdateState(AGVState newState)
|
||||
{
|
||||
currentState = newState;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -15,6 +16,7 @@ namespace Project
|
||||
DateTime LastCommandTime = DateTime.Now;
|
||||
DateTime LastCommandTimeNextStop = DateTime.Now;
|
||||
bool runStepisFirst = false;
|
||||
|
||||
private void _SM_RUN(Boolean isFirst, TimeSpan stepTime)
|
||||
{
|
||||
//중단기능이 동작이라면 처리하지 않는다.
|
||||
@@ -62,9 +64,9 @@ namespace Project
|
||||
if (isFirst)
|
||||
{
|
||||
if (PUB.sm.RunStep == ERunStep.READY)
|
||||
VAR.TIME.Set(eVarTime.ReadyStart);
|
||||
VAR.TIME.Update(eVarTime.ReadyStart);
|
||||
else
|
||||
VAR.TIME.Set(eVarTime.RunStart);
|
||||
VAR.TIME.Update(eVarTime.RunStart);
|
||||
}
|
||||
|
||||
switch (PUB.sm.RunStep)
|
||||
@@ -95,7 +97,7 @@ namespace Project
|
||||
case ERunStep.CHARGECHECK: //충전중
|
||||
if (runStepisFirst)
|
||||
{
|
||||
VAR.TIME.Set(eVarTime.ChargeStart);
|
||||
VAR.TIME.Update(eVarTime.ChargeStart);
|
||||
LastCommandTime = DateTime.Now;
|
||||
}
|
||||
else if (_SM_RUN_GOCHARGECHECK(runStepisFirst, PUB.sm.GetRunSteptime))
|
||||
@@ -109,7 +111,7 @@ namespace Project
|
||||
case ERunStep.CHARGEOFF:
|
||||
if (runStepisFirst)
|
||||
{
|
||||
VAR.TIME.Set(eVarTime.ChargeEnd);
|
||||
VAR.TIME.Update(eVarTime.ChargeEnd);
|
||||
LastCommandTime = DateTime.Now;
|
||||
}
|
||||
else
|
||||
@@ -160,8 +162,8 @@ namespace Project
|
||||
if (_SM_RUN_GODOWN(runStepisFirst, PUB.sm.GetRunSteptime))
|
||||
{
|
||||
PUB.Speak(Lang.하차작업이완료되었습니다);
|
||||
VAR.TIME.Set(eVarTime.ChargeTry);
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Down);// (Device.PLC.ZMotDirection.Down); //하차작업이 완료되면 커버를 내려서 바로 작업할 수 있게 한다.
|
||||
VAR.TIME.Update(eVarTime.ChargeTry);
|
||||
PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.DN);// (Device.PLC.ZMotDirection.Down); //하차작업이 완료되면 커버를 내려서 바로 작업할 수 있게 한다.
|
||||
|
||||
//230601
|
||||
//if (PUB.Result != null && PUB.sm != null)
|
||||
@@ -200,7 +202,7 @@ namespace Project
|
||||
// EEMStatus.AddEEDBSQL(PUB.sm.Step, PUB.sm.RunStep.ToString(), PUB.Result.TargetPos.ToString());
|
||||
|
||||
PUB.Speak(Lang.홈이동완료대기상태로전환합니다);
|
||||
VAR.TIME.Set(eVarTime.ChargeTry);
|
||||
VAR.TIME.Update(eVarTime.ChargeTry);
|
||||
PUB.sm.SetNewRunStep(ERunStep.READY); //대기상태로 전환한다
|
||||
return;
|
||||
}
|
||||
@@ -213,6 +215,7 @@ namespace Project
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CheckAGVMoveTo(eGoDir dir)
|
||||
{
|
||||
//계속내려간다
|
||||
@@ -233,15 +236,12 @@ namespace Project
|
||||
{
|
||||
PUB.log.Add($"마크정지를 해제하기 위해 장비를 멈춥니다");
|
||||
}
|
||||
//이동해야하는데 마크 스탑이 되어있다면 일단 멈춘다
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//움직이지 않으므로 전진하도록 한다
|
||||
PUB.log.Add($"AGV 기동 방향(DOWN):{dir}");
|
||||
PUB.AGV.AGVMoveRun(arDev.Narumi.eRunOpt.Forward);//PUB.PLC.Move(Device.PLC.Rundirection.Backward, "UpdateMotionPosition(" + sender + ")");
|
||||
|
||||
PUB.AGV.AGVMoveRun(arDev.Narumi.eRunOpt.Forward);
|
||||
}
|
||||
LastCommandTime = DateTime.Now;
|
||||
}
|
||||
@@ -266,8 +266,7 @@ namespace Project
|
||||
else
|
||||
{
|
||||
PUB.log.Add($"AGV 기동 방향(UP):{dir}");
|
||||
PUB.AGV.AGVMoveRun(arDev.Narumi.eRunOpt.Backward);//PUB.PLC.Move(Device.PLC.Rundirection.Backward, "UpdateMotionPosition(" + sender + ")");
|
||||
|
||||
PUB.AGV.AGVMoveRun(arDev.Narumi.eRunOpt.Backward);
|
||||
}
|
||||
LastCommandTime = DateTime.Now;
|
||||
}
|
||||
@@ -546,5 +545,7 @@ namespace Project
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//cvass
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -18,7 +19,7 @@ namespace Project
|
||||
{
|
||||
if (isFirst)
|
||||
{
|
||||
VAR.TIME.Set(eVarTime.ChargeEnd);
|
||||
VAR.TIME.Update(eVarTime.ChargeEnd);
|
||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA])
|
||||
{
|
||||
PUB.Speak(Lang.충전을해제합니다);
|
||||
@@ -44,7 +45,7 @@ namespace Project
|
||||
{
|
||||
PUB.log.Add("충전 해제 전송");
|
||||
PUB.AGV.AGVCharge(PUB.setting.ChargerID, false);
|
||||
VAR.TIME.Set(eVarTime.SendChargeOff);
|
||||
VAR.TIME.Update(eVarTime.SendChargeOff);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -26,11 +27,7 @@ namespace Project
|
||||
PUB.Result.SetResultMessage(eResult.Hardware, eECode.AGVCONN, eNextStep.ERROR);
|
||||
return false;
|
||||
}
|
||||
else if (PUB.PLC.IsValid == false)
|
||||
{
|
||||
PUB.Result.SetResultMessage(eResult.Hardware, eECode.PLCCONN, eNextStep.ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//충전 상태가 OFF되어야 동작하게한다
|
||||
if (_SM_RUN_CHGOFF(isFirst, stepTime) == false)
|
||||
@@ -68,7 +65,7 @@ namespace Project
|
||||
{
|
||||
PUB.Speak(Lang.충전을위해홈위치로이동합니다);
|
||||
PUB.Result.TargetPos = ePosition.QC;
|
||||
VAR.TIME.Set(eVarTime.ChargeSearch);
|
||||
VAR.TIME.Update(eVarTime.ChargeSearch);
|
||||
PUB.sm.UpdateRunStepSeq();
|
||||
PUB.log.Add($"충전:대상위치 QC 시작");
|
||||
return false;
|
||||
@@ -114,7 +111,7 @@ namespace Project
|
||||
});
|
||||
PUB.AGV.AGVMoveRun(arDev.Narumi.eRunOpt.Forward);
|
||||
//PUB.Result.TargetPos = ePosition.CHARGE;
|
||||
VAR.TIME.Set(eVarTime.ChargeSearch);
|
||||
VAR.TIME.Update(eVarTime.ChargeSearch);
|
||||
}
|
||||
else if (PUB.setting.chargerpos == 2) //up search
|
||||
{
|
||||
@@ -129,7 +126,7 @@ namespace Project
|
||||
});
|
||||
PUB.AGV.AGVMoveRun(arDev.Narumi.eRunOpt.Backward);
|
||||
//PUB.Result.TargetPos = ePosition.CHARGE;
|
||||
VAR.TIME.Set(eVarTime.ChargeSearch);
|
||||
VAR.TIME.Update(eVarTime.ChargeSearch);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -148,7 +145,7 @@ namespace Project
|
||||
PUB.log.Add($"충전:AGV기동확인으로 마크정지신호설정");
|
||||
PUB.Speak(Lang.다음마크위치에서정지합니다);
|
||||
PUB.AGV.AGVMoveStop("SM_RUN_GOCHARGE", arDev.Narumi.eStopOpt.MarkStop);
|
||||
VAR.TIME.Set(eVarTime.ChargeSearch);
|
||||
VAR.TIME.Update(eVarTime.ChargeSearch);
|
||||
PUB.sm.UpdateRunStepSeq();
|
||||
}
|
||||
else
|
||||
@@ -163,7 +160,7 @@ namespace Project
|
||||
}
|
||||
else
|
||||
{
|
||||
VAR.TIME.Set(eVarTime.ChargeSearch);
|
||||
VAR.TIME.Update(eVarTime.ChargeSearch);
|
||||
PUB.sm.UpdateRunStepSeq();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -25,11 +26,7 @@ namespace Project
|
||||
PUB.Result.SetResultMessage(eResult.Hardware, eECode.AGVCONN, eNextStep.ERROR);
|
||||
return false;
|
||||
}
|
||||
else if (PUB.PLC.IsValid == false)
|
||||
{
|
||||
PUB.Result.SetResultMessage(eResult.Hardware, eECode.PLCCONN, eNextStep.ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//충전 상태가 OFF되어야 동작하게한다
|
||||
if (_SM_RUN_CHGOFF(isFirst, stepTime) == false)
|
||||
@@ -124,19 +121,19 @@ namespace Project
|
||||
CoverControlTime = DateTime.Now;
|
||||
UpdateProgressStatus(stepTime.TotalSeconds, 5, Lang.안전커버를내립니다);
|
||||
VAR.BOOL[eVarBool.WAIT_COVER_DOWN] = true;
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Down);//
|
||||
PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.DN);//
|
||||
PUB.sm.UpdateRunStepSeq();
|
||||
return false;
|
||||
}
|
||||
else if (PUB.sm.RunStepSeq == 7)
|
||||
{
|
||||
//커버 내림이 완료될때까지 기다린다
|
||||
if (PUB.PLC.IsLimitDn() == true)
|
||||
{
|
||||
VAR.BOOL[eVarBool.WAIT_COVER_DOWN] = false;
|
||||
PUB.sm.UpdateRunStepSeq();
|
||||
}
|
||||
else
|
||||
//if (PUB.PLC.IsLimitDn() == true)
|
||||
//{
|
||||
// VAR.BOOL[eVarBool.WAIT_COVER_DOWN] = false;
|
||||
// PUB.sm.UpdateRunStepSeq();
|
||||
//}
|
||||
//else
|
||||
{
|
||||
//경과시간이 10초가 지나면 5초마다 음성을 출력한다
|
||||
var tsCover = DateTime.Now - CoverControlTime;
|
||||
@@ -177,39 +174,39 @@ namespace Project
|
||||
PUB.Speak(Lang.안전커버를올려주세요);
|
||||
CoverControlTime = DateTime.Now;
|
||||
|
||||
//한쪽이 올라가 있는 상태에..
|
||||
if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) == true)
|
||||
{
|
||||
//모터는 올리는 방향일때에...
|
||||
if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_LDIR) == true)
|
||||
{
|
||||
//모터가 멈춰있을때에..
|
||||
if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_LRUN) == false)
|
||||
{
|
||||
//자동으로 올려준다 (센서가 간혹 인식이 안되어서 .대기하는 경우가 잇음)
|
||||
////한쪽이 올라가 있는 상태에..
|
||||
//if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) == true)
|
||||
//{
|
||||
// //모터는 올리는 방향일때에...
|
||||
// if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_LDIR) == true)
|
||||
// {
|
||||
// //모터가 멈춰있을때에..
|
||||
// if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_LRUN) == false)
|
||||
// {
|
||||
// //자동으로 올려준다 (센서가 간혹 인식이 안되어서 .대기하는 경우가 잇음)
|
||||
|
||||
//왼쪽이 올라가 있지 않은 경우
|
||||
if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) == false)
|
||||
PUB.PLC.ZMot_Left(arDev.FakePLC.ZMotDirection.Up);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU) == true)
|
||||
{
|
||||
//모터는 올리는 방향일때에...
|
||||
if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_RDIR) == true)
|
||||
{
|
||||
//모터가 멈춰있을때에..
|
||||
if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_RRUN) == false)
|
||||
{
|
||||
//자동으로 올려준다 (센서가 간혹 인식이 안되어서 .대기하는 경우가 잇음)
|
||||
// //왼쪽이 올라가 있지 않은 경우
|
||||
// if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) == false)
|
||||
// PUB.PLC.ZMot_Left(arDev.FakePLC.ZMotDirection.Up);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU) == true)
|
||||
//{
|
||||
// //모터는 올리는 방향일때에...
|
||||
// if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_RDIR) == true)
|
||||
// {
|
||||
// //모터가 멈춰있을때에..
|
||||
// if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_RRUN) == false)
|
||||
// {
|
||||
// //자동으로 올려준다 (센서가 간혹 인식이 안되어서 .대기하는 경우가 잇음)
|
||||
|
||||
//왼쪽이 올라가 있지 않은 경우
|
||||
if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU) == false)
|
||||
PUB.PLC.ZMot_Right(arDev.FakePLC.ZMotDirection.Up);
|
||||
}
|
||||
}
|
||||
}
|
||||
// //왼쪽이 올라가 있지 않은 경우
|
||||
// if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU) == false)
|
||||
// PUB.PLC.ZMot_Right(arDev.FakePLC.ZMotDirection.Up);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -32,11 +33,7 @@ namespace Project
|
||||
PUB.Result.SetResultMessage(eResult.Hardware, eECode.AGVCONN, eNextStep.ERROR);
|
||||
return false;
|
||||
}
|
||||
else if (PUB.PLC.IsValid == false)
|
||||
{
|
||||
PUB.Result.SetResultMessage(eResult.Hardware, eECode.PLCCONN, eNextStep.ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//충전 상태가 OFF되어야 동작하게한다
|
||||
if (_SM_RUN_CHGOFF(isFirst, stepTime) == false)
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -25,12 +26,6 @@ namespace Project
|
||||
PUB.Result.SetResultMessage(eResult.Hardware, eECode.AGVCONN, eNextStep.ERROR);
|
||||
return false;
|
||||
}
|
||||
else if (PUB.PLC.IsValid == false)
|
||||
{
|
||||
PUB.Result.SetResultMessage(eResult.Hardware, eECode.PLCCONN, eNextStep.ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//충전 상태가 OFF되어야 동작하게한다
|
||||
if (_SM_RUN_CHGOFF(isFirst, stepTime) == false)
|
||||
@@ -111,7 +106,7 @@ namespace Project
|
||||
//커버를 자동으로 내려준다
|
||||
CoverControlTime = DateTime.Now;
|
||||
UpdateProgressStatus(stepTime.TotalSeconds, 5, Lang.안전커버를내립니다);
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Down);
|
||||
PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.DN);
|
||||
VAR.BOOL[eVarBool.WAIT_COVER_DOWN] = true;
|
||||
PUB.sm.UpdateRunStepSeq();
|
||||
return false;
|
||||
@@ -130,7 +125,7 @@ namespace Project
|
||||
|
||||
|
||||
//커버 내림이 완료될때까지 기다린다
|
||||
if (PUB.PLC.IsLimitDn() == true)
|
||||
if (true)
|
||||
{
|
||||
VAR.BOOL[eVarBool.WAIT_COVER_DOWN] = false;
|
||||
PUB.Result.NextPos = ePosition.NONE;
|
||||
@@ -138,6 +133,8 @@ namespace Project
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
//경과시간이 10초가 지나면 5초마다 음성을 출력한다
|
||||
var tsCover = DateTime.Now - CoverControlTime;
|
||||
if (tsCover.TotalSeconds >= 7)
|
||||
@@ -179,7 +176,7 @@ namespace Project
|
||||
}
|
||||
else if (PUB.sm.RunStepSeq == idx++)
|
||||
{
|
||||
|
||||
|
||||
//IO업데이트 간격 전송
|
||||
UpdateProgressStatus(stepTime.TotalSeconds, 5, Lang.안전커버를올려주세요);
|
||||
PUB.Speak(Lang.안전커버를올리면상차가완료됩니다);
|
||||
@@ -219,47 +216,47 @@ namespace Project
|
||||
PUB.Speak(Lang.안전커버를올려주세요);
|
||||
CoverControlTime = DateTime.Now;
|
||||
|
||||
//한쪽이 올라가 있는 상태에..
|
||||
if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) == true)
|
||||
{
|
||||
//모터는 올리는 방향일때에...
|
||||
if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_LDIR) == true)
|
||||
{
|
||||
//모터가 멈춰있을때에..
|
||||
if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_LRUN) == false)
|
||||
{
|
||||
//자동으로 올려준다 (센서가 간혹 인식이 안되어서 .대기하는 경우가 잇음)
|
||||
////한쪽이 올라가 있는 상태에..
|
||||
//if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) == true)
|
||||
//{
|
||||
// //모터는 올리는 방향일때에...
|
||||
// if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_LDIR) == true)
|
||||
// {
|
||||
// //모터가 멈춰있을때에..
|
||||
// if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_LRUN) == false)
|
||||
// {
|
||||
// //자동으로 올려준다 (센서가 간혹 인식이 안되어서 .대기하는 경우가 잇음)
|
||||
|
||||
//왼쪽이 올라가 있지 않은 경우
|
||||
if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) == false)
|
||||
PUB.PLC.ZMot_Left(arDev.FakePLC.ZMotDirection.Up);
|
||||
// //왼쪽이 올라가 있지 않은 경우
|
||||
// if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) == false)
|
||||
// PUB.PLC.ZMot_Left(arDev.FakePLC.ZMotDirection.Up);
|
||||
|
||||
//오른쪽이 올라가 있지 않은 경우
|
||||
if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU) == false)
|
||||
PUB.PLC.ZMot_Right(arDev.FakePLC.ZMotDirection.Up);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU) == true)
|
||||
{
|
||||
//모터는 올리는 방향일때에...
|
||||
if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_RDIR) == true)
|
||||
{
|
||||
//모터가 멈춰있을때에..
|
||||
if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_RRUN) == false)
|
||||
{
|
||||
//자동으로 올려준다 (센서가 간혹 인식이 안되어서 .대기하는 경우가 잇음)
|
||||
// //오른쪽이 올라가 있지 않은 경우
|
||||
// if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU) == false)
|
||||
// PUB.PLC.ZMot_Right(arDev.FakePLC.ZMotDirection.Up);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU) == true)
|
||||
//{
|
||||
// //모터는 올리는 방향일때에...
|
||||
// if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_RDIR) == true)
|
||||
// {
|
||||
// //모터가 멈춰있을때에..
|
||||
// if (PUB.PLC.GetValueO(arDev.FakePLC.DOName.PINO_GUIDEMOTOR_RRUN) == false)
|
||||
// {
|
||||
// //자동으로 올려준다 (센서가 간혹 인식이 안되어서 .대기하는 경우가 잇음)
|
||||
|
||||
//왼쪽이 올라가 있지 않은 경우
|
||||
if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) == false)
|
||||
PUB.PLC.ZMot_Left(arDev.FakePLC.ZMotDirection.Up);
|
||||
// //왼쪽이 올라가 있지 않은 경우
|
||||
// if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) == false)
|
||||
// PUB.PLC.ZMot_Left(arDev.FakePLC.ZMotDirection.Up);
|
||||
|
||||
//오른쪽이 올라가 있지 않은 경우
|
||||
if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU) == false)
|
||||
PUB.PLC.ZMot_Right(arDev.FakePLC.ZMotDirection.Up);
|
||||
}
|
||||
}
|
||||
}
|
||||
// //오른쪽이 올라가 있지 않은 경우
|
||||
// if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU) == false)
|
||||
// PUB.PLC.ZMot_Right(arDev.FakePLC.ZMotDirection.Up);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AR;
|
||||
using COMM;
|
||||
using static Project.StateMachine;
|
||||
|
||||
@@ -24,7 +25,7 @@ namespace Project
|
||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONA] == true)
|
||||
{
|
||||
if (VAR.TIME.IsSet(eVarTime.ChargeStart) == false)
|
||||
VAR.TIME.Set(eVarTime.ChargeStart);
|
||||
VAR.TIME.Update(eVarTime.ChargeStart);
|
||||
|
||||
//충전중이라면 최대 충전 시간을 체크한다.
|
||||
var tsChargeRunTime = VAR.TIME.RUN(eVarTime.ChargeStart);
|
||||
@@ -53,7 +54,7 @@ namespace Project
|
||||
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONM] == true)
|
||||
{
|
||||
if (VAR.TIME.IsSet(eVarTime.ChargeStart) == false)
|
||||
VAR.TIME.Set(eVarTime.ChargeStart);
|
||||
VAR.TIME.Update(eVarTime.ChargeStart);
|
||||
VAR.STR[eVarString.ChargeCheckMsg] = "수동 충전";
|
||||
}
|
||||
|
||||
@@ -133,7 +134,7 @@ namespace Project
|
||||
{
|
||||
PUB.log.Add($"대기상태에서는 정차");
|
||||
PUB.AGV.AGVMoveStop("대기상태에서는 정차");
|
||||
VAR.TIME.Set(eVarTime.IdleStopTime);
|
||||
VAR.TIME.Update(eVarTime.IdleStopTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Text;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using System.Diagnostics;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Project
|
||||
private void _STEP_CLOSING_START(eSMStep step)
|
||||
{
|
||||
PUB.bShutdown = true;
|
||||
if (PUB.PLC != null) PUB.PLC.Dispose();
|
||||
//if (PUB.PLC != null) PUB.PLC.Dispose();
|
||||
|
||||
PUB.AddEEDB("프로그램 종료");
|
||||
PUB.log.Add("Program Close");
|
||||
@@ -23,7 +23,7 @@ namespace Project
|
||||
PUB.logagv.Flush();
|
||||
PUB.logplc.Flush();
|
||||
PUB.logbms.Flush();
|
||||
PUB.logcal.Flush();
|
||||
PUB.logxbee.Flush();
|
||||
// PUB.sm.Stop();
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Text;
|
||||
using arCtl;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using AR;
|
||||
namespace Project
|
||||
{
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Text;
|
||||
using arCtl;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AR;
|
||||
using arDev;
|
||||
using COMM;
|
||||
|
||||
@@ -46,7 +47,7 @@ namespace Project
|
||||
if (VAR.BOOL[eVarBool.WAIT_COVER_UP])
|
||||
{
|
||||
PUB.log.Add($"버튼({diName}) 눌림");
|
||||
PUB.PLC.ZMot(FakePLC.ZMotDirection.Up);
|
||||
PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.UP);
|
||||
PUB.Result.NextPos = ePosition.QC;
|
||||
}
|
||||
else PUB.Speak(Lang.커버업대기상태가아닙니다);
|
||||
@@ -92,7 +93,7 @@ namespace Project
|
||||
if (VAR.BOOL[eVarBool.WAIT_COVER_UP])
|
||||
{
|
||||
PUB.log.Add($"버튼({diName}) 눌림");
|
||||
PUB.PLC.ZMot(FakePLC.ZMotDirection.Up);
|
||||
PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.UP);
|
||||
PUB.Result.NextPos = ePosition.QA;
|
||||
}
|
||||
else PUB.Speak(Lang.커버업대기상태가아닙니다);
|
||||
@@ -120,7 +121,7 @@ namespace Project
|
||||
{
|
||||
//Z-up기능으로 업데이트 230119
|
||||
PUB.log.Add($"버튼({diName}) 눌림");
|
||||
PUB.PLC.ZMot(FakePLC.ZMotDirection.Up);
|
||||
PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.UP);
|
||||
}
|
||||
}
|
||||
else if (diName == arDev.FakePLC.DIName.PINI_EMG)
|
||||
@@ -172,8 +173,8 @@ namespace Project
|
||||
//}
|
||||
//PUB.flag.set(EFlag.FLAG_LIMITHIGH, (PUB.flag.get(EFlag.FLAG_LIMITHIGHL) && PUB.flag.get(EFlag.FLAG_LIMITHIGHR)));
|
||||
//PUB.flag.set(EFlag.FLAG_LIMITLOW, (PUB.flag.get(EFlag.FLAG_LIMITLOWL) && PUB.flag.get(EFlag.FLAG_LIMITLOWR)));
|
||||
VAR.BOOL[eVarBool.FLAG_LIMITHIGH] = PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) || PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU);
|
||||
VAR.BOOL[eVarBool.FLAG_LIMITLOW] = PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LD) || PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RD);
|
||||
VAR.BOOL[eVarBool.FLAG_LIMITHIGH] = false;// PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LU) || PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RU);
|
||||
VAR.BOOL[eVarBool.FLAG_LIMITLOW] = false;//PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_LD) || PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_LIMIT_RD);
|
||||
VAR.BOOL[eVarBool.OVERLOAD] = (VAR.BOOL[eVarBool.OVERLOADL] || VAR.BOOL[eVarBool.OVERLOADR]);
|
||||
}
|
||||
else
|
||||
@@ -189,109 +190,7 @@ namespace Project
|
||||
DateTime lastplclogtime = DateTime.Now;
|
||||
string logmessage = "";
|
||||
bool logerror = false;
|
||||
void PLC_Message(object sender, FakePLC.MessageEventArgs e)
|
||||
{
|
||||
if (e.MsgType == arRS232.MessageType.Error)
|
||||
{
|
||||
PUB.logplc.Add("ERROR-MAIN", e.Message);
|
||||
}
|
||||
else if (e.MsgType == arRS232.MessageType.Normal)
|
||||
{
|
||||
//내부클래스에서 발생한 메세지(이 프로그램)
|
||||
if (e.Message.StartsWith("@STP:") && e.Message.Length > 5)
|
||||
{
|
||||
PUB.Result.StopMessageSWR = e.Message.Substring(5);
|
||||
PUB.Result.StopMessageTimeSWR = DateTime.Now;
|
||||
}
|
||||
PUB.logplc.Add("MOT", "[Inner Msg]" + e.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
//PLC에서 수신된 메세지
|
||||
if (e.Message.StartsWith("@STP|") && e.Message.Length > 5)
|
||||
{
|
||||
PUB.Result.StopMessagePLC = e.Message.Substring(5);
|
||||
PUB.Result.StopMessageTimePLC = DateTime.Now;
|
||||
PUB.logplc.Add("PLC", "[" + e.MsgType.ToString() + "]" + e.Message);
|
||||
}
|
||||
else if (e.Message.StartsWith("@FLAG|") && e.Message.Length > 6)
|
||||
{
|
||||
var flagData = e.Message.Split('|')[1].Split(',');
|
||||
var flag = (COMM.eVarBool)(byte.Parse(flagData[0]));
|
||||
|
||||
var flagmsg = "[" + flag.ToString() + "] = " + flagData[1];
|
||||
|
||||
|
||||
//플래그값이 바뀌면 로깅한다
|
||||
var fValueTrue = flagData[1] == "1";
|
||||
if (PUB.PLC.GetFlag(flag) != fValueTrue)
|
||||
{
|
||||
PUB.logplc.Add("MFLAG", flagmsg);
|
||||
}
|
||||
}
|
||||
else if (e.Message.StartsWith("@SET|") && e.Message.Length > 5)
|
||||
{
|
||||
//셋팅관련 정보이다
|
||||
var flagData = e.Message.Split('|')[1];
|
||||
var splBuf = flagData.Split(':');
|
||||
if (splBuf[0] == "SAVE") PUB.PLC.SaveTime = DateTime.Now;
|
||||
PUB.logplc.Add("SETUP", "[SETTING] " + flagData);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (e.Message.StartsWith("ERR"))
|
||||
{
|
||||
logmessage = e.Message;
|
||||
logerror = true;
|
||||
}
|
||||
else if (e.Message.StartsWith("@@") & e.Data.Length == 16)
|
||||
{
|
||||
//표시하지 말자
|
||||
logerror = false;
|
||||
var hexstr = e.Data.GetHexString();
|
||||
logmessage = "[" + e.MsgType.ToString() + "]" + hexstr;
|
||||
}
|
||||
else
|
||||
{
|
||||
logmessage = "[" + e.MsgType.ToString() + "]" + e.Message;
|
||||
logerror = false;
|
||||
}
|
||||
|
||||
bool addlog = false;
|
||||
if (lastplclogmessage.StartsWith("[Recv] 40 40"))
|
||||
{
|
||||
if (lastplclogmessage.Length > 40)
|
||||
{
|
||||
var st = lastplclogmessage.Substring(0, 40);
|
||||
var cr = logmessage.Substring(0, 40);
|
||||
addlog = st.Equals(cr) == false;
|
||||
if (addlog == false)
|
||||
{
|
||||
var ts = DateTime.Now - lastplclogtime;
|
||||
if (ts.TotalSeconds > 5) addlog = true;
|
||||
}
|
||||
}
|
||||
else addlog = true;
|
||||
}
|
||||
else if (logmessage.Equals(lastplclogmessage) == false) addlog = true;
|
||||
else
|
||||
{
|
||||
var ts = DateTime.Now - lastplclogtime;
|
||||
if (ts.TotalSeconds > 30) addlog = true;
|
||||
}
|
||||
if (addlog)
|
||||
{
|
||||
if (logerror) PUB.logplc.AddE(logmessage);
|
||||
else PUB.logplc.Add("PLC", logmessage);
|
||||
lastplclogmessage = logmessage;
|
||||
lastplclogtime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using COMM;
|
||||
using AR;
|
||||
using COMM;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -62,7 +63,7 @@ namespace Project
|
||||
{
|
||||
if (NewValue)
|
||||
{
|
||||
VAR.TIME.Set(eVarTime.ChargeStart);
|
||||
VAR.TIME.Update(eVarTime.ChargeStart);
|
||||
PUB.counter.CountChargeA += 1;
|
||||
PUB.counter.Save();
|
||||
PUB.Speak(Lang.충전을시작합니다);
|
||||
@@ -76,7 +77,7 @@ namespace Project
|
||||
{
|
||||
if (NewValue)
|
||||
{
|
||||
VAR.TIME.Set(eVarTime.ChargeStart);
|
||||
VAR.TIME.Update(eVarTime.ChargeStart);
|
||||
PUB.counter.CountChargeM += 1;
|
||||
PUB.counter.Save();
|
||||
PUB.Speak(Lang.수동충전을시작합니다);
|
||||
|
||||
@@ -9,6 +9,7 @@ using static Project.StateMachine;
|
||||
using COMM;
|
||||
using System.Windows.Forms;
|
||||
using Project.ViewForm;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -179,7 +180,7 @@ namespace Project
|
||||
{
|
||||
var b1 = PUB.XBE.IsOpen;
|
||||
var b2 = PUB.AGV.IsOpen;
|
||||
var b3 = PUB.PLC.IsOpen;
|
||||
var b3 = true;// PUB.PLC.IsOpen;
|
||||
var b4 = PUB.BMS.IsOpen;
|
||||
|
||||
if (b1 == false || b2 == false || b3 == false || b4 == false)
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AR;
|
||||
using arCtl;
|
||||
using COMM;
|
||||
using static Project.StateMachine;
|
||||
@@ -23,10 +24,10 @@ namespace Project
|
||||
var tsPLC = VAR.TIME.RUN(conntry);
|
||||
if (tsPLC.TotalSeconds > 5)
|
||||
{
|
||||
VAR.TIME.Set(conntry);
|
||||
VAR.TIME.Update(conntry);
|
||||
try
|
||||
{
|
||||
VAR.TIME.Set(recvtime); //this.LastReceiveTime = DateTime.Now;
|
||||
VAR.TIME.Update(recvtime); //this.LastReceiveTime = DateTime.Now;
|
||||
dev.PortName = port;
|
||||
dev.BaudRate = baud;
|
||||
if (dev.Open())
|
||||
@@ -38,8 +39,8 @@ namespace Project
|
||||
var errmessage = dev.errorMessage;
|
||||
PUB.log.Add("ERROR-" + port, errmessage);
|
||||
}
|
||||
VAR.TIME.Set(conn);
|
||||
VAR.TIME.Set(conntry);
|
||||
VAR.TIME.Update(conn);
|
||||
VAR.TIME.Update(conntry);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -51,17 +52,53 @@ namespace Project
|
||||
{
|
||||
PUB.log.Add(port, $"포트변경({dev.PortName}->{port})으로 연결 종료");
|
||||
dev.Close();
|
||||
VAR.TIME.Set(conntry);
|
||||
VAR.TIME.Update(conntry);
|
||||
}
|
||||
}
|
||||
void ConnectSerialPort(Device.Xbee dev, string port, int baud, eVarTime conn, eVarTime conntry, eVarTime recvtime)
|
||||
{
|
||||
if (dev.IsOpen == false && port.isEmpty() == false)
|
||||
{
|
||||
var tsPLC = VAR.TIME.RUN(conntry);
|
||||
if (tsPLC.TotalSeconds > 5)
|
||||
{
|
||||
VAR.TIME.Update(conntry);
|
||||
try
|
||||
{
|
||||
VAR.TIME.Update(recvtime); //this.LastReceiveTime = DateTime.Now;
|
||||
dev.PortName = port;
|
||||
dev.BaudRate = baud;
|
||||
if (dev.Open())
|
||||
{
|
||||
PUB.log.Add(port, "연결완료");
|
||||
}
|
||||
else
|
||||
{
|
||||
var errmessage = dev.errorMessage;
|
||||
PUB.log.Add("ERROR-" + port, errmessage);
|
||||
}
|
||||
VAR.TIME.Update(conn);
|
||||
VAR.TIME.Update(conntry);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PUB.log.AddE(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dev.PortName.Equals(port) == false)
|
||||
{
|
||||
PUB.log.Add(port, $"포트변경({dev.PortName}->{port})으로 연결 종료");
|
||||
dev.Close();
|
||||
VAR.TIME[(int)conntry] = DateTime.Now; ;
|
||||
}
|
||||
}
|
||||
|
||||
void sm_SPS(object sender, EventArgs e)
|
||||
{
|
||||
if (PUB.sm.Step < eSMStep.IDLE || PUB.sm.Step >= eSMStep.CLOSING) return;
|
||||
|
||||
//plc connect
|
||||
ConnectSerialPort(PUB.PLC, PUB.setting.Port_PLC, PUB.setting.Baud_PLC,
|
||||
eVarTime.LastConn_PLC, eVarTime.LastConnTry_PLC, eVarTime.LastRecv_PLC);
|
||||
|
||||
|
||||
//agv connect
|
||||
ConnectSerialPort(PUB.AGV, PUB.setting.Port_AGV, PUB.setting.Baud_AGV,
|
||||
eVarTime.LastConn_AGV, eVarTime.LastConnTry_AGV, eVarTime.LastRecv_AGV);
|
||||
@@ -78,14 +115,14 @@ namespace Project
|
||||
if (PUB.XBE != null && PUB.XBE.IsOpen)
|
||||
{
|
||||
//일정간격으로 상태를 전송한다
|
||||
if (PUB.XBE.lastSendTime.Year == 1982) PUB.XBE.lastSendTime = DateTime.Now.AddSeconds(1);
|
||||
var ts = DateTime.Now - PUB.XBE.lastSendTime;
|
||||
if (PUB.XBE.LastStatusSendTime.Year == 1982) PUB.XBE.LastStatusSendTime = DateTime.Now.AddSeconds(1);
|
||||
var ts = DateTime.Now - PUB.XBE.LastStatusSendTime;
|
||||
if (ts.TotalSeconds >= PUB.setting.interval_xbe)
|
||||
{
|
||||
var statusMsg = PUB.XBE.GetStatusString();
|
||||
PUB.XBE.SendStatus(statusMsg);
|
||||
PUB.XBE.SendStatus();
|
||||
}
|
||||
}
|
||||
|
||||
//배터리쿼리
|
||||
if (PUB.BMS != null && PUB.BMS.IsOpen)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using COMM;
|
||||
using AR;
|
||||
using COMM;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using static Project.StateMachine;
|
||||
@@ -231,7 +232,7 @@ namespace Project
|
||||
//hw접속상태 표시
|
||||
MenuAGV.BackColor = PUB.AGV.IsValid ? Color.FromArgb(40, 40, 40) : Color.Brown;
|
||||
MenuBMS.BackColor = PUB.BMS.IsValid ? Color.FromArgb(40, 40, 40) : Color.Brown;
|
||||
MenuMAN.BackColor = PUB.PLC.IsValid ? Color.FromArgb(40, 40, 40) : Color.Brown;
|
||||
MenuMAN.BackColor = PUB.AGV.IsValid ? Color.FromArgb(40, 40, 40) : Color.Brown;
|
||||
|
||||
|
||||
btChargeA.Enabled = !VAR.BOOL[eVarBool.FLAG_CHARGEONM];
|
||||
@@ -296,7 +297,7 @@ namespace Project
|
||||
_AutoResetCount();
|
||||
|
||||
//상태를 DB에 저장한다. 230314
|
||||
var tsrun = COMM.VAR.TIME.RUN(eVarTime.StatusReporttime);
|
||||
var tsrun = VAR.TIME.RUN(eVarTime.StatusReporttime);
|
||||
if (tsrun.TotalSeconds >= PUB.setting.StatusInterval) EEMStatus.UpdateStatusSQL(PUB.sm.Step, _extrun: true);
|
||||
|
||||
tm1minute = DateTime.Now;
|
||||
@@ -410,7 +411,7 @@ namespace Project
|
||||
}
|
||||
|
||||
|
||||
VAR.TIME.Set(eVarTime.BatWarnTime);
|
||||
VAR.TIME.Update(eVarTime.BatWarnTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -580,14 +581,14 @@ namespace Project
|
||||
UpdateStatusMessage("비상 정지", Color.Tomato, Color.Black);
|
||||
}
|
||||
}
|
||||
else if (PUB.PLC.IsOpen == false)
|
||||
{
|
||||
UpdateStatusMessage(Lang.PLC연결실패, Color.Tomato, Color.Black);
|
||||
}
|
||||
else if (PUB.PLC.IsValid == false)
|
||||
{
|
||||
UpdateStatusMessage(Lang.PLC통신실패, Color.Tomato, Color.Black);
|
||||
}
|
||||
//else if (PUB.PLC.IsOpen == false)
|
||||
//{
|
||||
// UpdateStatusMessage(Lang.PLC연결실패, Color.Tomato, Color.Black);
|
||||
//}
|
||||
//else if (PUB.PLC.IsValid == false)
|
||||
//{
|
||||
// UpdateStatusMessage(Lang.PLC통신실패, Color.Tomato, Color.Black);
|
||||
//}
|
||||
else if (VAR.BOOL[eVarBool.FLAG_CHARGEONA] == true)
|
||||
{
|
||||
//남은 충전시간 계산
|
||||
@@ -646,8 +647,8 @@ namespace Project
|
||||
string stMsg;
|
||||
if (PUB.AGV.system1.stop_by_front_detect)//.GetValueI(arDev.FakePLC.DIName.PINI_LIDAR_STOP))
|
||||
stMsg = Lang.전방에물체가감지되었습니다;
|
||||
else if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_EMG))
|
||||
stMsg = Lang.비상정지신호가감지되었습니다;
|
||||
//else if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_EMG))
|
||||
// stMsg = Lang.비상정지신호가감지되었습니다;
|
||||
else if (PUB.AGV.signal.front_gate_out == true)
|
||||
stMsg = Lang.선로를이탈했습니다;
|
||||
else if (PUB.AGV.error.runerror_by_no_magent_line)
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static Project.StateMachine;
|
||||
using COMM;
|
||||
using AR;
|
||||
|
||||
namespace Project.ViewForm
|
||||
{
|
||||
@@ -28,7 +29,7 @@ namespace Project.ViewForm
|
||||
private void fAuto_Load(object sender, EventArgs e)
|
||||
{
|
||||
ctlAuto1.dev_agv = PUB.AGV;
|
||||
ctlAuto1.dev_plc = PUB.PLC;
|
||||
// ctlAuto1.dev_plc = PUB.PLC;
|
||||
ctlAuto1.dev_bms = PUB.BMS;
|
||||
ctlAuto1.dev_xbe = PUB.XBE;
|
||||
this.timer1.Start();
|
||||
@@ -40,7 +41,7 @@ namespace Project.ViewForm
|
||||
{
|
||||
PUB.log.Add("ui reset click");
|
||||
PUB.AGV.AGVErrorReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Sm_StepChanged(object sender, StepChangeEventArgs e)
|
||||
@@ -52,7 +53,7 @@ namespace Project.ViewForm
|
||||
}
|
||||
|
||||
private void FAuto_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
{
|
||||
timer1.Stop();
|
||||
PUB.sm.StepChanged -= Sm_StepChanged;
|
||||
this.ctlAuto1.ButtonClick -= CtlAuto1_ButtonClick;
|
||||
@@ -67,21 +68,13 @@ namespace Project.ViewForm
|
||||
|
||||
this.ctlAuto1.OnUpdateMode = true;
|
||||
|
||||
//lbBatteryLevel.Text = $"{PUB.BMS.Current_Level}%";
|
||||
//lbBatteryLevel.ProgressValue = PUB.BMS.Current_Level;
|
||||
|
||||
if(this.ctlAuto1.Scean == CtlAuto.eScean.Progress)
|
||||
if (this.ctlAuto1.Scean == CtlAuto.eScean.Progress)
|
||||
{
|
||||
ctlAuto1.ProgressVal = PUB.Result.SMSG_ProgressValue;
|
||||
ctlAuto1.ProgressMax = PUB.Result.SMSG_ProgressMax;
|
||||
ctlAuto1.StatusMessage = VAR.STR?.Get(eVarString.StatusMessage) ?? string.Empty;
|
||||
}
|
||||
|
||||
//if(Pub.Result.StopMessagePLC.StartsWith()
|
||||
if (PUB.PLC.GetValueI(arDev.FakePLC.DIName.PINI_EMG) == true)
|
||||
this.ctlAuto1.StopMessage = PUB.Result.StopMessagePLC;
|
||||
else
|
||||
this.ctlAuto1.StopMessage = string.Empty;
|
||||
this.ctlAuto1.StopMessage = string.Empty;
|
||||
|
||||
if (PUB.sm.Step == StateMachine.eSMStep.RUN)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using AR;
|
||||
using COMM;
|
||||
|
||||
namespace Project.ViewForm
|
||||
|
||||
180
Cs_HMI/Project/ViewForm/fIO.Designer.cs
generated
180
Cs_HMI/Project/ViewForm/fIO.Designer.cs
generated
@@ -29,28 +29,29 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
arFrame.Control.ColorListItem colorListItem1 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem2 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem3 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem4 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem5 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem6 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem7 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem8 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem25 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem26 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem27 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem28 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem29 = new arFrame.Control.ColorListItem();
|
||||
arFrame.Control.ColorListItem colorListItem30 = new arFrame.Control.ColorListItem();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(fIO));
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.HWState = new arFrame.Control.GridView();
|
||||
this.tblMain = new arFrame.Control.GridView();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -59,8 +60,8 @@
|
||||
this.tableLayoutPanel1.ColumnCount = 1;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.HWState, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.tblMain, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.panel3, 0, 1);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
@@ -68,38 +69,38 @@
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(957, 583);
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1056, 583);
|
||||
this.tableLayoutPanel1.TabIndex = 5;
|
||||
//
|
||||
// HWState
|
||||
//
|
||||
this.HWState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.HWState.BorderSize = 0;
|
||||
colorListItem1.BackColor1 = System.Drawing.Color.Gray;
|
||||
colorListItem1.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
|
||||
colorListItem1.Remark = "타이틀바(상)";
|
||||
colorListItem2.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
colorListItem2.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
colorListItem2.Remark = "상태표시(하)";
|
||||
colorListItem3.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
colorListItem3.BackColor2 = System.Drawing.Color.Lime;
|
||||
colorListItem3.Remark = "정상";
|
||||
colorListItem4.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
colorListItem4.BackColor2 = System.Drawing.Color.Red;
|
||||
colorListItem4.Remark = "오류";
|
||||
colorListItem5.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
colorListItem5.BackColor2 = System.Drawing.Color.Yellow;
|
||||
colorListItem5.Remark = "오류(깜박)";
|
||||
colorListItem6.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
colorListItem6.BackColor2 = System.Drawing.Color.DarkViolet;
|
||||
colorListItem6.Remark = "오류(유효)";
|
||||
colorListItem25.BackColor1 = System.Drawing.Color.Gray;
|
||||
colorListItem25.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
|
||||
colorListItem25.Remark = "타이틀바(상)";
|
||||
colorListItem26.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
colorListItem26.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
colorListItem26.Remark = "상태표시(하)";
|
||||
colorListItem27.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
colorListItem27.BackColor2 = System.Drawing.Color.Lime;
|
||||
colorListItem27.Remark = "정상";
|
||||
colorListItem28.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
colorListItem28.BackColor2 = System.Drawing.Color.Red;
|
||||
colorListItem28.Remark = "오류";
|
||||
colorListItem29.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
colorListItem29.BackColor2 = System.Drawing.Color.Yellow;
|
||||
colorListItem29.Remark = "오류(깜박)";
|
||||
colorListItem30.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
colorListItem30.BackColor2 = System.Drawing.Color.DarkViolet;
|
||||
colorListItem30.Remark = "오류(유효)";
|
||||
this.HWState.ColorList = new arFrame.Control.ColorListItem[] {
|
||||
colorListItem1,
|
||||
colorListItem2,
|
||||
colorListItem3,
|
||||
colorListItem4,
|
||||
colorListItem5,
|
||||
colorListItem6};
|
||||
colorListItem25,
|
||||
colorListItem26,
|
||||
colorListItem27,
|
||||
colorListItem28,
|
||||
colorListItem29,
|
||||
colorListItem30};
|
||||
this.HWState.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.HWState.Font = new System.Drawing.Font("Consolas", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.HWState.FontPin = new System.Drawing.Font("Consolas", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
@@ -107,7 +108,7 @@
|
||||
this.HWState.ForeColorPin = System.Drawing.Color.Moccasin;
|
||||
this.HWState.Location = new System.Drawing.Point(0, 525);
|
||||
this.HWState.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.HWState.MatrixSize = new System.Drawing.Point(4, 2);
|
||||
this.HWState.MatrixSize = new System.Drawing.Point(3, 2);
|
||||
this.HWState.MenuBorderSize = 1;
|
||||
this.HWState.MenuGap = 5;
|
||||
this.HWState.MinimumSize = new System.Drawing.Size(100, 0);
|
||||
@@ -128,61 +129,21 @@
|
||||
this.HWState.ShadowColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.HWState.showDebugInfo = false;
|
||||
this.HWState.ShowIndexString = false;
|
||||
this.HWState.Size = new System.Drawing.Size(957, 58);
|
||||
this.HWState.Size = new System.Drawing.Size(1056, 58);
|
||||
this.HWState.TabIndex = 9;
|
||||
this.HWState.Tags = null;
|
||||
this.HWState.Text = "gridView3";
|
||||
this.HWState.TextAttachToImage = true;
|
||||
this.HWState.Titles = new string[] {
|
||||
"AGV|XBE|PLC|BAT|",
|
||||
"C00|C00|C00|C00|"};
|
||||
"AGV|XBE|BAT|",
|
||||
"C00|C00|C00|"};
|
||||
this.HWState.Values = new ushort[] {
|
||||
((ushort)(0)),
|
||||
((ushort)(0)),
|
||||
((ushort)(0)),
|
||||
((ushort)(0)),
|
||||
((ushort)(1)),
|
||||
((ushort)(1)),
|
||||
((ushort)(1)),
|
||||
((ushort)(1))};
|
||||
//
|
||||
// tblMain
|
||||
//
|
||||
this.tblMain.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
|
||||
this.tblMain.BorderSize = 1;
|
||||
colorListItem7.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
|
||||
colorListItem7.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
|
||||
colorListItem7.Remark = "";
|
||||
colorListItem8.BackColor1 = System.Drawing.Color.Orange;
|
||||
colorListItem8.BackColor2 = System.Drawing.Color.DarkOrange;
|
||||
colorListItem8.Remark = "";
|
||||
this.tblMain.ColorList = new arFrame.Control.ColorListItem[] {
|
||||
colorListItem7,
|
||||
colorListItem8};
|
||||
this.tblMain.Cursor = System.Windows.Forms.Cursors.Arrow;
|
||||
this.tblMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tblMain.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.tblMain.FontPin = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold);
|
||||
this.tblMain.ForeColor = System.Drawing.Color.White;
|
||||
this.tblMain.ForeColorPin = System.Drawing.Color.WhiteSmoke;
|
||||
this.tblMain.Location = new System.Drawing.Point(3, 23);
|
||||
this.tblMain.MatrixSize = new System.Drawing.Point(8, 4);
|
||||
this.tblMain.MenuBorderSize = 1;
|
||||
this.tblMain.MenuGap = 5;
|
||||
this.tblMain.MinimumSize = new System.Drawing.Size(100, 50);
|
||||
this.tblMain.Name = "tblMain";
|
||||
this.tblMain.Names = null;
|
||||
this.tblMain.ShadowColor = System.Drawing.Color.Black;
|
||||
this.tblMain.showDebugInfo = false;
|
||||
this.tblMain.ShowIndexString = true;
|
||||
this.tblMain.Size = new System.Drawing.Size(951, 499);
|
||||
this.tblMain.TabIndex = 4;
|
||||
this.tblMain.Tags = null;
|
||||
this.tblMain.Text = "gridView1";
|
||||
this.tblMain.TextAttachToImage = true;
|
||||
this.tblMain.Titles = null;
|
||||
this.tblMain.Values = null;
|
||||
this.tblMain.ItemClick += new System.EventHandler<arFrame.Control.GridView.ItemClickEventArgs>(this.tblIn1_ItemClick);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
@@ -191,7 +152,7 @@
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(3, 3);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(951, 14);
|
||||
this.panel1.Size = new System.Drawing.Size(1050, 14);
|
||||
this.panel1.TabIndex = 6;
|
||||
//
|
||||
// label1
|
||||
@@ -200,7 +161,7 @@
|
||||
this.label1.ForeColor = System.Drawing.Color.White;
|
||||
this.label1.Location = new System.Drawing.Point(0, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(551, 14);
|
||||
this.label1.Size = new System.Drawing.Size(650, 14);
|
||||
this.label1.TabIndex = 5;
|
||||
this.label1.Text = "label1";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
@@ -209,17 +170,23 @@
|
||||
//
|
||||
this.label3.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
|
||||
this.label3.Location = new System.Drawing.Point(551, 0);
|
||||
this.label3.Location = new System.Drawing.Point(650, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(400, 14);
|
||||
this.label3.TabIndex = 6;
|
||||
this.label3.Text = "label3";
|
||||
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// timer1
|
||||
// panel3
|
||||
//
|
||||
this.timer1.Interval = 200;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
this.panel3.Controls.Add(this.button5);
|
||||
this.panel3.Controls.Add(this.button4);
|
||||
this.panel3.Controls.Add(this.panel2);
|
||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel3.Location = new System.Drawing.Point(3, 23);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(1050, 499);
|
||||
this.panel3.TabIndex = 10;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
@@ -227,10 +194,9 @@
|
||||
this.panel2.Controls.Add(this.button2);
|
||||
this.panel2.Controls.Add(this.button3);
|
||||
this.panel2.Controls.Add(this.button1);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.panel2.Location = new System.Drawing.Point(957, 0);
|
||||
this.panel2.Location = new System.Drawing.Point(925, 15);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(99, 583);
|
||||
this.panel2.Size = new System.Drawing.Size(99, 315);
|
||||
this.panel2.TabIndex = 6;
|
||||
//
|
||||
// button2
|
||||
@@ -239,7 +205,7 @@
|
||||
this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image")));
|
||||
this.button2.Location = new System.Drawing.Point(0, 100);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(99, 383);
|
||||
this.button2.Size = new System.Drawing.Size(99, 115);
|
||||
this.button2.TabIndex = 1;
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
@@ -248,7 +214,7 @@
|
||||
//
|
||||
this.button3.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.button3.Image = ((System.Drawing.Image)(resources.GetObject("button3.Image")));
|
||||
this.button3.Location = new System.Drawing.Point(0, 483);
|
||||
this.button3.Location = new System.Drawing.Point(0, 215);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(99, 100);
|
||||
this.button3.TabIndex = 2;
|
||||
@@ -266,13 +232,37 @@
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Interval = 200;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(726, 53);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(134, 100);
|
||||
this.button4.TabIndex = 7;
|
||||
this.button4.Text = "Magnet On";
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
this.button4.Click += new System.EventHandler(this.button4_Click);
|
||||
//
|
||||
// button5
|
||||
//
|
||||
this.button5.Location = new System.Drawing.Point(726, 159);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(134, 100);
|
||||
this.button5.TabIndex = 8;
|
||||
this.button5.Text = "Magnet Off";
|
||||
this.button5.UseVisualStyleBackColor = true;
|
||||
this.button5.Click += new System.EventHandler(this.button5_Click);
|
||||
//
|
||||
// fIO
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.ClientSize = new System.Drawing.Size(1056, 583);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "fIO";
|
||||
this.Text = "fIO";
|
||||
@@ -280,14 +270,13 @@
|
||||
this.VisibleChanged += new System.EventHandler(this.fIO_VisibleChanged);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel3.ResumeLayout(false);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private arFrame.Control.GridView tblMain;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
@@ -298,5 +287,8 @@
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private System.Windows.Forms.Button button4;
|
||||
private System.Windows.Forms.Button button5;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@ namespace Project.ViewForm
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
tblMain.SuspendLayout();
|
||||
|
||||
//이름설정 INput #1
|
||||
List<string> namearray = new List<string>(32);
|
||||
@@ -50,25 +49,17 @@ namespace Project.ViewForm
|
||||
}
|
||||
namearray.Add(flagName);
|
||||
}
|
||||
this.tblMain.setTitle(namearray.ToArray());
|
||||
this.tblMain.setTag(tagarray.ToArray());
|
||||
this.tblMain.setItemTextAlign(ContentAlignment.BottomLeft);
|
||||
|
||||
////값설정
|
||||
//List<Boolean> fgValueM = new List<bool>();
|
||||
//List<Boolean> fgValueS = new List<bool>();
|
||||
|
||||
////mainplc
|
||||
//for (byte i = 0; i < 16; i++)
|
||||
// fgValueM.Add(PUB.PLC.GetValueI(i));
|
||||
//for (byte i = 0; i < 16; i++)
|
||||
// fgValueM.Add(PUB.PLC.GetValueO(i));
|
||||
|
||||
//값설정
|
||||
List<Boolean> fgValueM = new List<bool>();
|
||||
List<Boolean> fgValueS = new List<bool>();
|
||||
|
||||
//mainplc
|
||||
for (byte i = 0; i < 16; i++)
|
||||
fgValueM.Add(PUB.PLC.GetValueI(i));
|
||||
for (byte i = 0; i < 16; i++)
|
||||
fgValueM.Add(PUB.PLC.GetValueO(i));
|
||||
|
||||
|
||||
|
||||
tblMain.setValue(fgValueM.ToArray());
|
||||
tblMain.ResumeLayout();
|
||||
|
||||
this.FormClosed += FIO_FormClosed;
|
||||
UpdateControl();
|
||||
@@ -85,8 +76,8 @@ namespace Project.ViewForm
|
||||
if (PUB.XBE.IsOpen == false) BlinkGridViewItem(HWState, rownum, colIdx++, 3, 4);
|
||||
else HWState.setValue(rownum, colIdx++, 2); //
|
||||
|
||||
if (PUB.PLC.IsOpen == false) BlinkGridViewItem(HWState, rownum, colIdx++, 3, 4);
|
||||
else HWState.setValue(rownum, colIdx++, 2); //
|
||||
//if (PUB.PLC.IsOpen == false) BlinkGridViewItem(HWState, rownum, colIdx++, 3, 4);
|
||||
//else HWState.setValue(rownum, colIdx++, 2); //
|
||||
|
||||
if (PUB.BMS.IsOpen == false) BlinkGridViewItem(HWState, rownum, colIdx++, 3, 4);
|
||||
else HWState.setValue(rownum, colIdx++, 2); //
|
||||
@@ -103,13 +94,13 @@ namespace Project.ViewForm
|
||||
var colIdx = 0;
|
||||
HWState.setTitle(0, colIdx++, "AGV");
|
||||
HWState.setTitle(0, colIdx++, "XBE");
|
||||
HWState.setTitle(0, colIdx++, "PLC");
|
||||
//HWState.setTitle(0, colIdx++, "PLC");
|
||||
HWState.setTitle(0, colIdx++, "BAT");
|
||||
|
||||
colIdx = 0;
|
||||
HWState.setTitle(rowNum, colIdx++, PUB.setting.Port_AGV);
|
||||
HWState.setTitle(rowNum, colIdx++, PUB.setting.Port_XBE);
|
||||
HWState.setTitle(rowNum, colIdx++, PUB.setting.Port_PLC);
|
||||
//HWState.setTitle(rowNum, colIdx++, PUB.setting.Port_PLC);
|
||||
HWState.setTitle(rowNum, colIdx++, PUB.setting.Port_BAT);
|
||||
|
||||
HWState.Invalidate();
|
||||
@@ -126,27 +117,7 @@ namespace Project.ViewForm
|
||||
}
|
||||
|
||||
|
||||
private void tblIn1_ItemClick(object sender, arFrame.Control.GridView.ItemClickEventArgs e)
|
||||
{
|
||||
var dataIndex = (byte)e.idx;
|
||||
if (dataIndex >= 16)
|
||||
{
|
||||
var ctl = sender as arFrame.Control.GridView;
|
||||
var pinNoStr = ctl.Tags[e.idx];
|
||||
if (pinNoStr.isEmpty() == true)
|
||||
{
|
||||
Util.MsgE("해당 포트는 핀번호가 설정되지 않았습니다", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
var pinNo = byte.Parse(pinNoStr);
|
||||
var curVal = PUB.PLC.GetValueO((byte)(dataIndex - 16));
|
||||
PUB.PLC.SetOutput(pinNo, !curVal);// .Sendcommand(Device.PLC1.eCommand.SET_DOUTPUT, pinNo, newval);
|
||||
}
|
||||
}
|
||||
else Util.MsgE("해당 주소는 허용되지 않습니다.", true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool tmrun = false;
|
||||
@@ -156,24 +127,11 @@ namespace Project.ViewForm
|
||||
if (tmrun == true) return;
|
||||
tmrun = true;
|
||||
|
||||
label1.Text = string.Format("{0} / {1}",
|
||||
PUB.PLC.ioBinStr, PUB.PLC.SetupStr);
|
||||
label3.Text = PUB.PLC.LastMessage;
|
||||
|
||||
Update_HWStatus();
|
||||
|
||||
List<Boolean> fgValueM = new List<bool>();
|
||||
List<Boolean> fgValueS = new List<bool>();
|
||||
|
||||
//mainplc
|
||||
for (byte i = 0; i < 16; i++)
|
||||
this.tblMain.setValue(i, PUB.PLC.GetValueI(i));
|
||||
|
||||
for (byte i = 0; i < 16; i++)
|
||||
this.tblMain.setValue(i + 16, PUB.PLC.GetValueO(i));
|
||||
|
||||
|
||||
this.tblMain.Invalidate();
|
||||
|
||||
tmrun = false;
|
||||
}
|
||||
@@ -187,18 +145,28 @@ namespace Project.ViewForm
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Up);
|
||||
PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.UP);
|
||||
}
|
||||
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Stop);
|
||||
PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.STP);
|
||||
}
|
||||
|
||||
private void button3_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Down);
|
||||
PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.DN);
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.ON);
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.OFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,9 +117,6 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="button2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
@@ -211,4 +208,7 @@
|
||||
iAXpTl+ARH8vfFW5YszxNxI+Afqdj2aEL3vaoNP9AxkclDhe7/QIAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -7,6 +7,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using AR;
|
||||
using arDev;
|
||||
using COMM;
|
||||
|
||||
@@ -330,25 +331,7 @@ namespace Project.ViewForm
|
||||
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
PUB.AGV.AGVCommand("SCK", "0010");
|
||||
}
|
||||
|
||||
private void button2_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Stop);
|
||||
}
|
||||
|
||||
private void button3_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Up);
|
||||
}
|
||||
|
||||
private void button4_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
PUB.PLC.ZMot(arDev.FakePLC.ZMotDirection.Down);
|
||||
}
|
||||
|
||||
|
||||
private void arLabel1_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ using Microsoft.Speech.Synthesis;
|
||||
using Microsoft.Speech;
|
||||
using COMM;
|
||||
using System.CodeDom;
|
||||
using AR;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -31,7 +32,7 @@ namespace Project
|
||||
public fMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
COMM.VAR.Init(128);
|
||||
VAR.Init(128);
|
||||
PUB.initCore();
|
||||
this.KeyDown += (s1, e1) =>
|
||||
{
|
||||
@@ -186,15 +187,15 @@ namespace Project
|
||||
VAR.BOOL.PropertyChanged += BOOL_PropertyChanged;
|
||||
|
||||
|
||||
///모터용 pLC
|
||||
PUB.PLC = new arDev.FakePLC();
|
||||
PUB.PLC.ValueChanged += PLC_DioChanged;
|
||||
PUB.PLC.FlagChanged += PLC_FlagChanged;
|
||||
PUB.PLC.Message += PLC_Message;
|
||||
/////모터용 pLC
|
||||
//PUB.PLC = new arDev.FakePLC();
|
||||
//PUB.PLC.ValueChanged += PLC_DioChanged;
|
||||
//PUB.PLC.FlagChanged += PLC_FlagChanged;
|
||||
//PUB.PLC.Message += PLC_Message;
|
||||
|
||||
//지그비통신
|
||||
PUB.XBE = new Device.Xbee();
|
||||
PUB.XBE.Message += Xbee_Message;
|
||||
//PUB.XBE.Message += Xbee_Message;
|
||||
//HWState.setTitle(1, 3, Pub.setting.Port_Xbee);
|
||||
//HWState.setTitle(1, 0, Pub.setting.Address_RFID);
|
||||
|
||||
@@ -294,63 +295,7 @@ namespace Project
|
||||
|
||||
#endregion
|
||||
|
||||
string last_xbee_tx = "";
|
||||
string last_xbee_rx = "";
|
||||
|
||||
DateTime lasttime_xbee_tx = DateTime.Now;
|
||||
DateTime lasttime_xbee_rx = DateTime.Now;
|
||||
private void Xbee_Message(object sender, arDev.arRS232.MessageEventArgs e)
|
||||
{
|
||||
if (e.MsgType == arDev.arRS232.MessageType.Error) PUB.logcal.AddE("xbee err : " + e.Message);
|
||||
else if (e.MsgType == arDev.arRS232.MessageType.Normal) PUB.logcal.Add("xbe", e.Message);
|
||||
else if (e.MsgType == arDev.arRS232.MessageType.Recv)
|
||||
{
|
||||
var datastr = System.Text.Encoding.Default.GetString(e.Data, 1, e.Data.Length - 2);
|
||||
var val = datastr.Substring(datastr.Length - 1);
|
||||
var kitno = datastr.Substring(0, datastr.Length - 1);
|
||||
|
||||
if (last_xbee_rx.Equals(e.Message) == false)
|
||||
{
|
||||
PUB.logcal.Add("xbe-rx", e.Message);
|
||||
last_xbee_rx = e.Message;
|
||||
lasttime_xbee_rx = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
var ts = DateTime.Now - lasttime_xbee_rx;
|
||||
if (ts.TotalSeconds > 30)
|
||||
{
|
||||
PUB.logcal.Add("xbe-rx", e.Message);
|
||||
last_xbee_rx = e.Message;
|
||||
lasttime_xbee_rx = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
PUB.log.Add($"콜버튼:{kitno} 값:{val} 수신");
|
||||
//PUB.XBE.NewMsgEvent(kitno[0], val[0]);
|
||||
}
|
||||
else if (e.MsgType == arDev.arRS232.MessageType.Send)
|
||||
{
|
||||
if (last_xbee_tx.Equals(e.Message) == false)
|
||||
{
|
||||
PUB.logcal.Add("xbe-tx", e.Message);
|
||||
last_xbee_tx = e.Message;
|
||||
lasttime_xbee_tx = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
var ts = DateTime.Now - lasttime_xbee_tx;
|
||||
if (ts.TotalSeconds > 30)
|
||||
{
|
||||
PUB.logcal.Add("xbe-tx", e.Message);
|
||||
last_xbee_tx = e.Message;
|
||||
lasttime_xbee_tx = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else PUB.logcal.Add("XBEE", $"Rx:{e.Message}");
|
||||
}
|
||||
|
||||
private void CtlPos1_ItemClick(object sender, CtlPos.ItemClickEventArgs e)
|
||||
{
|
||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM] == true)
|
||||
@@ -1005,7 +950,7 @@ namespace Project
|
||||
|
||||
private void btChargeM_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (COMM.VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
||||
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM])
|
||||
{
|
||||
var dlg = Util.MsgQ("수동 충전을 해제 할까요?");
|
||||
if (dlg != DialogResult.Yes) return;
|
||||
|
||||
125
Cs_HMI/Project/fSetup.Designer.cs
generated
125
Cs_HMI/Project/fSetup.Designer.cs
generated
@@ -84,7 +84,6 @@
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.label30 = new System.Windows.Forms.Label();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.tbBaudBAT = new System.Windows.Forms.ComboBox();
|
||||
this.tbportBMS = new System.Windows.Forms.TextBox();
|
||||
@@ -93,16 +92,11 @@
|
||||
this.tbBaudAGV = new System.Windows.Forms.ComboBox();
|
||||
this.tbPortAGV = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.btSelPlc1 = new System.Windows.Forms.Button();
|
||||
this.btSelXbee = new System.Windows.Forms.Button();
|
||||
this.tbBaudPLC = new System.Windows.Forms.ComboBox();
|
||||
this.tbBaudXBE = new System.Windows.Forms.ComboBox();
|
||||
this.tbPortPLC = new System.Windows.Forms.TextBox();
|
||||
this.tbPortXBE = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.valIntervalBMS = new AGVControl.ValueSelect();
|
||||
this.valueSelect4 = new AGVControl.ValueSelect();
|
||||
this.valIntervalXBE = new AGVControl.ValueSelect();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.cmbChargerPos = new System.Windows.Forms.ComboBox();
|
||||
@@ -171,6 +165,7 @@
|
||||
this.vcTagNOT = new AGVControl.ValueSelect();
|
||||
this.tabPage4 = new System.Windows.Forms.TabPage();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.chkClearPos = new System.Windows.Forms.CheckBox();
|
||||
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.tbMCID = new System.Windows.Forms.TextBox();
|
||||
@@ -207,7 +202,6 @@
|
||||
this.bt1 = new arCtl.arLabel();
|
||||
this.bt0 = new arCtl.arLabel();
|
||||
this.btSave = new arCtl.arLabel();
|
||||
this.chkClearPos = new System.Windows.Forms.CheckBox();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage6.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
@@ -1236,7 +1230,6 @@
|
||||
this.tabPage2.Controls.Add(this.button3);
|
||||
this.tabPage2.Controls.Add(this.label30);
|
||||
this.tabPage2.Controls.Add(this.label12);
|
||||
this.tabPage2.Controls.Add(this.label13);
|
||||
this.tabPage2.Controls.Add(this.button2);
|
||||
this.tabPage2.Controls.Add(this.tbBaudBAT);
|
||||
this.tabPage2.Controls.Add(this.tbportBMS);
|
||||
@@ -1245,16 +1238,11 @@
|
||||
this.tabPage2.Controls.Add(this.tbBaudAGV);
|
||||
this.tabPage2.Controls.Add(this.tbPortAGV);
|
||||
this.tabPage2.Controls.Add(this.label6);
|
||||
this.tabPage2.Controls.Add(this.btSelPlc1);
|
||||
this.tabPage2.Controls.Add(this.btSelXbee);
|
||||
this.tabPage2.Controls.Add(this.tbBaudPLC);
|
||||
this.tabPage2.Controls.Add(this.tbBaudXBE);
|
||||
this.tabPage2.Controls.Add(this.tbPortPLC);
|
||||
this.tabPage2.Controls.Add(this.tbPortXBE);
|
||||
this.tabPage2.Controls.Add(this.label7);
|
||||
this.tabPage2.Controls.Add(this.label5);
|
||||
this.tabPage2.Controls.Add(this.valIntervalBMS);
|
||||
this.tabPage2.Controls.Add(this.valueSelect4);
|
||||
this.tabPage2.Controls.Add(this.valIntervalXBE);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 4);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
@@ -1296,17 +1284,6 @@
|
||||
this.label12.TabIndex = 33;
|
||||
this.label12.Text = "ms";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Font = new System.Drawing.Font("궁서체", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.label13.ForeColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.label13.Location = new System.Drawing.Point(946, 114);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(36, 24);
|
||||
this.label13.TabIndex = 15;
|
||||
this.label13.Text = "ms";
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(383, 178);
|
||||
@@ -1405,17 +1382,6 @@
|
||||
this.label6.TabIndex = 21;
|
||||
this.label6.Text = "AGV PORT";
|
||||
//
|
||||
// btSelPlc1
|
||||
//
|
||||
this.btSelPlc1.Location = new System.Drawing.Point(383, 98);
|
||||
this.btSelPlc1.Name = "btSelPlc1";
|
||||
this.btSelPlc1.Size = new System.Drawing.Size(89, 56);
|
||||
this.btSelPlc1.TabIndex = 15;
|
||||
this.btSelPlc1.Tag = "PLC";
|
||||
this.btSelPlc1.Text = "...";
|
||||
this.btSelPlc1.UseVisualStyleBackColor = true;
|
||||
this.btSelPlc1.Click += new System.EventHandler(this.btSelXbee_Click);
|
||||
//
|
||||
// btSelXbee
|
||||
//
|
||||
this.btSelXbee.Location = new System.Drawing.Point(383, 257);
|
||||
@@ -1427,23 +1393,6 @@
|
||||
this.btSelXbee.UseVisualStyleBackColor = true;
|
||||
this.btSelXbee.Click += new System.EventHandler(this.btSelXbee_Click);
|
||||
//
|
||||
// tbBaudPLC
|
||||
//
|
||||
this.tbBaudPLC.Font = new System.Drawing.Font("궁서체", 32F, System.Drawing.FontStyle.Bold);
|
||||
this.tbBaudPLC.FormattingEnabled = true;
|
||||
this.tbBaudPLC.Items.AddRange(new object[] {
|
||||
"4800",
|
||||
"9600",
|
||||
"19200",
|
||||
"46800",
|
||||
"115200",
|
||||
"250000"});
|
||||
this.tbBaudPLC.Location = new System.Drawing.Point(478, 101);
|
||||
this.tbBaudPLC.Name = "tbBaudPLC";
|
||||
this.tbBaudPLC.Size = new System.Drawing.Size(217, 51);
|
||||
this.tbBaudPLC.TabIndex = 10;
|
||||
this.tbBaudPLC.Tag = "P1";
|
||||
//
|
||||
// tbBaudXBE
|
||||
//
|
||||
this.tbBaudXBE.Font = new System.Drawing.Font("궁서체", 32F, System.Drawing.FontStyle.Bold);
|
||||
@@ -1461,16 +1410,6 @@
|
||||
this.tbBaudXBE.TabIndex = 8;
|
||||
this.tbBaudXBE.Tag = "XB";
|
||||
//
|
||||
// tbPortPLC
|
||||
//
|
||||
this.tbPortPLC.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.tbPortPLC.Font = new System.Drawing.Font("궁서체", 32F, System.Drawing.FontStyle.Bold);
|
||||
this.tbPortPLC.Location = new System.Drawing.Point(161, 98);
|
||||
this.tbPortPLC.Name = "tbPortPLC";
|
||||
this.tbPortPLC.Size = new System.Drawing.Size(216, 56);
|
||||
this.tbPortPLC.TabIndex = 5;
|
||||
this.tbPortPLC.Tag = "P1";
|
||||
//
|
||||
// tbPortXBE
|
||||
//
|
||||
this.tbPortXBE.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
@@ -1481,17 +1420,6 @@
|
||||
this.tbPortXBE.TabIndex = 3;
|
||||
this.tbPortXBE.Tag = "XB";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Font = new System.Drawing.Font("궁서체", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.label7.ForeColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.label7.Location = new System.Drawing.Point(38, 114);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(114, 24);
|
||||
this.label7.TabIndex = 2;
|
||||
this.label7.Text = "PLC PORT";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
@@ -1526,29 +1454,6 @@
|
||||
this.valIntervalBMS.Value = 0D;
|
||||
this.valIntervalBMS.ButtonClick += new System.EventHandler<AGVControl.ValueSelect.ButtonClickEventArgs>(this.valIntervalBMS_ButtonClick);
|
||||
//
|
||||
// valueSelect4
|
||||
//
|
||||
this.valueSelect4.BackColorButton = System.Drawing.Color.White;
|
||||
this.valueSelect4.ButtonWidth = "30";
|
||||
this.valueSelect4.ColorBorder = System.Drawing.Color.White;
|
||||
this.valueSelect4.DecimalPosition = ((ushort)(0));
|
||||
this.valueSelect4.Font = new System.Drawing.Font("궁서체", 32F, System.Drawing.FontStyle.Bold);
|
||||
this.valueSelect4.FontSideButton = new System.Drawing.Font("Consolas", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.valueSelect4.ForeColor = System.Drawing.Color.White;
|
||||
this.valueSelect4.ForeColorButton = System.Drawing.Color.Black;
|
||||
this.valueSelect4.Location = new System.Drawing.Point(701, 101);
|
||||
this.valueSelect4.MaxValue = 254D;
|
||||
this.valueSelect4.MinValue = 0D;
|
||||
this.valueSelect4.Name = "valueSelect4";
|
||||
this.valueSelect4.NullDisplay = "--";
|
||||
this.valueSelect4.SideButtonClickValue = 20D;
|
||||
this.valueSelect4.Size = new System.Drawing.Size(239, 51);
|
||||
this.valueSelect4.TabIndex = 13;
|
||||
this.valueSelect4.Tag = "SL";
|
||||
this.valueSelect4.Text = "1";
|
||||
this.valueSelect4.Value = 1D;
|
||||
this.valueSelect4.ButtonClick += new System.EventHandler<AGVControl.ValueSelect.ButtonClickEventArgs>(this.vcChargeLow_ButtonClick);
|
||||
//
|
||||
// valIntervalXBE
|
||||
//
|
||||
this.valIntervalXBE.BackColorButton = System.Drawing.Color.White;
|
||||
@@ -2762,6 +2667,17 @@
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "일반 설정";
|
||||
//
|
||||
// chkClearPos
|
||||
//
|
||||
this.chkClearPos.AutoSize = true;
|
||||
this.chkClearPos.Font = new System.Drawing.Font("궁서체", 20F, System.Drawing.FontStyle.Bold);
|
||||
this.chkClearPos.Location = new System.Drawing.Point(27, 371);
|
||||
this.chkClearPos.Name = "chkClearPos";
|
||||
this.chkClearPos.Size = new System.Drawing.Size(468, 31);
|
||||
this.chkClearPos.TabIndex = 12;
|
||||
this.chkClearPos.Text = "자동모드 해제 시 위치정보 삭제";
|
||||
this.chkClearPos.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// propertyGrid1
|
||||
//
|
||||
this.propertyGrid1.Font = new System.Drawing.Font("맑은 고딕", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
@@ -3410,17 +3326,6 @@
|
||||
this.btSave.TextVisible = true;
|
||||
this.btSave.Click += new System.EventHandler(this.btSave_Click);
|
||||
//
|
||||
// chkClearPos
|
||||
//
|
||||
this.chkClearPos.AutoSize = true;
|
||||
this.chkClearPos.Font = new System.Drawing.Font("궁서체", 20F, System.Drawing.FontStyle.Bold);
|
||||
this.chkClearPos.Location = new System.Drawing.Point(27, 371);
|
||||
this.chkClearPos.Name = "chkClearPos";
|
||||
this.chkClearPos.Size = new System.Drawing.Size(468, 31);
|
||||
this.chkClearPos.TabIndex = 12;
|
||||
this.chkClearPos.Text = "자동모드 해제 시 위치정보 삭제";
|
||||
this.chkClearPos.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// fSetup
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
@@ -3477,20 +3382,14 @@
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox tbPortXBE;
|
||||
private System.Windows.Forms.TextBox tbPortPLC;
|
||||
private System.Windows.Forms.ComboBox tbBaudXBE;
|
||||
private System.Windows.Forms.ComboBox tbBaudPLC;
|
||||
private System.Windows.Forms.Button btSelXbee;
|
||||
private System.Windows.Forms.Button btSelPlc1;
|
||||
private System.Windows.Forms.Panel panTopMenu;
|
||||
private arCtl.arLabel btClose;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private AGVControl.ValueSelect valIntervalXBE;
|
||||
private AGVControl.ValueSelect valueSelect4;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.TabPage tabPage4;
|
||||
|
||||
@@ -53,12 +53,12 @@ namespace Project
|
||||
|
||||
//통신값 표시
|
||||
//tbPortBMS.Text = Pub.setting.Port_BMS;
|
||||
tbPortPLC.Text = PUB.setting.Port_PLC;
|
||||
///tbPortPLC.Text = PUB.setting.Port_PLC;
|
||||
tbPortAGV.Text = PUB.setting.Port_AGV;
|
||||
tbPortXBE.Text = PUB.setting.Port_XBE;
|
||||
tbportBMS.Text = PUB.setting.Port_BAT;
|
||||
|
||||
tbBaudPLC.Text = PUB.setting.Baud_PLC.ToString();
|
||||
// tbBaudPLC.Text = PUB.setting.Baud_PLC.ToString();
|
||||
tbBaudAGV.Text = PUB.setting.Baud_AGV.ToString();
|
||||
tbBaudXBE.Text = PUB.setting.Baud_XBE.ToString();
|
||||
tbBaudBAT.Text = PUB.setting.Baud_BAT.ToString();
|
||||
@@ -66,7 +66,7 @@ namespace Project
|
||||
//valueSelect1.Value = Pub.setting.interval_bms;
|
||||
valIntervalXBE.Value = PUB.setting.interval_xbe;
|
||||
vcpidDS.Value = PUB.setting.ZSpeed;
|
||||
valueSelect4.Value = PUB.setting.interval_iostate;
|
||||
//valueSelect4.Value = PUB.setting.interval_iostate;
|
||||
valIntervalBMS.Value = PUB.setting.interval_bms;
|
||||
tbChargerID.Value = PUB.setting.ChargerID;
|
||||
|
||||
@@ -221,13 +221,13 @@ namespace Project
|
||||
//통신정보저장
|
||||
// Pub.setting.Port_BMS = tbPortBMS.Text;
|
||||
PUB.setting.Port_XBE = tbPortXBE.Text;
|
||||
PUB.setting.Port_PLC = tbPortPLC.Text;
|
||||
//PUB.setting.Port_PLC = tbPortPLC.Text;
|
||||
PUB.setting.Port_AGV = tbPortAGV.Text;
|
||||
PUB.setting.Port_BAT = tbportBMS.Text;
|
||||
|
||||
// Pub.setting.Baud_bms = int.Parse(tbBaudBms.Text);
|
||||
PUB.setting.Baud_XBE = int.Parse(tbBaudXBE.Text);
|
||||
PUB.setting.Baud_PLC = int.Parse(tbBaudPLC.Text);
|
||||
//PUB.setting.Baud_PLC = int.Parse(tbBaudPLC.Text);
|
||||
PUB.setting.Baud_AGV = int.Parse(tbBaudAGV.Text);
|
||||
PUB.setting.Baud_BAT = int.Parse(tbBaudBAT.Text);
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Project
|
||||
PUB.setting.interval_bms = (int)valIntervalBMS.Value;
|
||||
PUB.setting.interval_xbe = (float)valIntervalXBE.Value;
|
||||
PUB.setting.ZSpeed = (byte)vcpidDS.Value;
|
||||
PUB.setting.interval_iostate = (byte)valueSelect4.Value;
|
||||
//PUB.setting.interval_iostate = (byte)valueSelect4.Value;
|
||||
PUB.setting.chargerpos = this.cmbChargerPos.SelectedIndex;
|
||||
PUB.setting.AutoModeOffAndClearPosition = this.chkClearPos.Checked;
|
||||
//PUB.setting.MotorUpTime = (byte)valueSelect5.Value;
|
||||
@@ -487,7 +487,7 @@ namespace Project
|
||||
|
||||
if (tagStr == "XBE") tbPortXBE.Text = newPort;
|
||||
else if (tagStr == "AGV") tbPortAGV.Text = newPort;
|
||||
else if (tagStr == "PLC") tbPortPLC.Text = newPort;
|
||||
// else if (tagStr == "PLC") tbPortPLC.Text = newPort;
|
||||
else if (tagStr == "BAT") tbportBMS.Text = newPort;
|
||||
|
||||
}
|
||||
@@ -551,14 +551,14 @@ namespace Project
|
||||
if (this.tbPortAGV.Text == "COM21")
|
||||
{
|
||||
this.tbPortAGV.Text = "COM11";
|
||||
this.tbPortPLC.Text = "COM6";
|
||||
// this.tbPortPLC.Text = "COM6";
|
||||
this.tbportBMS.Text = "COM15";
|
||||
this.tbPortXBE.Text = "COM18";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.tbPortAGV.Text = "COM21";
|
||||
this.tbPortPLC.Text = "COM31";
|
||||
// this.tbPortPLC.Text = "COM31";
|
||||
this.tbportBMS.Text = "COM41";
|
||||
this.tbPortXBE.Text = "COM51";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user