Compare commits
3 Commits
d5516f9708
...
0396c61517
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0396c61517 | ||
|
|
b4da1cca00 | ||
|
|
48acb5b7b7 |
@@ -147,31 +147,31 @@ namespace AGVNavigationCore.PathFinding.Planning
|
||||
for (int i = 0; i < pathResult.Path.Count; i++)
|
||||
{
|
||||
var node = pathResult.Path[i];
|
||||
string nextNodeId = (i + 1 < pathResult.Path.Count) ? pathResult.Path[i + 1].Id : null;
|
||||
var nextNode = (i + 1 < pathResult.Path.Count) ? pathResult.Path[i + 1] : null;
|
||||
|
||||
// 마그넷 방향 계산 (갈림길인 경우)
|
||||
MagnetDirection magnetDirection = MagnetDirection.Straight;
|
||||
|
||||
if (node.ConnectedNodes != null && node.ConnectedNodes.Count >= 3 && i > 0 && nextNodeId != null)
|
||||
if ((node.ConnectedNodes?.Count ?? 0) >= 2 && nextNode != null)
|
||||
{
|
||||
// 갈림길인 경우: 진입 방향과 진출 방향의 각도 계산
|
||||
var prevNode = pathResult.Path[i - 1];
|
||||
var nextNode = pathResult.Path[i + 1];
|
||||
//var prevNode = pathResult.Path[i - 1];
|
||||
//var nextNode = pathResult.Path[i + 1];
|
||||
|
||||
// 진입 각도 계산 (이전 노드 → 현재 노드)
|
||||
double entryAngle = Math.Atan2(
|
||||
node.Position.Y - prevNode.Position.Y,
|
||||
node.Position.X - prevNode.Position.X
|
||||
) * 180.0 / Math.PI;
|
||||
//double entryAngle = Math.Atan2(
|
||||
// node.Position.Y - prevNode.Position.Y,
|
||||
// node.Position.X - prevNode.Position.X
|
||||
//) * 180.0 / Math.PI;
|
||||
|
||||
// 진출 각도 계산 (현재 노드 → 다음 노드)
|
||||
double exitAngle = Math.Atan2(
|
||||
nextNode.Position.Y - node.Position.Y,
|
||||
nextNode.Position.X - node.Position.X
|
||||
) * 180.0 / Math.PI;
|
||||
|
||||
|
||||
// 각도 차이 계산 (-180~180 범위로 정규화)
|
||||
double angleDiff = exitAngle - entryAngle;
|
||||
double angleDiff = exitAngle;// - entryAngle;
|
||||
while (angleDiff > 180) angleDiff -= 360;
|
||||
while (angleDiff < -180) angleDiff += 360;
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace AGVNavigationCore.PathFinding.Planning
|
||||
}
|
||||
}
|
||||
|
||||
var nodeInfo = new NodeMotorInfo(i + 1, node.Id, node.RfidId, prevDirection, nextNodeId, magnetDirection);
|
||||
var nodeInfo = new NodeMotorInfo(i + 1, node.Id, node.RfidId, prevDirection, nextNode.Id, magnetDirection);
|
||||
|
||||
// 속도 설정
|
||||
var mapNode = _mapNodes.FirstOrDefault(n => n.Id == node.Id);
|
||||
|
||||
@@ -121,8 +121,8 @@ public static partial class EEMStatus
|
||||
|
||||
var file = System.IO.Path.Combine(path, $"{DateTime.Now.ToString("HHmmssfff")}_BMS_INF.sql");
|
||||
|
||||
var sql = "insert into AGV_Shuttle_BMS(MCID,wdate,info_volt,info_current,info_capa,info_level,info_temp1,info_temp2,soc,cycle,protection,balance) " +
|
||||
$"values('{mcid}','{timestr}',{data.packVoltage},{data.current},{data.fullCapacity},{data.RawLevel},{data.ntcTemp[0]},{data.ntcTemp[1]},{data.rsoc},{data.cycleCount},{data.raw_protection},{data.fullBalance})";
|
||||
var sql = "insert into AGV_Shuttle_BMS(MCID,wdate,info_volt,info_current,info_capa,info_level,info_temp1,info_temp2,soc,cycle,protection,balance,watt) " +
|
||||
$"values('{mcid}','{timestr}',{data.packVoltage},{data.current},{data.fullCapacity},{data.RawLevel},{data.ntcTemp[0]},{data.ntcTemp[1]},{data.rsoc},{data.cycleCount},{data.raw_protection},{data.fullBalance},{data.watt})";
|
||||
|
||||
System.IO.File.WriteAllText(file, sql, System.Text.Encoding.Default);
|
||||
LastBMSIFTime = DateTime.Now;
|
||||
|
||||
@@ -25,7 +25,8 @@ namespace arDev
|
||||
get
|
||||
{
|
||||
if (Voltage.Any() == false) return 0f;
|
||||
return Math.Abs(Voltage.Max() - Voltage.Min());
|
||||
var value = Math.Abs(Voltage.Max() - Voltage.Min());
|
||||
return value * 1000f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,7 +72,7 @@ namespace arDev
|
||||
protectionStatus = new BMSProtectionStatus();
|
||||
mosfetStatus = new BMSMosfetStatus();
|
||||
productionDate = new DateTime();
|
||||
ntcTemp = new float[] { 0f,0f};
|
||||
ntcTemp = new float[] { 0f, 0f };
|
||||
|
||||
}
|
||||
public void Clear()
|
||||
@@ -435,8 +436,8 @@ namespace arDev
|
||||
|
||||
//250620 jwlee 추가
|
||||
newinfo.ntcCount = LastReceiveBuffer[offset + 22]; //센서갯수
|
||||
int temp1 = (LastReceiveBuffer[offset + 23] << 8) | LastReceiveBuffer[24];
|
||||
int temp2 = (LastReceiveBuffer[offset + 25] << 8) | LastReceiveBuffer[36];
|
||||
int temp1 = (LastReceiveBuffer[offset + 23] << 8) | LastReceiveBuffer[offset + 24];
|
||||
int temp2 = (LastReceiveBuffer[offset + 25] << 8) | LastReceiveBuffer[offset + 26];
|
||||
var Current_temp1 = (temp1 - 2731) / 10f;
|
||||
var Current_temp2 = (temp2 - 2731) / 10f;
|
||||
newinfo.ntcTemp = new float[] { (temp1 - 2731) / 10f, (temp2 - 2731) / 10f };
|
||||
|
||||
@@ -70,10 +70,14 @@ namespace Project.ViewForm
|
||||
else if (PUB.BMS.IsValid == false)
|
||||
this.lbCycle.Text = "데이터가 유효하지 않습니다";
|
||||
else
|
||||
this.lbCycle.Text = $"Cell Average:{volt.Average},Delta:{volt.Delta},Cycle({data.cycleCount})";
|
||||
this.lbCycle.Text = $"Average:{volt.Average:N2}v, Delta:{volt.Delta:N0}, Cycle({data.cycleCount})";
|
||||
this.arLabel1.Text = $"{data.rsoc}%";
|
||||
this.arLabel1.Sign = $"{data.packVoltage}v, {data.watt}w";// PUB.BMS.Current_Volt.ToString() + "v";
|
||||
this.cv1.Text = volt.Voltage[0].ToString("N3") + "v";
|
||||
this.arLabel1.Sign = $"{data.packVoltage}v, {data.watt:N0}w";// PUB.BMS.Current_Volt.ToString() + "v";
|
||||
|
||||
if (data.watt < 0) this.arLabel1.SignColor = Color.Tomato;
|
||||
else this.arLabel1.SignColor = Color.Lime;
|
||||
|
||||
this.cv1.Text = volt.Voltage[0].ToString("N3") + "v";
|
||||
this.cv2.Text = volt.Voltage[1].ToString("N3") + "v";
|
||||
this.cv3.Text = volt.Voltage[2].ToString("N3") + "v";
|
||||
this.cv4.Text = volt.Voltage[3].ToString("N3") + "v";
|
||||
|
||||
Reference in New Issue
Block a user