diff --git a/Emulator/AGVEmulator.sln b/Emulator/AGVEmulator.sln new file mode 100644 index 0000000..a11e8bd --- /dev/null +++ b/Emulator/AGVEmulator.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33801.468 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGVEmulator", "AGVEmulator\AGVEmulator.csproj", "{9312AB43-72F6-4365-A266-E767215FA7F5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9312AB43-72F6-4365-A266-E767215FA7F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9312AB43-72F6-4365-A266-E767215FA7F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9312AB43-72F6-4365-A266-E767215FA7F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9312AB43-72F6-4365-A266-E767215FA7F5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6F494EC0-1316-409F-8C1A-D882BBF25D13} + EndGlobalSection +EndGlobal diff --git a/Emulator/AGVEmulator/AGVEmulator.csproj b/Emulator/AGVEmulator/AGVEmulator.csproj new file mode 100644 index 0000000..8b91560 --- /dev/null +++ b/Emulator/AGVEmulator/AGVEmulator.csproj @@ -0,0 +1,121 @@ + + + + + Debug + AnyCPU + {9312AB43-72F6-4365-A266-E767215FA7F5} + WinExe + AGVEmulator + AGVEmulator + v4.8 + 512 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + ..\arControl.Net4.dll + + + ..\arFrameControl.dll + + + ..\ArLog.Net4.dll + + + ..\ArSetting.Net4.dll + + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + + UserControl + + + SerialConn.cs + + + Component + + + AgvViewer.cs + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SerialConn.cs + + + + PreserveNewest + + + PreserveNewest + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + \ No newline at end of file diff --git a/Emulator/AGVEmulator/DevAGV.cs b/Emulator/AGVEmulator/DevAGV.cs new file mode 100644 index 0000000..3838d88 --- /dev/null +++ b/Emulator/AGVEmulator/DevAGV.cs @@ -0,0 +1,586 @@ +using arCtl; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; + +namespace AGVEmulator +{ + class DevAGV : AR.Dev.RS232 + { + //######### private variable + byte runtime = 0; + + //######### public variable + public UInt16 system0 = 0; + public UInt16 system1 = 0; + public UInt16 error = 0; + public byte signal = 0; + public char sts_bunki = 'S'; + public char sts_speed = 'L'; + public char sts_dir = 'F'; + public char sts_sensor = '1'; + + + public enum eCommand : byte + { + LOAD = 0, //EEPROM 불러오기 + SAVE, //EEPROM 저장 + RESET, //초기화 + PINGCHK, + SET_PINMODE, //PINMODE 설정 + SET_DOUTPUT, //디지털출력설정(포트번호,값[1,0]) + SET_AOUTPUT, //아날로그출력설정(포트GET_SETTING = 50, //셋팅값 요청 + SET_FLAG, + SET_EEPROM, + SET_MANUALSPEED, + GET_SETTING = 50, + GUIDE_MOT = 90, //가이드커버(양쪽) 0=멈춤,1=UP,2=DN 아스키코드표 90=Z + SET_EEP_DIREV, + }; + + public enum DOName + { + PINO_GUIDEMOTOR_LDIR, + PINO_GUIDEMOTOR_LRUN, + PINO_GUIDEMOTOR_RDIR, + PINO_GUIDEMOTOR_RRUN, + PINO_EMPTY_26, + PINO_EMPTY_27, + PINO_EMPTY_28, + PINO_EMPTY_29, + } + + public enum DIName + { + PINI_EMG, + PINI_BTN_1, + PINI_BTN_2, + PINI_BTN_3, + PINI_BTN_4, + PINI_OVERLOADL, + PINI_OVERLOADR, + PINI_EMPTY_36, + PINI_EMPTY_37, + PINI_EMPTY_38, + PINI_BTN_ZUP, + PINI_BTN_ZDN, + PINI_LIMIT_LU, + PINI_LIMIT_LD, + PINI_LIMIT_RU, + PINI_LIMIT_RD, + PINI_STOP, + } + public enum eerror + { + Emergency = 0, + Overcurrent, + Charger_run_error, + Charger_pos_error, + line_out_error = 4, + + /// + /// 기동시 자석 감지 에러 + /// + runerror_by_no_magent_line, + /// + /// 호출제어기 통신 오류 + /// + controller_comm_error = 11, + /// + /// 도착경보기 통신 오류 + /// + arrive_ctl_comm_error, + + /// + /// 자동문제어기 통신 오류 + /// + door_ctl_comm_error, + + /// + /// 자동충전기 통신 오류 + /// + charger_comm_error, + + /// + /// 교차로 제어기 통신 오류 + /// + cross_ctrl_comm_error, + } + public enum esignal + { + front_gate_out = 0, + rear_sensor_out, + mark_sensor_1, + mark_sensor_2, + front_left_sensor, + front_right_sensor, + front_center_sensor, + charger_align_sensor, + } + public enum esystemflag0 + { + Memory_RW_State = 5, + EXT_IO_Conn_State, + RFID_Conn_State, + M5E_Module_Run_State = 8, + Front_Ultrasonic_Conn_State, + Front_Untrasonic_Sensor_State, + Side_Ultrasonic_Conn_State, + Side_Ultrasonic_Sensor_State = 12, + Front_Guide_Sensor_State, + Rear_Guide_Sensor_State, + Battery_Level_Check + } + public enum esystemflag1 + { + Side_Detect_Ignore = 3, + Melody_check, + Mark2_check, + Mark1_check, + gateout_check, + Battery_charging = 8, + re_Start, + + /// + /// 전방 감지 무시 + /// + front_detect_ignore, + + /// + /// 전방장애물감지상태 + /// + front_detect_check, + + /// + /// 전방감지 후 정지 상태 + /// + stop_by_front_detect = 12, + /// + /// 교차로 진입 후 정지 상태 + /// + stop_by_cross_in, + agv_stop, + agv_run + } + + public enum evaluetype + { + system0, + system1, + error, + signal, + } + public enum estsvaluetype + { + bunki, + speed, + direction, + sensor + } + public class ValueChangedArgs : EventArgs + { + public int Idx { get; set; } + public bool Value { get; set; } + public evaluetype vtype { get; set; } + public ValueChangedArgs(int idx, bool val, evaluetype isOut) + { + this.Idx = idx; + this.Value = val; + this.vtype = isOut; + } + } + public class StsValueChangedArgs : EventArgs + { + public char Value { get; set; } + public estsvaluetype vtype { get; set; } + public StsValueChangedArgs(estsvaluetype vType, char val) + { + this.Value = val; + this.vtype = vType; + } + } + + public class RequestStatusDataArgs : EventArgs + { + public UInt16 system0 { get; set; } = 0; + public UInt16 system1 { get; set; } = 0; + public char speed { get; set; } = 'L'; + public char direction { get; set; } = 'F'; + public char bunki { get; set; } = 'S'; + + public byte signal { get; set; } = 0; + public float volt { get; set; } = 0f; + public UInt16 error { get; set; } = 0; + public char sensor { get; set; } = '0'; + public RequestStatusDataArgs() + { + + } + } + public event EventHandler RequestStatusData; + public event EventHandler ValueChanged; + public event EventHandler StsValueChanged; + + public class commandargs : EventArgs + { + public string Command { get; set; } + public commandargs(string cmd) + { + this.Command = cmd; + } + } + public event EventHandler Command; + public class FrameData + { + public string Checksum { get; set; } + public byte stx { get; set; } + public byte etx { get; set; } + public string cmd { get; set; } + public string data { get; set; } + public FrameData(byte[] data) + { + this.stx = data[0]; + this.etx = data[data.Length - 1]; + this.Checksum = System.Text.Encoding.Default.GetString(data, data.Length - 3, 2); + this.data = System.Text.Encoding.Default.GetString(data, 1, data.Length - 4); + this.cmd = this.data.Substring(0, 3); + this.data = this.data.Substring(3); + } + } + + + #region SetAGV/SetSTS/SetBIT/GetBIT + Boolean GetBit(ref UInt16 _value, int idx) + { + var offset = (UInt16)(1 << idx); + return (_value & offset) != 0; + } + + Boolean GetBit(ref byte _value, int idx) + { + var offset = (byte)(1 << idx); + return (_value & offset) != 0; + } + + bool SetBit(ref UInt16 _value, int idx, Boolean value) + { + var oldvalue = GetBit(ref _value, idx); + if (value) + { + var offset = (UInt16)(1 << idx); + _value = (UInt16)(_value | offset); + } + else + { + var offset = (UInt16)(~(1 << idx)); + _value = (UInt16)(_value & offset); + } + return oldvalue != value; + } + bool SetBit(ref byte _value, int idx, Boolean value) + { + var oldvalue = GetBit(ref _value, idx); + if (value) + { + var offset = (byte)(1 << idx); + _value = (byte)(_value | offset); + } + else + { + var offset = (byte)(~(1 << idx)); + _value = (byte)(_value & offset); + } + return oldvalue != value; + } + public bool GetAGV(DevAGV.esystemflag1 flag) + { + var idx = (int)flag; + return GetBit(ref system1, idx); + } + public void SetAGV(DevAGV.esystemflag0 flag, bool value) + { + var idx = (int)flag; + if (SetBit(ref system0, idx, value)) + ValueChanged?.Invoke(this, new ValueChangedArgs(idx, value, evaluetype.system0)); + } + public void SetAGV(DevAGV.esystemflag1 flag, bool value) + { + var idx = (int)flag; + if (SetBit(ref system1, idx, value)) + ValueChanged?.Invoke(this, new ValueChangedArgs(idx, value, evaluetype.system1)); + } + public void SetAGV(DevAGV.eerror flag, bool value) + { + var idx = (int)flag; + if (SetBit(ref error, idx, value)) + ValueChanged?.Invoke(this, new ValueChangedArgs(idx, value, evaluetype.error)); + } + public void SetAGV(DevAGV.esignal flag, bool value) + { + var idx = (int)flag; + if (SetBit(ref signal, idx, value)) + ValueChanged?.Invoke(this, new ValueChangedArgs(idx, value, evaluetype.signal)); + } + + public void SetSTS(estsvaluetype target, char value) + { + //bool changed = false; + switch (target) + { + case estsvaluetype.sensor: + //changed = this.sts_sensor.Equals(value); + sts_sensor = value; + break; + case estsvaluetype.direction: + //changed = this.sts_dir.Equals(value); + sts_dir = value; + break; + case estsvaluetype.speed: + //changed = this.sts_speed.Equals(value); + sts_speed = value; + break; + case estsvaluetype.bunki: + //changed = this.sts_bunki.Equals(value); + sts_bunki = value; + break; + } + //if(changed) + { + StsValueChanged?.Invoke(this, new StsValueChangedArgs(target, value)); + } + } + #endregion + + public override bool ProcessRecvData(byte[] data) + { + //dd로 시작하고 34개의 데이터 + //STS258FFFF40000000LSF0000003A + //02 53 54 53 32 35 38 46 46 46 46 34 30 30 30 30 30 30 30 4C 53 46 30 30 30 30 30 30 33 41 03 + var frame = new FrameData(data); + + switch (frame.cmd) + { + case "CRN": //기동명령 + //sts_dir = frame.data[0]; + SetSTS(estsvaluetype.direction, frame.data[0]); + SetAGV(esystemflag1.agv_stop, false); + SetAGV(esystemflag1.agv_run, true); + break; + case "CST": //중지명령 + //(바로 중지한다) + if (frame.data.StartsWith("M")) + { + Command?.Invoke(this, new commandargs("stopmark")); + } + else + { + SetAGV(esystemflag1.agv_run, false); + SetAGV(esystemflag1.agv_stop, true); + } + + break; + case "CBR": //분기명령 + //FSL + SetSTS(estsvaluetype.direction, frame.data[0]); + SetSTS(estsvaluetype.bunki, frame.data[1]); + SetSTS(estsvaluetype.speed, frame.data[2]); + SetSTS(estsvaluetype.sensor, frame.data[3]); + break; + case "CRT"://수동제어 + sts_dir = frame.data[0]; + sts_bunki = frame.data[1]; + sts_speed = frame.data[2]; + sts_sensor = frame.data[3]; + SetAGV(esystemflag1.agv_stop, false); + SetAGV(esystemflag1.agv_run, true); + break; + case "ACK": //응답ok + RaiseMessage(MessageType.Normal, $">> {frame.cmd} DATA={frame.data}"); + break; + case "SFR": //reset + SetAGV(DevAGV.eerror.Emergency, false); + SetAGV(DevAGV.eerror.line_out_error, false); + SetAGV(DevAGV.eerror.Overcurrent, false); + SetAGV(DevAGV.esystemflag1.agv_run, false); + SetAGV(DevAGV.esystemflag1.agv_stop, true); + break; + case "CBT"://충전작업 + SetAGV(DevAGV.esystemflag1.Battery_charging, true); + var id = frame.data.Substring(2, 2); + var cmd = frame.data[4]; + var delaytime = int.Parse(frame.data.Substring(5)); + if (cmd == 'I') SetAGV(DevAGV.esystemflag1.Battery_charging, true); + else SetAGV(esystemflag1.Battery_charging, false); + break; + case "SSH": + case "SSM": + case "SSL": + case "SSS": + case "SHS": + case "SLS": + case "SPK": + case "SPM": + case "SPL": + case "SPS": + case "SIK": + case "SIM": + case "SIH": + case "SIL": + case "SIS": + case "SDK": + case "SDW": + case "SDL": + case "SDS": + case "SRS": + case "SCK": + case "SSK": + case "STT": + case "SSI": + case "SMD": + case "SSC": + case "SPN": + case "SPH": + case "SCH": + case "SDH": + case "SDM": + case "SLB": + SendCmd("ACK", frame.cmd); + break; + default: + RaiseMessage(MessageType.Normal, $"미처리명령 {frame.cmd} DATA={frame.data}"); + break; + } + + + + return true; + } + public void SendCmd(string cmd, string value) + { + + var barr = new List(); + barr.Add(0x02); + barr.AddRange(System.Text.Encoding.Default.GetBytes(cmd)); + barr.AddRange(System.Text.Encoding.Default.GetBytes(value)); + barr.Add((byte)'*'); + barr.Add((byte)'*'); + barr.Add(0x03); + var cmdstr = System.Text.Encoding.Default.GetString(barr.ToArray()); + RaiseMessage(MessageType.Normal, "Tx:" + barr.ToArray().HexString()); + WriteData(barr.ToArray()); + } + + public void SendTag(string tagno) + { + tagno = tagno.PadLeft(6, '0'); + if (tagno.Length > 6) tagno = tagno.Substring(0, 6); + var barr = new List(); + barr.Add(0x02); + barr.Add((byte)'T'); + barr.Add((byte)'A'); + barr.Add((byte)'G'); + barr.AddRange(System.Text.Encoding.Default.GetBytes(tagno)); + barr.Add((byte)'*'); + barr.Add((byte)'*'); + barr.Add(0x03); + var cmdstr = System.Text.Encoding.Default.GetString(barr.ToArray()); + RaiseMessage(MessageType.Normal, "Tx:" + barr.ToArray().HexString()); + WriteData(barr.ToArray()); + } + + public override void AutoSendData() + { + //if (_device.DtrEnable == false) return; + //STS258FFFF40000000LSF0000003A + //02 53 54 53 32 35 38 46 46 46 46 34 30 30 30 30 30 30 30 4C 53 46 30 30 30 30 30 30 33 41 03 + var sample = "02 53 54 53 32 35 38 46 46 46 46 34 30 30 30 30 30 30 30 4C 53 46 30 30 30 30 30 30 33 41 03"; + var barr = sample.Split(' ').ToList().Select(t => Convert.ToByte(t, 16)).ToArray(); + + //if (RequestStatusData != null) + //{ + //var p = new RequestStatusDataArgs(); + //RequestStatusData.Invoke(this, p); + + var voltstr = "255";// ((int)(p.volt * 10f)).ToString().PadRight(3, '0'); + var bufarr = System.Text.Encoding.Default.GetBytes(voltstr); + Array.Copy(bufarr, 0, barr, 4, bufarr.Length); + + bufarr = System.Text.Encoding.Default.GetBytes(system0.ToString("X2").PadLeft(4, '0')); + + Array.Copy(bufarr, 0, barr, 7, bufarr.Length); + + bufarr = System.Text.Encoding.Default.GetBytes(system1.ToString("X2").PadLeft(4, '0')); + Array.Copy(bufarr, 0, barr, 11, bufarr.Length); + + bufarr = System.Text.Encoding.Default.GetBytes(error.ToString("X2").PadLeft(4, '0')); + Array.Copy(bufarr, 0, barr, 15, bufarr.Length); + + + barr[19] = (byte)this.sts_speed; + barr[20] = (byte)this.sts_bunki; + barr[21] = (byte)this.sts_dir; + barr[22] = (byte)this.sts_sensor; + //bufarr = System.Text.Encoding.Default.GetBytes(p.sensor.ToString().PadLeft(2, '0')); + //Array.Copy(bufarr, 0, barr, 22, bufarr.Length); + bufarr = System.Text.Encoding.Default.GetBytes(signal.ToString("X2").PadLeft(2, '0')); + Array.Copy(bufarr, 0, barr, 23, bufarr.Length); + //barr[22] = (byte)'5'; + + barr[barr.Length - 3] = (byte)'*'; + barr[barr.Length - 2] = (byte)'*'; + + //} + + var cmdstr = System.Text.Encoding.Default.GetString(barr); + RaiseMessage(MessageType.Normal, "Tx:" + barr.ToArray().HexString()); + WriteData(barr.ToArray()); + } + + + protected override bool CustomParser(byte[] buf, out byte[] remainBuffer) + { + //DD A5 03 00 FF FD 77 0D + //remainBuffer = new byte[] { }; + List remain = new List(); + bool retval = false; + foreach (var b in buf) + { + if (retval) + { + remain.Add(b); + continue; + } + + + + if (b == 0x02) //stx + { + tempBuffer.Clear(); + tempBuffer.Add(b); + } + + else if (b == 0x03) //etx + { + tempBuffer.Add(b); + retval = true; + } + else + { + //데이터길이가 만족한 상태 + tempBuffer.Add(b); + var maxlen = 100; + if (tempBuffer.Count > maxlen) + { + RaiseMessage(MessageType.Error, $"buffer over({maxlen})"); + tempBuffer.Clear(); + } + } + + + } + remainBuffer = remain.ToArray(); + return retval; + } + } +} diff --git a/Emulator/AGVEmulator/DevCAL.cs b/Emulator/AGVEmulator/DevCAL.cs new file mode 100644 index 0000000..bcf0953 --- /dev/null +++ b/Emulator/AGVEmulator/DevCAL.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace AGVEmulator +{ + class DevCAL : AR.Dev.RS232 + { + public override bool ProcessRecvData(byte[] data) + { + var sample = "02 30 31 32 01 03"; + var barr = sample.Split(' ').ToList().Select(t => Convert.ToByte(t, 16)).ToArray(); + var sendstr = System.Text.Encoding.Default.GetString(barr); + //RaiseMessage(MessageType.Normal, "Tx:" + barr.HexString()); + //WriteData(barr); + return true; + } + + protected override bool CustomParser(byte[] buf, out byte[] remainBuffer) + { + + List remain = new List(); + bool retval = false; + foreach (var b in buf) + { + if (retval) + { + remain.Add(b); + continue; + } + + if (b == 0x02) //stx + { + tempBuffer.Clear(); + tempBuffer.Add(b); + } + else if (b == 0x03) //etx + { + tempBuffer.Add(b); + retval = true; + } + else + { + if (tempBuffer.Count > 0 && tempBuffer[0] == 0xDD) + { + tempBuffer.Add(b); + if (tempBuffer.Count > 10) + { + RaiseMessage(MessageType.Error, "buffer over"); + tempBuffer.Clear(); + retval = false; + } + } + else + { + //trash + } + } + } + remainBuffer = remain.ToArray(); + return retval; + } + } +} diff --git a/Emulator/AGVEmulator/DevPLC.cs b/Emulator/AGVEmulator/DevPLC.cs new file mode 100644 index 0000000..585b384 --- /dev/null +++ b/Emulator/AGVEmulator/DevPLC.cs @@ -0,0 +1,298 @@ +using System; +using static AGVEmulator.DevBMS; +using System.Collections.Generic; +using System.Linq; +using System.Diagnostics.Contracts; +using arCtl; +using System.Xml.Schema; +using System.Drawing; + +namespace AGVEmulator +{ + class DevPLC : AR.Dev.RS232 + { + byte runtime = 0; + + + public enum eCommand : byte + { + LOAD = 0, //EEPROM 불러오기 + SAVE, //EEPROM 저장 + RESET, //초기화 + PINGCHK, + SET_PINMODE, //PINMODE 설정 + SET_DOUTPUT, //디지털출력설정(포트번호,값[1,0]) + SET_AOUTPUT, //아날로그출력설정(포트GET_SETTING = 50, //셋팅값 요청 + SET_FLAG, + SET_EEPROM, + SET_MANUALSPEED, + GET_SETTING = 50, + GUIDE_MOT = 90, //가이드커버(양쪽) 0=멈춤,1=UP,2=DN 아스키코드표 90=Z + SET_EEP_DIREV, + }; + + public enum DOName + { + PINO_GUIDEMOTOR_LDIR, + PINO_GUIDEMOTOR_LRUN, + PINO_GUIDEMOTOR_RDIR, + PINO_GUIDEMOTOR_RRUN, + PINO_EMPTY_26, + PINO_EMPTY_27, + PINO_EMPTY_28, + PINO_EMPTY_29, + } + + public enum DIName + { + PINI_EMG, + PINI_BTN_1, + PINI_BTN_2, + PINI_BTN_3, + PINI_BTN_4, + PINI_OVERLOADL, + PINI_OVERLOADR, + PINI_EMPTY_36, + PINI_EMPTY_37, + PINI_EMPTY_38, + PINI_BTN_ZUP, + PINI_BTN_ZDN, + PINI_LIMIT_LU, + PINI_LIMIT_LD, + PINI_LIMIT_RU, + PINI_LIMIT_RD, + PINI_STOP, + } + + public class ValueChangedArgs : EventArgs + { + public int Idx { get; set; } + public bool Value { get; set; } + public bool IsOut { get; set; } + public ValueChangedArgs(int idx, bool val, bool isOut) + { + this.Idx = idx; + this.Value = val; + this.IsOut = isOut; + } + } + + public class RequestBatteryDataArgs : EventArgs + { + public UInt32 IOValue { get; set; } + public UInt32 FGValue { get; set; } + public RequestBatteryDataArgs() + { + this.IOValue = 0x00; + this.FGValue = 0xFF; + } + } + public event EventHandler RequestData; + public event EventHandler ValueChanged; + + public override bool ProcessRecvData(byte[] data) + { + //dd로 시작하고 34개의 데이터 + // var sample = "DD 03 00 1B 0A 65 00 00 21 63 29 04 00 00 2C 92 00 00 00 00 00 00 28 51 03 08 02 0B 69 0B 66 FC 9C 77"; + // var barr = sample.Split(' ').ToList().Select(t => Convert.ToByte(t, 16)).ToArray(); + var datalne = data[2]; + byte[] buffer = new byte[datalen]; + Array.Copy(data, 3, buffer, 0, buffer.Length); + + var cmd = (eCommand)buffer[0]; + if (cmd == eCommand.GUIDE_MOT) + { + var p1 = (char)buffer[1]; + var p2 = (char)buffer[2]; + + switch (p1) + { + case 'A': //all + if (p2 == 'P') + { + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, true, true)); + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, true, true)); + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LDIR, true, true)); + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RDIR, true, true)); + } + else if (p2 == 'N') + { + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, true, true)); + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, true, true)); + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LDIR, false, true)); + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RDIR, false, true)); + } + else if(p2 == 'S') + { + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, false, true)); + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, false, true)); + } + break; + case 'L': + if (p2 == 'P') + { + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, true, true)); + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LDIR, true, true)); + } + else if (p2 == 'N') + { + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, true, true)); + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LDIR, false, true)); + } + else if (p2 == 'S') + { + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_LRUN, false, true)); + } + break; + case 'R': + if (p2 == 'P') + { + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, true, true)); + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RDIR, true, true)); + } + else if (p2 == 'N') + { + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, true, true)); + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RDIR, false, true)); + } + else if (p2 == 'S') + { + ValueChanged?.Invoke(this, new ValueChangedArgs((int)DOName.PINO_GUIDEMOTOR_RRUN, false, true)); + } + break; + } + } + + + return true; + } + + public override void AutoSendData() + { + //if (_device.DtrEnable == false) return; + + List barr = new List(); + barr.Add((byte)'@'); + barr.Add((byte)'@'); + barr.Add(10); + barr.Add((byte)'I'); + + //입/출력포트 각 16접 데이터 입력 + UInt32 iovalue = 0; + //플래그 각 16접 데이터 입력 + UInt32 fgvalue = 0; + + + if (RequestData != null) + { + var p = new RequestBatteryDataArgs(); + RequestData.Invoke(this, p); + iovalue = p.IOValue; + fgvalue = p.FGValue; + } + + + var arr_volt = BitConverter.GetBytes(iovalue).ToArray(); + foreach (var b in arr_volt) + barr.Add(b); + + + arr_volt = BitConverter.GetBytes(fgvalue).ToArray(); + foreach (var b in arr_volt) + barr.Add(b); + + + if (runtime < 255) runtime += 1; + else runtime = 0; + barr.Add(runtime); + + //체크섬무시 + barr.Add((byte)'*'); + //barr.Add((byte)'*'); + + barr.Add(0x0D); + barr.Add(0x0A); + + RaiseMessage(MessageType.Normal, "Tx:" + barr.ToArray().HexString()); + WriteData(barr.ToArray()); + } + + bool findstx2 = false; + byte datalen = 0; + protected override bool CustomParser(byte[] buf, out byte[] remainBuffer) + { + //DD A5 03 00 FF FD 77 0D + //remainBuffer = new byte[] { }; + List remain = new List(); + bool retval = false; + foreach (var b in buf) + { + if (retval) + { + remain.Add(b); + continue; + } + + + if (findSTX == false) + { + if (b == '@') + { + tempBuffer.Clear(); + tempBuffer.Add(b); + findSTX = true; + findstx2 = false; + datalen = 0; + } + } + else if (findstx2 == false) + { + if (b == '@') + { + tempBuffer.Add(b); + findstx2 = true; + datalen = 0; + } + else + { + tempBuffer.Clear(); + findSTX = false; + findstx2 = false; + } + } + else if (datalen == 0) + { + tempBuffer.Add(b); + datalen = b; + } + else + { + //데이터길이가 만족한 상태 + tempBuffer.Add(b); + var maxlen = datalen + 3 + 3; + + if (tempBuffer.Count == maxlen) + { + if (tempBuffer[tempBuffer.Count - 1] == 0x0A && tempBuffer[tempBuffer.Count - 2] == 0x0D) + { + //무조건 맞는걸로 하자 체크섬은 체크하지 말자 + retval = true; + } + } + else if (tempBuffer.Count > maxlen) + { + RaiseMessage(MessageType.Error, $"buffer over({maxlen})"); + findstx2 = false; + findSTX = false; + datalen = 0; + tempBuffer.Clear(); + } + } + + + } + remainBuffer = remain.ToArray(); + return retval; + } + } +} diff --git a/Emulator/AGVEmulator/Form1.Designer.cs b/Emulator/AGVEmulator/Form1.Designer.cs new file mode 100644 index 0000000..c96319e --- /dev/null +++ b/Emulator/AGVEmulator/Form1.Designer.cs @@ -0,0 +1,1973 @@ + +namespace AGVEmulator +{ + partial class Form1 + { + /// + /// 필수 디자이너 변수입니다. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 사용 중인 모든 리소스를 정리합니다. + /// + /// 관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form 디자이너에서 생성한 코드 + + /// + /// 디자이너 지원에 필요한 메서드입니다. + /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요. + /// + 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(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); + AGVEmulator.UC.AgvViewer.ptdata ptdata1 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata2 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata3 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata4 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata5 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata6 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata7 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata8 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata9 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata10 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata11 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata12 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata13 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata14 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata15 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata16 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata17 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata18 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata19 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata20 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata21 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata22 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata23 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata24 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata25 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata26 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata27 = new AGVEmulator.UC.AgvViewer.ptdata(); + AGVEmulator.UC.AgvViewer.ptdata ptdata28 = new AGVEmulator.UC.AgvViewer.ptdata(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.rtBMS = new arCtl.LogTextBox(); + this.panel1 = new System.Windows.Forms.Panel(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.label6 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.trackBar1 = new System.Windows.Forms.TrackBar(); + this.rtAGV = new arCtl.LogTextBox(); + this.panel4 = new System.Windows.Forms.Panel(); + this.groupBox9 = new System.Windows.Forms.GroupBox(); + this.groupBox10 = new System.Windows.Forms.GroupBox(); + this.panel8 = new System.Windows.Forms.Panel(); + this.groupBox11 = new System.Windows.Forms.GroupBox(); + this.panel9 = new System.Windows.Forms.Panel(); + this.groupBox7 = new System.Windows.Forms.GroupBox(); + this.panel7 = new System.Windows.Forms.Panel(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.panel6 = new System.Windows.Forms.Panel(); + this.panel11 = new System.Windows.Forms.Panel(); + this.groupBox8 = new System.Windows.Forms.GroupBox(); + this.radioButton17 = new System.Windows.Forms.RadioButton(); + this.radioButton13 = new System.Windows.Forms.RadioButton(); + this.radioButton16 = new System.Windows.Forms.RadioButton(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.radioButton12 = new System.Windows.Forms.RadioButton(); + this.radioButton10 = new System.Windows.Forms.RadioButton(); + this.radioButton11 = new System.Windows.Forms.RadioButton(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.radioButton9 = new System.Windows.Forms.RadioButton(); + this.radioButton8 = new System.Windows.Forms.RadioButton(); + this.radioButton7 = new System.Windows.Forms.RadioButton(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.radioButton14 = new System.Windows.Forms.RadioButton(); + this.radioButton15 = new System.Windows.Forms.RadioButton(); + this.panel13 = new System.Windows.Forms.Panel(); + this.chkSimulation = new System.Windows.Forms.CheckBox(); + this.checkBox3 = new System.Windows.Forms.CheckBox(); + this.panel10 = new System.Windows.Forms.Panel(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.button18 = new System.Windows.Forms.Button(); + this.button17 = new System.Windows.Forms.Button(); + this.button15 = new System.Windows.Forms.Button(); + this.button16 = new System.Windows.Forms.Button(); + this.button14 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.rtCAL = new arCtl.LogTextBox(); + this.panel2 = new System.Windows.Forms.Panel(); + this.radioButton20 = new System.Windows.Forms.RadioButton(); + this.radioButton21 = new System.Windows.Forms.RadioButton(); + this.radioButton18 = new System.Windows.Forms.RadioButton(); + this.radioButton19 = new System.Windows.Forms.RadioButton(); + this.nudBMSKitNo = new System.Windows.Forms.NumericUpDown(); + this.label9 = new System.Windows.Forms.Label(); + this.radioButton6 = new System.Windows.Forms.RadioButton(); + this.radioButton5 = new System.Windows.Forms.RadioButton(); + this.radioButton4 = new System.Windows.Forms.RadioButton(); + this.radioButton3 = new System.Windows.Forms.RadioButton(); + this.radioButton2 = new System.Windows.Forms.RadioButton(); + this.radioButton1 = new System.Windows.Forms.RadioButton(); + this.button3 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.rtPLC = new arCtl.LogTextBox(); + this.panel3 = new System.Windows.Forms.Panel(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.gvdPLCInOut = new arFrame.Control.GridView(); + this.gvdPLCFlag = new arFrame.Control.GridView(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.panel5 = new System.Windows.Forms.Panel(); + this.button11 = new System.Windows.Forms.Button(); + this.button12 = new System.Windows.Forms.Button(); + this.button13 = new System.Windows.Forms.Button(); + this.button10 = new System.Windows.Forms.Button(); + this.button9 = new System.Windows.Forms.Button(); + this.btPLCemg = new System.Windows.Forms.Button(); + this.button7 = new System.Windows.Forms.Button(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.button6 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.rtAGVPro = new arCtl.LogTextBox(); + this.panel12 = new System.Windows.Forms.Panel(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel8 = new System.Windows.Forms.ToolStripStatusLabel(); + this.sbAGV = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel6 = new System.Windows.Forms.ToolStripStatusLabel(); + this.sbPLC = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel(); + this.sbBMS = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); + this.sbCAL = new System.Windows.Forms.ToolStripStatusLabel(); + this.btc1 = new System.Windows.Forms.Label(); + this.btc5 = new System.Windows.Forms.Label(); + this.btc6 = new System.Windows.Forms.Label(); + this.btc2 = new System.Windows.Forms.Label(); + this.btc7 = new System.Windows.Forms.Label(); + this.btc3 = new System.Windows.Forms.Label(); + this.btc8 = new System.Windows.Forms.Label(); + this.btc4 = new System.Windows.Forms.Label(); + this.agvViewer1 = new AGVEmulator.UC.AgvViewer(); + this.serAGV = new AGVEmulator.SerialConn(); + this.serPLC = new AGVEmulator.SerialConn(); + this.serBMS = new AGVEmulator.SerialConn(); + this.serCAL = new AGVEmulator.SerialConn(); + this.groupBox1.SuspendLayout(); + this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit(); + this.panel4.SuspendLayout(); + this.groupBox9.SuspendLayout(); + this.groupBox10.SuspendLayout(); + this.groupBox11.SuspendLayout(); + this.groupBox7.SuspendLayout(); + this.groupBox6.SuspendLayout(); + this.panel11.SuspendLayout(); + this.groupBox8.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.panel13.SuspendLayout(); + this.panel10.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + this.groupBox3.SuspendLayout(); + this.panel2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudBMSKitNo)).BeginInit(); + this.panel3.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this.panel5.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); + this.panel12.SuspendLayout(); + this.tabPage3.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.statusStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.rtBMS); + this.groupBox1.Controls.Add(this.panel1); + this.groupBox1.Controls.Add(this.serBMS); + this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox1.Location = new System.Drawing.Point(3, 3); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(564, 610); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "BMS"; + // + // rtBMS + // + this.rtBMS.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24))))); + this.rtBMS.ColorList = new arCtl.sLogMessageColor[0]; + this.rtBMS.DateFormat = "ss.fff"; + this.rtBMS.DefaultColor = System.Drawing.Color.LightGray; + this.rtBMS.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtBMS.EnableDisplayTimer = false; + this.rtBMS.EnableGubunColor = true; + this.rtBMS.Font = new System.Drawing.Font("Consolas", 9F); + this.rtBMS.ListFormat = "[{0}] {1}"; + this.rtBMS.Location = new System.Drawing.Point(3, 204); + this.rtBMS.MaxListCount = ((ushort)(200)); + this.rtBMS.MaxTextLength = ((uint)(4000u)); + this.rtBMS.MessageInterval = 50; + this.rtBMS.Name = "rtBMS"; + this.rtBMS.Size = new System.Drawing.Size(558, 403); + this.rtBMS.TabIndex = 2; + this.rtBMS.Text = ""; + // + // panel1 + // + this.panel1.Controls.Add(this.btc8); + this.panel1.Controls.Add(this.btc4); + this.panel1.Controls.Add(this.btc7); + this.panel1.Controls.Add(this.btc3); + this.panel1.Controls.Add(this.btc6); + this.panel1.Controls.Add(this.btc2); + this.panel1.Controls.Add(this.btc5); + this.panel1.Controls.Add(this.btc1); + this.panel1.Controls.Add(this.checkBox1); + this.panel1.Controls.Add(this.label6); + this.panel1.Controls.Add(this.label5); + this.panel1.Controls.Add(this.label4); + this.panel1.Controls.Add(this.label3); + this.panel1.Controls.Add(this.label2); + this.panel1.Controls.Add(this.label1); + this.panel1.Controls.Add(this.trackBar1); + this.panel1.Dock = System.Windows.Forms.DockStyle.Top; + this.panel1.Location = new System.Drawing.Point(3, 101); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(558, 103); + this.panel1.TabIndex = 4; + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Checked = true; + this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBox1.Location = new System.Drawing.Point(14, 77); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(70, 16); + this.checkBox1.TabIndex = 6; + this.checkBox1.Text = "decrese"; + this.checkBox1.UseVisualStyleBackColor = true; + // + // label6 + // + this.label6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.label6.ForeColor = System.Drawing.Color.White; + this.label6.Location = new System.Drawing.Point(14, 44); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(68, 24); + this.label6.TabIndex = 5; + this.label6.Text = "Curr"; + this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label5 + // + this.label5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.label5.ForeColor = System.Drawing.Color.White; + this.label5.Location = new System.Drawing.Point(189, 6); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(75, 24); + this.label5.TabIndex = 3; + this.label5.Text = "Curr"; + this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label4 + // + this.label4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.label4.ForeColor = System.Drawing.Color.White; + this.label4.Location = new System.Drawing.Point(213, 44); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(50, 24); + this.label4.TabIndex = 2; + this.label4.Text = "80"; + this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label3 + // + this.label3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.label3.ForeColor = System.Drawing.Color.White; + this.label3.Location = new System.Drawing.Point(123, 44); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(48, 24); + this.label3.TabIndex = 2; + this.label3.Text = "Curr"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(177, 50); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(30, 12); + this.label2.TabIndex = 1; + this.label2.Text = "Max"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(88, 50); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(29, 12); + this.label1.TabIndex = 1; + this.label1.Text = "Curr"; + // + // trackBar1 + // + this.trackBar1.LargeChange = 10; + this.trackBar1.Location = new System.Drawing.Point(14, 6); + this.trackBar1.Maximum = 8000; + this.trackBar1.Name = "trackBar1"; + this.trackBar1.Size = new System.Drawing.Size(172, 45); + this.trackBar1.SmallChange = 5; + this.trackBar1.TabIndex = 0; + this.trackBar1.Value = 7000; + this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll); + // + // rtAGV + // + this.rtAGV.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24))))); + this.rtAGV.ColorList = new arCtl.sLogMessageColor[0]; + this.rtAGV.DateFormat = "ss.fff"; + this.rtAGV.DefaultColor = System.Drawing.Color.LightGray; + this.rtAGV.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtAGV.EnableDisplayTimer = false; + this.rtAGV.EnableGubunColor = true; + this.rtAGV.Font = new System.Drawing.Font("Consolas", 8F); + this.rtAGV.ListFormat = "[{0}] {1}"; + this.rtAGV.Location = new System.Drawing.Point(3, 3); + this.rtAGV.MaxListCount = ((ushort)(200)); + this.rtAGV.MaxTextLength = ((uint)(4000u)); + this.rtAGV.MessageInterval = 50; + this.rtAGV.Name = "rtAGV"; + this.rtAGV.Size = new System.Drawing.Size(795, 210); + this.rtAGV.TabIndex = 2; + this.rtAGV.Text = ""; + // + // panel4 + // + this.panel4.Controls.Add(this.groupBox9); + this.panel4.Controls.Add(this.panel10); + this.panel4.Dock = System.Windows.Forms.DockStyle.Top; + this.panel4.Location = new System.Drawing.Point(3, 123); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(1140, 280); + this.panel4.TabIndex = 3; + this.panel4.Paint += new System.Windows.Forms.PaintEventHandler(this.panel4_Paint); + // + // groupBox9 + // + this.groupBox9.Controls.Add(this.groupBox10); + this.groupBox9.Controls.Add(this.groupBox11); + this.groupBox9.Controls.Add(this.groupBox7); + this.groupBox9.Controls.Add(this.groupBox6); + this.groupBox9.Controls.Add(this.panel11); + this.groupBox9.Controls.Add(this.panel13); + this.groupBox9.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox9.Location = new System.Drawing.Point(0, 0); + this.groupBox9.Name = "groupBox9"; + this.groupBox9.Size = new System.Drawing.Size(982, 280); + this.groupBox9.TabIndex = 13; + this.groupBox9.TabStop = false; + this.groupBox9.Text = "Status"; + this.groupBox9.Enter += new System.EventHandler(this.groupBox9_Enter); + // + // groupBox10 + // + this.groupBox10.Controls.Add(this.panel8); + this.groupBox10.Dock = System.Windows.Forms.DockStyle.Left; + this.groupBox10.Location = new System.Drawing.Point(652, 44); + this.groupBox10.Name = "groupBox10"; + this.groupBox10.Size = new System.Drawing.Size(189, 233); + this.groupBox10.TabIndex = 12; + this.groupBox10.TabStop = false; + this.groupBox10.Text = "signal"; + // + // panel8 + // + this.panel8.AutoScroll = true; + this.panel8.AutoSize = true; + this.panel8.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel8.Location = new System.Drawing.Point(3, 17); + this.panel8.Name = "panel8"; + this.panel8.Size = new System.Drawing.Size(183, 213); + this.panel8.TabIndex = 1; + this.panel8.Tag = "sg"; + // + // groupBox11 + // + this.groupBox11.Controls.Add(this.panel9); + this.groupBox11.Dock = System.Windows.Forms.DockStyle.Left; + this.groupBox11.Location = new System.Drawing.Point(430, 44); + this.groupBox11.Name = "groupBox11"; + this.groupBox11.Size = new System.Drawing.Size(222, 233); + this.groupBox11.TabIndex = 12; + this.groupBox11.TabStop = false; + this.groupBox11.Text = "error"; + // + // panel9 + // + this.panel9.AutoScroll = true; + this.panel9.AutoSize = true; + this.panel9.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel9.Location = new System.Drawing.Point(3, 17); + this.panel9.Name = "panel9"; + this.panel9.Size = new System.Drawing.Size(216, 213); + this.panel9.TabIndex = 0; + this.panel9.Tag = "er"; + // + // groupBox7 + // + this.groupBox7.Controls.Add(this.panel7); + this.groupBox7.Dock = System.Windows.Forms.DockStyle.Left; + this.groupBox7.Location = new System.Drawing.Point(241, 44); + this.groupBox7.Name = "groupBox7"; + this.groupBox7.Size = new System.Drawing.Size(189, 233); + this.groupBox7.TabIndex = 12; + this.groupBox7.TabStop = false; + this.groupBox7.Text = "System 1"; + // + // panel7 + // + this.panel7.AutoScroll = true; + this.panel7.AutoSize = true; + this.panel7.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel7.Location = new System.Drawing.Point(3, 17); + this.panel7.Name = "panel7"; + this.panel7.Size = new System.Drawing.Size(183, 213); + this.panel7.TabIndex = 1; + this.panel7.Tag = "s1"; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.panel6); + this.groupBox6.Dock = System.Windows.Forms.DockStyle.Left; + this.groupBox6.Location = new System.Drawing.Point(3, 44); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(238, 233); + this.groupBox6.TabIndex = 12; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "System 0"; + // + // panel6 + // + this.panel6.AutoScroll = true; + this.panel6.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel6.Location = new System.Drawing.Point(3, 17); + this.panel6.Name = "panel6"; + this.panel6.Size = new System.Drawing.Size(232, 213); + this.panel6.TabIndex = 0; + this.panel6.Tag = "s0"; + // + // panel11 + // + this.panel11.Controls.Add(this.groupBox8); + this.panel11.Controls.Add(this.groupBox4); + this.panel11.Controls.Add(this.groupBox2); + this.panel11.Controls.Add(this.groupBox5); + this.panel11.Dock = System.Windows.Forms.DockStyle.Right; + this.panel11.Location = new System.Drawing.Point(846, 44); + this.panel11.Name = "panel11"; + this.panel11.Padding = new System.Windows.Forms.Padding(5); + this.panel11.Size = new System.Drawing.Size(133, 233); + this.panel11.TabIndex = 13; + // + // groupBox8 + // + this.groupBox8.Controls.Add(this.radioButton17); + this.groupBox8.Controls.Add(this.radioButton13); + this.groupBox8.Controls.Add(this.radioButton16); + this.groupBox8.Dock = System.Windows.Forms.DockStyle.Top; + this.groupBox8.Location = new System.Drawing.Point(5, 149); + this.groupBox8.Name = "groupBox8"; + this.groupBox8.Size = new System.Drawing.Size(123, 48); + this.groupBox8.TabIndex = 12; + this.groupBox8.TabStop = false; + this.groupBox8.Text = "PBS"; + // + // radioButton17 + // + this.radioButton17.AutoSize = true; + this.radioButton17.Checked = true; + this.radioButton17.Location = new System.Drawing.Point(6, 20); + this.radioButton17.Name = "radioButton17"; + this.radioButton17.Size = new System.Drawing.Size(29, 16); + this.radioButton17.TabIndex = 10; + this.radioButton17.TabStop = true; + this.radioButton17.Text = "0"; + this.radioButton17.UseVisualStyleBackColor = true; + // + // radioButton13 + // + this.radioButton13.AutoSize = true; + this.radioButton13.Location = new System.Drawing.Point(76, 20); + this.radioButton13.Name = "radioButton13"; + this.radioButton13.Size = new System.Drawing.Size(29, 16); + this.radioButton13.TabIndex = 9; + this.radioButton13.Text = "2"; + this.radioButton13.UseVisualStyleBackColor = true; + // + // radioButton16 + // + this.radioButton16.AutoSize = true; + this.radioButton16.Location = new System.Drawing.Point(41, 20); + this.radioButton16.Name = "radioButton16"; + this.radioButton16.Size = new System.Drawing.Size(29, 16); + this.radioButton16.TabIndex = 9; + this.radioButton16.Text = "1"; + this.radioButton16.UseVisualStyleBackColor = true; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.radioButton12); + this.groupBox4.Controls.Add(this.radioButton10); + this.groupBox4.Controls.Add(this.radioButton11); + this.groupBox4.Dock = System.Windows.Forms.DockStyle.Top; + this.groupBox4.Location = new System.Drawing.Point(5, 101); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(123, 48); + this.groupBox4.TabIndex = 11; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "속도"; + // + // radioButton12 + // + this.radioButton12.AutoSize = true; + this.radioButton12.Checked = true; + this.radioButton12.Location = new System.Drawing.Point(7, 20); + this.radioButton12.Name = "radioButton12"; + this.radioButton12.Size = new System.Drawing.Size(30, 16); + this.radioButton12.TabIndex = 10; + this.radioButton12.TabStop = true; + this.radioButton12.Text = "L"; + this.radioButton12.UseVisualStyleBackColor = true; + // + // radioButton10 + // + this.radioButton10.AutoSize = true; + this.radioButton10.Location = new System.Drawing.Point(83, 20); + this.radioButton10.Name = "radioButton10"; + this.radioButton10.Size = new System.Drawing.Size(31, 16); + this.radioButton10.TabIndex = 9; + this.radioButton10.Text = "H"; + this.radioButton10.UseVisualStyleBackColor = true; + // + // radioButton11 + // + this.radioButton11.AutoSize = true; + this.radioButton11.Location = new System.Drawing.Point(44, 20); + this.radioButton11.Name = "radioButton11"; + this.radioButton11.Size = new System.Drawing.Size(34, 16); + this.radioButton11.TabIndex = 9; + this.radioButton11.Text = "M"; + this.radioButton11.UseVisualStyleBackColor = true; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.radioButton9); + this.groupBox2.Controls.Add(this.radioButton8); + this.groupBox2.Controls.Add(this.radioButton7); + this.groupBox2.Dock = System.Windows.Forms.DockStyle.Top; + this.groupBox2.Location = new System.Drawing.Point(5, 53); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(123, 48); + this.groupBox2.TabIndex = 10; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "분기"; + // + // radioButton9 + // + this.radioButton9.AutoSize = true; + this.radioButton9.Location = new System.Drawing.Point(80, 20); + this.radioButton9.Name = "radioButton9"; + this.radioButton9.Size = new System.Drawing.Size(31, 16); + this.radioButton9.TabIndex = 9; + this.radioButton9.Text = "R"; + this.radioButton9.UseVisualStyleBackColor = true; + // + // radioButton8 + // + this.radioButton8.AutoSize = true; + this.radioButton8.Checked = true; + this.radioButton8.Location = new System.Drawing.Point(43, 20); + this.radioButton8.Name = "radioButton8"; + this.radioButton8.Size = new System.Drawing.Size(31, 16); + this.radioButton8.TabIndex = 9; + this.radioButton8.TabStop = true; + this.radioButton8.Text = "S"; + this.radioButton8.UseVisualStyleBackColor = true; + // + // radioButton7 + // + this.radioButton7.AutoSize = true; + this.radioButton7.Location = new System.Drawing.Point(7, 20); + this.radioButton7.Name = "radioButton7"; + this.radioButton7.Size = new System.Drawing.Size(30, 16); + this.radioButton7.TabIndex = 9; + this.radioButton7.Text = "L"; + this.radioButton7.UseVisualStyleBackColor = true; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.radioButton14); + this.groupBox5.Controls.Add(this.radioButton15); + this.groupBox5.Dock = System.Windows.Forms.DockStyle.Top; + this.groupBox5.Location = new System.Drawing.Point(5, 5); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(123, 48); + this.groupBox5.TabIndex = 11; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "방향"; + // + // radioButton14 + // + this.radioButton14.AutoSize = true; + this.radioButton14.Location = new System.Drawing.Point(43, 20); + this.radioButton14.Name = "radioButton14"; + this.radioButton14.Size = new System.Drawing.Size(31, 16); + this.radioButton14.TabIndex = 9; + this.radioButton14.Text = "B"; + this.radioButton14.UseVisualStyleBackColor = true; + // + // radioButton15 + // + this.radioButton15.AutoSize = true; + this.radioButton15.Checked = true; + this.radioButton15.Location = new System.Drawing.Point(7, 20); + this.radioButton15.Name = "radioButton15"; + this.radioButton15.Size = new System.Drawing.Size(30, 16); + this.radioButton15.TabIndex = 9; + this.radioButton15.TabStop = true; + this.radioButton15.Text = "F"; + this.radioButton15.UseVisualStyleBackColor = true; + // + // panel13 + // + this.panel13.Controls.Add(this.chkSimulation); + this.panel13.Controls.Add(this.checkBox3); + this.panel13.Dock = System.Windows.Forms.DockStyle.Top; + this.panel13.Location = new System.Drawing.Point(3, 17); + this.panel13.Name = "panel13"; + this.panel13.Size = new System.Drawing.Size(976, 27); + this.panel13.TabIndex = 14; + // + // chkSimulation + // + this.chkSimulation.Checked = true; + this.chkSimulation.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkSimulation.Dock = System.Windows.Forms.DockStyle.Left; + this.chkSimulation.Location = new System.Drawing.Point(122, 0); + this.chkSimulation.Name = "chkSimulation"; + this.chkSimulation.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0); + this.chkSimulation.Size = new System.Drawing.Size(122, 27); + this.chkSimulation.TabIndex = 9; + this.chkSimulation.Text = "Animation"; + this.chkSimulation.UseVisualStyleBackColor = true; + // + // checkBox3 + // + this.checkBox3.Checked = true; + this.checkBox3.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBox3.Dock = System.Windows.Forms.DockStyle.Left; + this.checkBox3.Location = new System.Drawing.Point(0, 0); + this.checkBox3.Name = "checkBox3"; + this.checkBox3.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0); + this.checkBox3.Size = new System.Drawing.Size(122, 27); + this.checkBox3.TabIndex = 8; + this.checkBox3.Text = "Send Status"; + this.checkBox3.UseVisualStyleBackColor = true; + // + // panel10 + // + this.panel10.Controls.Add(this.numericUpDown1); + this.panel10.Controls.Add(this.button18); + this.panel10.Controls.Add(this.button17); + this.panel10.Controls.Add(this.button15); + this.panel10.Controls.Add(this.button16); + this.panel10.Controls.Add(this.button14); + this.panel10.Controls.Add(this.button5); + this.panel10.Controls.Add(this.button4); + this.panel10.Dock = System.Windows.Forms.DockStyle.Right; + this.panel10.Location = new System.Drawing.Point(982, 0); + this.panel10.Name = "panel10"; + this.panel10.Size = new System.Drawing.Size(158, 280); + this.panel10.TabIndex = 14; + // + // numericUpDown1 + // + this.numericUpDown1.Font = new System.Drawing.Font("굴림", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.numericUpDown1.Location = new System.Drawing.Point(19, 220); + this.numericUpDown1.Maximum = new decimal(new int[] { + 9999999, + 0, + 0, + 0}); + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.Size = new System.Drawing.Size(130, 38); + this.numericUpDown1.TabIndex = 9; + this.numericUpDown1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDown1.Value = new decimal(new int[] { + 9900, + 0, + 0, + 0}); + // + // button18 + // + this.button18.Location = new System.Drawing.Point(19, 187); + this.button18.Name = "button18"; + this.button18.Size = new System.Drawing.Size(130, 28); + this.button18.TabIndex = 8; + this.button18.Tag = "--"; + this.button18.Text = "TAG"; + this.button18.UseVisualStyleBackColor = true; + this.button18.Click += new System.EventHandler(this.button18_Click); + // + // button17 + // + this.button17.Location = new System.Drawing.Point(87, 68); + this.button17.Name = "button17"; + this.button17.Size = new System.Drawing.Size(62, 54); + this.button17.TabIndex = 7; + this.button17.Text = "reset"; + this.button17.UseVisualStyleBackColor = true; + this.button17.Click += new System.EventHandler(this.button17_Click); + // + // button15 + // + this.button15.Location = new System.Drawing.Point(87, 128); + this.button15.Name = "button15"; + this.button15.Size = new System.Drawing.Size(62, 54); + this.button15.TabIndex = 6; + this.button15.Tag = "--"; + this.button15.Text = "PBS Of"; + this.button15.UseVisualStyleBackColor = true; + this.button15.Click += new System.EventHandler(this.button15_Click); + // + // button16 + // + this.button16.Location = new System.Drawing.Point(19, 126); + this.button16.Name = "button16"; + this.button16.Size = new System.Drawing.Size(62, 54); + this.button16.TabIndex = 5; + this.button16.Tag = "--"; + this.button16.Text = "PBS On"; + this.button16.UseVisualStyleBackColor = true; + this.button16.Click += new System.EventHandler(this.button16_Click); + // + // button14 + // + this.button14.Location = new System.Drawing.Point(19, 66); + this.button14.Name = "button14"; + this.button14.Size = new System.Drawing.Size(62, 54); + this.button14.TabIndex = 3; + this.button14.Text = "emg"; + this.button14.UseVisualStyleBackColor = true; + this.button14.Click += new System.EventHandler(this.button14_Click); + // + // button5 + // + this.button5.Location = new System.Drawing.Point(19, 6); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(62, 54); + this.button5.TabIndex = 2; + this.button5.Text = "ACK"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // button4 + // + this.button4.Location = new System.Drawing.Point(87, 6); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(62, 54); + this.button4.TabIndex = 1; + this.button4.Text = "NAK"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.rtCAL); + this.groupBox3.Controls.Add(this.panel2); + this.groupBox3.Controls.Add(this.serCAL); + this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox3.Location = new System.Drawing.Point(573, 3); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(564, 610); + this.groupBox3.TabIndex = 0; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Call button ( custom button)"; + // + // rtCAL + // + this.rtCAL.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24))))); + this.rtCAL.ColorList = new arCtl.sLogMessageColor[0]; + this.rtCAL.DateFormat = "ss.fff"; + this.rtCAL.DefaultColor = System.Drawing.Color.LightGray; + this.rtCAL.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtCAL.EnableDisplayTimer = false; + this.rtCAL.EnableGubunColor = true; + this.rtCAL.Font = new System.Drawing.Font("Consolas", 9F); + this.rtCAL.ListFormat = "[{0}] {1}"; + this.rtCAL.Location = new System.Drawing.Point(3, 204); + this.rtCAL.MaxListCount = ((ushort)(200)); + this.rtCAL.MaxTextLength = ((uint)(4000u)); + this.rtCAL.MessageInterval = 50; + this.rtCAL.Name = "rtCAL"; + this.rtCAL.Size = new System.Drawing.Size(558, 403); + this.rtCAL.TabIndex = 2; + this.rtCAL.Text = ""; + // + // panel2 + // + this.panel2.Controls.Add(this.radioButton20); + this.panel2.Controls.Add(this.radioButton21); + this.panel2.Controls.Add(this.radioButton18); + this.panel2.Controls.Add(this.radioButton19); + this.panel2.Controls.Add(this.nudBMSKitNo); + this.panel2.Controls.Add(this.label9); + this.panel2.Controls.Add(this.radioButton6); + this.panel2.Controls.Add(this.radioButton5); + this.panel2.Controls.Add(this.radioButton4); + this.panel2.Controls.Add(this.radioButton3); + this.panel2.Controls.Add(this.radioButton2); + this.panel2.Controls.Add(this.radioButton1); + this.panel2.Controls.Add(this.button3); + this.panel2.Controls.Add(this.button2); + this.panel2.Controls.Add(this.button1); + this.panel2.Dock = System.Windows.Forms.DockStyle.Top; + this.panel2.Location = new System.Drawing.Point(3, 101); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(558, 103); + this.panel2.TabIndex = 3; + // + // radioButton20 + // + this.radioButton20.AutoSize = true; + this.radioButton20.Location = new System.Drawing.Point(331, 11); + this.radioButton20.Name = "radioButton20"; + this.radioButton20.Size = new System.Drawing.Size(29, 16); + this.radioButton20.TabIndex = 12; + this.radioButton20.Text = "9"; + this.radioButton20.UseVisualStyleBackColor = true; + this.radioButton20.Click += new System.EventHandler(this.radioButton20_Click); + // + // radioButton21 + // + this.radioButton21.AutoSize = true; + this.radioButton21.Checked = true; + this.radioButton21.Location = new System.Drawing.Point(296, 11); + this.radioButton21.Name = "radioButton21"; + this.radioButton21.Size = new System.Drawing.Size(29, 16); + this.radioButton21.TabIndex = 11; + this.radioButton21.TabStop = true; + this.radioButton21.Text = "8"; + this.radioButton21.UseVisualStyleBackColor = true; + this.radioButton21.Click += new System.EventHandler(this.radioButton20_Click); + // + // radioButton18 + // + this.radioButton18.AutoSize = true; + this.radioButton18.Location = new System.Drawing.Point(261, 11); + this.radioButton18.Name = "radioButton18"; + this.radioButton18.Size = new System.Drawing.Size(29, 16); + this.radioButton18.TabIndex = 10; + this.radioButton18.Text = "7"; + this.radioButton18.UseVisualStyleBackColor = true; + this.radioButton18.Click += new System.EventHandler(this.radioButton20_Click); + // + // radioButton19 + // + this.radioButton19.AutoSize = true; + this.radioButton19.Location = new System.Drawing.Point(226, 11); + this.radioButton19.Name = "radioButton19"; + this.radioButton19.Size = new System.Drawing.Size(29, 16); + this.radioButton19.TabIndex = 9; + this.radioButton19.Text = "6"; + this.radioButton19.UseVisualStyleBackColor = true; + this.radioButton19.Click += new System.EventHandler(this.radioButton20_Click); + // + // nudBMSKitNo + // + this.nudBMSKitNo.Font = new System.Drawing.Font("Microsoft Sans Serif", 50F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.nudBMSKitNo.Location = new System.Drawing.Point(435, 7); + this.nudBMSKitNo.Name = "nudBMSKitNo"; + this.nudBMSKitNo.Size = new System.Drawing.Size(120, 83); + this.nudBMSKitNo.TabIndex = 8; + this.nudBMSKitNo.Tag = "1"; + this.nudBMSKitNo.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.nudBMSKitNo.Value = new decimal(new int[] { + 8, + 0, + 0, + 0}); + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(390, 16); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(39, 12); + this.label9.TabIndex = 7; + this.label9.Text = "Kit No"; + // + // radioButton6 + // + this.radioButton6.AutoSize = true; + this.radioButton6.Location = new System.Drawing.Point(191, 11); + this.radioButton6.Name = "radioButton6"; + this.radioButton6.Size = new System.Drawing.Size(29, 16); + this.radioButton6.TabIndex = 6; + this.radioButton6.Text = "5"; + this.radioButton6.UseVisualStyleBackColor = true; + this.radioButton6.Click += new System.EventHandler(this.radioButton20_Click); + // + // radioButton5 + // + this.radioButton5.AutoSize = true; + this.radioButton5.Location = new System.Drawing.Point(156, 11); + this.radioButton5.Name = "radioButton5"; + this.radioButton5.Size = new System.Drawing.Size(29, 16); + this.radioButton5.TabIndex = 5; + this.radioButton5.Text = "4"; + this.radioButton5.UseVisualStyleBackColor = true; + this.radioButton5.Click += new System.EventHandler(this.radioButton20_Click); + // + // radioButton4 + // + this.radioButton4.AutoSize = true; + this.radioButton4.Location = new System.Drawing.Point(121, 11); + this.radioButton4.Name = "radioButton4"; + this.radioButton4.Size = new System.Drawing.Size(29, 16); + this.radioButton4.TabIndex = 4; + this.radioButton4.Text = "3"; + this.radioButton4.UseVisualStyleBackColor = true; + this.radioButton4.Click += new System.EventHandler(this.radioButton20_Click); + // + // radioButton3 + // + this.radioButton3.AutoSize = true; + this.radioButton3.Location = new System.Drawing.Point(86, 11); + this.radioButton3.Name = "radioButton3"; + this.radioButton3.Size = new System.Drawing.Size(29, 16); + this.radioButton3.TabIndex = 3; + this.radioButton3.Text = "2"; + this.radioButton3.UseVisualStyleBackColor = true; + this.radioButton3.Click += new System.EventHandler(this.radioButton20_Click); + // + // radioButton2 + // + this.radioButton2.AutoSize = true; + this.radioButton2.Location = new System.Drawing.Point(51, 11); + this.radioButton2.Name = "radioButton2"; + this.radioButton2.Size = new System.Drawing.Size(29, 16); + this.radioButton2.TabIndex = 2; + this.radioButton2.Text = "1"; + this.radioButton2.UseVisualStyleBackColor = true; + this.radioButton2.Click += new System.EventHandler(this.radioButton20_Click); + // + // radioButton1 + // + this.radioButton1.AutoSize = true; + this.radioButton1.Location = new System.Drawing.Point(16, 11); + this.radioButton1.Name = "radioButton1"; + this.radioButton1.Size = new System.Drawing.Size(29, 16); + this.radioButton1.TabIndex = 1; + this.radioButton1.Text = "0"; + this.radioButton1.UseVisualStyleBackColor = true; + this.radioButton1.Click += new System.EventHandler(this.radioButton20_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(246, 34); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(96, 59); + this.button3.TabIndex = 0; + this.button3.Tag = "0"; + this.button3.Text = "Blue\r\n(Cancel)"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(131, 34); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(96, 59); + this.button2.TabIndex = 0; + this.button2.Tag = "2"; + this.button2.Text = "White\r\n(Spare)"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button1_Click); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(16, 34); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(96, 59); + this.button1.TabIndex = 0; + this.button1.Tag = "1"; + this.button1.Text = "Green\r\n(Call)"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // rtPLC + // + this.rtPLC.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24))))); + this.rtPLC.ColorList = new arCtl.sLogMessageColor[0]; + this.rtPLC.DateFormat = "ss.fff"; + this.rtPLC.DefaultColor = System.Drawing.Color.LightGray; + this.rtPLC.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtPLC.EnableDisplayTimer = false; + this.rtPLC.EnableGubunColor = true; + this.rtPLC.Font = new System.Drawing.Font("Consolas", 9F); + this.rtPLC.ListFormat = "[{0}] {1}"; + this.rtPLC.Location = new System.Drawing.Point(0, 302); + this.rtPLC.MaxListCount = ((ushort)(200)); + this.rtPLC.MaxTextLength = ((uint)(4000u)); + this.rtPLC.MessageInterval = 50; + this.rtPLC.Name = "rtPLC"; + this.rtPLC.Size = new System.Drawing.Size(1146, 320); + this.rtPLC.TabIndex = 2; + this.rtPLC.Text = ""; + // + // panel3 + // + this.panel3.Controls.Add(this.tableLayoutPanel2); + this.panel3.Controls.Add(this.panel5); + this.panel3.Dock = System.Windows.Forms.DockStyle.Top; + this.panel3.Location = new System.Drawing.Point(0, 84); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(1146, 218); + this.panel3.TabIndex = 3; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 77.68595F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 22.31405F)); + this.tableLayoutPanel2.Controls.Add(this.gvdPLCInOut, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.gvdPLCFlag, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.label7, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.label8, 1, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 2; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(818, 218); + this.tableLayoutPanel2.TabIndex = 9; + // + // gvdPLCInOut + // + this.gvdPLCInOut.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100))))); + this.gvdPLCInOut.BorderSize = 1; + colorListItem1.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); + colorListItem1.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); + colorListItem1.Remark = ""; + colorListItem2.BackColor1 = System.Drawing.Color.Orange; + colorListItem2.BackColor2 = System.Drawing.Color.DarkOrange; + colorListItem2.Remark = ""; + this.gvdPLCInOut.ColorList = new arFrame.Control.ColorListItem[] { + colorListItem1, + colorListItem2}; + this.gvdPLCInOut.Cursor = System.Windows.Forms.Cursors.Arrow; + this.gvdPLCInOut.Dock = System.Windows.Forms.DockStyle.Fill; + this.gvdPLCInOut.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.gvdPLCInOut.FontPin = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold); + this.gvdPLCInOut.ForeColor = System.Drawing.Color.White; + this.gvdPLCInOut.ForeColorPin = System.Drawing.Color.WhiteSmoke; + this.gvdPLCInOut.Location = new System.Drawing.Point(3, 23); + this.gvdPLCInOut.MatrixSize = new System.Drawing.Point(8, 3); + this.gvdPLCInOut.MenuBorderSize = 1; + this.gvdPLCInOut.MenuGap = 5; + this.gvdPLCInOut.MinimumSize = new System.Drawing.Size(100, 50); + this.gvdPLCInOut.Name = "gvdPLCInOut"; + this.gvdPLCInOut.Names = null; + this.gvdPLCInOut.ShadowColor = System.Drawing.Color.Black; + this.gvdPLCInOut.showDebugInfo = false; + this.gvdPLCInOut.ShowIndexString = true; + this.gvdPLCInOut.Size = new System.Drawing.Size(629, 192); + this.gvdPLCInOut.TabIndex = 12; + this.gvdPLCInOut.Tags = null; + this.gvdPLCInOut.Text = "gridView1"; + this.gvdPLCInOut.TextAttachToImage = true; + this.gvdPLCInOut.Titles = null; + this.gvdPLCInOut.Values = null; + // + // gvdPLCFlag + // + this.gvdPLCFlag.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100))))); + this.gvdPLCFlag.BorderSize = 1; + colorListItem3.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); + colorListItem3.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); + colorListItem3.Remark = ""; + colorListItem4.BackColor1 = System.Drawing.Color.Orange; + colorListItem4.BackColor2 = System.Drawing.Color.DarkOrange; + colorListItem4.Remark = ""; + this.gvdPLCFlag.ColorList = new arFrame.Control.ColorListItem[] { + colorListItem3, + colorListItem4}; + this.gvdPLCFlag.Cursor = System.Windows.Forms.Cursors.Arrow; + this.gvdPLCFlag.Dock = System.Windows.Forms.DockStyle.Fill; + this.gvdPLCFlag.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.gvdPLCFlag.FontPin = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold); + this.gvdPLCFlag.ForeColor = System.Drawing.Color.White; + this.gvdPLCFlag.ForeColorPin = System.Drawing.Color.WhiteSmoke; + this.gvdPLCFlag.Location = new System.Drawing.Point(638, 23); + this.gvdPLCFlag.MatrixSize = new System.Drawing.Point(8, 4); + this.gvdPLCFlag.MenuBorderSize = 1; + this.gvdPLCFlag.MenuGap = 5; + this.gvdPLCFlag.MinimumSize = new System.Drawing.Size(100, 50); + this.gvdPLCFlag.Name = "gvdPLCFlag"; + this.gvdPLCFlag.Names = null; + this.gvdPLCFlag.ShadowColor = System.Drawing.Color.Black; + this.gvdPLCFlag.showDebugInfo = false; + this.gvdPLCFlag.ShowIndexString = true; + this.gvdPLCFlag.Size = new System.Drawing.Size(177, 192); + this.gvdPLCFlag.TabIndex = 11; + this.gvdPLCFlag.Tags = null; + this.gvdPLCFlag.Text = "gridView1"; + this.gvdPLCFlag.TextAttachToImage = true; + this.gvdPLCFlag.Titles = null; + this.gvdPLCFlag.Values = null; + // + // label7 + // + this.label7.Dock = System.Windows.Forms.DockStyle.Fill; + this.label7.Location = new System.Drawing.Point(3, 0); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(629, 20); + this.label7.TabIndex = 13; + this.label7.Text = "I/O"; + this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label8 + // + this.label8.Dock = System.Windows.Forms.DockStyle.Fill; + this.label8.Location = new System.Drawing.Point(638, 0); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(177, 20); + this.label8.TabIndex = 13; + this.label8.Text = "FLAG"; + this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // panel5 + // + this.panel5.Controls.Add(this.button11); + this.panel5.Controls.Add(this.button12); + this.panel5.Controls.Add(this.button13); + this.panel5.Controls.Add(this.button10); + this.panel5.Controls.Add(this.button9); + this.panel5.Controls.Add(this.btPLCemg); + this.panel5.Controls.Add(this.button7); + this.panel5.Controls.Add(this.checkBox2); + this.panel5.Controls.Add(this.button6); + this.panel5.Controls.Add(this.button8); + this.panel5.Dock = System.Windows.Forms.DockStyle.Right; + this.panel5.Location = new System.Drawing.Point(818, 0); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(328, 218); + this.panel5.TabIndex = 8; + // + // button11 + // + this.button11.Location = new System.Drawing.Point(178, 156); + this.button11.Name = "button11"; + this.button11.Size = new System.Drawing.Size(76, 54); + this.button11.TabIndex = 13; + this.button11.Text = "But #3"; + this.button11.UseVisualStyleBackColor = true; + this.button11.Click += new System.EventHandler(this.button11_Click); + // + // button12 + // + this.button12.Location = new System.Drawing.Point(178, 96); + this.button12.Name = "button12"; + this.button12.Size = new System.Drawing.Size(76, 54); + this.button12.TabIndex = 12; + this.button12.Text = "But #2"; + this.button12.UseVisualStyleBackColor = true; + this.button12.Click += new System.EventHandler(this.button12_Click); + // + // button13 + // + this.button13.Location = new System.Drawing.Point(178, 35); + this.button13.Name = "button13"; + this.button13.Size = new System.Drawing.Size(76, 54); + this.button13.TabIndex = 11; + this.button13.Text = "But #1"; + this.button13.UseVisualStyleBackColor = true; + this.button13.Click += new System.EventHandler(this.button13_Click); + // + // button10 + // + this.button10.Location = new System.Drawing.Point(96, 156); + this.button10.Name = "button10"; + this.button10.Size = new System.Drawing.Size(76, 54); + this.button10.TabIndex = 10; + this.button10.Text = "Limit - R"; + this.button10.UseVisualStyleBackColor = true; + this.button10.Click += new System.EventHandler(this.button10_Click); + // + // button9 + // + this.button9.Location = new System.Drawing.Point(96, 96); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(76, 54); + this.button9.TabIndex = 9; + this.button9.Text = "Limit - L"; + this.button9.UseVisualStyleBackColor = true; + this.button9.Click += new System.EventHandler(this.button9_Click); + // + // btPLCemg + // + this.btPLCemg.Location = new System.Drawing.Point(96, 35); + this.btPLCemg.Name = "btPLCemg"; + this.btPLCemg.Size = new System.Drawing.Size(76, 54); + this.btPLCemg.TabIndex = 8; + this.btPLCemg.Text = "Emg"; + this.btPLCemg.UseVisualStyleBackColor = true; + this.btPLCemg.Click += new System.EventHandler(this.btPLCemg_Click); + // + // button7 + // + this.button7.Location = new System.Drawing.Point(14, 36); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(76, 54); + this.button7.TabIndex = 4; + this.button7.Text = "UP"; + this.button7.UseVisualStyleBackColor = true; + this.button7.Click += new System.EventHandler(this.button7_Click); + // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.Checked = true; + this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBox2.Location = new System.Drawing.Point(15, 13); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(81, 16); + this.checkBox2.TabIndex = 7; + this.checkBox2.Text = "I/O Status"; + this.checkBox2.UseVisualStyleBackColor = true; + // + // button6 + // + this.button6.Location = new System.Drawing.Point(14, 96); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(76, 54); + this.button6.TabIndex = 3; + this.button6.Text = "STOP"; + this.button6.UseVisualStyleBackColor = true; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // button8 + // + this.button8.Location = new System.Drawing.Point(14, 156); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(76, 54); + this.button8.TabIndex = 5; + this.button8.Text = "DOWN"; + this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.groupBox3, 1, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1140, 616); + this.tableLayoutPanel1.TabIndex = 2; + // + // timer1 + // + this.timer1.Interval = 200; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl1.Location = new System.Drawing.Point(0, 25); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(1154, 648); + this.tabControl1.TabIndex = 3; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.tableLayoutPanel3); + this.tabPage1.Controls.Add(this.panel4); + this.tabPage1.Controls.Add(this.panel12); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(1146, 622); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "AGV"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tableLayoutPanel3 + // + this.tableLayoutPanel3.ColumnCount = 2; + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 339F)); + this.tableLayoutPanel3.Controls.Add(this.rtAGVPro, 1, 0); + this.tableLayoutPanel3.Controls.Add(this.rtAGV, 0, 0); + this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 403); + this.tableLayoutPanel3.Name = "tableLayoutPanel3"; + this.tableLayoutPanel3.RowCount = 1; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Size = new System.Drawing.Size(1140, 216); + this.tableLayoutPanel3.TabIndex = 4; + // + // rtAGVPro + // + this.rtAGVPro.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(24)))), ((int)(((byte)(24))))); + this.rtAGVPro.ColorList = new arCtl.sLogMessageColor[0]; + this.rtAGVPro.DateFormat = "ss.fff"; + this.rtAGVPro.DefaultColor = System.Drawing.Color.LightGray; + this.rtAGVPro.Dock = System.Windows.Forms.DockStyle.Fill; + this.rtAGVPro.EnableDisplayTimer = false; + this.rtAGVPro.EnableGubunColor = true; + this.rtAGVPro.Font = new System.Drawing.Font("Consolas", 9F); + this.rtAGVPro.ListFormat = "[{0}] {1}"; + this.rtAGVPro.Location = new System.Drawing.Point(804, 3); + this.rtAGVPro.MaxListCount = ((ushort)(200)); + this.rtAGVPro.MaxTextLength = ((uint)(4000u)); + this.rtAGVPro.MessageInterval = 50; + this.rtAGVPro.Name = "rtAGVPro"; + this.rtAGVPro.Size = new System.Drawing.Size(333, 210); + this.rtAGVPro.TabIndex = 5; + this.rtAGVPro.Text = ""; + // + // panel12 + // + this.panel12.Controls.Add(this.agvViewer1); + this.panel12.Controls.Add(this.serAGV); + this.panel12.Dock = System.Windows.Forms.DockStyle.Top; + this.panel12.Location = new System.Drawing.Point(3, 3); + this.panel12.Name = "panel12"; + this.panel12.Size = new System.Drawing.Size(1140, 120); + this.panel12.TabIndex = 5; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.rtPLC); + this.tabPage3.Controls.Add(this.panel3); + this.tabPage3.Controls.Add(this.serPLC); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Size = new System.Drawing.Size(1146, 622); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "PLC"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.tableLayoutPanel1); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(1146, 622); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "BMS & CALL"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButton1, + this.toolStripButton2}); + this.toolStrip1.Location = new System.Drawing.Point(0, 0); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(1154, 25); + this.toolStrip1.TabIndex = 4; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripButton1 + // + this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(74, 22); + this.toolStripButton1.Text = "All Open"; + this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click); + // + // toolStripButton2 + // + this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image"))); + this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton2.Name = "toolStripButton2"; + this.toolStripButton2.Size = new System.Drawing.Size(74, 22); + this.toolStripButton2.Text = "All Close"; + this.toolStripButton2.Click += new System.EventHandler(this.toolStripButton2_Click); + // + // statusStrip1 + // + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel8, + this.sbAGV, + this.toolStripStatusLabel6, + this.sbPLC, + this.toolStripStatusLabel4, + this.sbBMS, + this.toolStripStatusLabel2, + this.sbCAL}); + this.statusStrip1.Location = new System.Drawing.Point(0, 673); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(1154, 22); + this.statusStrip1.TabIndex = 5; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabel8 + // + this.toolStripStatusLabel8.Name = "toolStripStatusLabel8"; + this.toolStripStatusLabel8.Size = new System.Drawing.Size(31, 17); + this.toolStripStatusLabel8.Text = "AGV"; + // + // sbAGV + // + this.sbAGV.Name = "sbAGV"; + this.sbAGV.Size = new System.Drawing.Size(19, 17); + this.sbAGV.Text = "●"; + // + // toolStripStatusLabel6 + // + this.toolStripStatusLabel6.Name = "toolStripStatusLabel6"; + this.toolStripStatusLabel6.Size = new System.Drawing.Size(28, 17); + this.toolStripStatusLabel6.Text = "PLC"; + // + // sbPLC + // + this.sbPLC.Name = "sbPLC"; + this.sbPLC.Size = new System.Drawing.Size(19, 17); + this.sbPLC.Text = "●"; + // + // toolStripStatusLabel4 + // + this.toolStripStatusLabel4.Name = "toolStripStatusLabel4"; + this.toolStripStatusLabel4.Size = new System.Drawing.Size(32, 17); + this.toolStripStatusLabel4.Text = "BMS"; + // + // sbBMS + // + this.sbBMS.Name = "sbBMS"; + this.sbBMS.Size = new System.Drawing.Size(19, 17); + this.sbBMS.Text = "●"; + // + // toolStripStatusLabel2 + // + this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; + this.toolStripStatusLabel2.Size = new System.Drawing.Size(35, 17); + this.toolStripStatusLabel2.Text = "CALL"; + // + // sbCAL + // + this.sbCAL.Name = "sbCAL"; + this.sbCAL.Size = new System.Drawing.Size(19, 17); + this.sbCAL.Text = "●"; + // + // btc1 + // + this.btc1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btc1.ForeColor = System.Drawing.Color.White; + this.btc1.Location = new System.Drawing.Point(279, 7); + this.btc1.Name = "btc1"; + this.btc1.Size = new System.Drawing.Size(50, 24); + this.btc1.TabIndex = 7; + this.btc1.Text = "3338"; + this.btc1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // btc5 + // + this.btc5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btc5.ForeColor = System.Drawing.Color.White; + this.btc5.Location = new System.Drawing.Point(335, 7); + this.btc5.Name = "btc5"; + this.btc5.Size = new System.Drawing.Size(50, 24); + this.btc5.TabIndex = 7; + this.btc5.Text = "3338"; + this.btc5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // btc6 + // + this.btc6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btc6.ForeColor = System.Drawing.Color.White; + this.btc6.Location = new System.Drawing.Point(335, 27); + this.btc6.Name = "btc6"; + this.btc6.Size = new System.Drawing.Size(50, 24); + this.btc6.TabIndex = 8; + this.btc6.Text = "3338"; + this.btc6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // btc2 + // + this.btc2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btc2.ForeColor = System.Drawing.Color.White; + this.btc2.Location = new System.Drawing.Point(279, 27); + this.btc2.Name = "btc2"; + this.btc2.Size = new System.Drawing.Size(50, 24); + this.btc2.TabIndex = 9; + this.btc2.Text = "3338"; + this.btc2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // btc7 + // + this.btc7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btc7.ForeColor = System.Drawing.Color.White; + this.btc7.Location = new System.Drawing.Point(335, 50); + this.btc7.Name = "btc7"; + this.btc7.Size = new System.Drawing.Size(50, 24); + this.btc7.TabIndex = 10; + this.btc7.Text = "3338"; + this.btc7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // btc3 + // + this.btc3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btc3.ForeColor = System.Drawing.Color.White; + this.btc3.Location = new System.Drawing.Point(279, 50); + this.btc3.Name = "btc3"; + this.btc3.Size = new System.Drawing.Size(50, 24); + this.btc3.TabIndex = 11; + this.btc3.Text = "3338"; + this.btc3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // btc8 + // + this.btc8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btc8.ForeColor = System.Drawing.Color.White; + this.btc8.Location = new System.Drawing.Point(335, 69); + this.btc8.Name = "btc8"; + this.btc8.Size = new System.Drawing.Size(50, 24); + this.btc8.TabIndex = 12; + this.btc8.Text = "3338"; + this.btc8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // btc4 + // + this.btc4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.btc4.ForeColor = System.Drawing.Color.White; + this.btc4.Location = new System.Drawing.Point(279, 69); + this.btc4.Name = "btc4"; + this.btc4.Size = new System.Drawing.Size(50, 24); + this.btc4.TabIndex = 13; + this.btc4.Text = "3338"; + this.btc4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // agvViewer1 + // + this.agvViewer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.agvViewer1.FontMrk = new System.Drawing.Font("Arial Rounded MT Bold", 7F); + this.agvViewer1.FontTag = new System.Drawing.Font("Arial Rounded MT Bold", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.agvViewer1.lastmark = ""; + this.agvViewer1.lastmarkdir = ""; + this.agvViewer1.lasttag = ""; + this.agvViewer1.lasttagdir = ""; + ptdata1.active = false; + ptdata1.data = "NOT"; + ptdata1.pos = 30F; + ptdata2.active = false; + ptdata2.data = "QA"; + ptdata2.pos = 200F; + ptdata3.active = false; + ptdata3.data = "CHG"; + ptdata3.pos = 300F; + ptdata4.active = false; + ptdata4.data = "QC"; + ptdata4.pos = 400F; + ptdata5.active = false; + ptdata5.data = "#FVI-1"; + ptdata5.pos = 500F; + ptdata6.active = false; + ptdata6.data = "#FVI-2"; + ptdata6.pos = 600F; + ptdata7.active = false; + ptdata7.data = "#FVI-3"; + ptdata7.pos = 700F; + ptdata8.active = false; + ptdata8.data = "#FVI-4"; + ptdata8.pos = 800F; + ptdata9.active = false; + ptdata9.data = "#FVI-5"; + ptdata9.pos = 900F; + ptdata10.active = false; + ptdata10.data = "POT"; + ptdata10.pos = 970F; + this.agvViewer1.listMRK = new AGVEmulator.UC.AgvViewer.ptdata[] { + ptdata1, + ptdata2, + ptdata3, + ptdata4, + ptdata5, + ptdata6, + ptdata7, + ptdata8, + ptdata9, + ptdata10}; + ptdata11.active = false; + ptdata11.data = "9000"; + ptdata11.pos = 80F; + ptdata12.active = false; + ptdata12.data = "9001"; + ptdata12.pos = 120F; + ptdata13.active = false; + ptdata13.data = "9010"; + ptdata13.pos = 180F; + ptdata14.active = false; + ptdata14.data = "9011"; + ptdata14.pos = 220F; + ptdata15.active = false; + ptdata15.data = "9020"; + ptdata15.pos = 280F; + ptdata16.active = false; + ptdata16.data = "9021"; + ptdata16.pos = 320F; + ptdata17.active = false; + ptdata17.data = "9030"; + ptdata17.pos = 380F; + ptdata18.active = false; + ptdata18.data = "9031"; + ptdata18.pos = 420F; + ptdata19.active = false; + ptdata19.data = "9040"; + ptdata19.pos = 480F; + ptdata20.active = false; + ptdata20.data = "9041"; + ptdata20.pos = 520F; + ptdata21.active = false; + ptdata21.data = "9050"; + ptdata21.pos = 580F; + ptdata22.active = false; + ptdata22.data = "9051"; + ptdata22.pos = 620F; + ptdata23.active = false; + ptdata23.data = "9060"; + ptdata23.pos = 680F; + ptdata24.active = false; + ptdata24.data = "9061"; + ptdata24.pos = 720F; + ptdata25.active = false; + ptdata25.data = "9070"; + ptdata25.pos = 780F; + ptdata26.active = false; + ptdata26.data = "9071"; + ptdata26.pos = 820F; + ptdata27.active = false; + ptdata27.data = "9000"; + ptdata27.pos = 10F; + ptdata28.active = false; + ptdata28.data = "9001"; + ptdata28.pos = 50F; + this.agvViewer1.listTAG = new AGVEmulator.UC.AgvViewer.ptdata[] { + ptdata11, + ptdata12, + ptdata13, + ptdata14, + ptdata15, + ptdata16, + ptdata17, + ptdata18, + ptdata19, + ptdata20, + ptdata21, + ptdata22, + ptdata23, + ptdata24, + ptdata25, + ptdata26, + ptdata27, + ptdata28}; + this.agvViewer1.Location = new System.Drawing.Point(241, 0); + this.agvViewer1.Name = "agvViewer1"; + this.agvViewer1.Size = new System.Drawing.Size(899, 120); + this.agvViewer1.StopbyMark = false; + this.agvViewer1.TabIndex = 0; + this.agvViewer1.Text = "agvViewer1"; + this.agvViewer1.Click += new System.EventHandler(this.agvViewer1_Click); + this.agvViewer1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.agvViewer1_MouseDown); + // + // serAGV + // + this.serAGV.BaudRate = 9600; + this.serAGV.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.serAGV.dev = null; + this.serAGV.Dock = System.Windows.Forms.DockStyle.Left; + this.serAGV.Location = new System.Drawing.Point(0, 0); + this.serAGV.Name = "serAGV"; + this.serAGV.PortName = "COM20"; + this.serAGV.Size = new System.Drawing.Size(241, 120); + this.serAGV.TabIndex = 0; + this.serAGV.Load += new System.EventHandler(this.serAGV_Load); + // + // serPLC + // + this.serPLC.BaudRate = 9600; + this.serPLC.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.serPLC.dev = null; + this.serPLC.Dock = System.Windows.Forms.DockStyle.Top; + this.serPLC.Location = new System.Drawing.Point(0, 0); + this.serPLC.Name = "serPLC"; + this.serPLC.PortName = "COM30"; + this.serPLC.Size = new System.Drawing.Size(1146, 84); + this.serPLC.TabIndex = 1; + // + // serBMS + // + this.serBMS.BaudRate = 9600; + this.serBMS.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.serBMS.dev = null; + this.serBMS.Dock = System.Windows.Forms.DockStyle.Top; + this.serBMS.Location = new System.Drawing.Point(3, 17); + this.serBMS.Name = "serBMS"; + this.serBMS.PortName = "COM40"; + this.serBMS.Size = new System.Drawing.Size(558, 84); + this.serBMS.TabIndex = 1; + this.serBMS.Load += new System.EventHandler(this.serBMS_Load); + // + // serCAL + // + this.serCAL.BaudRate = 9600; + this.serCAL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.serCAL.dev = null; + this.serCAL.Dock = System.Windows.Forms.DockStyle.Top; + this.serCAL.Location = new System.Drawing.Point(3, 17); + this.serCAL.Name = "serCAL"; + this.serCAL.PortName = "COM50"; + this.serCAL.Size = new System.Drawing.Size(558, 84); + this.serCAL.TabIndex = 1; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1154, 695); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.toolStrip1); + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Form1"; + this.Load += new System.EventHandler(this.Form1_Load); + this.groupBox1.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit(); + this.panel4.ResumeLayout(false); + this.groupBox9.ResumeLayout(false); + this.groupBox10.ResumeLayout(false); + this.groupBox10.PerformLayout(); + this.groupBox11.ResumeLayout(false); + this.groupBox11.PerformLayout(); + this.groupBox7.ResumeLayout(false); + this.groupBox7.PerformLayout(); + this.groupBox6.ResumeLayout(false); + this.panel11.ResumeLayout(false); + this.groupBox8.ResumeLayout(false); + this.groupBox8.PerformLayout(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + this.panel13.ResumeLayout(false); + this.panel10.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + this.groupBox3.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudBMSKitNo)).EndInit(); + this.panel3.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); + this.panel5.ResumeLayout(false); + this.panel5.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tableLayoutPanel3.ResumeLayout(false); + this.panel12.ResumeLayout(false); + this.tabPage3.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox groupBox3; + private SerialConn serAGV; + private SerialConn serBMS; + private SerialConn serCAL; + private SerialConn serPLC; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private arCtl.LogTextBox rtBMS; + private arCtl.LogTextBox rtAGV; + private arCtl.LogTextBox rtCAL; + private arCtl.LogTextBox rtPLC; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button8; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button7; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.TrackBar trackBar1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.RadioButton radioButton1; + private System.Windows.Forms.RadioButton radioButton6; + private System.Windows.Forms.RadioButton radioButton5; + private System.Windows.Forms.RadioButton radioButton4; + private System.Windows.Forms.RadioButton radioButton3; + private System.Windows.Forms.RadioButton radioButton2; + private System.Windows.Forms.CheckBox checkBox2; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.Panel panel5; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private arFrame.Control.GridView gvdPLCInOut; + private arFrame.Control.GridView gvdPLCFlag; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Button btPLCemg; + private System.Windows.Forms.Button button10; + private System.Windows.Forms.Button button9; + private System.Windows.Forms.Button button11; + private System.Windows.Forms.Button button12; + private System.Windows.Forms.Button button13; + private System.Windows.Forms.CheckBox checkBox3; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.RadioButton radioButton7; + private System.Windows.Forms.RadioButton radioButton9; + private System.Windows.Forms.RadioButton radioButton8; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.RadioButton radioButton14; + private System.Windows.Forms.RadioButton radioButton15; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.RadioButton radioButton10; + private System.Windows.Forms.RadioButton radioButton11; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.GroupBox groupBox7; + private System.Windows.Forms.GroupBox groupBox8; + private System.Windows.Forms.RadioButton radioButton13; + private System.Windows.Forms.RadioButton radioButton16; + private System.Windows.Forms.RadioButton radioButton12; + private System.Windows.Forms.RadioButton radioButton17; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; + private arCtl.LogTextBox rtAGVPro; + private System.Windows.Forms.GroupBox groupBox9; + private System.Windows.Forms.Panel panel6; + private System.Windows.Forms.Panel panel7; + private System.Windows.Forms.GroupBox groupBox10; + private System.Windows.Forms.Panel panel8; + private System.Windows.Forms.GroupBox groupBox11; + private System.Windows.Forms.Panel panel9; + private System.Windows.Forms.Panel panel10; + private System.Windows.Forms.Panel panel11; + private System.Windows.Forms.Button button14; + private System.Windows.Forms.Button button16; + private System.Windows.Forms.Button button15; + private System.Windows.Forms.Button button17; + private System.Windows.Forms.Button button18; + private System.Windows.Forms.NumericUpDown numericUpDown1; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.NumericUpDown nudBMSKitNo; + private System.Windows.Forms.Panel panel12; + private UC.AgvViewer agvViewer1; + private System.Windows.Forms.Panel panel13; + private System.Windows.Forms.CheckBox chkSimulation; + private System.Windows.Forms.RadioButton radioButton20; + private System.Windows.Forms.RadioButton radioButton21; + private System.Windows.Forms.RadioButton radioButton18; + private System.Windows.Forms.RadioButton radioButton19; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripButton toolStripButton1; + private System.Windows.Forms.ToolStripButton toolStripButton2; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel8; + private System.Windows.Forms.ToolStripStatusLabel sbAGV; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel6; + private System.Windows.Forms.ToolStripStatusLabel sbPLC; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4; + private System.Windows.Forms.ToolStripStatusLabel sbBMS; + private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; + private System.Windows.Forms.ToolStripStatusLabel sbCAL; + private System.Windows.Forms.Label btc8; + private System.Windows.Forms.Label btc4; + private System.Windows.Forms.Label btc7; + private System.Windows.Forms.Label btc3; + private System.Windows.Forms.Label btc6; + private System.Windows.Forms.Label btc2; + private System.Windows.Forms.Label btc5; + private System.Windows.Forms.Label btc1; + } +} + diff --git a/Emulator/AGVEmulator/Form1.cs b/Emulator/AGVEmulator/Form1.cs new file mode 100644 index 0000000..3a62d6e --- /dev/null +++ b/Emulator/AGVEmulator/Form1.cs @@ -0,0 +1,1154 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Globalization; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Windows.Forms; +using System.Windows.Forms.VisualStyles; +using static AGVEmulator.DevAGV; + +namespace AGVEmulator +{ + public partial class Form1 : Form + { + arUtil.Log logPLC, logAGV, logBMS, logCAL; + DevBMS BMS; + DevAGV AGV; + DevPLC PLC; + DevCAL CAL; + + + float BMS_MaxA = 80f; + float BMS_Remain = 79f; + float BMS_CurA = 70f; + float BMS_Volt = 25.4f; + + UInt16[] cellvolt = new UInt16[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + + + public Form1() + { + InitializeComponent(); + logPLC = new arUtil.Log(); + logAGV = new arUtil.Log(); + logBMS = new arUtil.Log(); + logCAL = new arUtil.Log(); + + logPLC.FileNameFormat = "{yyyyMMdd}_PLC"; + logAGV.FileNameFormat = "{yyyyMMdd}_AGV"; + logBMS.FileNameFormat = "{yyyyMMdd}_BMS"; + logCAL.FileNameFormat = "{yyyyMMdd}_CAL"; + + logPLC.RaiseMsg += (s1, e1, d1) => { this.rtPLC.AddMsg(s1, e1, d1); }; + logAGV.RaiseMsg += (s1, e1, d1) => + { + if (d1.StartsWith("Tx")) + this.rtAGV.AddMsg(s1, e1, d1); + else + this.rtAGVPro.AddMsg(s1, e1, d1); + }; + logBMS.RaiseMsg += (s1, e1, d1) => { this.rtBMS.AddMsg(s1, e1, d1); }; + logCAL.RaiseMsg += (s1, e1, d1) => { this.rtCAL.AddMsg(s1, e1, d1); }; + + + var logcolor = new arCtl.sLogMessageColor[] { + new arCtl.sLogMessageColor("NORM", Color.White), + new arCtl.sLogMessageColor("INF", Color.SkyBlue), + new arCtl.sLogMessageColor("WARN", Color.Tomato), + new arCtl.sLogMessageColor("ERR", Color.Red), + new arCtl.sLogMessageColor("RX", Color.Lime), + new arCtl.sLogMessageColor("TX", Color.Orange), + }; + + rtPLC.ColorList = logcolor; + rtAGV.ColorList = logcolor; + rtBMS.ColorList = logcolor; + rtCAL.ColorList = logcolor; + rtAGVPro.ColorList = logcolor; + + this.FormClosed += Form1_FormClosed; + + BMS = new DevBMS(); + AGV = new DevAGV(); + PLC = new DevPLC(); + CAL = new DevCAL(); + this.serAGV.dev = AGV; + this.serPLC.dev = PLC; + this.serBMS.dev = BMS; + this.serCAL.dev = CAL; + + BMS.Message += Bms_Message; + AGV.Message += Bms_Message; + PLC.Message += Bms_Message; + CAL.Message += Bms_Message; + + BMS.RequestBatteryData += Bms_RequestBatteryData; + BMS.RequestVoltageData += BMS_RequestVoltageData; + PLC.RequestData += Plc_RequestData; + PLC.ValueChanged += Plc_ValueChanged; + AGV.RequestStatusData += Agv_RequestStatusData; + AGV.ValueChanged += Agv_ValueChanged; + AGV.StsValueChanged += Agv_StsValueChanged; + AGV.Command += Agv_Command; + + } + + + + Random rnd; + private void Form1_Load(object sender, EventArgs e) + { + rnd = new Random(3000); + + serAGV.BaudRate = 57600; + serPLC.BaudRate = 57600; + trackBar1_Scroll(null, null); + timer1.Start(); + + //plc inout 이름 설정 + List titles = new List(); + List values = new List(); + for (int i = 0; i < 16; i++) + { + var pin = (DevPLC.DIName)i; + titles.Add(pin.ToString()); + values.Add(false); + } + for (int i = 0; i < 8; i++) + { + var pin = (DevPLC.DOName)i; + titles.Add(pin.ToString()); + values.Add(false); + } + this.gvdPLCInOut.setTitle(titles.ToArray()); + this.gvdPLCInOut.setValue(values.ToArray()); + + + titles.Clear(); + values.Clear(); + for (int i = 0; i < 32; i++) + { + titles.Add(i.ToString()); + values.Add(false); + } + this.gvdPLCFlag.setTitle(titles.ToArray()); + this.gvdPLCFlag.setValue(values.ToArray()); + this.gvdPLCInOut.ItemClick += GvdPLCInOut_ItemClick; + this.gvdPLCFlag.ItemClick += GvdPLCFlag_ItemClick; + this.gvdPLCFlag.ColorList = new arFrame.Control.ColorListItem[] { + new arFrame.Control.ColorListItem(){ BackColor1 = Color.DimGray, BackColor2 = Color.Gray }, + new arFrame.Control.ColorListItem(){ BackColor1 = Color.Green, BackColor2 = Color.Lime }, + new arFrame.Control.ColorListItem(){ BackColor1 = Color.Red, BackColor2 = Color.Tomato }, + }; + this.gvdPLCInOut.ColorList = this.gvdPLCFlag.ColorList; + + var arrs = Enum.GetNames(typeof(DevAGV.esystemflag0)); + foreach (var item in arrs) + { + var data = (DevAGV.esystemflag0)Enum.Parse(typeof(DevAGV.esystemflag0), item); + + var chk = new CheckBox(); + chk.Text = $"[{(int)data:00}] {item}"; + chk.AutoSize = true; + chk.Visible = true; + chk.Tag = (int)data; + chk.Dock = DockStyle.Top; + chk.CheckedChanged += Chk_CheckedChanged; + this.panel6.Controls.Add(chk); + chk.Checked = true; //기본값 rue + } + arrs = Enum.GetNames(typeof(DevAGV.esystemflag1)); + foreach (var item in arrs) + { + var data = (DevAGV.esystemflag1)Enum.Parse(typeof(DevAGV.esystemflag1), item); + + var chk = new CheckBox(); + chk.Text = $"[{(int)data:00}] {item}"; + chk.AutoSize = true; + chk.Visible = true; + chk.Tag = (int)data; + chk.Dock = DockStyle.Top; + chk.CheckedChanged += Chk_CheckedChanged; + this.panel7.Controls.Add(chk); + } + arrs = Enum.GetNames(typeof(DevAGV.esignal)); + foreach (var item in arrs) + { + var data = (DevAGV.esignal)Enum.Parse(typeof(DevAGV.esignal), item); + + var chk = new CheckBox(); + chk.Text = $"[{(int)data:00}] {item}"; + chk.AutoSize = true; + chk.Visible = true; + chk.Tag = (int)data; + chk.Dock = DockStyle.Top; + chk.CheckedChanged += Chk_CheckedChanged; + this.panel8.Controls.Add(chk); + } + arrs = Enum.GetNames(typeof(DevAGV.eerror)); + foreach (var item in arrs) + { + var data = (DevAGV.eerror)Enum.Parse(typeof(DevAGV.eerror), item); + + var chk = new CheckBox(); + chk.Text = $"[{(int)data:00}] {item}"; + chk.AutoSize = true; + chk.Visible = true; + chk.Tag = (int)data; + chk.Dock = DockStyle.Top; + chk.CheckedChanged += Chk_CheckedChanged; + this.panel9.Controls.Add(chk); + } + + //기본 중지상태로 변환 + AGV.SetAGV(DevAGV.esystemflag1.agv_stop, true); + + foreach (RadioButton rad in groupBox5.Controls) + { + rad.CheckedChanged += (s1, e1) => + { + if (rad.Checked) + { + AGV.sts_dir = rad.Text[0]; + } + }; + } + foreach (RadioButton rad in groupBox2.Controls) + { + rad.CheckedChanged += (s1, e1) => + { + if (rad.Checked) + { + AGV.sts_bunki = rad.Text[0]; + } + }; + } + foreach (RadioButton rad in groupBox4.Controls) + { + rad.CheckedChanged += (s1, e1) => + { + if (rad.Checked) + { + AGV.sts_speed = rad.Text[0]; + } + }; + } + foreach (RadioButton rad in groupBox8.Controls) + { + rad.CheckedChanged += (s1, e1) => + { + if (rad.Checked) + { + AGV.sts_sensor = rad.Text[0]; + } + }; + } + + MakeViewer(); + + + agvViewer1.TagTouched += AgvViewer1_TagTouched; + agvViewer1.MarkTouched += AgvViewer1_MarkTouched; + agvViewer1.Command += AgvViewer1_Command; + } + private void Agv_Command(object sender, commandargs e) + { + switch (e.Command.ToLower()) + { + case "stopmark": + agvViewer1.StopbyMark = true; + break; + } + } + void MakeViewer() + { + //태그목록 + List listTAG = new List(); + //var strtag = new string[] { + // "9000", "9001", //not + // "9010", "9011", + // //"9020", "9021", + // "9030", "9031", + // // "9040", "9041", + // "9050", "9051", + // // "9060", "9061", + // "9070", "9071", + // "9080", "9081", + // "9090", "9091"}; + + //foreach(var tag in strtag) + //{ + // listTAG.Add(new UC.AgvViewer.ptdata { + // active=false, + // data = tag, + // pos = + // }); + //} + //agvViewer1.listTAG = listTAG.ToArray(); + + //마크지점 + List listMRK = new List(); + var strmark = new string[] { "NOT", "QC", "CHG", "{0}", "#1", "{1}", "#2", "{2}", "#3", "{3}", "#4", "POT" }; + var pos = 50; + var tagstart = 9000; + foreach (var item in strmark) + { + listMRK.Add(new UC.AgvViewer.ptdata + { + pos = pos, + data = item, + }); + + + if (item.Equals("CHG")) + { + pos += 100; + continue; + } + else if (item.Equals("{0}")) tagstart = 9350; + else if (item.Equals("{1}")) tagstart = 9450; + else if (item.Equals("{2}")) tagstart = 9550; + else if (item.Equals("{3}")) tagstart = 9650; + else if (item.Equals("#1")) tagstart = 9400; + else if (item.Equals("#2")) tagstart = 9500; + else if (item.Equals("#3")) tagstart = 9600; + else if (item.Equals("#4")) tagstart = 9700; + + + //지정위치 좌우에 태그를 심는다 + listTAG.Add(new UC.AgvViewer.ptdata + { + pos = pos - 20, + data = tagstart.ToString(), + }); + + if (item.Equals("NOT") == false && item.Equals("POT") == false && item.StartsWith("{") == false) + tagstart += 1; + + + listTAG.Add(new UC.AgvViewer.ptdata + { + pos = pos + 20, + data = tagstart.ToString(), + }); + + + pos += 100; + + if (item.Equals("NOT") == false && item.Equals("POT") == false && item.StartsWith("{") == false) + tagstart += 99; + else + tagstart += 100; + + + if (item.Equals("NOT")) + tagstart = 9300; + + //else + //{ + // pos += 100; + // tagstart += 10; + //} + + } + agvViewer1.listMRK = listMRK.ToArray(); + agvViewer1.listTAG = listTAG.ToArray(); + agvViewer1.Invalidate(); + + } + private void AgvViewer1_Command(object sender, UC.AgvViewer.TagArgs e) + { + if (e.Data == "stop") + { + AGV.SetAGV(esystemflag1.agv_run, false); + AGV.SetAGV(esystemflag1.agv_stop, true); + logAGV.Add("시뮬로부터 자동 중지"); + } + } + + private void AgvViewer1_MarkTouched(object sender, UC.AgvViewer.TagArgs e) + { + // throw new NotImplementedException(); + AGV.SetAGV(esignal.mark_sensor_1, e.Active); + logAGV.Add($"mark {e.Data} touch:{e.Active}"); + } + + private void AgvViewer1_TagTouched(object sender, UC.AgvViewer.TagArgs e) + { + logAGV.Add($"tag touch:{e.Data}"); + numericUpDown1.Value = decimal.Parse(e.Data); + button18.PerformClick(); + } + + private void Agv_StsValueChanged(object sender, DevAGV.StsValueChangedArgs e) + { + Console.WriteLine($"STS [{e.vtype}] VAL={e.Value}"); + if (this.InvokeRequired) + { + this.BeginInvoke(new EventHandler(Agv_StsValueChanged), sender, e); + return; + } + switch (e.vtype) + { + case DevAGV.estsvaluetype.direction: + foreach (RadioButton c in this.groupBox5.Controls) + { + if (c.Text[0].Equals(e.Value)) + { + c.Checked = true; + + } + else + { + c.Checked = false; + } + c.Refresh(); + } + groupBox5.Refresh(); + break; + case DevAGV.estsvaluetype.bunki: + foreach (RadioButton c in this.groupBox2.Controls) + { + if (c.Text[0].Equals(e.Value)) + { + c.Checked = true; + c.Refresh(); + break; + } + } + break; + case DevAGV.estsvaluetype.speed: + foreach (RadioButton c in this.groupBox4.Controls) + { + if (c.Text[0].Equals(e.Value)) + { + c.Checked = true; + c.Refresh(); + break; + } + } + break; + case DevAGV.estsvaluetype.sensor: + foreach (RadioButton c in this.groupBox8.Controls) + { + if (c.Text.Equals(e.Value)) + { + c.Checked = true; + c.Refresh(); + break; + } + } + break; + } + } + + private void Agv_ValueChanged(object sender, DevAGV.ValueChangedArgs e) + { + if (this.InvokeRequired) + { + this.Invoke(new EventHandler(Agv_ValueChanged), sender, e); + return; + } + + //내부값이 바뀌었다면 컨트롤을 변경해준다. + switch (e.vtype) + { + + case DevAGV.evaluetype.system0: + foreach (CheckBox c in panel6.Controls) + { + var idx = int.Parse(c.Tag.ToString()); + if (idx == e.Idx) + { + c.Checked = e.Value; + break; + } + } + break; + case DevAGV.evaluetype.system1: + + var v = (DevAGV.esystemflag1)e.Idx; + if (e.Value) + { + if (v == esystemflag1.agv_run) + { + agvViewer1.wat.Restart(); + } + if (v == esystemflag1.agv_stop) + { + agvViewer1.wat.Stop(); + } + } + + + foreach (CheckBox c in panel7.Controls) + { + var idx = int.Parse(c.Tag.ToString()); + if (idx == e.Idx) + { + c.Checked = e.Value; + break; + } + } + break; + case DevAGV.evaluetype.error: + foreach (CheckBox c in panel9.Controls) + { + var idx = int.Parse(c.Tag.ToString()); + if (idx == e.Idx) + { + c.Checked = e.Value; + break; + } + } + break; + case DevAGV.evaluetype.signal: + foreach (CheckBox c in panel8.Controls) + { + var idx = int.Parse(c.Tag.ToString()); + if (idx == e.Idx) + { + c.Checked = e.Value; + break; + } + } + break; + + + } + } + + char GetGroupItemCheckbox(GroupBox grp) + { + foreach (var ctl in grp.Controls) + { + if (ctl is RadioButton) + { + var rad = ctl as RadioButton; + if (rad.Checked) return rad.Text[0]; + } + } + return '0'; + } + + + + + int PLC_LeftPosition = 0; + int PLC_RightPosition = 0; + int PLC_LeftDir = 0; + int PLC_RightDir = 0; + + private void Plc_ValueChanged(object sender, DevPLC.ValueChangedArgs e) + { + if (e.IsOut) + { + this.gvdPLCInOut.setValue(e.Idx + 16, e.Value); + var doname = (DevPLC.DOName)e.Idx; + + switch (doname) + { + case DevPLC.DOName.PINO_GUIDEMOTOR_RRUN: + break; + case DevPLC.DOName.PINO_GUIDEMOTOR_LRUN: + break; + } + } + else + { + this.gvdPLCInOut.setValue(e.Idx, e.Value); + + } + this.gvdPLCInOut.Invalidate(); + } + + private void Plc_RequestData(object sender, DevPLC.RequestBatteryDataArgs e) + { + var idx = 0; + UInt32 val = 0; + foreach (var data in gvdPLCInOut.Values) + { + SetBit(ref val, idx++, (data > 0)); + } + e.IOValue = val; + idx = 0; + val = 0; + foreach (var data in gvdPLCFlag.Values) + { + SetBit(ref val, idx++, (data > 0)); + } + e.FGValue = val; + } + + public void SetBit(ref UInt32 _value, int idx, Boolean value) + { + if (value) + { + var offset = (UInt32)(1 << idx); + _value = _value | offset; + } + else + { + var offset = (UInt32)(~(1 << idx)); + _value = _value & offset; + } + } + public void SetBit(ref UInt16 _value, int idx, Boolean value) + { + if (value) + { + var offset = (UInt16)(1 << idx); + _value = (UInt16)(_value | offset); + } + else + { + var offset = (UInt16)(~(1 << idx)); + _value = (UInt16)(_value & offset); + } + } + public void SetBit(ref byte _value, int idx, Boolean value) + { + if (value) + { + var offset = (byte)(1 << idx); + _value = (byte)(_value | offset); + } + else + { + var offset = (byte)(~(1 << idx)); + _value = (byte)(_value & offset); + } + } + + void aaplycheckboxbit(ref UInt16 v, Panel p) + { + foreach (CheckBox chk in p.Controls) + { + var idx = int.Parse(chk.Tag.ToString()); + SetBit(ref v, idx, chk.Checked); + } + } + void aaplycheckboxbit(ref byte v, Panel p) + { + foreach (CheckBox chk in p.Controls) + { + var idx = int.Parse(chk.Tag.ToString()); + SetBit(ref v, idx, chk.Checked); + } + } + + + + private void Agv_RequestStatusData(object sender, DevAGV.RequestStatusDataArgs e) + { + //UInt16 system0 = 0xFFFF; + //UInt16 system1 = 0xFFFF; + //UInt16 error = 0xFFFF; + //byte signal = 0xFF; + + aaplycheckboxbit(ref AGV.system0, panel6); + aaplycheckboxbit(ref AGV.system1, panel7); + aaplycheckboxbit(ref AGV.error, panel9); + aaplycheckboxbit(ref AGV.signal, panel8); + + if (this.agvViewer1.StopbyMark) AGV.sts_speed = 'S'; + else AGV.sts_speed = GetGroupItemCheckbox(groupBox4); + AGV.sts_bunki = GetGroupItemCheckbox(groupBox2); + AGV.sts_dir = GetGroupItemCheckbox(groupBox5); + AGV.sts_sensor = GetGroupItemCheckbox(groupBox8); + + //this.Invoke(new Action(() => + //{ + // e.system0 = system0; + // e.system1 = system1; + // e.error = error; + // e.signal = signal; + // e.speed = GetGroupItemCheckbox(groupBox4); + // e.bunki = GetGroupItemCheckbox(groupBox2); + // e.direction = GetGroupItemCheckbox(groupBox5); + // e.sensor = GetGroupItemCheckbox(groupBox8); + + // e.volt = 23.4f; + //})); + } + private void BMS_RequestVoltageData(object sender, DevBMS.RequestVoltageDataArgs e) + { + + //cell전압값추가 + for (int i = 0; i < cellvolt.Length; i++) + { + this.cellvolt[i] = (UInt16)rnd.Next(3300, 3350); + } + Array.Copy(this.cellvolt, 0, e.cellVolt, 0, 8); + this.btc1.Invoke(new Action(() => { + var idx = 0; + btc1.Text = (this.cellvolt[idx++] / 1000f).ToString(); + btc2.Text = (this.cellvolt[idx++] / 1000f).ToString(); + btc3.Text = (this.cellvolt[idx++] / 1000f).ToString(); + btc4.Text = (this.cellvolt[idx++] / 1000f).ToString(); + btc5.Text = (this.cellvolt[idx++] / 1000f).ToString(); + btc6.Text = (this.cellvolt[idx++] / 1000f).ToString(); + btc7.Text = (this.cellvolt[idx++] / 1000f).ToString(); + btc8.Text = (this.cellvolt[idx++] / 1000f).ToString(); + })); + + } + private void Bms_RequestBatteryData(object sender, DevBMS.RequestBatteryDataArgs e) + { + if (checkBox1.Checked) + this.trackBar1.Invoke(new Action(() => + { + this.trackBar1.Value -= 1; + trackBar1_Scroll(null, null); + })); + + e.CurA = (int)BMS_CurA; + e.MaxA = (int)BMS_MaxA; + e.Remain = BMS_Remain; + e.Volt = BMS_Volt; + + } + + private void button5_Click(object sender, EventArgs e) + { + AGV.WriteData("ACK"); + } + + private void button4_Click(object sender, EventArgs e) + { + AGV.WriteData("NAK"); + } + + private void button7_Click(object sender, EventArgs e) + { + var pinL = DevPLC.DOName.PINO_GUIDEMOTOR_LRUN; + var pinR = DevPLC.DOName.PINO_GUIDEMOTOR_RRUN; + var pinDL = DevPLC.DOName.PINO_GUIDEMOTOR_LDIR; + var pinDR = DevPLC.DOName.PINO_GUIDEMOTOR_RDIR; + + this.gvdPLCInOut.setValue((int)pinDL + 16, true); + this.gvdPLCInOut.setValue((int)pinDR + 16, true); + this.gvdPLCInOut.setValue((int)pinL + 16, true); + this.gvdPLCInOut.setValue((int)pinR + 16, true); + this.gvdPLCInOut.Invalidate(); + } + + private void button6_Click(object sender, EventArgs e) + { + var pinL = DevPLC.DOName.PINO_GUIDEMOTOR_LRUN; + var pinR = DevPLC.DOName.PINO_GUIDEMOTOR_RRUN; + var cur = gvdPLCInOut.Values[(int)pinL + 16]; + this.gvdPLCInOut.setValue((int)pinL + 16, false); + this.gvdPLCInOut.setValue((int)pinR + 16, false); + this.gvdPLCInOut.Invalidate(); + } + + private void button8_Click(object sender, EventArgs e) + { + var pinL = DevPLC.DOName.PINO_GUIDEMOTOR_LRUN; + var pinR = DevPLC.DOName.PINO_GUIDEMOTOR_RRUN; + var pinDL = DevPLC.DOName.PINO_GUIDEMOTOR_LDIR; + var pinDR = DevPLC.DOName.PINO_GUIDEMOTOR_RDIR; + + this.gvdPLCInOut.setValue((int)pinDL + 16, false); + this.gvdPLCInOut.setValue((int)pinDR + 16, false); + this.gvdPLCInOut.setValue((int)pinL + 16, true); + this.gvdPLCInOut.setValue((int)pinR + 16, true); + this.gvdPLCInOut.Invalidate(); + } + + private void trackBar1_Scroll(object sender, EventArgs e) + { + BMS_MaxA = float.Parse(label4.Text); + BMS_CurA = (float)(trackBar1.Value / 100f); + BMS_Remain = 100f * (BMS_CurA / BMS_MaxA);// (trackBar1.Value / 10f); + var minvolt = 20.2f; + var maxvolt = 26.8f; + // BMS_CurA = (BMS_MaxA * (BMS_Remain / 100f)); + label3.Text = BMS_CurA.ToString("N0"); //curr amp + label5.Text = $"{BMS_Remain:N2}%"; + BMS_Volt = minvolt + ((maxvolt - minvolt) * (BMS_CurA / BMS_MaxA)); + label6.Text = $"{BMS_Volt:N2}v"; + } + + private void timer1_Tick(object sender, EventArgs e) + { + timer1.Stop(); + sbAGV.ForeColor = AGV.IsOpen ? Color.ForestGreen : Color.Red; + sbPLC.ForeColor = PLC.IsOpen ? Color.ForestGreen : Color.Red; + sbBMS.ForeColor = BMS.IsOpen ? Color.ForestGreen : Color.Red; + sbCAL.ForeColor = CAL.IsOpen ? Color.ForestGreen : Color.Red; + + if (checkBox2.Checked && PLC != null && PLC.IsOpen) PLC.AutoSendData(); //자동전송해야함 + if (checkBox3.Checked && AGV != null && AGV.IsOpen) AGV.AutoSendData(); //자동전송해야함 + if (BMS != null && BMS.IsOpen) BMS.AutoSendData(); //자동전송해야함 + if (CAL != null && CAL.IsOpen) CAL.AutoSendData(); //자동전송해야함 + + if (chkSimulation.Checked && AGV.GetAGV(esystemflag1.agv_run)) + { + if (radioButton15.Checked) + { + agvViewer1.dir = 1; + } + else + { + agvViewer1.dir = -1; + } + if (radioButton12.Checked) agvViewer1.mspd = 7; + else if (radioButton11.Checked) agvViewer1.mspd = 20; + else agvViewer1.mspd = 40; + agvViewer1.Invalidate(); + } + + UpdatePLC(); + label7.Text = $"I/O L({PLC_LeftPosition}),R({PLC_RightPosition})"; + + timer1.Start(); + } + + void UpdatePLC() + { + //plc값을 업데이트해준다. + var LRun = gvdPLCInOut.getValue((int)DevPLC.DOName.PINO_GUIDEMOTOR_LRUN + 16) == 1; + var RRun = gvdPLCInOut.getValue((int)DevPLC.DOName.PINO_GUIDEMOTOR_RRUN + 16) == 1; + var LDir = gvdPLCInOut.getValue((int)DevPLC.DOName.PINO_GUIDEMOTOR_LDIR + 16) == 1; + var RDir = gvdPLCInOut.getValue((int)DevPLC.DOName.PINO_GUIDEMOTOR_RDIR + 16) == 1; + + if (LRun == false) this.PLC_LeftDir = 0; + else if (LDir == true) this.PLC_LeftDir = 1; + else this.PLC_LeftDir = -1; + + if (RRun == false) this.PLC_RightDir = 0; + else if (RDir == true) this.PLC_RightDir = 1; + else this.PLC_RightDir = -1; + + this.PLC_LeftPosition += this.PLC_LeftDir; + this.PLC_RightPosition += this.PLC_RightDir; + + var maxvalue = 20; + if (PLC_LeftPosition >= maxvalue) + { + PLC_LeftPosition = maxvalue; + PLC_LeftDir = 0;//멈춤 + var idx = (int)DevPLC.DOName.PINO_GUIDEMOTOR_LRUN; + gvdPLCInOut.setValue(idx + 16, false); + idx = (int)DevPLC.DIName.PINI_LIMIT_LD; + gvdPLCInOut.setValue(idx, false); + idx = (int)DevPLC.DIName.PINI_LIMIT_LU; + gvdPLCInOut.setValue(idx, true); + } + else if (PLC_LeftPosition <= 0) + { + PLC_LeftPosition = 0; + PLC_LeftDir = 0; + var idx = (int)DevPLC.DOName.PINO_GUIDEMOTOR_LRUN; + gvdPLCInOut.setValue(idx + 16, false); + idx = (int)DevPLC.DIName.PINI_LIMIT_LU; + gvdPLCInOut.setValue(idx, false); + idx = (int)DevPLC.DIName.PINI_LIMIT_LD; + gvdPLCInOut.setValue(idx, true); + } + else if (PLC_LeftPosition > 5 && PLC_LeftPosition < maxvalue - 5) + { + if (gvdPLCInOut.getValue((int)DevPLC.DIName.PINI_LIMIT_LD) > 0) + gvdPLCInOut.setValue((int)DevPLC.DIName.PINI_LIMIT_LD, false); + if (gvdPLCInOut.getValue((int)DevPLC.DIName.PINI_LIMIT_LU) > 0) + gvdPLCInOut.setValue((int)DevPLC.DIName.PINI_LIMIT_LU, false); + } + + if (PLC_RightPosition >= maxvalue) + { + PLC_RightPosition = maxvalue; + PLC_RightDir = 0;//멈춤 + var idx = (int)DevPLC.DOName.PINO_GUIDEMOTOR_RRUN; + gvdPLCInOut.setValue(idx + 16, false); + idx = (int)DevPLC.DIName.PINI_LIMIT_RD; + gvdPLCInOut.setValue(idx, false); + idx = (int)DevPLC.DIName.PINI_LIMIT_RU; + gvdPLCInOut.setValue(idx, true); + } + else if (PLC_RightPosition <= 0) + { + PLC_RightPosition = 0; + PLC_RightDir = 0; + var idx = (int)DevPLC.DOName.PINO_GUIDEMOTOR_RRUN; + gvdPLCInOut.setValue(idx + 16, false); + idx = (int)DevPLC.DIName.PINI_LIMIT_RU; + gvdPLCInOut.setValue(idx, false); + idx = (int)DevPLC.DIName.PINI_LIMIT_RD; + gvdPLCInOut.setValue(idx, true); + } + else if (PLC_RightPosition > 5 && PLC_RightPosition < maxvalue - 5) + { + if (gvdPLCInOut.getValue((int)DevPLC.DIName.PINI_LIMIT_RD) > 0) + gvdPLCInOut.setValue((int)DevPLC.DIName.PINI_LIMIT_RD, false); + if (gvdPLCInOut.getValue((int)DevPLC.DIName.PINI_LIMIT_RU) > 0) + gvdPLCInOut.setValue((int)DevPLC.DIName.PINI_LIMIT_RU, false); + } + } + + + private void Bms_Message(object sender, AR.Dev.RS232.MessageEventArgs e) + { + var dev = sender as AR.Dev.RS232; + if (dev is DevBMS) + { + logBMS.Add(e.Message); + } + else if (dev is DevAGV) + { + logAGV.Add(e.Message); + } + else if (dev is DevPLC) + { + logPLC.Add(e.Message); + } + else if (dev is DevCAL) + { + if (e.MsgType == AR.Dev.RS232.MessageType.Send) + logCAL.Add(">> " + e.Data.HexString()); + else if (e.MsgType == AR.Dev.RS232.MessageType.Recv) + logCAL.Add("<< " + e.Data.HexString()); + else logCAL.Add(e.Message); + } + } + + private void Form1_FormClosed(object sender, FormClosedEventArgs e) + { + timer1.Stop(); + logPLC.Flush(); + logAGV.Flush(); + logBMS.Flush(); + logCAL.Flush(); + } + + private void btPLCemg_Click(object sender, EventArgs e) + { + var pin = DevPLC.DIName.PINI_EMG; + var cur = gvdPLCInOut.Values[(int)pin]; + this.gvdPLCInOut.setValue((int)pin, cur == 0); + this.gvdPLCInOut.Invalidate(); + } + + private void button9_Click(object sender, EventArgs e) + { + var pinL = DevPLC.DIName.PINI_LIMIT_LU; + var pinR = DevPLC.DIName.PINI_LIMIT_RU; + var cur = gvdPLCInOut.Values[(int)pinL]; + this.gvdPLCInOut.setValue((int)pinL, cur == 0); + this.gvdPLCInOut.setValue((int)pinR, cur == 0); + + pinL = DevPLC.DIName.PINI_LIMIT_LD; + pinR = DevPLC.DIName.PINI_LIMIT_RD; + this.gvdPLCInOut.setValue((int)pinL, false); + this.gvdPLCInOut.setValue((int)pinR, false); + this.gvdPLCInOut.Invalidate(); + } + + private void button10_Click(object sender, EventArgs e) + { + var pinL = DevPLC.DIName.PINI_LIMIT_LD; + var pinR = DevPLC.DIName.PINI_LIMIT_RD; + var cur = gvdPLCInOut.Values[(int)pinL]; + this.gvdPLCInOut.setValue((int)pinL, cur == 0); + this.gvdPLCInOut.setValue((int)pinR, cur == 0); + + + pinL = DevPLC.DIName.PINI_LIMIT_LU; + pinR = DevPLC.DIName.PINI_LIMIT_RU; + this.gvdPLCInOut.setValue((int)pinL, false); + this.gvdPLCInOut.setValue((int)pinR, false); + + + this.gvdPLCInOut.Invalidate(); + } + + private void button13_Click(object sender, EventArgs e) + { + var pinL = DevPLC.DIName.PINI_BTN_1; + var cur = gvdPLCInOut.Values[(int)pinL]; + this.gvdPLCInOut.setValue((int)pinL, cur == 0); + this.gvdPLCInOut.Invalidate(); + } + + private void button12_Click(object sender, EventArgs e) + { + var pinL = DevPLC.DIName.PINI_BTN_2; + var cur = gvdPLCInOut.Values[(int)pinL]; + this.gvdPLCInOut.setValue((int)pinL, cur == 0); + this.gvdPLCInOut.Invalidate(); + } + + private void button11_Click(object sender, EventArgs e) + { + var pinL = DevPLC.DIName.PINI_BTN_3; + var cur = gvdPLCInOut.Values[(int)pinL]; + this.gvdPLCInOut.setValue((int)pinL, cur == 0); + this.gvdPLCInOut.Invalidate(); + } + + private void panel4_Paint(object sender, PaintEventArgs e) + { + + } + + private void groupBox9_Enter(object sender, EventArgs e) + { + + } + + private void button14_Click(object sender, EventArgs e) + { + //agv 정지 + //비상정지 에러 플래그 + AGV.SetAGV(DevAGV.eerror.Emergency, true); + AGV.SetAGV(DevAGV.esystemflag1.agv_run, false); + AGV.SetAGV(DevAGV.esystemflag1.agv_stop, true); + } + + + + private void button16_Click(object sender, EventArgs e) + { + AGV.SetAGV(DevAGV.esystemflag1.stop_by_front_detect, true); + } + + private void button15_Click(object sender, EventArgs e) + { + AGV.SetAGV(DevAGV.esystemflag1.stop_by_front_detect, false); + } + + private void button17_Click(object sender, EventArgs e) + { + //agv 정지 + //비상정지 에러 플래그 + AGV.SetAGV(DevAGV.eerror.Emergency, false); + AGV.SetAGV(DevAGV.eerror.line_out_error, false); + AGV.SetAGV(DevAGV.eerror.Overcurrent, false); + AGV.SetAGV(DevAGV.esystemflag1.agv_run, false); + AGV.SetAGV(DevAGV.esystemflag1.agv_stop, true); + } + + + + private void Chk_CheckedChanged(object sender, EventArgs e) + { + var chk = sender as CheckBox; + var idx = int.Parse(chk.Tag.ToString()); + + switch (chk.Parent.Tag.ToString().ToLower()) + { + case "s0": + var v0 = (DevAGV.esystemflag0)idx; + AGV.SetAGV(v0, chk.Checked); + break; + case "s1": + var v1 = (DevAGV.esystemflag1)idx; + AGV.SetAGV(v1, chk.Checked); + break; + case "er": + var v2 = (DevAGV.eerror)idx; + AGV.SetAGV(v2, chk.Checked); + break; + case "sg": + var v3 = (DevAGV.esignal)idx; + AGV.SetAGV(v3, chk.Checked); + break; + } + + chk.BackColor = chk.Checked ? Color.Lime : SystemColors.Window; + } + + private void button18_Click(object sender, EventArgs e) + { + AGV.SendTag(numericUpDown1.Value.ToString()); + } + + private void button1_Click(object sender, EventArgs e) + { + var bt = sender as Button; + var kitno = nudBMSKitNo.Value.ToString()[0]; + var value = bt.Tag.ToString()[0]; + var barr = new List(); + barr.Add(0x02); + barr.Add((byte)kitno); + barr.Add((byte)value); + barr.Add(0x03); + CAL.WriteData(barr.ToArray()); + } + + private void serAGV_Load(object sender, EventArgs e) + { + + } + + private void agvViewer1_Click(object sender, EventArgs e) + { + + } + + private void agvViewer1_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + agvViewer1.StopbyMark = !agvViewer1.StopbyMark; + } + else if (e.Button == MouseButtons.Right) + { + MakeViewer(); + } + } + + private void radioButton20_Click(object sender, EventArgs e) + { + var rad = sender as RadioButton; + var kitno = int.Parse(rad.Text); + nudBMSKitNo.Value = (decimal)kitno; + } + + private void toolStripButton1_Click(object sender, EventArgs e) + { + serAGV.Connect(); + serPLC.Connect(); + serBMS.Connect(); + serCAL.Connect(); + } + + private void toolStripButton2_Click(object sender, EventArgs e) + { + serAGV.Disconnect(); + serPLC.Disconnect(); + serBMS.Disconnect(); + serCAL.Disconnect(); + } + + private void serBMS_Load(object sender, EventArgs e) + { + + } + + void checkboxevent() + { + + } + + private void GvdPLCFlag_ItemClick(object sender, arFrame.Control.GridView.ItemClickEventArgs e) + { + var newvalue = gvdPLCFlag.Values[e.idx]; + this.gvdPLCFlag.setValue(e.idx, (ushort)(newvalue == 0 ? 1 : 0)); + this.gvdPLCFlag.Invalidate(); + } + + private void GvdPLCInOut_ItemClick(object sender, arFrame.Control.GridView.ItemClickEventArgs e) + { + var newvalue = gvdPLCInOut.Values[e.idx]; + this.gvdPLCInOut.setValue(e.idx, (ushort)(newvalue == 0 ? 1 : 0)); + this.gvdPLCInOut.Invalidate(); + } + } +} diff --git a/Emulator/AGVEmulator/Form1.resx b/Emulator/AGVEmulator/Form1.resx new file mode 100644 index 0000000..12f786e --- /dev/null +++ b/Emulator/AGVEmulator/Form1.resx @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 104, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + 210, 17 + + \ No newline at end of file diff --git a/Emulator/AGVEmulator/Program.cs b/Emulator/AGVEmulator/Program.cs new file mode 100644 index 0000000..63e4d9c --- /dev/null +++ b/Emulator/AGVEmulator/Program.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace AGVEmulator +{ + static class Program + { + /// + /// 해당 애플리케이션의 주 진입점입니다. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } + public static class methodext + { + public static string HexString(this byte[] buf) + { + var sb = new System.Text.StringBuilder(); + foreach (var b in buf) + { + sb.Append(" " + b.ToString("X2")); + } + return sb.ToString(); + } + } + +} diff --git a/Emulator/AGVEmulator/Properties/AssemblyInfo.cs b/Emulator/AGVEmulator/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..abd4775 --- /dev/null +++ b/Emulator/AGVEmulator/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 +// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 +// 이러한 특성 값을 변경하세요. +[assembly: AssemblyTitle("AGVEmulator")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AGVEmulator")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 +// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 +// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. +[assembly: ComVisible(false)] + +// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. +[assembly: Guid("9312ab43-72f6-4365-a266-e767215fa7f5")] + +// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. +// +// 주 버전 +// 부 버전 +// 빌드 번호 +// 수정 버전 +// +// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 +// 기본값으로 할 수 있습니다. +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Emulator/AGVEmulator/Properties/Resources.Designer.cs b/Emulator/AGVEmulator/Properties/Resources.Designer.cs new file mode 100644 index 0000000..fdfabc2 --- /dev/null +++ b/Emulator/AGVEmulator/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 이 코드는 도구를 사용하여 생성되었습니다. +// 런타임 버전:4.0.30319.42000 +// +// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 +// 이러한 변경 내용이 손실됩니다. +// +//------------------------------------------------------------------------------ + +namespace AGVEmulator.Properties { + using System; + + + /// + /// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다. + /// + // 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder + // 클래스에서 자동으로 생성되었습니다. + // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을 + // 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AGVEmulator.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을 + /// 재정의합니다. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Emulator/AGVEmulator/Properties/Resources.resx b/Emulator/AGVEmulator/Properties/Resources.resx new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/Emulator/AGVEmulator/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Emulator/AGVEmulator/Properties/Settings.Designer.cs b/Emulator/AGVEmulator/Properties/Settings.Designer.cs new file mode 100644 index 0000000..63bd2b7 --- /dev/null +++ b/Emulator/AGVEmulator/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 이 코드는 도구를 사용하여 생성되었습니다. +// 런타임 버전:4.0.30319.42000 +// +// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 +// 이러한 변경 내용이 손실됩니다. +// +//------------------------------------------------------------------------------ + +namespace AGVEmulator.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Emulator/AGVEmulator/Properties/Settings.settings b/Emulator/AGVEmulator/Properties/Settings.settings new file mode 100644 index 0000000..abf36c5 --- /dev/null +++ b/Emulator/AGVEmulator/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Emulator/AGVEmulator/RS232.cs b/Emulator/AGVEmulator/RS232.cs new file mode 100644 index 0000000..04dba53 --- /dev/null +++ b/Emulator/AGVEmulator/RS232.cs @@ -0,0 +1,481 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading; + +namespace AR.Dev +{ + public abstract partial class RS232 : IDisposable + { + protected System.IO.Ports.SerialPort _device; + protected ManualResetEvent _mre; + protected byte[] LastReceiveBuffer; + + protected List tempBuffer = new List(); + protected Boolean findSTX = false; + + + public int WriteError = 0; + public string WriteErrorMessage = string.Empty; + public int WaitTimeout { get; set; } = 1000; + public int MinRecvLength { get; set; } = 1; + /// + /// 포트이름 + /// + [Description("시리얼 포트 이름")] + [Category("설정"), DisplayName("Port Name")] + public string PortName + { + get + { + if (_device == null) return string.Empty; + else return _device.PortName; + } + set + { + if (this.IsOpen) + { + Message?.Invoke(this, new MessageEventArgs("포트가 열려있어 포트이름을 변경할 수 없습니다", true)); + } + else if (String.IsNullOrEmpty(value) == false) + _device.PortName = value; + else + { + Message?.Invoke(this, new MessageEventArgs("No PortName", true)); + } + } + } + + public int BaudRate + { + get + { + if (_device == null) return 0; + else return _device.BaudRate; + } + set + { + if (this.IsOpen) + { + Message?.Invoke(this, new MessageEventArgs("포트가 열려있어 BaudRate(를) 변경할 수 없습니다", true)); + } + else if (value != 0) + _device.BaudRate = value; + else Message?.Invoke(this, new MessageEventArgs("No baud rate", true)); + } + } + + public string errorMessage { get; set; } + public DateTime LastConnTime { get; set; } + public DateTime LastConnTryTime { get; set; } + public DateTime lastSendTime; + /// + /// 메세지 수신시 사용하는 내부버퍼 + /// + protected List _buffer = new List(); + + /// + /// 최종 전송 메세지 + /// + public byte[] lastSendBuffer; + public byte[] LastRecvData; + public string LastRecvString + { + get + { + if (LastRecvData == null) return String.Empty; + else return System.Text.Encoding.Default.GetString(LastRecvData); + } + } + /// + /// 마지막으로 데이터를 받은 시간 + /// + public DateTime lastRecvTime; + + public RS232() + { + _device = new System.IO.Ports.SerialPort(); + this.BaudRate = 9600; + + _device.DataReceived += barcode_DataReceived; + _device.ErrorReceived += this.barcode_ErrorReceived; + _device.WriteTimeout = 5000; + _device.ReadTimeout = 5000; + _device.DtrEnable = false; + _device.RtsEnable = false; + _device.ReadBufferSize = 8192; + _device.WriteBufferSize = 8192; + + errorMessage = string.Empty; + lastRecvTime = DateTime.Parse("1982-11-23"); + LastConnTime = DateTime.Parse("1982-11-23"); + LastConnTryTime = DateTime.Parse("1982-11-23"); + lastRecvTime = DateTime.Parse("1982-11-23"); + this._mre = new ManualResetEvent(true); + } + + ~RS232() + { + Dispose(false); + } + + + // Flag: Has Dispose already been called? + bool disposed = false; + + // Public implementation of Dispose pattern callable by consumers. + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + // Protected implementation of Dispose pattern. + protected virtual void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free any other managed objects here. + // + } + + _device.DataReceived -= barcode_DataReceived; + _device.ErrorReceived -= this.barcode_ErrorReceived; + + // Free any unmanaged objects here. + // + disposed = true; + } + + public Boolean Open() + { + try + { + _device.Open(); + Message?.Invoke(this, new MessageEventArgs(msgtype: MessageType.Normal, $"port open:{_device.IsOpen}")); + return IsOpen; + } + catch (Exception ex) + { + errorMessage = ex.Message; + Message.Invoke(this, new MessageEventArgs(ex.Message, true)); + return false; + } + } + public string GetHexString(Byte[] input) + { + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + foreach (byte b in input) + sb.Append(" " + b.ToString("X2")); + return sb.ToString(); + } + + /// + /// 포트가 열려있는지 확인 + /// + [Description("현재 시리얼포트가 열려있는지 확인합니다")] + [Category("정보"), DisplayName("Port Open")] + public Boolean IsOpen + { + get + { + if (_device == null) return false; + return _device.IsOpen; + } + } + + public virtual void Close(Boolean PortClose = true) + { + if (_device != null && _device.IsOpen) + { + _device.DiscardInBuffer(); + _device.DiscardOutBuffer(); + if (PortClose) _device.Close(); //dispose에서는 포트를 직접 클리어하지 않게 해뒀다. + } + } + + public Boolean RaiseRecvData() + { + return RaiseRecvData(LastReceiveBuffer.ToArray()); + } + /// + /// 수신받은 메세지를 발생 시킵니다 + /// + /// + /// + public virtual Boolean RaiseRecvData(byte[] Data) + { + //181206 - 최종수신 메세지 기록 + lastRecvTime = DateTime.Now; + LastRecvData = Data; + + try + { + Message?.Invoke(this, new MessageEventArgs(Data, true)); //recvmessage + if (ProcessRecvData(Data) == false) + { + //Message?.Invoke(this, new MessageEventArgs(Data, true)); //recvmessage + Message?.Invoke(this, new MessageEventArgs(this.errorMessage, true)); //errormessage + return false; + } + else + { + + return true; + } + } + catch (Exception ex) + { + this.errorMessage = ex.Message; + this.Message?.Invoke(this, new MessageEventArgs(ex.Message, true)); + return false; + } + } + + /// + /// 수신받은 자료를 처리한다 + /// + /// + /// + public abstract bool ProcessRecvData(byte[] data); + + #region "Internal Events" + + void barcode_ErrorReceived(object sender, System.IO.Ports.SerialErrorReceivedEventArgs e) + { + Message?.Invoke(this, new MessageEventArgs(e.ToString(), true)); + } + + void barcode_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) + { + + try + { + int ReadCount = _device.BytesToRead; + + byte[] buffer = new byte[ReadCount]; + _device.Read(buffer, 0, buffer.Length); + + System.Text.StringBuilder LogMsg = new StringBuilder(); + + byte[] remainBuffer; + Repeat: + if (CustomParser(buffer, out remainBuffer)) + { + //parser ok + LastReceiveBuffer = tempBuffer.ToArray(); + RaiseRecvData(); + tempBuffer.Clear(); + if (remainBuffer != null && remainBuffer.Length > 0) + { + //버퍼를 변경해서 다시 전송을 해준다. + buffer = new byte[remainBuffer.Length]; + Array.Copy(remainBuffer, buffer, buffer.Length); + goto Repeat; //남은 버퍼가 있다면 진행을 해준다. + } + } + + } + catch (Exception ex) + { + if (IsOpen) + { + //_device.DiscardInBuffer(); + //_device.DiscardOutBuffer(); + } + errorMessage = ex.Message; + this.Message?.Invoke(this, new MessageEventArgs(ex.Message, true)); + } + + } + + + #endregion + + #region "External Events" + + + /// + /// 오류 및 기타 일반 메세지 + /// + public event EventHandler Message; + + #endregion + + #region "Event Args" + + /// + /// 데이터를 수신할떄 사용함(RAW 포함) + /// + public class ReceiveDataEventArgs : EventArgs + { + private byte[] _buffer = null; + + /// + /// 바이트배열의 버퍼값 + /// + public byte[] Value { get { return _buffer; } } + + /// + /// 버퍼(바이트배열)의 데이터를 문자로 반환합니다. + /// + public string StrValue + { + get + { + //return string.Empty; + + if (_buffer == null || _buffer.Length < 1) return string.Empty; + else return System.Text.Encoding.Default.GetString(_buffer); + } + } + public ReceiveDataEventArgs(byte[] buffer) + { + _buffer = buffer; + } + } + + /// + /// 메세지를 강제 발생 + /// + /// + /// + protected virtual void RaiseMessage(MessageType mt, string message) + { + this.Message?.Invoke(this, new MessageEventArgs(mt, message)); + } + public enum MessageType + { + Normal, + Error, + Send, + Recv, + } + + public class MessageEventArgs : EventArgs + { + public MessageType MsgType { get; set; } + private string _message = string.Empty; + + /// + /// Recv,Send,Normal,Error 모두 지원 + /// + public string Message { get { return _message; } } + + private byte[] _data = null; + + /// + /// Recv,Send에서만 값이 존재 합니다 + /// + public byte[] Data { get { return _data; } } + public MessageEventArgs(string Message, bool isError = false) + { + if (isError) MsgType = MessageType.Error; + else MsgType = MessageType.Normal; + _message = Message; + } + public MessageEventArgs(MessageType msgtype, string Message) + { + MsgType = msgtype; + _message = Message; + _data = System.Text.Encoding.Default.GetBytes(Message); + } + + public MessageEventArgs(byte[] buffer, bool isRecv = true) + { + if (isRecv) MsgType = MessageType.Recv; + else MsgType = MessageType.Send; + _data = new byte[buffer.Length]; + Array.Copy(buffer, _data, Data.Length); + _message = System.Text.Encoding.Default.GetString(_data); + } + + } + + #endregion + + + public virtual void AutoSendData() + { + + } + + protected abstract bool CustomParser(byte[] buf, out byte[] remainBuffer); + + /// + /// 데이터수신시간이 설정값보다 x 2.5를 초과하면 false 가 반환됨 + /// + public Boolean IsValid + { + get + { + if (IsOpen == false) return false; + if (lastRecvTime.Year == 1982) return false; + var ts = DateTime.Now - lastRecvTime; + if (ts.TotalSeconds > 5) return false; + return true; + } + } + public bool WriteData(string cmd) + { + return WriteData(System.Text.Encoding.Default.GetBytes(cmd)); + } + /// + /// 포트에 쓰기(barcode_DataReceived 이벤트로 메세지수신) + /// + public Boolean WriteData(byte[] data) + { + Boolean bRet = false; + + //171205 : 타임아웃시간추가 + if (!_mre.WaitOne(WaitTimeout)) + { + errorMessage = $"WriteData:MRE:WaitOne:TimeOut {WaitTimeout}ms"; + this.Message?.Invoke(this, new MessageEventArgs(errorMessage, true)); + return false; + } + + _mre.Reset(); + + //Array.Resize(ref data, data.Length + 2); + + try + { + lastSendTime = DateTime.Now; + if (lastSendBuffer == null) lastSendBuffer = new byte[data.Length]; //171113 + else Array.Resize(ref lastSendBuffer, data.Length); + Array.Copy(data, lastSendBuffer, data.Length); + + for (int i = 0; i < data.Length; i++) + _device.Write(data, i, 1); + + //_device.Write(data, 0, data.Length); + + //171113 + this.Message?.Invoke(this, new MessageEventArgs(data, false)); + + bRet = true; + WriteError = 0; + WriteErrorMessage = string.Empty; + } + catch (Exception ex) + { + // this.isinit = false; + this.Message?.Invoke(this, new MessageEventArgs(ex.Message, true)); + bRet = false; + WriteError += 1; //연속쓰기오류횟수 + WriteErrorMessage = ex.Message; + } + finally + { + _mre.Set(); + } + return bRet; + } + } +} diff --git a/Emulator/AGVEmulator/UC/AgvViewer.Designer.cs b/Emulator/AGVEmulator/UC/AgvViewer.Designer.cs new file mode 100644 index 0000000..e85de4f --- /dev/null +++ b/Emulator/AGVEmulator/UC/AgvViewer.Designer.cs @@ -0,0 +1,37 @@ + +namespace AGVEmulator.UC +{ + partial class AgvViewer + { + /// + /// 필수 디자이너 변수입니다. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 사용 중인 모든 리소스를 정리합니다. + /// + /// 관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 구성 요소 디자이너에서 생성한 코드 + + /// + /// 디자이너 지원에 필요한 메서드입니다. + /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/Emulator/AGVEmulator/UC/AgvViewer.cs b/Emulator/AGVEmulator/UC/AgvViewer.cs new file mode 100644 index 0000000..c51ace3 --- /dev/null +++ b/Emulator/AGVEmulator/UC/AgvViewer.cs @@ -0,0 +1,272 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AGVEmulator.UC +{ + public partial class AgvViewer : Control + { + + public AgvViewer() + { + InitializeComponent(); + + // Set Optimized Double Buffer to reduce flickering + this.SetStyle(ControlStyles.UserPaint, true); + this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); + this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); + + // Redraw when resized + this.SetStyle(ControlStyles.ResizeRedraw, true); + } + + public class TagArgs : EventArgs + { + public string Data { get; set; } + public bool Active { get; set; } + public TagArgs(string tag,bool act) + { + this.Data = tag; + this.Active = act; + } + } + public event EventHandler TagTouched; + public event EventHandler MarkTouched; + public event EventHandler Command; + + public bool StopbyMark { get; set; } + public float mpos = 100; + public float posmax = 1200; + public float posmin = 0; + public float mspd = 10; + public System.Diagnostics.Stopwatch wat = new System.Diagnostics.Stopwatch(); + public Font FontTag { get; set; } + public Font FontMrk { get; set; } + public int dir = 1; + + public class ptdata + { + public float pos { get; set; } = 0f; + public string data { get; set; } = string.Empty; + public Boolean active { get; set; } = false; + } + public ptdata[] listMRK { get; set; } + public ptdata[] listTAG { get; set; } + + public string lasttag { get; set; } = string.Empty; + public string lasttagdir { get; set; } = string.Empty; + public string lastmark { get; set; } = string.Empty; + public string lastmarkdir { get; set; } = string.Empty; + + protected override void OnPaint(PaintEventArgs pe) + { + pe.Graphics.Clear(this.BackColor); + var r = new Rectangle(DisplayRectangle.Left + Padding.Left, + DisplayRectangle.Top + Padding.Top, + DisplayRectangle.Width - Padding.Right - Padding.Left - 1, + DisplayRectangle.Height - Padding.Top - Padding.Bottom - 1); + + + // pe.Graphics.FillRectangle(new SolidBrush(this.BackColor), DisplayRectangle); + pe.Graphics.DrawRectangle(Pens.Black, r); + + + var ptwidth = 25; + var ptheight = 35; + if (listMRK != null && listMRK.Any() && FontMrk != null) + { + foreach (var item in listMRK) + { + var x = r.Left + ((item.pos * 1f) / posmax) * r.Width; + var rr = new RectangleF(x - ptwidth, r.Top + r.Height / 2f - ptheight / 2f, ptwidth * 2, ptheight); + pe.Graphics.DrawLine(Pens.Gray, x, r.Top, x, r.Bottom); + pe.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(120, Color.Gold)), rr); + pe.Graphics.DrawRectangle(Pens.DimGray, rr.Left, rr.Top, rr.Width, rr.Height); + pe.Graphics.DrawString(item.data, FontMrk, Brushes.Gray, rr, new StringFormat + { + Alignment = StringAlignment.Center, + LineAlignment = StringAlignment.Center, + }); + + } + } + + ptwidth = 15; + if (listTAG != null && listTAG.Any() && FontTag != null) + { + var lst = listTAG.Where(t => t.data.EndsWith("1")); + foreach (var item in lst) + { + var x = r.Left + ((item.pos * 1f) / posmax) * r.Width; + var rr = new RectangleF(x - ptwidth, r.Top + 5, ptwidth * 2, 15); + pe.Graphics.DrawLine(Pens.Orange, x, r.Top, x, rr.Top); + pe.Graphics.FillRectangle(Brushes.Orange, rr); + pe.Graphics.DrawRectangle(Pens.DimGray, rr.Left, rr.Top, rr.Width, rr.Height); + pe.Graphics.DrawString(item.data, FontTag, Brushes.Black, rr, new StringFormat + { + Alignment = StringAlignment.Center, + LineAlignment = StringAlignment.Center, + }); + } + + lst = listTAG.Where(t => t.data.EndsWith("0")); + foreach (var item in lst) + { + var x = r.Left + ((item.pos * 1f) / posmax) * r.Width; + var rr = new RectangleF(x - ptwidth, r.Bottom - 20, ptwidth * 2, 15); + pe.Graphics.DrawLine(Pens.Orange, x, rr.Bottom, x, r.Bottom); + pe.Graphics.FillRectangle(Brushes.Orange, rr); + pe.Graphics.DrawRectangle(Pens.DimGray, rr.Left, rr.Top, rr.Width, rr.Height); + pe.Graphics.DrawString(item.data, FontTag, Brushes.Black, rr, new StringFormat + { + Alignment = StringAlignment.Center, + LineAlignment = StringAlignment.Center, + }); + } + } + + var posX = r.Left + (mpos / posmax) * r.Width; + var posY = r.Top + r.Height / 2f; + var boxw = r.Width * 0.030f; + var boxh = r.Height * 0.15f; + var box = new RectangleF(posX - boxw, posY - boxh, boxw * 2, boxh * 2); + var box2 = new RectangleF(box.Left - 5, box.Top + 3, 10, box.Height - 6); + for (int i = 0; i < posmax; i += 100) + { + var x = r.Left + ((i * 1f) / posmax) * r.Width; + pe.Graphics.DrawLine(Pens.Black, x, r.Bottom - 3, x, r.Bottom); + if (i > 0) + pe.Graphics.DrawString($"{i / 10f}m", this.Font, Brushes.Black, x - 12, r.Bottom - 15); + } + pe.Graphics.FillRectangle(Brushes.LightSkyBlue, box); + pe.Graphics.DrawRectangle(Pens.Black, box.Left, box.Top, box.Width, box.Height); + pe.Graphics.DrawLine(new Pen(Color.Black, 4), posX, box.Top - 5, posX, box.Bottom + 5); + + pe.Graphics.FillRectangle(Brushes.Gold, box2); + pe.Graphics.DrawRectangle(Pens.Black, box2.Left, box2.Top, box2.Width, box2.Height); + //pe.Graphics.DrawString((mpos / 10f).ToString("N1") + "m", this.Font, Brushes.Black, box, new StringFormat + //{ + // Alignment = StringAlignment.Center, + // LineAlignment = StringAlignment.Center, + //}); + + if (StopbyMark) + pe.Graphics.DrawString("!MRK-STP!", this.Font, Brushes.Blue, r.Left+2, r.Top+2); + + if (wat.IsRunning) + { + var newpos = mspd * (wat.ElapsedMilliseconds / 1000f); + if (dir < 0) //forward + { + if (mpos - newpos < 0) + mpos = posmax; + else mpos -= newpos; + + //내위치주변에 마커가 있는지 본다 + var mlist = listMRK.Where(t => t.pos <= mpos && (mpos - t.pos) < 10); + var mrk = mlist.FirstOrDefault(); + if (mrk != null) + { + //대상마커가있다 + if (lastmark.Equals(mrk.data) == false || lastmarkdir.Equals("F") == false) + { + lastmark = mrk.data; + lastmarkdir = "F"; + mrk.active = true; + MarkTouched?.Invoke(this, new TagArgs(mrk.data,true)); + if(StopbyMark) + { + Command?.Invoke(this, new TagArgs("stop",true)); + StopbyMark = false; + } + } + } + else + { + if (string.IsNullOrEmpty(lastmark) == false) + { + foreach(var item in listMRK.Where(t=>t.active)) + { + item.active = false; + MarkTouched?.Invoke(this, new TagArgs(item.data,false)); + } + } + } + + //주변태그확인 + var tlist = listTAG.Where(t => t.pos <= mpos && (mpos - t.pos) < 10); + var tag = tlist.FirstOrDefault(); + if (tag != null) + { + //대상마커가있다 + if (lasttag.Equals(tag.data) == false || lasttagdir.Equals("F") == false) + { + lasttag = tag.data; + lasttagdir = "F"; + TagTouched?.Invoke(this, new TagArgs(tag.data, true)); + } + } + } + else //backward + { + if (mpos + newpos > posmax) + mpos = 0; + else mpos += newpos; + + //내위치주변에 마커가 있는지 본다 + var mlist = listMRK.Where(t => t.pos >= mpos && (t.pos - mpos) < 10); + var mrk = mlist.FirstOrDefault(); + if (mrk != null) + { + //대상마커가있다 + if (lastmark.Equals(mrk.data) == false || lastmarkdir.Equals("B") == false) + { + lastmark = mrk.data; + lastmarkdir = "B"; + mrk.active = true; + MarkTouched?.Invoke(this, new TagArgs(mrk.data, true)); + if (StopbyMark) + { + Command?.Invoke(this, new TagArgs("stop", true)); + StopbyMark = false; + } + } + } + else + { + if (string.IsNullOrEmpty(lastmark) == false) + { + foreach (var item in listMRK.Where(t => t.active)) + { + item.active = false; + MarkTouched?.Invoke(this, new TagArgs(item.data, false)); + } + } + } + + //주변태그확인 + var tlist = listTAG.Where(t => t.pos >= mpos && (t.pos - mpos) < 10); + var tag = tlist.FirstOrDefault(); + if (tag != null) + { + //대상마커가있다 + if (lasttag.Equals(tag.data) == false || lasttagdir.Equals("B") == false) + { + lasttag = tag.data; + lasttagdir = "B"; + TagTouched?.Invoke(this, new TagArgs(tag.data, true)); + } + } + } + + wat.Restart(); + } + } + } +} diff --git a/Emulator/AGVEmulator/UC/SerialConn.Designer.cs b/Emulator/AGVEmulator/UC/SerialConn.Designer.cs new file mode 100644 index 0000000..8665797 --- /dev/null +++ b/Emulator/AGVEmulator/UC/SerialConn.Designer.cs @@ -0,0 +1,162 @@ + +namespace AGVEmulator +{ + partial class SerialConn + { + /// + /// 필수 디자이너 변수입니다. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 사용 중인 모든 리소스를 정리합니다. + /// + /// 관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 구성 요소 디자이너에서 생성한 코드 + + /// + /// 디자이너 지원에 필요한 메서드입니다. + /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요. + /// + private void InitializeComponent() + { + this.cmbBaud = new System.Windows.Forms.ComboBox(); + this.cmbPOrt = new System.Windows.Forms.ComboBox(); + this.panel1 = new System.Windows.Forms.Panel(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.lbrx = new System.Windows.Forms.Label(); + this.lbtx = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.panel1.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // cmbBaud + // + this.cmbBaud.Dock = System.Windows.Forms.DockStyle.Top; + this.cmbBaud.Font = new System.Drawing.Font("굴림", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.cmbBaud.FormattingEnabled = true; + this.cmbBaud.Items.AddRange(new object[] { + "9600", + "12800", + "25600", + "38400", + "512000"}); + this.cmbBaud.Location = new System.Drawing.Point(0, 28); + this.cmbBaud.Name = "cmbBaud"; + this.cmbBaud.Size = new System.Drawing.Size(134, 28); + this.cmbBaud.TabIndex = 0; + this.cmbBaud.Text = "9600"; + // + // cmbPOrt + // + this.cmbPOrt.Dock = System.Windows.Forms.DockStyle.Top; + this.cmbPOrt.Font = new System.Drawing.Font("굴림", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.cmbPOrt.FormattingEnabled = true; + this.cmbPOrt.Location = new System.Drawing.Point(0, 0); + this.cmbPOrt.Name = "cmbPOrt"; + this.cmbPOrt.Size = new System.Drawing.Size(134, 28); + this.cmbPOrt.TabIndex = 1; + // + // panel1 + // + this.panel1.Controls.Add(this.tableLayoutPanel1); + this.panel1.Controls.Add(this.cmbBaud); + this.panel1.Controls.Add(this.cmbPOrt); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(134, 96); + this.panel1.TabIndex = 2; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.lbrx, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.lbtx, 1, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 56); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(134, 40); + this.tableLayoutPanel1.TabIndex = 4; + // + // lbrx + // + this.lbrx.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.lbrx.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbrx.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.lbrx.Location = new System.Drawing.Point(0, 0); + this.lbrx.Margin = new System.Windows.Forms.Padding(0); + this.lbrx.Name = "lbrx"; + this.lbrx.Size = new System.Drawing.Size(67, 40); + this.lbrx.TabIndex = 2; + this.lbrx.Text = "RX"; + this.lbrx.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lbtx + // + this.lbtx.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.lbtx.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbtx.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.lbtx.Location = new System.Drawing.Point(67, 0); + this.lbtx.Margin = new System.Windows.Forms.Padding(0); + this.lbtx.Name = "lbtx"; + this.lbtx.Size = new System.Drawing.Size(67, 40); + this.lbtx.TabIndex = 3; + this.lbtx.Text = "TX"; + this.lbtx.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // button1 + // + this.button1.Dock = System.Windows.Forms.DockStyle.Right; + this.button1.FlatAppearance.BorderColor = System.Drawing.Color.DodgerBlue; + this.button1.FlatAppearance.BorderSize = 3; + this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button1.Font = new System.Drawing.Font("맑은 고딕", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.button1.Location = new System.Drawing.Point(134, 0); + this.button1.Margin = new System.Windows.Forms.Padding(0); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(82, 96); + this.button1.TabIndex = 3; + this.button1.Text = "연결"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // SerialConn + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.panel1); + this.Controls.Add(this.button1); + this.Name = "SerialConn"; + this.Size = new System.Drawing.Size(216, 96); + this.panel1.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ComboBox cmbBaud; + private System.Windows.Forms.ComboBox cmbPOrt; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label lbtx; + private System.Windows.Forms.Label lbrx; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + } +} diff --git a/Emulator/AGVEmulator/UC/SerialConn.cs b/Emulator/AGVEmulator/UC/SerialConn.cs new file mode 100644 index 0000000..50834ec --- /dev/null +++ b/Emulator/AGVEmulator/UC/SerialConn.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AGVEmulator +{ + public partial class SerialConn : UserControl + { + public AR.Dev.RS232 dev { get; set; } + public SerialConn() + { + InitializeComponent(); + } + + void AttachEvent() + { + dev.Message += Dev_Message; + } + void DetachEvent() + { + dev.Message -= Dev_Message; + } + private void Dev_Message(object sender, AR.Dev.RS232.MessageEventArgs e) + { + if (e.MsgType == AR.Dev.RS232.MessageType.Recv) + ToggleRX(); + else if (e.MsgType == AR.Dev.RS232.MessageType.Send) + ToggleTX(); + } + + public void SetPortList(string[] list) + { + cmbPOrt.Items.Clear(); + foreach (var item in list) + cmbPOrt.Items.Add(item); + } + public string PortName + { + get + { + return cmbPOrt.Text; + } + set { this.cmbPOrt.Text = value; } + } + public int BaudRate + { + get + { + return int.Parse(cmbBaud.Text); + } + set + { + cmbBaud.Text = value.ToString(); + } + } + public void ToggleTX() + { + if (lbtx.BackColor == Color.DeepSkyBlue) + lbtx.BackColor = Color.White; + else lbtx.BackColor = Color.DeepSkyBlue; + } + public void ToggleRX() + { + if (lbrx.BackColor == Color.Lime) + lbrx.BackColor = Color.White; + else lbrx.BackColor = Color.Lime; + } + public void Disconnect() + { + if (this.dev.IsOpen) + { + DetachEvent(); + dev.Close(); + } + if (dev.IsOpen) + button1.BackColor = Color.Lime; + else button1.BackColor = Color.Tomato; + } + public void Connect() + { + if (this.dev.IsOpen) + { + DetachEvent(); + dev.Close(); + } + else + { + this.dev.PortName = cmbPOrt.Text; + this.dev.BaudRate = int.Parse(cmbBaud.Text); + AttachEvent(); + try + { + dev.Open(); + } + catch (Exception ex) + { + button1.BackColor = Color.Red; + } + } + + if (dev.IsOpen) + button1.BackColor = Color.Lime; + else button1.BackColor = Color.Tomato; + } + + private void button1_Click(object sender, EventArgs e) + { + if (this.dev == null) + { + MessageBox.Show("시리얼 개체가 연결되지 않았습니다"); + return; + } + if(int.TryParse(cmbBaud.Text,out int baud)==false) + { + MessageBox.Show("Baudrate 값이 올바르지 않습니다"); + return; + } + Connect(); + + + + + } + } +} diff --git a/Emulator/AGVEmulator/UC/SerialConn.resx b/Emulator/AGVEmulator/UC/SerialConn.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/Emulator/AGVEmulator/UC/SerialConn.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Emulator/AGVEmulator/app.config b/Emulator/AGVEmulator/app.config new file mode 100644 index 0000000..2c0f559 --- /dev/null +++ b/Emulator/AGVEmulator/app.config @@ -0,0 +1,3 @@ + + + diff --git a/Emulator/AGVEmulator/devBMS.cs b/Emulator/AGVEmulator/devBMS.cs new file mode 100644 index 0000000..0b00cc0 --- /dev/null +++ b/Emulator/AGVEmulator/devBMS.cs @@ -0,0 +1,228 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace AGVEmulator +{ + class DevBMS : AR.Dev.RS232 + { + public class RequestBatteryDataArgs : EventArgs + { + + public float Volt { get; set; } + public float Remain { get; set; } + public int CurA { get; set; } + public int MaxA { get; set; } + public RequestBatteryDataArgs() + { + this.Volt = 25; + this.Remain = 79f; + this.CurA = 40; + this.MaxA = 80; + } + } + public class RequestVoltageDataArgs : EventArgs + { + public UInt16[] cellVolt { get; set; } + public RequestVoltageDataArgs() + { + + cellVolt = new UInt16[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + } + } + + public event EventHandler RequestBatteryData; + public event EventHandler RequestVoltageData; + public override bool ProcessRecvData(byte[] data) + { + //dd로 시작하고 34개의 데이터(명령이 0D로 끝나면 34이고, 77로 끝나면 34보다크다) + var sample000D = "DD 03 00 1B 0A 65 00 00 21 63 29 04 00 00 2C 92 00 00 00 00 00 00 28 51 03 08 02 0B 69 0B 66 FC 9C 77"; + var sampleFC77 = "DD 03 00 1B 0A 6E 0D DD 04 00 10 0D 0A 0D 09 0D 0C 0D 09 0D 0A 0D 09 0D 09 0D 0C FF 38 77 DD 04 00 10 0D 0A 0D 09 0D 0C 0D 09 0D 0A 0D 09 0D 09 0D 0C FF 38 77"; + var sampleFD77 = "DD 03 00 1B 0A 6E 00 00 1F 4A 29 04 00 4E 2C D7 00 00 00 00 00 00 28 4C 03 08 02 0B 9F 0B A9 FB A7 77 DD 03 00 1B 0A 6E 00 00 1F 4A 29 04 00 4E 2C D7 00 00 00 00 00 00 28 4C 03 08 02 0B 9F 0B AA FB A6 77"; + + //basic + var basicinfosmaple = "0A 65 00 00 21 63 29 04 00 00 2C 92 00 00 00 00 00 00 28 51 03 08 02 0B 69 0B 66"; + var basic_payload = basicinfosmaple.Split(' ').ToList().Select(t => Convert.ToByte(t, 16)).ToArray(); //old + + + + var barr0D = sample000D.Split(' ').ToList().Select(t => Convert.ToByte(t, 16)).ToArray(); //old + var barrFC77 = sampleFC77.Split(' ').ToList().Select(t => Convert.ToByte(t, 16)).ToArray(); //setting + var barrFD77 = sampleFD77.Split(' ').ToList().Select(t => Convert.ToByte(t, 16)).ToArray(); //normal + + if (data.First() != 0xDD || data.Last() != 0x77) + { + RaiseMessage(MessageType.Error, "stx,etx error"); + return false; + } + var sts = data[1]; + var cmd = data[2]; + + RaiseMessage(MessageType.Normal, "Rx:" + data.HexString()); + byte sendOld = 0; + + if (cmd == 0x03) //get basic info + { + if (RequestBatteryData != null) + { + var p = new RequestBatteryDataArgs(); + RequestBatteryData.Invoke(this, p); + + //전압 + var Volt = (UInt16)(p.Volt * 100); + var arr_volt = BitConverter.GetBytes(Volt).Reverse().ToArray(); + Array.Copy(arr_volt, 0, basic_payload, 0, arr_volt.Length); + + //잔량A + var CurA = (UInt16)p.CurA; + var arr_cura = BitConverter.GetBytes(CurA).Reverse().ToArray(); + Array.Copy(arr_cura, 0, basic_payload, 4, arr_cura.Length); + + + //최대A + var MaxA = (UInt16)p.MaxA; + var arr_maxa = BitConverter.GetBytes(MaxA).Reverse().ToArray(); + Array.Copy(arr_maxa, 0, basic_payload, 6, arr_maxa.Length); + + //% + var perc = (byte)(int)p.Remain; + Array.Copy(new byte[] { perc }, 0, basic_payload, 19, 1); + + var datalen = (byte)basic_payload.Length; + var payload_cs = new List(); + payload_cs.Add(datalen); + payload_cs.AddRange(basic_payload); + var chks = MakeCheckSum(payload_cs); + + var buffer = new List(); + buffer.Add(0xdd); + buffer.Add(cmd); + buffer.Add(0x00); + buffer.Add(datalen); + buffer.AddRange(basic_payload); + buffer.AddRange(chks); + buffer.Add(0x77); + + + ////makechecksum + //UInt16 chksum = 0; + //for (int i = 3; i <= 19; i++) + //{ + // chksum += barrFD77[i]; + //} + //chksum = (UInt16)(0xFFFF - chksum + 1); + //Array.Copy(BitConverter.GetBytes(chksum).Reverse().ToArray(), 0, barrFD77, 20, 2); + + + RaiseMessage(MessageType.Normal, $"Volt:{p.Volt}v,Remain:{p.Remain}%"); + + var sendstr = System.Text.Encoding.Default.GetString(barr0D); + RaiseMessage(MessageType.Normal, "Tx:" + barr0D.HexString()); + WriteData(buffer.ToArray()); + } + } + else if (cmd == 0x04) //get cellvoltage + { + if (RequestVoltageData != null) + { + var p = new RequestVoltageDataArgs(); + RequestVoltageData.Invoke(this, p); + + //var sig = data.Skip(data.Length - 2).Take(1).First(); + + //cellvolt 240201 + var payload = new byte[8 * 2]; + for (int i = 0; i < 8; i++) + { + var volt = p.cellVolt[i]; + var arr_cellvolt = BitConverter.GetBytes(volt).Reverse().ToArray(); + Array.Copy(arr_cellvolt, 0, payload, ( i * 2), arr_cellvolt.Length); + } + + //makechecksum + var datalen = (byte)payload.Length; + var payload_cs = new List(); + payload_cs.Add(datalen); + payload_cs.AddRange(payload); + var chksum = MakeCheckSum(payload_cs); + + var buffer = new List(); + buffer.Add(0xDD); + buffer.Add(cmd); + buffer.Add(0x00); + buffer.Add(datalen); + buffer.AddRange(payload); + buffer.AddRange(chksum); + buffer.Add(0x77); + WriteData(buffer.ToArray()); + } + + } + + + + + return true; + } + public byte[] MakeCheckSum(IEnumerable payload) + { + UInt16 retval = 0; + var payloadsum = payload.Sum(t => t); + retval = (UInt16)(payloadsum); + retval = (UInt16)(0xFFFF - retval); + retval += 1; + + return BitConverter.GetBytes(retval).Reverse().ToArray(); + } + protected override bool CustomParser(byte[] buf, out byte[] remainBuffer) + { + //DD A5 03 00 FF FD 77 0D + //remainBuffer = new byte[] { }; + List remain = new List(); + bool retval = false; + foreach (var b in buf) + { + if (retval) + { + remain.Add(b); + continue; + } + + if (b == 0xDD) //stx + { + tempBuffer.Clear(); + tempBuffer.Add(b); + } + else if (b == 0x0D || b == 0x77) //etx + { + //과거데이터 34개이다 (DD A5 03 00 FF FD 77 0D) + //대쉬보드상태일때(DD A5 03 00 FF FD 77) + //설정상태일때-셀전압표시(DD A5 04 00 FF FC 77) + + tempBuffer.Add(b); + retval = true; + } + else + { + if (tempBuffer.Count > 0 && tempBuffer[0] == 0xDD) + { + tempBuffer.Add(b); + if (tempBuffer.Count > 10) + { + RaiseMessage(MessageType.Error, "buffer over"); + tempBuffer.Clear(); + retval = false; + } + } + else + { + //trash + } + } + } + remainBuffer = remain.ToArray(); + return retval; + } + } +} diff --git a/Emulator/AGVEmulator/packetFC.bin b/Emulator/AGVEmulator/packetFC.bin new file mode 100644 index 0000000..83dc36c Binary files /dev/null and b/Emulator/AGVEmulator/packetFC.bin differ diff --git a/Emulator/AGVEmulator/packetFD.bin b/Emulator/AGVEmulator/packetFD.bin new file mode 100644 index 0000000..c861398 Binary files /dev/null and b/Emulator/AGVEmulator/packetFD.bin differ diff --git a/Emulator/ArLog.Net4.dll b/Emulator/ArLog.Net4.dll new file mode 100644 index 0000000..1f7c09a Binary files /dev/null and b/Emulator/ArLog.Net4.dll differ diff --git a/Emulator/ArSetting.Net4.dll b/Emulator/ArSetting.Net4.dll new file mode 100644 index 0000000..941494f Binary files /dev/null and b/Emulator/ArSetting.Net4.dll differ diff --git a/Emulator/CarlosAg.ExcelXmlWriter.dll b/Emulator/CarlosAg.ExcelXmlWriter.dll new file mode 100644 index 0000000..7760d6d Binary files /dev/null and b/Emulator/CarlosAg.ExcelXmlWriter.dll differ diff --git a/Emulator/Winsock Orcas.dll b/Emulator/Winsock Orcas.dll new file mode 100644 index 0000000..3ac1126 Binary files /dev/null and b/Emulator/Winsock Orcas.dll differ diff --git a/Emulator/arControl.Net4.dll b/Emulator/arControl.Net4.dll new file mode 100644 index 0000000..84a8e10 Binary files /dev/null and b/Emulator/arControl.Net4.dll differ diff --git a/Emulator/arFrameControl.dll b/Emulator/arFrameControl.dll new file mode 100644 index 0000000..485ec1c Binary files /dev/null and b/Emulator/arFrameControl.dll differ