APD 추가

- HeadNo(JigNo)

PLC API 추가
This commit is contained in:
최이근 2026-02-21 10:04:45 +09:00
parent 5b4a856a2e
commit c6e9783950
3 changed files with 43 additions and 9 deletions

View File

@ -33,6 +33,38 @@ namespace ILSOS_CCW_H52A.Device
return sb.ToString();
}
public int WriteWordToBit((eWordOutput addrOffset, int bitNo) address, bool on)
{
var value = base.ReadWord((int)address.addrOffset, ePLCDevice.W, false);
short current = value.data;
if (on) {
current |= (short)(1 << address.bitNo);
} else {
current &= (short)~(1 << address.bitNo);
}
return base.WriteWord((int)address.addrOffset, current, ePLCDevice.W);
}
public bool ReadWordToBit((eWordInput addrOffset, int bitNo) address)
{
short current = ReadWord(address.addrOffset).data;
return (current & (1 << address.bitNo)) != 0;
}
public IEnumerable<bool> ReadWordToBits(eWordInput address, bool isLowerFirst = true)
{
var ret = new List<bool>();
int word = ReadWord(address).data;
if (isLowerFirst) {
for (int idx = 0; idx < 15; idx++)
ret.Add((word & (1 << idx)) != 0);
} else {
for (int idx = 15; idx > 0; idx--)
ret.Add((word & (1 << idx)) != 0);
}
return ret;
}
public override void MappingPLCAddr()
{

View File

@ -28,6 +28,7 @@ namespace WeldingCommon.Data
table.Columns.Add("Time", typeof(string));
table.Columns.Add(nameof(ActualProcessUnit.LotID), typeof(string));
table.Columns.Add(nameof(ActualProcessUnit.CellID), typeof(string));
table.Columns.Add(nameof(ActualProcessUnit.HeadNo), typeof(string));
table.Columns.Add(nameof(ActualProcessUnit.WeldType), typeof(string));
table.Columns.Add(nameof(ActualProcessUnit.EncoderCheck), typeof(bool));
table.Columns.Add(nameof(ActualProcessUnit.StartPointX), typeof(double));
@ -61,10 +62,10 @@ namespace WeldingCommon.Data
protected override void InsertItem(int index, ActualProcessUnit item)
{
base.InsertItem(index, item);
table.Rows.Add(item.Date.ToString("yyyy-MM-dd"), item.Date.ToString("HH:mm:ss.fff"), item.LotID, item.CellID, item.WeldType, item.EncoderCheck,
item.StartPointX, item.StartPointY, item.EndPointX, item.EndPointY,
item.WeldCondition, item.LaserOnDelay, item.LaserOffDelay, item.JumpDelay, item.MarkDelay,
item.PolygonDelay, item.Power, item.JumpSpeed, item.MarkSpeed, item.JumpX,
table.Rows.Add(item.Date.ToString("yyyy-MM-dd"), item.Date.ToString("HH:mm:ss.fff"), item.LotID, item.CellID, item.HeadNo, item.WeldType, item.EncoderCheck,
item.StartPointX, item.StartPointY, item.EndPointX, item.EndPointY,
item.WeldCondition, item.LaserOnDelay, item.LaserOffDelay, item.JumpDelay, item.MarkDelay,
item.PolygonDelay, item.Power, item.JumpSpeed, item.MarkSpeed, item.JumpX,
item.JumpY);
}
@ -81,10 +82,10 @@ namespace WeldingCommon.Data
private DateTime _Date;
public string LotID { get => _LodID; set => SetProperty(ref _LodID, value); }
private string _LodID;
public string CellID { get => _CellID; set => SetProperty(ref _CellID, value); }
private string _CellID;
public string HeadNo { get => _HeadNo; set => SetProperty(ref _HeadNo, value); }
private string _HeadNo;
public string WeldType { get => _WeldType; set => SetProperty(ref _WeldType, value); }
private string _WeldType;
public bool EncoderCheck { get => _EncoderCheck; set => SetProperty(ref _EncoderCheck, value); }

View File

@ -701,7 +701,7 @@ namespace WeldingCommon.Sequences {
Log.I(string.Format($"[Line Weld] Mark(Ramping) ({obj.PF2.X},{obj.PF2.Y})"));
} else {
// Ramping 이 없는 경우
_Scanner.WriteDA((uint)eAnalogPortOut.DA1, percentLaser1, eFunctionType.LIST);
_Scanner.WriteDA((uint)eAnalogPortOut.DA2, percentLaser2, eFunctionType.LIST);
_Scanner.MarkAbs(obj.PF2.X + xOffset, obj.PF2.Y + yOffset);
@ -726,6 +726,7 @@ namespace WeldingCommon.Sequences {
laserLog.EndPointY = obj.PF2.Y;
laserLog.LotID = Status.GetProcessingWeldingData().WorkLotId;
laserLog.CellID = Status.GetProcessingWeldingData().WorkCellId;
laserLog.HeadNo = Status.GetProcessingWeldingData().WeldingJigNo;
Status.GetProcessingWeldingData().APD.Add(laserLog);
}
@ -1607,7 +1608,7 @@ namespace WeldingCommon.Sequences {
// 2.2.3.1. Constant Range 파워 설정
_Scanner.WriteDA((uint)eAnalogPortOut.DA1, percentLaser1, eFunctionType.LIST);
_Scanner.WriteDA((uint)eAnalogPortOut.DA2, percentLaser2, eFunctionType.LIST);
// 2.2.3.2. Constant Range 구간 위치 변경
for (int iter = risingEdgeCount+firstEdgeCount; iter < totalCount - fallingEdgeCount; iter++) {
_Scanner.ArcAbs(obj.CenterPointF.X + xOffset, obj.CenterPointF.Y + yOffset, theta);
@ -1686,7 +1687,7 @@ namespace WeldingCommon.Sequences {
SetScannerProcessCondition(param, out percentLaser1, out percentLaser2);
Log.I(string.Format($"[Arc3P Weld] Weld Condition(No:{param.No + 1}) Setting(LaserOnDelay:{param.LaserOnDelay},LaserOffDelay:{param.LaserOffDelay},JumpDelay:{param.JumpDelay},MarkDelay:{param.MarkDelay},PolygonDelay:{param.PolygonDelay},Power:{param.LaserPower1},JumpSpeed:{param.JumpSpeed},MarkSpeed:{param.MarkSpeed})"));
//CSV Laser Log 추가
laserLog.Date = DateTime.Now;
laserLog.WeldType = "Arc3";