diff --git a/AGVLogic/AGVNavigationCore/Models/Enums.cs b/AGVLogic/AGVNavigationCore/Models/Enums.cs index 6e72daf..ddad122 100644 --- a/AGVLogic/AGVNavigationCore/Models/Enums.cs +++ b/AGVLogic/AGVNavigationCore/Models/Enums.cs @@ -179,4 +179,7 @@ namespace AGVNavigationCore.Models Complete, } + + + } \ No newline at end of file diff --git a/HMI/Project/AGV4.csproj b/HMI/Project/AGV4.csproj index 34668ba..7424e1a 100644 --- a/HMI/Project/AGV4.csproj +++ b/HMI/Project/AGV4.csproj @@ -311,7 +311,7 @@ Form - + Form @@ -320,7 +320,7 @@ Form - + Form diff --git a/HMI/Project/StateMachine/Step/_SM_RUN.cs b/HMI/Project/StateMachine/Step/_SM_RUN.cs index 80df2e6..bbe0eb9 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN.cs @@ -186,7 +186,7 @@ namespace Project PUB.sm.ResetRunStepSeq(); PUB.log.Add("충전 명령 시작"); } - else if (_SM_RUN_CHARGE_GO(runStepisFirst, PUB.sm.GetRunSteptime)) + else if (_SM_RUN_CHARGE_ON(runStepisFirst, PUB.sm.GetRunSteptime)) { PUB.XBE.SendActionComplete(PUB.sm.RunStep); PUB.Speak(Lang.충전을시작합니다); @@ -219,7 +219,7 @@ namespace Project else { //충전 상태가 OFF되어야 동작하게한다 - if (_SM_RUN_CHARGE_GOFF(isFirst, stepTime) == true) + if (_SM_RUN_CHARGE_OFF(isFirst, stepTime) == true) { PUB.XBE.SendActionComplete(PUB.sm.RunStep); //충전상태가 활성화되었으므로 대기상태로 전환한다 diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_IN.cs b/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_IN.cs index d609316..60a81d1 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_IN.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_IN.cs @@ -8,6 +8,7 @@ using COMM; using AR; using System.Windows.Media.Animation; using System.Net.Security; +using AGVNavigationCore.Models; namespace Project { @@ -19,7 +20,7 @@ namespace Project var idx = 1; //충전 상태가 OFF되어야 동작하게한다 - if (_SM_RUN_CHARGE_GOFF(isFirst, seqtime) == false) return false; + if (_SM_RUN_CHARGE_OFF(isFirst, seqtime) == false) return false; //라이더멈춤이 설정되어있다면 음성으로 알려준다 if (CheckLiderStop() == false) return false; @@ -137,7 +138,7 @@ namespace Project if (PUB.AGV.signal1.lift_down == false) { VAR.I32[eVarInt32.RetryLift] += 1; - var rlt = PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.DN); + var rlt = PUB.AGV.LiftControl(LiftCommand.DN); PUB.log.Add($"[{funcname}-{PUB.sm.RunStepSeq}] 리프트 하강 실행:{rlt}"); } PUB.sm.UpdateRunStepSeq(); @@ -175,7 +176,7 @@ namespace Project if (PUB.NextWorkCmd == ENIGProtocol.AGVCommandHE.PickOffEnter) { VAR.I32[eVarInt32.RetryManget] += 1; - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.ON); + PUB.AGV.LiftControl(LiftCommand.ON); PUB.log.Add($"[{funcname}-{PUB.sm.RunStepSeq}] 마그넷ON"); } @@ -351,7 +352,7 @@ namespace Project if (PUB.NextWorkCmd == ENIGProtocol.AGVCommandHE.PickOffEnter) { VAR.I32[eVarInt32.RetryManget] += 1; - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.OFF); + PUB.AGV.LiftControl(LiftCommand.OFF); } PUB.sm.UpdateRunStepSeq(); return false; diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_OUT.cs b/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_OUT.cs index 57a3eac..f39eb19 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_OUT.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_BUFFER_OUT.cs @@ -6,6 +6,7 @@ using System.Text; using Project.StateMachine; using COMM; using AR; +using AGVNavigationCore.Models; namespace Project { @@ -18,7 +19,7 @@ namespace Project var idx = 1; //충전 상태가 OFF되어야 동작하게한다 - if (_SM_RUN_CHARGE_GOFF(isFirst, seqtime) == false) return false; + if (_SM_RUN_CHARGE_OFF(isFirst, seqtime) == false) return false; //라이더멈춤이 설정되어있다면 음성으로 알려준다 if (CheckLiderStop() == false) return false; @@ -53,7 +54,7 @@ namespace Project } else if (PUB.sm.RunStepSeq == idx++) { - arDev.Narumi.LiftCommand lift = PUB.NextWorkCmd == ENIGProtocol.AGVCommandHE.PickOnExit ? arDev.Narumi.LiftCommand.UP : arDev.Narumi.LiftCommand.DN; + LiftCommand lift = PUB.NextWorkCmd == ENIGProtocol.AGVCommandHE.PickOnExit ? LiftCommand.UP : LiftCommand.DN; PUB.log.Add($"[{funcname}-{PUB.sm.RunStepSeq}] 리프트제어 {lift}"); VAR.I32[eVarInt32.RetryLift] += 1; PUB.AGV.LiftControl(lift); diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_GOFF.cs b/HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_OFF.cs similarity index 97% rename from HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_GOFF.cs rename to HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_OFF.cs index 3d5bd89..a402724 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_GOFF.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_OFF.cs @@ -18,7 +18,7 @@ namespace Project /// /// /// - public Boolean _SM_RUN_CHARGE_GOFF(bool isFirst, TimeSpan stepTime) + public Boolean _SM_RUN_CHARGE_OFF(bool isFirst, TimeSpan stepTime) { //충전중인지 확인한다. diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_GO.cs b/HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_ON.cs similarity index 87% rename from HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_GO.cs rename to HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_ON.cs index a02c7b5..0ab3b00 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_GO.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_CHARGE_ON.cs @@ -12,7 +12,7 @@ namespace Project public partial class fMain { DateTime tm_gocharge_command = DateTime.Now; - public Boolean _SM_RUN_CHARGE_GO(bool isFirst, TimeSpan stepTime) + public Boolean _SM_RUN_CHARGE_ON(bool isFirst, TimeSpan stepTime) { var funcname = "GOCHARGE"; if (runStepisFirst) @@ -29,7 +29,8 @@ namespace Project } //이미 충전중이라면 바로 완료 처리한다 (사용자 요청) - if (VAR.BOOL[eVarBool.FLAG_CHARGEONA] == true || PUB.AGV.system1.Battery_charging == true || + if (VAR.BOOL[eVarBool.FLAG_CHARGEONA] == true || + PUB.AGV.system1.Battery_charging == true || VAR.BOOL[eVarBool.FLAG_CHARGEONM] == true) { SetRunStepError(ENIGProtocol.AGVErrorCode.ALREADY_CHARGE); @@ -37,7 +38,7 @@ namespace Project } //충전 상태가 OFF되어야 동작하게한다 - if (_SM_RUN_CHARGE_GOFF(isFirst, stepTime) == false) + if (_SM_RUN_CHARGE_OFF(isFirst, stepTime) == false) return false; @@ -67,12 +68,19 @@ namespace Project //현재위치가 충전기위치이고 마크센서가 감지되었다면 충전기위치로 인지하고 //그렇지 못하면 충전위치가 아니라는 오류를 발생한다 var curnode = PUB._virtualAGV.CurrentNode; - if (PUB.AGV.signal1.mark_sensor == false || curnode.Id != targetnode.Id) + if (curnode.Id != targetnode.Id) { SetRunStepError(ENIGProtocol.AGVErrorCode.NO_CHARGEPOINT, $"충전기위치가 아니므로 충전을 시작할 수 없습니다(현재위치:{curnode.RfidId})"); return false; } + //마크센서가 들어와있어야한다 + if (PUB.AGV.signal1.mark_sensor == false) + { + SetRunStepError(ENIGProtocol.AGVErrorCode.MARK_SENSOR_FAIL, $"충전기위치에서 마크센서가 확인되지 않습니다"); + return false; + } + PUB.sm.UpdateRunStepSeq(); return false; } diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_ENTER.cs b/HMI/Project/StateMachine/Step/_SM_RUN_ENTER.cs index 82c3153..58d9d82 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_ENTER.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_ENTER.cs @@ -6,6 +6,7 @@ using System.Text; using Project.StateMachine; using COMM; using AR; +using AGVNavigationCore.Models; namespace Project { @@ -20,7 +21,7 @@ namespace Project var funcname = PUB.sm.RunStep.ToString(); //충전 상태가 OFF되어야 동작하게한다 - if (_SM_RUN_CHARGE_GOFF(isFirst, seqTime) == false) return false; + if (_SM_RUN_CHARGE_OFF(isFirst, seqTime) == false) return false; //라이더멈춤이 설정되어있다면 음성으로 알려준다 if (CheckLiderStop() == false) return false; @@ -78,7 +79,7 @@ namespace Project else if (PUB.sm.RunStepSeq == idx++) { //pick off/on 상관없이 리프트는 내려서 이동한다 - var liftCmd = arDev.Narumi.LiftCommand.DN; + var liftCmd = LiftCommand.DN; PUB.AGV.LiftControl(liftCmd); VAR.TIME.Update(eVarTime.LastTurnCommandTime); PUB.sm.UpdateRunStepSeq(); @@ -109,7 +110,7 @@ namespace Project if (PUB.NextWorkCmd == ENIGProtocol.AGVCommandHE.PickOffEnter) { VAR.I32[eVarInt32.RetryManget] += 1; - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.ON); + PUB.AGV.LiftControl(LiftCommand.ON); } PUB.sm.UpdateRunStepSeq(); return false; @@ -249,7 +250,7 @@ namespace Project if (PUB.NextWorkCmd == ENIGProtocol.AGVCommandHE.PickOffEnter) { VAR.I32[eVarInt32.RetryManget] += 1; - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.OFF); + PUB.AGV.LiftControl(LiftCommand.OFF); } PUB.sm.UpdateRunStepSeq(); return false; diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_EXIT.cs b/HMI/Project/StateMachine/Step/_SM_RUN_EXIT.cs index c5ca003..a3ca7b6 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_EXIT.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_EXIT.cs @@ -6,6 +6,7 @@ using System.Text; using Project.StateMachine; using COMM; using AR; +using AGVNavigationCore.Models; namespace Project { @@ -20,7 +21,7 @@ namespace Project var funcname = $"[EXIT-{PUB.sm.RunStep}]"; //충전 상태가 OFF되어야 동작하게한다 - if (_SM_RUN_CHARGE_GOFF(isFirst, seqtime) == false) return false; + if (_SM_RUN_CHARGE_OFF(isFirst, seqtime) == false) return false; //라이더멈춤이 설정되어있다면 음성으로 알려준다 if (CheckLiderStop() == false) return false; @@ -37,8 +38,8 @@ namespace Project else if (PUB.sm.RunStepSeq == idx++) { //작업형태에 따라서. 리프트를 제어한다. - var liftCmd = arDev.Narumi.LiftCommand.DN; - if (PUB.NextWorkCmd == ENIGProtocol.AGVCommandHE.PickOnExit) liftCmd = arDev.Narumi.LiftCommand.UP; + var liftCmd = LiftCommand.DN; + if (PUB.NextWorkCmd == ENIGProtocol.AGVCommandHE.PickOnExit) liftCmd = LiftCommand.UP; VAR.I32[eVarInt32.RetryLift] += 1; PUB.AGV.LiftControl(liftCmd); PUB.sm.UpdateRunStepSeq(); @@ -46,18 +47,18 @@ namespace Project } else if (PUB.sm.RunStepSeq == idx++) { - var liftCmd = arDev.Narumi.LiftCommand.DN; - if (PUB.NextWorkCmd == ENIGProtocol.AGVCommandHE.PickOnExit) liftCmd = arDev.Narumi.LiftCommand.UP; + var liftCmd = LiftCommand.DN; + if (PUB.NextWorkCmd == ENIGProtocol.AGVCommandHE.PickOnExit) liftCmd = LiftCommand.UP; //리프트 센서 확인 var liftdnok = (PUB.AGV.signal1.lift_down == true && PUB.AGV.signal1.lift_up == false); var liiftupok = (PUB.AGV.signal1.lift_up == true && PUB.AGV.signal1.lift_down == false); - if (liftCmd == arDev.Narumi.LiftCommand.DN && liftdnok) + if (liftCmd == LiftCommand.DN && liftdnok) { //정상조건 } - else if (liftCmd == arDev.Narumi.LiftCommand.UP && liftdnok) + else if (liftCmd == LiftCommand.UP && liftdnok) { //정상조건 } diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_GOTO.cs b/HMI/Project/StateMachine/Step/_SM_RUN_GOTO.cs index 2e28378..07a2577 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_GOTO.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_GOTO.cs @@ -20,7 +20,7 @@ namespace Project var funcname = "_SM_RUN_GOTO"; //충전 상태가 OFF되어야 동작하게한다 - if (_SM_RUN_CHARGE_GOFF(isFirst, seqtime) == false) + if (_SM_RUN_CHARGE_OFF(isFirst, seqtime) == false) return false; //최초시작이라면 시간변수 초기화 diff --git a/HMI/Project/StateMachine/Step/_SM_RUN_GOTO_HOME.cs b/HMI/Project/StateMachine/Step/_SM_RUN_GOTO_HOME.cs index a132e05..d4ec15a 100644 --- a/HMI/Project/StateMachine/Step/_SM_RUN_GOTO_HOME.cs +++ b/HMI/Project/StateMachine/Step/_SM_RUN_GOTO_HOME.cs @@ -27,7 +27,7 @@ namespace Project } //충전 상태가 OFF되어야 동작하게한다 - if (_SM_RUN_CHARGE_GOFF(isFirst, stepTime) == false) + if (_SM_RUN_CHARGE_OFF(isFirst, stepTime) == false) return false; //라이더멈춤이 설정되어있다면 음성으로 알려준다 200409 diff --git a/HMI/Project/StateMachine/_DIO.cs b/HMI/Project/StateMachine/_DIO.cs index 7611f9f..398e916 100644 --- a/HMI/Project/StateMachine/_DIO.cs +++ b/HMI/Project/StateMachine/_DIO.cs @@ -47,7 +47,7 @@ namespace Project // if (VAR.BOOL[eVarBool.WAIT_COVER_UP]) // { // PUB.log.Add($"버튼({diName}) 눌림"); - // PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.UP); + // PUB.AGV.LiftControl(LiftCommand.UP); // PUB.Result.NextPos = ePosition.QC; // } // else PUB.Speak(Lang.커버업대기상태가아닙니다); @@ -93,7 +93,7 @@ namespace Project // if (VAR.BOOL[eVarBool.WAIT_COVER_UP]) // { // PUB.log.Add($"버튼({diName}) 눌림"); - // PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.UP); + // PUB.AGV.LiftControl(LiftCommand.UP); // PUB.Result.NextPos = ePosition.QA; // } // else PUB.Speak(Lang.커버업대기상태가아닙니다); @@ -121,7 +121,7 @@ namespace Project // { // //Z-up기능으로 업데이트 230119 // PUB.log.Add($"버튼({diName}) 눌림"); - // PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.UP); + // PUB.AGV.LiftControl(LiftCommand.UP); // } // } // else if (diName == arDev.FakePLC.DIName.PINI_EMG) diff --git a/HMI/Project/StateMachine/_Xbee.cs b/HMI/Project/StateMachine/_Xbee.cs index 0a1d6c0..3a55e46 100644 --- a/HMI/Project/StateMachine/_Xbee.cs +++ b/HMI/Project/StateMachine/_Xbee.cs @@ -75,6 +75,7 @@ namespace Project PUB._mapCanvas.SetAGVPosition(PUB.setting.MCID, node, PUB._virtualAGV.CurrentDirection); PUB._virtualAGV.SetPosition(node, PUB._virtualAGV.CurrentDirection); + PUB.SaveLastPosition(); //위치저장 260205 } else PUB.log.AddE($"[{logPrefix}-SetCurrent] TagString Value Errorr:{data}"); } @@ -353,25 +354,25 @@ namespace Project break; case ENIGProtocol.AGVCommandHE.LiftControl: //Lift Control - var LiftCommand = data[1]; //0=stop, 1=up, 2=down - - arDev.Narumi.LiftCommand LCmd = arDev.Narumi.LiftCommand.STP; - if (LiftCommand == 1) LCmd = arDev.Narumi.LiftCommand.UP; - else if (LiftCommand == 2) LCmd = arDev.Narumi.LiftCommand.DN; - - PUB.log.Add($"[{logPrefix}-LiftControl] {LCmd}"); - PUB.AGV.LiftControl(LCmd); //리프트제어 + var LiftCommand = (LiftCommand)data[1]; + PUB.log.Add($"[{logPrefix}-LiftControl] {LiftCommand}"); + PUB.AGV.LiftControl(LiftCommand); //리프트제어 break; case ENIGProtocol.AGVCommandHE.ChargeControl: //충전을 제어한다 var chargeAction = data[1] == 1; //0= off, 1=on //충전시퀀스가 진행되지 않았다면 진행한다 - if (PUB.sm.RunStep == StateMachine.ERunStep.GOCHARGE && PUB.sm.RunStepNew != StateMachine.ERunStep.GOCHARGE) + if(chargeAction==true) { PUB.sm.SetNewRunStep(StateMachine.ERunStep.GOCHARGE); PUB.log.AddI($"충전을 시작합니다"); } + else + { + PUB.sm.SetNewRunStep(ERunStep.CHARGEOFF); + PUB.log.AddI($"충전을 해제 합니다"); + } break; default: diff --git a/HMI/Project/ViewForm/fAgv.cs b/HMI/Project/ViewForm/fAgv.cs index 4a1f5e5..c261231 100644 --- a/HMI/Project/ViewForm/fAgv.cs +++ b/HMI/Project/ViewForm/fAgv.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using AGVNavigationCore.Models; using COMM; namespace Project.ViewForm @@ -170,27 +171,27 @@ namespace Project.ViewForm private void button14_Click(object sender, EventArgs e) { - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.ON); + PUB.AGV.LiftControl(LiftCommand.ON); } private void button15_Click(object sender, EventArgs e) { - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.OFF); + PUB.AGV.LiftControl(LiftCommand.OFF); } private void button11_Click(object sender, EventArgs e) { - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.UP); + PUB.AGV.LiftControl(LiftCommand.UP); } private void button13_Click(object sender, EventArgs e) { - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.DN); + PUB.AGV.LiftControl(LiftCommand.DN); } private void button12_Click(object sender, EventArgs e) { - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.STP); + PUB.AGV.LiftControl(LiftCommand.STP); } private void button17_Click(object sender, EventArgs e) diff --git a/HMI/Project/ViewForm/fIO.cs b/HMI/Project/ViewForm/fIO.cs index 22b55e6..109b6c7 100644 --- a/HMI/Project/ViewForm/fIO.cs +++ b/HMI/Project/ViewForm/fIO.cs @@ -1,4 +1,5 @@ -using System; +using AGVNavigationCore.Models; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -135,28 +136,28 @@ namespace Project.ViewForm private void button1_Click(object sender, EventArgs e) { - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.UP); + PUB.AGV.LiftControl(LiftCommand.UP); } private void button2_Click(object sender, EventArgs e) { - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.STP); + PUB.AGV.LiftControl(LiftCommand.STP); } private void button3_Click_1(object sender, EventArgs e) { - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.DN); + PUB.AGV.LiftControl(LiftCommand.DN); } private void button4_Click(object sender, EventArgs e) { - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.ON); + PUB.AGV.LiftControl(LiftCommand.ON); } private void button5_Click(object sender, EventArgs e) { - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.OFF); + PUB.AGV.LiftControl(LiftCommand.OFF); } } } diff --git a/HMI/Project/ViewForm/fManual.cs b/HMI/Project/ViewForm/fManual.cs index 6f9e530..93a9255 100644 --- a/HMI/Project/ViewForm/fManual.cs +++ b/HMI/Project/ViewForm/fManual.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using AGVNavigationCore.Models; using AR; using arDev; using COMM; @@ -399,12 +400,12 @@ namespace Project.ViewForm private void btBack180_Click(object sender, EventArgs e) { //[STX] C T B 0 0 0 0 9 9 [ETX] - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.ON);// (;// (true); + PUB.AGV.LiftControl(LiftCommand.ON);// (;// (true); } private void button2_Click(object sender, EventArgs e) { - PUB.AGV.LiftControl(arDev.Narumi.LiftCommand.OFF); + PUB.AGV.LiftControl(LiftCommand.OFF); } } } diff --git a/HMI/SubProject/AGV/Command.cs b/HMI/SubProject/AGV/Command.cs index f4b92c5..0c71793 100644 --- a/HMI/SubProject/AGV/Command.cs +++ b/HMI/SubProject/AGV/Command.cs @@ -63,11 +63,11 @@ namespace arDev Wait = 2, Error = 100, Timeout, - + } public enum eNarmiPBSSensor : byte { - notset=0, + notset = 0, on = 1, off = 2 } @@ -383,9 +383,9 @@ namespace arDev case eAgvCmd.MoveSet: - cmdString = $"CBR{param}"; + cmdString = $"CBR{param}"; retval = AddCommand(cmdString); - if(retval == eNarumiCommandResult.Success) + if (retval == eNarumiCommandResult.Success) { if (param.Length > 3) { diff --git a/HMI/SubProject/AGV/Dataframe.cs b/HMI/SubProject/AGV/Dataframe.cs index 4250003..9633e88 100644 --- a/HMI/SubProject/AGV/Dataframe.cs +++ b/HMI/SubProject/AGV/Dataframe.cs @@ -1,6 +1,5 @@ using System; using System.Linq; -using AR; namespace arDev { diff --git a/HMI/SubProject/AGV/EnumData.cs b/HMI/SubProject/AGV/EnumData.cs index bfe54e5..fd0f8c2 100644 --- a/HMI/SubProject/AGV/EnumData.cs +++ b/HMI/SubProject/AGV/EnumData.cs @@ -216,6 +216,78 @@ namespace arDev EditRoute, } - + + public enum LiftCommand + { + /// + /// lift up + /// + UP, + /// + /// lift down + /// + DN, + /// + /// lift 동작 정지 + /// + STP, + /// + /// magnet holder on + /// + ON, + /// + /// magnet holder off + /// + OFF + } + + public enum eflag + { + Emergency = 0, + Overcurrent, + Charger_run_error, + Charger_pos_error, + line_out_error = 4, + + /// + /// 기동시 자석 감지 에러 + /// + runerror_by_no_magent_line = 5, + /// + /// 호출제어기 통신 오류 + /// + controller_comm_error = 6, + + /// + /// 배터리 저전압 + /// + battery_low_voltage = 7, + + spare08 = 8, + + lift_timeout = 9, + lift_driver_overcurrent = 10, + lift_driver_emergency = 11, + + /// + /// 도착경보기 통신 오류 + /// + arrive_ctl_comm_error, + + /// + /// 자동문제어기 통신 오류 + /// + door_ctl_comm_error, + + /// + /// 자동충전기 통신 오류 + /// + charger_comm_error, + + /// + /// 교차로 제어기 통신 오류 + /// + cross_ctrl_comm_error, + } } } diff --git a/HMI/SubProject/AGV/Narumi.cs b/HMI/SubProject/AGV/Narumi.cs index 95d048b..68bd663 100644 --- a/HMI/SubProject/AGV/Narumi.cs +++ b/HMI/SubProject/AGV/Narumi.cs @@ -475,30 +475,7 @@ namespace arDev Mid, Low, } - public enum LiftCommand - { - /// - /// lift up - /// - UP, - /// - /// lift down - /// - DN, - /// - /// lift 동작 정지 - /// - STP, - /// - /// magnet holder on - /// - ON, - /// - /// magnet holder off - /// - OFF - } - + private bool CheckSum(byte[] bData) { diff --git a/HMI/SubProject/AGV/Structure/ErrorFlag.cs b/HMI/SubProject/AGV/Structure/ErrorFlag.cs index c7d9da5..beecdab 100644 --- a/HMI/SubProject/AGV/Structure/ErrorFlag.cs +++ b/HMI/SubProject/AGV/Structure/ErrorFlag.cs @@ -4,7 +4,6 @@ namespace arDev { public partial class Narumi { - public class ErrorFlag { private COMM.Flag _value { get; set; } = new COMM.Flag(16); @@ -16,54 +15,7 @@ namespace arDev return (UInt16)_value.Value; } } - public enum eflag - { - Emergency = 0, - Overcurrent, - Charger_run_error, - Charger_pos_error, - line_out_error = 4, - - /// - /// 기동시 자석 감지 에러 - /// - runerror_by_no_magent_line=5, - /// - /// 호출제어기 통신 오류 - /// - controller_comm_error =6, - - /// - /// 배터리 저전압 - /// - battery_low_voltage=7, - - spare08=8, - - lift_timeout=9, - lift_driver_overcurrent=10, - lift_driver_emergency = 11, - - /// - /// 도착경보기 통신 오류 - /// - arrive_ctl_comm_error, - - /// - /// 자동문제어기 통신 오류 - /// - door_ctl_comm_error, - - /// - /// 자동충전기 통신 오류 - /// - charger_comm_error, - - /// - /// 교차로 제어기 통신 오류 - /// - cross_ctrl_comm_error, - } + public bool GetValue(eflag idx) { diff --git a/HMI/TestProject/Test.sln b/HMI/TestProject/Test.sln index 88ae4b3..984f53e 100644 --- a/HMI/TestProject/Test.sln +++ b/HMI/TestProject/Test.sln @@ -15,7 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{530A EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommData", "..\SubProject\CommData\CommData.csproj", "{14E8C9A5-013E-49BA-B435-EFEFC77DD623}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ENIGProtocol", "..\SubProject\EnigProtocol\enigprotocol\ENIGProtocol.csproj", "{9365803B-933D-4237-93C7-B502C855A71C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ENIGProtocol", "..\..\AGVLogic\EnigProtocol\enigprotocol\ENIGProtocol.csproj", "{9365803B-933D-4237-93C7-B502C855A71C}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NARUMI", "..\SubProject\AGV\NARUMI.csproj", "{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}" EndProject diff --git a/HMI/TestProject/Test_ACS/MainForm.Designer.cs b/HMI/TestProject/Test_ACS/MainForm.Designer.cs index c2aae88..9e8b9e9 100644 --- a/HMI/TestProject/Test_ACS/MainForm.Designer.cs +++ b/HMI/TestProject/Test_ACS/MainForm.Designer.cs @@ -29,7 +29,12 @@ namespace Test_ACS this.rbAGV2 = new System.Windows.Forms.RadioButton(); this.rbAGV1 = new System.Windows.Forms.RadioButton(); this.grpCommands = new System.Windows.Forms.GroupBox(); + this.button11 = new System.Windows.Forms.Button(); + this.button12 = new System.Windows.Forms.Button(); + this.btnLiftStop = new System.Windows.Forms.Button(); this.button8 = new System.Windows.Forms.Button(); + this.btnLiftDown = new System.Windows.Forms.Button(); + this.btnLiftUp = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button(); this.button9 = new System.Windows.Forms.Button(); @@ -50,13 +55,13 @@ namespace Test_ACS this.radForw = new System.Windows.Forms.RadioButton(); this.radBack = new System.Windows.Forms.RadioButton(); this.btAMove = new System.Windows.Forms.Button(); + this.btnMarkStop = new System.Windows.Forms.Button(); this.grpManual = new System.Windows.Forms.GroupBox(); this.button5 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); - this.btnMarkStop = new System.Windows.Forms.Button(); this.btnReset = new System.Windows.Forms.Button(); this.btnStop = new System.Windows.Forms.Button(); this.btnGotoAlias = new System.Windows.Forms.Button(); @@ -66,11 +71,6 @@ namespace Test_ACS this.lblAlias = new System.Windows.Forms.Label(); this.txtRFID = new System.Windows.Forms.NumericUpDown(); this.lblRFID = new System.Windows.Forms.Label(); - this.grpLift = new System.Windows.Forms.GroupBox(); - this.btnLiftStop = new System.Windows.Forms.Button(); - this.btnLiftDown = new System.Windows.Forms.Button(); - this.btnLiftUp = new System.Windows.Forms.Button(); - this.lblDirection = new System.Windows.Forms.Label(); this.grpLogs = new System.Windows.Forms.GroupBox(); this.tabLogs = new System.Windows.Forms.TabControl(); this.tabRX = new System.Windows.Forms.TabPage(); @@ -84,22 +84,10 @@ namespace Test_ACS this.tabPage1 = new System.Windows.Forms.TabPage(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.grpAGVStatus = new System.Windows.Forms.GroupBox(); - this.lblLastTagValue = new System.Windows.Forms.Label(); - this.lblLastTag = new System.Windows.Forms.Label(); - this.lblLiftStValue = new System.Windows.Forms.Label(); - this.lblLiftSt = new System.Windows.Forms.Label(); - this.lblCartStValue = new System.Windows.Forms.Label(); - this.lblCartSt = new System.Windows.Forms.Label(); - this.lblChargeStValue = new System.Windows.Forms.Label(); - this.lblChargeSt = new System.Windows.Forms.Label(); - this.lblInpositionValue = new System.Windows.Forms.Label(); - this.lblInposition = new System.Windows.Forms.Label(); - this.lblDirectionValue = new System.Windows.Forms.Label(); - this.lblRunStValue = new System.Windows.Forms.Label(); - this.lblRunSt = new System.Windows.Forms.Label(); - this.lblModeValue = new System.Windows.Forms.Label(); - this.lblMode = new System.Windows.Forms.Label(); - this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.rtStatus = new System.Windows.Forms.TextBox(); + this.tbErCode = new System.Windows.Forms.TextBox(); + this.tbErmsg = new System.Windows.Forms.TextBox(); this.grpConnection.SuspendLayout(); this.grpAGV.SuspendLayout(); this.grpCommands.SuspendLayout(); @@ -110,7 +98,6 @@ namespace Test_ACS this.panel1.SuspendLayout(); this.grpManual.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.txtRFID)).BeginInit(); - this.grpLift.SuspendLayout(); this.grpLogs.SuspendLayout(); this.tabLogs.SuspendLayout(); this.tabRX.SuspendLayout(); @@ -118,7 +105,7 @@ namespace Test_ACS this.tabInfo.SuspendLayout(); this.tabPage1.SuspendLayout(); this.grpAGVStatus.SuspendLayout(); - this.tableLayoutPanel2.SuspendLayout(); + this.groupBox3.SuspendLayout(); this.SuspendLayout(); // // grpConnection @@ -231,7 +218,12 @@ namespace Test_ACS // // grpCommands // + this.grpCommands.Controls.Add(this.button11); + this.grpCommands.Controls.Add(this.button12); + this.grpCommands.Controls.Add(this.btnLiftStop); this.grpCommands.Controls.Add(this.button8); + this.grpCommands.Controls.Add(this.btnLiftDown); + this.grpCommands.Controls.Add(this.btnLiftUp); this.grpCommands.Controls.Add(this.button10); this.grpCommands.Controls.Add(this.button7); this.grpCommands.Controls.Add(this.button9); @@ -249,11 +241,41 @@ namespace Test_ACS this.grpCommands.Controls.Add(this.lblRFID); this.grpCommands.Location = new System.Drawing.Point(12, 98); this.grpCommands.Name = "grpCommands"; - this.grpCommands.Size = new System.Drawing.Size(433, 307); + this.grpCommands.Size = new System.Drawing.Size(535, 307); this.grpCommands.TabIndex = 2; this.grpCommands.TabStop = false; this.grpCommands.Text = "ACS 명령"; // + // button11 + // + this.button11.Location = new System.Drawing.Point(431, 198); + this.button11.Name = "button11"; + this.button11.Size = new System.Drawing.Size(100, 43); + this.button11.TabIndex = 18; + this.button11.Text = "전자석 OFF"; + this.button11.UseVisualStyleBackColor = true; + this.button11.Click += new System.EventHandler(this.button11_Click); + // + // button12 + // + this.button12.Location = new System.Drawing.Point(431, 153); + this.button12.Name = "button12"; + this.button12.Size = new System.Drawing.Size(100, 43); + this.button12.TabIndex = 17; + this.button12.Text = "전자석 ON"; + this.button12.UseVisualStyleBackColor = true; + this.button12.Click += new System.EventHandler(this.button12_Click); + // + // btnLiftStop + // + this.btnLiftStop.Location = new System.Drawing.Point(431, 108); + this.btnLiftStop.Name = "btnLiftStop"; + this.btnLiftStop.Size = new System.Drawing.Size(100, 43); + this.btnLiftStop.TabIndex = 2; + this.btnLiftStop.Text = "리프트 정지"; + this.btnLiftStop.UseVisualStyleBackColor = true; + this.btnLiftStop.Click += new System.EventHandler(this.btnLiftStop_Click); + // // button8 // this.button8.Location = new System.Drawing.Point(102, 264); @@ -264,6 +286,26 @@ namespace Test_ACS this.button8.UseVisualStyleBackColor = true; this.button8.Click += new System.EventHandler(this.button8_Click); // + // btnLiftDown + // + this.btnLiftDown.Location = new System.Drawing.Point(431, 63); + this.btnLiftDown.Name = "btnLiftDown"; + this.btnLiftDown.Size = new System.Drawing.Size(100, 43); + this.btnLiftDown.TabIndex = 1; + this.btnLiftDown.Text = "리프트 DN"; + this.btnLiftDown.UseVisualStyleBackColor = true; + this.btnLiftDown.Click += new System.EventHandler(this.btnLiftDown_Click); + // + // btnLiftUp + // + this.btnLiftUp.Location = new System.Drawing.Point(431, 18); + this.btnLiftUp.Name = "btnLiftUp"; + this.btnLiftUp.Size = new System.Drawing.Size(100, 43); + this.btnLiftUp.TabIndex = 0; + this.btnLiftUp.Text = "리프트 UP"; + this.btnLiftUp.UseVisualStyleBackColor = true; + this.btnLiftUp.Click += new System.EventHandler(this.btnLiftUp_Click); + // // button10 // this.button10.Location = new System.Drawing.Point(102, 229); @@ -310,6 +352,7 @@ namespace Test_ACS // radSpdL // this.radSpdL.AutoSize = true; + this.radSpdL.Checked = true; this.radSpdL.Location = new System.Drawing.Point(9, 20); this.radSpdL.Name = "radSpdL"; this.radSpdL.Size = new System.Drawing.Size(30, 16); @@ -326,7 +369,6 @@ namespace Test_ACS this.radSpdM.Name = "radSpdM"; this.radSpdM.Size = new System.Drawing.Size(34, 16); this.radSpdM.TabIndex = 7; - this.radSpdM.TabStop = true; this.radSpdM.Tag = "1"; this.radSpdM.Text = "M"; this.radSpdM.UseVisualStyleBackColor = true; @@ -338,7 +380,6 @@ namespace Test_ACS this.radSpdH.Name = "radSpdH"; this.radSpdH.Size = new System.Drawing.Size(31, 16); this.radSpdH.TabIndex = 7; - this.radSpdH.TabStop = true; this.radSpdH.Tag = "2"; this.radSpdH.Text = "H"; this.radSpdH.UseVisualStyleBackColor = true; @@ -417,13 +458,13 @@ namespace Test_ACS this.radRight.Name = "radRight"; this.radRight.Size = new System.Drawing.Size(31, 16); this.radRight.TabIndex = 1; - this.radRight.TabStop = true; this.radRight.Text = "R"; this.radRight.UseVisualStyleBackColor = true; // // radLeft // this.radLeft.AutoSize = true; + this.radLeft.Checked = true; this.radLeft.Location = new System.Drawing.Point(51, 9); this.radLeft.Name = "radLeft"; this.radLeft.Size = new System.Drawing.Size(30, 16); @@ -439,7 +480,6 @@ namespace Test_ACS this.radStraight.Name = "radStraight"; this.radStraight.Size = new System.Drawing.Size(31, 16); this.radStraight.TabIndex = 0; - this.radStraight.TabStop = true; this.radStraight.Text = "S"; this.radStraight.UseVisualStyleBackColor = true; // @@ -459,13 +499,13 @@ namespace Test_ACS this.radForw.Name = "radForw"; this.radForw.Size = new System.Drawing.Size(30, 16); this.radForw.TabIndex = 0; - this.radForw.TabStop = true; this.radForw.Text = "F"; this.radForw.UseVisualStyleBackColor = true; // // radBack // this.radBack.AutoSize = true; + this.radBack.Checked = true; this.radBack.Location = new System.Drawing.Point(12, 9); this.radBack.Name = "radBack"; this.radBack.Size = new System.Drawing.Size(31, 16); @@ -484,6 +524,16 @@ namespace Test_ACS this.btAMove.UseVisualStyleBackColor = true; this.btAMove.Click += new System.EventHandler(this.btAMove_Click); // + // btnMarkStop + // + this.btnMarkStop.Location = new System.Drawing.Point(10, 137); + this.btnMarkStop.Name = "btnMarkStop"; + this.btnMarkStop.Size = new System.Drawing.Size(139, 40); + this.btnMarkStop.TabIndex = 6; + this.btnMarkStop.Text = "마크 정지"; + this.btnMarkStop.UseVisualStyleBackColor = true; + this.btnMarkStop.Click += new System.EventHandler(this.btnMarkStop_Click); + // // grpManual // this.grpManual.Controls.Add(this.button5); @@ -553,16 +603,6 @@ namespace Test_ACS this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.btnManual_Click); // - // btnMarkStop - // - this.btnMarkStop.Location = new System.Drawing.Point(10, 137); - this.btnMarkStop.Name = "btnMarkStop"; - this.btnMarkStop.Size = new System.Drawing.Size(139, 40); - this.btnMarkStop.TabIndex = 6; - this.btnMarkStop.Text = "마크 정지"; - this.btnMarkStop.UseVisualStyleBackColor = true; - this.btnMarkStop.Click += new System.EventHandler(this.btnMarkStop_Click); - // // btnReset // this.btnReset.Location = new System.Drawing.Point(193, 81); @@ -662,62 +702,10 @@ namespace Test_ACS this.lblRFID.TabIndex = 0; this.lblRFID.Text = "RFID 번호:"; // - // grpLift - // - this.grpLift.Controls.Add(this.tableLayoutPanel2); - this.grpLift.Location = new System.Drawing.Point(12, 535); - this.grpLift.Name = "grpLift"; - this.grpLift.Size = new System.Drawing.Size(433, 79); - this.grpLift.TabIndex = 9; - this.grpLift.TabStop = false; - this.grpLift.Text = "리프트 제어"; - // - // btnLiftStop - // - this.btnLiftStop.Dock = System.Windows.Forms.DockStyle.Fill; - this.btnLiftStop.Location = new System.Drawing.Point(287, 3); - this.btnLiftStop.Name = "btnLiftStop"; - this.btnLiftStop.Size = new System.Drawing.Size(137, 53); - this.btnLiftStop.TabIndex = 2; - this.btnLiftStop.Text = "정지"; - this.btnLiftStop.UseVisualStyleBackColor = true; - this.btnLiftStop.Click += new System.EventHandler(this.btnLiftStop_Click); - // - // btnLiftDown - // - this.btnLiftDown.Dock = System.Windows.Forms.DockStyle.Fill; - this.btnLiftDown.Location = new System.Drawing.Point(145, 3); - this.btnLiftDown.Name = "btnLiftDown"; - this.btnLiftDown.Size = new System.Drawing.Size(136, 53); - this.btnLiftDown.TabIndex = 1; - this.btnLiftDown.Text = "하강"; - this.btnLiftDown.UseVisualStyleBackColor = true; - this.btnLiftDown.Click += new System.EventHandler(this.btnLiftDown_Click); - // - // btnLiftUp - // - this.btnLiftUp.Dock = System.Windows.Forms.DockStyle.Fill; - this.btnLiftUp.Location = new System.Drawing.Point(3, 3); - this.btnLiftUp.Name = "btnLiftUp"; - this.btnLiftUp.Size = new System.Drawing.Size(136, 53); - this.btnLiftUp.TabIndex = 0; - this.btnLiftUp.Text = "상승"; - this.btnLiftUp.UseVisualStyleBackColor = true; - this.btnLiftUp.Click += new System.EventHandler(this.btnLiftUp_Click); - // - // lblDirection - // - this.lblDirection.AutoSize = true; - this.lblDirection.Location = new System.Drawing.Point(10, 48); - this.lblDirection.Name = "lblDirection"; - this.lblDirection.Size = new System.Drawing.Size(33, 12); - this.lblDirection.TabIndex = 4; - this.lblDirection.Text = "방향:"; - // // grpLogs // this.grpLogs.Controls.Add(this.tabLogs); - this.grpLogs.Location = new System.Drawing.Point(451, 12); + this.grpLogs.Location = new System.Drawing.Point(553, 12); this.grpLogs.Name = "grpLogs"; this.grpLogs.Size = new System.Drawing.Size(520, 602); this.grpLogs.TabIndex = 3; @@ -816,7 +804,7 @@ namespace Test_ACS this.tabInfo.Controls.Add(this.txtInfoLog); this.tabInfo.Location = new System.Drawing.Point(4, 22); this.tabInfo.Name = "tabInfo"; - this.tabInfo.Size = new System.Drawing.Size(506, 518); + this.tabInfo.Size = new System.Drawing.Size(506, 556); this.tabInfo.TabIndex = 2; this.tabInfo.Text = "정보"; this.tabInfo.UseVisualStyleBackColor = true; @@ -830,7 +818,7 @@ namespace Test_ACS this.txtInfoLog.Name = "txtInfoLog"; this.txtInfoLog.ReadOnly = true; this.txtInfoLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtInfoLog.Size = new System.Drawing.Size(506, 518); + this.txtInfoLog.Size = new System.Drawing.Size(506, 556); this.txtInfoLog.TabIndex = 0; // // tabPage1 @@ -838,7 +826,7 @@ namespace Test_ACS this.tabPage1.Controls.Add(this.richTextBox1); this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; - this.tabPage1.Size = new System.Drawing.Size(506, 518); + this.tabPage1.Size = new System.Drawing.Size(506, 556); this.tabPage1.TabIndex = 3; this.tabPage1.Text = "프레임구조"; this.tabPage1.UseVisualStyleBackColor = true; @@ -851,201 +839,63 @@ namespace Test_ACS this.richTextBox1.Location = new System.Drawing.Point(0, 0); this.richTextBox1.Margin = new System.Windows.Forms.Padding(10); this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(506, 518); + this.richTextBox1.Size = new System.Drawing.Size(506, 556); this.richTextBox1.TabIndex = 0; this.richTextBox1.Text = resources.GetString("richTextBox1.Text"); // // grpAGVStatus // - this.grpAGVStatus.Controls.Add(this.lblLastTagValue); - this.grpAGVStatus.Controls.Add(this.lblLastTag); - this.grpAGVStatus.Controls.Add(this.lblLiftStValue); - this.grpAGVStatus.Controls.Add(this.lblLiftSt); - this.grpAGVStatus.Controls.Add(this.lblCartStValue); - this.grpAGVStatus.Controls.Add(this.lblCartSt); - this.grpAGVStatus.Controls.Add(this.lblChargeStValue); - this.grpAGVStatus.Controls.Add(this.lblChargeSt); - this.grpAGVStatus.Controls.Add(this.lblInpositionValue); - this.grpAGVStatus.Controls.Add(this.lblInposition); - this.grpAGVStatus.Controls.Add(this.lblDirectionValue); - this.grpAGVStatus.Controls.Add(this.lblDirection); - this.grpAGVStatus.Controls.Add(this.lblRunStValue); - this.grpAGVStatus.Controls.Add(this.lblRunSt); - this.grpAGVStatus.Controls.Add(this.lblModeValue); - this.grpAGVStatus.Controls.Add(this.lblMode); + this.grpAGVStatus.Controls.Add(this.rtStatus); this.grpAGVStatus.Location = new System.Drawing.Point(12, 409); this.grpAGVStatus.Name = "grpAGVStatus"; - this.grpAGVStatus.Size = new System.Drawing.Size(433, 120); + this.grpAGVStatus.Size = new System.Drawing.Size(535, 120); this.grpAGVStatus.TabIndex = 4; this.grpAGVStatus.TabStop = false; this.grpAGVStatus.Text = "AGV 상태"; // - // lblLastTagValue + // groupBox3 // - this.lblLastTagValue.AutoSize = true; - this.lblLastTagValue.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Bold); - this.lblLastTagValue.Location = new System.Drawing.Point(221, 98); - this.lblLastTagValue.Name = "lblLastTagValue"; - this.lblLastTagValue.Size = new System.Drawing.Size(14, 14); - this.lblLastTagValue.TabIndex = 15; - this.lblLastTagValue.Text = "-"; + this.groupBox3.Controls.Add(this.tbErCode); + this.groupBox3.Controls.Add(this.tbErmsg); + this.groupBox3.Location = new System.Drawing.Point(12, 535); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(535, 79); + this.groupBox3.TabIndex = 16; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Error 상태"; // - // lblLastTag + // rtStatus // - this.lblLastTag.AutoSize = true; - this.lblLastTag.Location = new System.Drawing.Point(151, 98); - this.lblLastTag.Name = "lblLastTag"; - this.lblLastTag.Size = new System.Drawing.Size(57, 12); - this.lblLastTag.TabIndex = 14; - this.lblLastTag.Text = "현재태그:"; + this.rtStatus.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtStatus.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rtStatus.Location = new System.Drawing.Point(3, 17); + this.rtStatus.Multiline = true; + this.rtStatus.Name = "rtStatus"; + this.rtStatus.ReadOnly = true; + this.rtStatus.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.rtStatus.Size = new System.Drawing.Size(529, 100); + this.rtStatus.TabIndex = 1; // - // lblLiftStValue + // tbErCode // - this.lblLiftStValue.AutoSize = true; - this.lblLiftStValue.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold); - this.lblLiftStValue.Location = new System.Drawing.Point(80, 98); - this.lblLiftStValue.Name = "lblLiftStValue"; - this.lblLiftStValue.Size = new System.Drawing.Size(12, 12); - this.lblLiftStValue.TabIndex = 13; - this.lblLiftStValue.Text = "-"; + this.tbErCode.Location = new System.Drawing.Point(6, 20); + this.tbErCode.Name = "tbErCode"; + this.tbErCode.Size = new System.Drawing.Size(523, 21); + this.tbErCode.TabIndex = 3; // - // lblLiftSt + // tbErmsg // - this.lblLiftSt.AutoSize = true; - this.lblLiftSt.Location = new System.Drawing.Point(10, 98); - this.lblLiftSt.Name = "lblLiftSt"; - this.lblLiftSt.Size = new System.Drawing.Size(45, 12); - this.lblLiftSt.TabIndex = 12; - this.lblLiftSt.Text = "리프트:"; - // - // lblCartStValue - // - this.lblCartStValue.AutoSize = true; - this.lblCartStValue.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold); - this.lblCartStValue.Location = new System.Drawing.Point(221, 73); - this.lblCartStValue.Name = "lblCartStValue"; - this.lblCartStValue.Size = new System.Drawing.Size(12, 12); - this.lblCartStValue.TabIndex = 11; - this.lblCartStValue.Text = "-"; - // - // lblCartSt - // - this.lblCartSt.AutoSize = true; - this.lblCartSt.Location = new System.Drawing.Point(151, 73); - this.lblCartSt.Name = "lblCartSt"; - this.lblCartSt.Size = new System.Drawing.Size(33, 12); - this.lblCartSt.TabIndex = 10; - this.lblCartSt.Text = "카트:"; - // - // lblChargeStValue - // - this.lblChargeStValue.AutoSize = true; - this.lblChargeStValue.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold); - this.lblChargeStValue.Location = new System.Drawing.Point(80, 73); - this.lblChargeStValue.Name = "lblChargeStValue"; - this.lblChargeStValue.Size = new System.Drawing.Size(12, 12); - this.lblChargeStValue.TabIndex = 9; - this.lblChargeStValue.Text = "-"; - // - // lblChargeSt - // - this.lblChargeSt.AutoSize = true; - this.lblChargeSt.Location = new System.Drawing.Point(10, 73); - this.lblChargeSt.Name = "lblChargeSt"; - this.lblChargeSt.Size = new System.Drawing.Size(33, 12); - this.lblChargeSt.TabIndex = 8; - this.lblChargeSt.Text = "충전:"; - // - // lblInpositionValue - // - this.lblInpositionValue.AutoSize = true; - this.lblInpositionValue.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold); - this.lblInpositionValue.Location = new System.Drawing.Point(221, 48); - this.lblInpositionValue.Name = "lblInpositionValue"; - this.lblInpositionValue.Size = new System.Drawing.Size(12, 12); - this.lblInpositionValue.TabIndex = 7; - this.lblInpositionValue.Text = "-"; - // - // lblInposition - // - this.lblInposition.AutoSize = true; - this.lblInposition.Location = new System.Drawing.Point(151, 48); - this.lblInposition.Name = "lblInposition"; - this.lblInposition.Size = new System.Drawing.Size(57, 12); - this.lblInposition.TabIndex = 6; - this.lblInposition.Text = "도달완료:"; - // - // lblDirectionValue - // - this.lblDirectionValue.AutoSize = true; - this.lblDirectionValue.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold); - this.lblDirectionValue.Location = new System.Drawing.Point(80, 48); - this.lblDirectionValue.Name = "lblDirectionValue"; - this.lblDirectionValue.Size = new System.Drawing.Size(12, 12); - this.lblDirectionValue.TabIndex = 5; - this.lblDirectionValue.Text = "-"; - // - // lblRunStValue - // - this.lblRunStValue.AutoSize = true; - this.lblRunStValue.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold); - this.lblRunStValue.Location = new System.Drawing.Point(221, 23); - this.lblRunStValue.Name = "lblRunStValue"; - this.lblRunStValue.Size = new System.Drawing.Size(12, 12); - this.lblRunStValue.TabIndex = 3; - this.lblRunStValue.Text = "-"; - // - // lblRunSt - // - this.lblRunSt.AutoSize = true; - this.lblRunSt.Location = new System.Drawing.Point(151, 23); - this.lblRunSt.Name = "lblRunSt"; - this.lblRunSt.Size = new System.Drawing.Size(57, 12); - this.lblRunSt.TabIndex = 2; - this.lblRunSt.Text = "실행상태:"; - // - // lblModeValue - // - this.lblModeValue.AutoSize = true; - this.lblModeValue.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold); - this.lblModeValue.Location = new System.Drawing.Point(80, 23); - this.lblModeValue.Name = "lblModeValue"; - this.lblModeValue.Size = new System.Drawing.Size(12, 12); - this.lblModeValue.TabIndex = 1; - this.lblModeValue.Text = "-"; - // - // lblMode - // - this.lblMode.AutoSize = true; - this.lblMode.Location = new System.Drawing.Point(10, 23); - this.lblMode.Name = "lblMode"; - this.lblMode.Size = new System.Drawing.Size(33, 12); - this.lblMode.TabIndex = 0; - this.lblMode.Text = "모드:"; - // - // tableLayoutPanel2 - // - this.tableLayoutPanel2.ColumnCount = 3; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); - this.tableLayoutPanel2.Controls.Add(this.btnLiftStop, 2, 0); - this.tableLayoutPanel2.Controls.Add(this.btnLiftUp, 0, 0); - this.tableLayoutPanel2.Controls.Add(this.btnLiftDown, 1, 0); - this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 17); - this.tableLayoutPanel2.Name = "tableLayoutPanel2"; - this.tableLayoutPanel2.RowCount = 1; - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(427, 59); - this.tableLayoutPanel2.TabIndex = 0; + this.tbErmsg.Location = new System.Drawing.Point(7, 47); + this.tbErmsg.Name = "tbErmsg"; + this.tbErmsg.Size = new System.Drawing.Size(523, 21); + this.tbErmsg.TabIndex = 2; // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(979, 621); - this.Controls.Add(this.grpLift); + this.ClientSize = new System.Drawing.Size(1083, 621); + this.Controls.Add(this.groupBox3); this.Controls.Add(this.grpAGVStatus); this.Controls.Add(this.grpLogs); this.Controls.Add(this.grpCommands); @@ -1073,7 +923,6 @@ namespace Test_ACS this.panel1.PerformLayout(); this.grpManual.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.txtRFID)).EndInit(); - this.grpLift.ResumeLayout(false); this.grpLogs.ResumeLayout(false); this.tabLogs.ResumeLayout(false); this.tabRX.ResumeLayout(false); @@ -1084,7 +933,8 @@ namespace Test_ACS this.tabPage1.ResumeLayout(false); this.grpAGVStatus.ResumeLayout(false); this.grpAGVStatus.PerformLayout(); - this.tableLayoutPanel2.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); this.ResumeLayout(false); } @@ -1109,7 +959,6 @@ namespace Test_ACS private System.Windows.Forms.Button btnReset; private System.Windows.Forms.Button btnMarkStop; private System.Windows.Forms.GroupBox grpManual; - private System.Windows.Forms.GroupBox grpLift; private System.Windows.Forms.Button btnLiftStop; private System.Windows.Forms.Button btnLiftDown; private System.Windows.Forms.Button btnLiftUp; @@ -1125,22 +974,6 @@ namespace Test_ACS private System.Windows.Forms.TextBox txtAlias; private System.Windows.Forms.Label lblAlias; private System.Windows.Forms.GroupBox grpAGVStatus; - private System.Windows.Forms.Label lblLastTagValue; - private System.Windows.Forms.Label lblLastTag; - private System.Windows.Forms.Label lblLiftStValue; - private System.Windows.Forms.Label lblLiftSt; - private System.Windows.Forms.Label lblCartStValue; - private System.Windows.Forms.Label lblCartSt; - private System.Windows.Forms.Label lblChargeStValue; - private System.Windows.Forms.Label lblChargeSt; - private System.Windows.Forms.Label lblInpositionValue; - private System.Windows.Forms.Label lblInposition; - private System.Windows.Forms.Label lblDirectionValue; - private System.Windows.Forms.Label lblDirection; - private System.Windows.Forms.Label lblRunStValue; - private System.Windows.Forms.Label lblRunSt; - private System.Windows.Forms.Label lblModeValue; - private System.Windows.Forms.Label lblMode; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; @@ -1172,6 +1005,11 @@ namespace Test_ACS private System.Windows.Forms.Panel panel3; private System.Windows.Forms.RadioButton radLidarOff; private System.Windows.Forms.RadioButton radLidarOn; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.Button button11; + private System.Windows.Forms.Button button12; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.TextBox rtStatus; + private System.Windows.Forms.TextBox tbErCode; + private System.Windows.Forms.TextBox tbErmsg; } } diff --git a/HMI/TestProject/Test_ACS/MainForm.cs b/HMI/TestProject/Test_ACS/MainForm.cs index 95f7ef4..a458649 100644 --- a/HMI/TestProject/Test_ACS/MainForm.cs +++ b/HMI/TestProject/Test_ACS/MainForm.cs @@ -55,16 +55,35 @@ namespace Test_ACS // AGV 상태 수신 처리 (cmd = 3) var device = e.ReceivedPacket.ID; var command = (ENIGProtocol.AGVCommandEH)e.ReceivedPacket.Command; + var data = e.ReceivedPacket.Data; switch (command) { case AGVCommandEH.Status: - UpdateAGVStatus(e.ReceivedPacket.Data); + _remoteStatus.Mode = data[0]; + _remoteStatus.RunSt = data[1]; + _remoteStatus.HWError = BitConverter.ToUInt16(data, 2); + _remoteStatus.RunStep = data[4]; + _remoteStatus.RunStepSeq = data[5]; + _remoteStatus.MotorDir = data[6]; + _remoteStatus.MagnetDir = data[7]; + _remoteStatus.ChargeSt = data[8]; + _remoteStatus.CartSt = data[9]; + _remoteStatus.LiftSt = data[10]; + _remoteStatus.ErrorCode = data[11]; + _remoteErrorCode = (ENIGProtocol.AGVErrorCode)data[11]; + _remoteErrorMessage = ENIGProtocol.AGVUtility.GetAGVErrorMessage(_remoteErrorCode); + _remoteStatus.LastTag = Encoding.ASCII.GetString(data, 12, 4); + + UpdateUIStatus(); break; case AGVCommandEH.Error: - var errorcode = (AGVErrorCode)e.ReceivedPacket.Data[0]; - var errorMessage = System.Text.Encoding.UTF8.GetString(e.ReceivedPacket.Data, 1, e.ReceivedPacket.Data.Length - 1); - AddLog($"Error Received : {errorcode} ID:{e.ReceivedPacket.ID} MSG:{errorMessage}", LogType.Info); + + _remoteErrorCode = (ENIGProtocol.AGVErrorCode)data[0]; + // _remoteErrorMessage = ... Error 메시지 자체는 패킷에 포함되지 않으므로 유틸리티 사용 가능 + _remoteErrorMessage = ENIGProtocol.AGVUtility.GetAGVErrorMessage(_remoteErrorCode); + UpdateUIStatus(); + AddLog($"Error Received : {_remoteErrorCode} ID:{e.ReceivedPacket.ID} MSG:{_remoteErrorMessage}", LogType.Info); break; default: AddLog($"unknown command:{command}", LogType.Error); @@ -305,20 +324,21 @@ namespace Test_ACS private void btnLiftUp_Click(object sender, EventArgs e) { - SendLiftCommand(1); // Up + SendLiftCommand( arDev.Narumi.LiftCommand.UP); // Up } private void btnLiftDown_Click(object sender, EventArgs e) { - SendLiftCommand(2); // Down + SendLiftCommand( arDev.Narumi.LiftCommand.DN); // Down } private void btnLiftStop_Click(object sender, EventArgs e) { - SendLiftCommand(0); // Stop + SendLiftCommand( arDev.Narumi.LiftCommand.STP); // Stop } - private void SendLiftCommand(byte liftCmd) + + private void SendLiftCommand(arDev.Narumi.LiftCommand liftCmd) { // LiftControl: data = TargetID(2 hex) + LiftCommand(1 byte) var targetID = selectedAGV.ToString("X2"); @@ -372,124 +392,56 @@ namespace Test_ACS AddLog($"전송 실패: {ex.Message}", LogType.Error); } } - - private void UpdateAGVStatus(byte[] data) + public ENIGProtocol.AGVErrorCode _remoteErrorCode = ENIGProtocol.AGVErrorCode.None; + public string _remoteErrorMessage = ""; + public RemoteStatus _remoteStatus = new RemoteStatus(); + private void UpdateUIStatus() { - if (data.Length < 12) + if (this.InvokeRequired) { - AddLog($"AGV 상태 데이터 길이 오류: {data.Length} bytes", LogType.Error); - return; - } - - if (InvokeRequired) - { - BeginInvoke(new Action(() => UpdateAGVStatus(data))); + this.BeginInvoke(new Action(UpdateUIStatus)); return; } try { - // Mode[1]: 0=manual, 1=auto - lblModeValue.Text = data[0] == 0 ? "수동" : "자동"; - lblModeValue.ForeColor = data[0] == 0 ? Color.Blue : Color.Green; - // RunSt[1]: 0=stop, 1=run, 2=error - switch (data[1]) + rtStatus.Text = _remoteStatus.ToString(); + + string errCode = _remoteErrorCode.ToString(); + string errMsg = _remoteErrorMessage; + + if (_remoteStatus.HWError > 0) { - case 0: - lblRunStValue.Text = "정지"; - lblRunStValue.ForeColor = Color.Gray; - break; - case 1: - lblRunStValue.Text = "실행"; - lblRunStValue.ForeColor = Color.Green; - break; - case 2: - lblRunStValue.Text = "에러"; - lblRunStValue.ForeColor = Color.Red; - break; - default: - lblRunStValue.Text = "알 수 없음"; - lblRunStValue.ForeColor = Color.Black; - break; + errCode = $"HW:{_remoteStatus.HWError:X4}" + (errCode == "None" ? "" : $" | {errCode}"); + + StringBuilder sbHw = new StringBuilder(); + for (int i = 0; i < 16; i++) + { + if (((ushort)_remoteStatus.HWError & (1 << i)) != 0) + { + sbHw.Append($"{(arDev.Narumi.eflag)i}, "); + } + } + errMsg = $"[HW] {sbHw}" + (string.IsNullOrEmpty(errMsg) ? "" : $" | {errMsg}"); } - // Mot Direction[1]: 0=forward, 1:backward - switch (data[2]) + tbErCode.Text = errCode; + tbErmsg.Text = errMsg; + + if (_remoteErrorCode != ENIGProtocol.AGVErrorCode.None || _remoteStatus.HWError > 0) { - case 0: - lblDirectionValue.Text = "전진"; - break; - case 1: - lblDirectionValue.Text = "후진"; - break; - default: - lblDirectionValue.Text = "??"; - break; + tbErCode.BackColor = Color.Red; + tbErCode.ForeColor = Color.White; + } + else + { + tbErCode.BackColor = SystemColors.Window; + tbErCode.ForeColor = SystemColors.WindowText; } - // Direction[1]: 0=straight, 1=left, 2=right, 3=markstop - switch (data[3]) - { - case 0: - lblDirectionValue.Text += "/직진"; - break; - case 1: - lblDirectionValue.Text += "/좌회전"; - break; - case 2: - lblDirectionValue.Text += "/우회전"; - break; - default: - lblDirectionValue.Text += "/??"; - break; - } - // Inposition[1]: 0=off, 1=on - lblInpositionValue.Text = data[4] == 0 ? "OFF" : "ON"; - lblInpositionValue.ForeColor = data[4] == 0 ? Color.Gray : Color.Green; - // ChargeSt[1]: 0=off, 1=on - lblChargeStValue.Text = data[5] == 0 ? "OFF" : "ON"; - lblChargeStValue.ForeColor = data[5] == 0 ? Color.Gray : Color.Orange; - - // CartSt[1]: 0=off, 1=on, 2=unknown - switch (data[6]) - { - case 0: - lblCartStValue.Text = "없음"; - lblCartStValue.ForeColor = Color.Gray; - break; - case 1: - lblCartStValue.Text = "있음"; - lblCartStValue.ForeColor = Color.Green; - break; - default: - lblCartStValue.Text = "??"; - lblCartStValue.ForeColor = Color.Red; - break; - } - - // LiftSt[1]: 0=down, 1=up, 2=unknown - switch (data[7]) - { - case 0: - lblLiftStValue.Text = "하강"; - lblLiftStValue.ForeColor = Color.Blue; - break; - case 1: - lblLiftStValue.Text = "상승"; - lblLiftStValue.ForeColor = Color.Green; - break; - default: - lblLiftStValue.Text = "??"; - lblLiftStValue.ForeColor = Color.Red; - break; - } - - string lastTag = Encoding.ASCII.GetString(data, 8, 4); - lblLastTagValue.Text = lastTag; - lblLastTagValue.ForeColor = Color.Black; } catch (Exception ex) { @@ -585,6 +537,8 @@ namespace Test_ACS private void button7_Click(object sender, EventArgs e) { //lt180 + var dlg = MessageBox.Show("턴작업을 실행할까요? 회전반경에 장애물이 없어야 합니다", "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dlg != DialogResult.Yes) return; var targetID = selectedAGV.ToString("X2"); SendCommand(AGVCommandHE.LTurn180, targetID); } @@ -592,6 +546,8 @@ namespace Test_ACS private void button8_Click(object sender, EventArgs e) { //rt180 + var dlg = MessageBox.Show("턴작업을 실행할까요? 회전반경에 장애물이 없어야 합니다", "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dlg != DialogResult.Yes) return; var targetID = selectedAGV.ToString("X2"); SendCommand(AGVCommandHE.RTurn180, targetID); } @@ -599,6 +555,8 @@ namespace Test_ACS private void button9_Click(object sender, EventArgs e) { //l turn + var dlg = MessageBox.Show("턴작업을 실행할까요? 회전반경에 장애물이 없어야 합니다", "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dlg != DialogResult.Yes) return; var targetID = selectedAGV.ToString("X2"); SendCommand(AGVCommandHE.LTurn, targetID); } @@ -606,8 +564,20 @@ namespace Test_ACS private void button10_Click(object sender, EventArgs e) { ///r-turn + var dlg = MessageBox.Show("턴작업을 실행할까요? 회전반경에 장애물이 없어야 합니다", "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dlg != DialogResult.Yes) return; var targetID = selectedAGV.ToString("X2"); SendCommand(AGVCommandHE.RTurn, targetID); } + + private void button12_Click(object sender, EventArgs e) + { + SendLiftCommand(arDev.Narumi.LiftCommand.ON); + } + + private void button11_Click(object sender, EventArgs e) + { + SendLiftCommand(arDev.Narumi.LiftCommand.OFF); + } } } diff --git a/HMI/TestProject/Test_ACS/RemoteStatus.cs b/HMI/TestProject/Test_ACS/RemoteStatus.cs new file mode 100644 index 0000000..e6801ba --- /dev/null +++ b/HMI/TestProject/Test_ACS/RemoteStatus.cs @@ -0,0 +1,49 @@ +using System.Text; + +namespace Test_ACS +{ + public partial class MainForm + { + public class RemoteStatus + { + public byte Mode { get; set; } // 0=manual, 1=auto + public byte RunSt { get; set; } // 0=stop, 1=run, 2=error + public byte RunStep { get; set; } + public byte RunStepSeq { get; set; } + public ushort HWError { get; set; } + public byte MotorDir { get; set; } // 0=F, 1=B + public byte MagnetDir { get; set; } // 0=S, 1=L, 2=R + public byte ChargeSt { get; set; } // 0=off, 1=on + public byte CartSt { get; set; } // 0=off, 1=on, 2=unknown + public byte LiftSt { get; set; } // 0=down, 1=up, 2=unknown + public byte ErrorCode { get; set; } + public string LastTag { get; set; } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.AppendLine($"Mode: {(Mode == 1 ? "Auto" : "Manual")}"); + sb.AppendLine($"RunSt: {(RunSt == 0 ? "Stop" : (RunSt == 1 ? "Run" : "Error"))}"); + if (HWError > 0) + { + sb.Append(" [HW ERR: "); + for (int i = 0; i < 16; i++) + { + if ((HWError & (1 << i)) != 0) + { + sb.Append($"{(arDev.Narumi.eflag)i},"); + } + } + sb.AppendLine("]"); + } + sb.AppendLine($"Step: {RunStep}, Seq: {RunStepSeq}"); + sb.AppendLine($"Dir: {(MotorDir == 1 ? "B" : "F")}, Mag: {(MagnetDir == 1 ? "L" : (MagnetDir == 2 ? "R" : "S"))}"); + sb.AppendLine($"Charge: {(ChargeSt == 1 ? "ON" : "OFF")}"); + sb.AppendLine($"Cart: {(CartSt == 1 ? "ON" : (CartSt == 0 ? "OFF" : "Unk"))}"); + sb.AppendLine($"Lift: {(LiftSt == 1 ? "UP" : (LiftSt == 0 ? "DOWN" : "Unk"))}"); + sb.Append($"Tag: {LastTag}"); + return sb.ToString(); + } + } + } +} diff --git a/HMI/TestProject/Test_ACS/Test_ACS.csproj b/HMI/TestProject/Test_ACS/Test_ACS.csproj index 66b9b12..8f3a7bb 100644 --- a/HMI/TestProject/Test_ACS/Test_ACS.csproj +++ b/HMI/TestProject/Test_ACS/Test_ACS.csproj @@ -69,6 +69,9 @@ True Settings.settings + + Form + MainForm.cs @@ -84,10 +87,14 @@ - - {499d8912-4b96-41e5-a70d-cfe797883d65} + + {9365803b-933d-4237-93c7-b502c855a71c} ENIGProtocol + + {8bae0eac-3d25-402f-9a65-2ba1ecfe28b7} + NARUMI + \ No newline at end of file