..
This commit is contained in:
@@ -1,14 +1,195 @@
|
||||
using AGVControl.Models;
|
||||
using AR;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace AGVControl
|
||||
{
|
||||
public class RFIDConnection
|
||||
{
|
||||
/// <summary>
|
||||
/// 시작지점
|
||||
/// </summary>
|
||||
public RFIDPoint P1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 종료지점
|
||||
/// </summary>
|
||||
public RFIDPoint P2 { get; set; }
|
||||
public bool DisableP1_to_P2 { get; set; }
|
||||
public bool DisableP2_to_P1 { get; set; }
|
||||
public float Distance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 도로의 사용여부
|
||||
/// </summary>
|
||||
public bool EnableP { get; set; }
|
||||
public bool EnableN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// AGV의 이동방향(리프트방향)
|
||||
/// 목적지 방향과의 일치를 위해 해당 방향을 설정할 수 있따
|
||||
/// </summary>
|
||||
public Direction? LiftDirectionP { get; set; }
|
||||
public Direction? LiftDirectionN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// AGV이동시 속도 (high, middle, low)
|
||||
/// </summary>
|
||||
public AgvSpeed? MoveSpeedP { get; set; }
|
||||
public AgvSpeed? MoveSpeedN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// AGV이동시 방향모드(좌분기, 전진, 우분기)
|
||||
/// </summary>
|
||||
public AgvRunDirection? MoveDirectionP { get; set; }
|
||||
public AgvRunDirection? MoveDirectionN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 파일저장 및 불러오기시 사용하는 문자열로 반환
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
public string DataFileString
|
||||
{
|
||||
get
|
||||
{
|
||||
var str_enbP = EnableP ? "1" : "0";
|
||||
var str_liftP = "";
|
||||
if (LiftDirectionP != null) str_liftP = ((int)LiftDirectionP).ToString();
|
||||
|
||||
var str_movespeedP = "";
|
||||
if (MoveSpeedP != null) str_movespeedP = ((int)MoveSpeedP).ToString();
|
||||
|
||||
var str_movdirP = "";
|
||||
if (MoveDirectionP != null) str_movdirP = ((int)MoveDirectionP).ToString();
|
||||
|
||||
var str_enbN = EnableP ? "1" : "0";
|
||||
var str_liftN = "";
|
||||
if (LiftDirectionN != null) str_liftN = ((int)LiftDirectionN).ToString();
|
||||
|
||||
var str_movespeedN = "";
|
||||
if (MoveSpeedN != null) str_movespeedN = ((int)MoveSpeedN).ToString();
|
||||
|
||||
var str_movdirN = "";
|
||||
if (MoveDirectionN != null) str_movdirN = ((int)MoveDirectionN).ToString();
|
||||
|
||||
|
||||
var PStr= $"{P1.Location.X},{P1.Location.Y},{P2.Location.X},{P2.Location.Y}," + //location
|
||||
$"{P1.Value},{P2.Value}," + //rfid values
|
||||
$"{str_enbP};{str_liftP};{str_movespeedP};{str_movdirP}," +
|
||||
$"{str_enbN};{str_liftN};{str_movespeedN};{str_movdirN}";
|
||||
|
||||
|
||||
return $"{PStr}";
|
||||
|
||||
|
||||
}
|
||||
set
|
||||
{
|
||||
var buf = value.Split(',');
|
||||
if (buf.Length >= 2)
|
||||
{
|
||||
var p1x = int.Parse(buf[0]);
|
||||
var p1y = int.Parse(buf[1]);
|
||||
var p2x = int.Parse(buf[2]);
|
||||
var p2y = int.Parse(buf[3]);
|
||||
var p1v = uint.Parse(buf[4]);
|
||||
var p2v = uint.Parse(buf[5]);
|
||||
|
||||
if (P1 == null) P1 = new RFIDPoint();
|
||||
P1.Location = new System.Drawing.Point(p1x, p1y);
|
||||
P1.Value = p1v;
|
||||
|
||||
if (P2 == null) P2 = new RFIDPoint();
|
||||
P2.Location = new System.Drawing.Point(p2x, p2y);
|
||||
P2.Value = p2v;
|
||||
|
||||
|
||||
if (buf[6].Contains(";")) //양방향 정보
|
||||
{
|
||||
var StrP = buf[6].Split(';');
|
||||
var StrN = buf[7].Split(';');
|
||||
|
||||
//Positive
|
||||
this.EnableP = StrP[0] == "1";
|
||||
|
||||
if (StrP[1].isEmpty()) LiftDirectionP = null;
|
||||
else LiftDirectionP = (Direction)int.Parse(StrP[1]);
|
||||
|
||||
if (StrP[2].isEmpty()) MoveSpeedP = null;
|
||||
else MoveSpeedP = (AgvSpeed)int.Parse(StrP[2]);
|
||||
|
||||
if (StrP[3].isEmpty()) MoveDirectionP = null;
|
||||
else MoveDirectionP = (AgvRunDirection)int.Parse(StrP[3]);
|
||||
|
||||
//Negative
|
||||
this.EnableN = StrN[0] == "1";
|
||||
|
||||
if (StrN[1].isEmpty()) LiftDirectionN = null;
|
||||
else LiftDirectionN = (Direction)int.Parse(StrN[1]);
|
||||
|
||||
if (StrN[2].isEmpty()) MoveSpeedN = null;
|
||||
else MoveSpeedN = (AgvSpeed)int.Parse(StrN[2]);
|
||||
|
||||
if (StrN[3].isEmpty()) MoveDirectionN = null;
|
||||
else MoveDirectionN = (AgvRunDirection)int.Parse(StrN[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EnableP = buf[6] == "1";
|
||||
|
||||
if (buf[7].isEmpty()) LiftDirectionP = null;
|
||||
else LiftDirectionP = (Direction)int.Parse(buf[7]);
|
||||
|
||||
if (buf[8].isEmpty()) MoveSpeedP = null;
|
||||
else MoveSpeedP = (AgvSpeed)int.Parse(buf[8]);
|
||||
|
||||
if (buf[9].isEmpty()) MoveDirectionP = null;
|
||||
else MoveDirectionP = (AgvRunDirection)int.Parse(buf[9]);
|
||||
|
||||
this.EnableN = this.EnableP;
|
||||
this.LiftDirectionN = this.LiftDirectionP;
|
||||
this.MoveSpeedN = this.MoveSpeedP;
|
||||
this.MoveDirectionN = this.MoveDirectionP;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public RFIDConnection(string dataline = "")
|
||||
{
|
||||
P1 = null;
|
||||
P2 = null;
|
||||
LiftDirectionP = null;
|
||||
MoveSpeedP = null;
|
||||
MoveDirectionP = null;
|
||||
EnableP = false;
|
||||
|
||||
LiftDirectionN = null;
|
||||
MoveSpeedN = null;
|
||||
MoveDirectionP = null;
|
||||
EnableP = false;
|
||||
|
||||
|
||||
if (dataline.isEmpty() == false) DataFileString = dataline;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 값이 설정되어있는지
|
||||
/// </summary>
|
||||
public bool HasValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (P1 == null || P2 == null) return false;
|
||||
if (LiftDirectionP == null && MoveSpeedP == null && MoveDirectionP == null &&
|
||||
LiftDirectionN == null && MoveSpeedN == null && MoveDirectionN == null) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -27,7 +208,7 @@ namespace AGVControl
|
||||
public override string ToString()
|
||||
{
|
||||
//연결정보를 확인
|
||||
return $"{P1.Value} ↔ {P2.Value},P1-2:{(DisableP1_to_P2 ? "X" : "O")},P2-1:{(DisableP2_to_P1 ? "X" : "O")}";
|
||||
return $"{P1.Value} ↔ {P2.Value},ENB:{(EnableP ? "O" : "X")}|{(EnableN ? "O" : "X")}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user