Cell APD Log 적용 최종 버전

This commit is contained in:
최민영 2026-02-06 14:35:53 +09:00
parent caf35988a7
commit a95534302f
4 changed files with 74 additions and 49 deletions

View File

@ -269,8 +269,6 @@ namespace ILSOS_ACW_H52A.Sequences
_RecipeManager = Application.Current.AuroraEnv().RecipeManager;
_SystemParameter = context.GetSetting<SystemParameter>(CommonSettingIds.SystemParameter);
InitDev(context);
if (!CheckDeviceReady(context))
{ //Check Device
@ -495,8 +493,8 @@ namespace ILSOS_ACW_H52A.Sequences
WaitingScannerList.Reset();
CompleteScannerList.Reset();
isTheFirstListWrite = true; // 작업 시작 시 처음 2개의 List는 입력하고 시작한다
isTheSecondListWrite = true;
isTheFirstListWrite = false; // 작업 시작 시 처음 2개의 List는 입력하고 시작한다
isTheSecondListWrite = false;
isTheFirstListExecute = true; // 제일 첫 List는 ExecuteList 필요. 이후는 AutoChange
InitAutoRunBit(); // GetRotaryCurrentPosition() 호출 이후 AutoStatus True 변경
@ -686,6 +684,7 @@ namespace ILSOS_ACW_H52A.Sequences
}
UpdateProductCount(context);
UpdateProductInfoForView();
SaveCellAPD();
}
//if (_SystemParameter.BypassModeLBAD == false) {
@ -1188,16 +1187,19 @@ namespace ILSOS_ACW_H52A.Sequences
return SEQ_CHECK_CYCLE_STOP;
}
private SequenceActionResult SaveResultData(SequenceContext context, string id, SequenceActionResult param)
private void SaveCellAPD()
{
if (Status.GetProcessingWeldingData().APD.Count > 0)
{
string directoryPath = "D:\\ILSOSConfig\\APD_History";
string fileName = Status.GetProcessingWeldingData().APD.First().Date.ToString("HHmmss") + "_" + Status.GetProcessingWeldingData().APD.First().CellID;
string fileName = DateTime.Now.ToString("HH") + "_CellAPD";
string fullPath = Path.Combine(directoryPath, Status.GetProcessingWeldingData().APD.First().Date.ToString("yyyy-MM-dd"), fileName);
Status.GetProcessingWeldingData().APD.CreateFiles(fullPath);
}
}
private SequenceActionResult SaveResultData(SequenceContext context, string id, SequenceActionResult param)
{
context.PutValue(ContextKey.KEY_SEQUENCE_RESULT, true);
return SequenceAction.Ok();
}

View File

@ -3,7 +3,6 @@ using Aurora.Api;
using Aurora.Api.Manager;
using Aurora.View;
using AuroraCellTracker;
//using AuroraOCT;
using AuroraIO;
using AuroraLaser;
using AuroraLaserScanner;
@ -13,7 +12,6 @@ using CoreUnit.Control.UserControl.Canvas;
using CoreUnit.Scanner.UserControl.ScannerCanvas;
using DB;
using Hermes;
using ILSOS_CCW_H52A.Device;
using ILSOS_CCW_H52A.Models;
using ILSOS_CCW_H52A.RMS;
using System;
@ -22,18 +20,18 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Windows;
using WeldingCommon;
using WeldingCommon.Alarm;
using WeldingCommon.Devices;
using WeldingCommon.Recipes;
using WeldingCommon.Sequences;
using WeldingCommon.Settings;
using WeldingCommon.Utils;
using static AuroraLBAD.Service.StreamLightLBAD;
using static ILSOS_CCW_H52A.Device.IOController_CCW_H52A;
using static ILSOS_CCW_H52A.Device.PLCControllerCCWH52A;
using static ILSOS_CCW_H52A.Device.ScannerListCCWH52A;
using Application = System.Windows.Application;
using SystemParameter = WeldingCommon.Settings.SystemParameter;
namespace ILSOS_CCW_H52A.Sequences
{
@ -43,6 +41,7 @@ namespace ILSOS_CCW_H52A.Sequences
const string SEQ_ENTER = "[SeqAutoRunCCWH52A] SEQ_ENTER"; // inputParam 으로 받자.
const string SEQ_CHECK_INIT_CONDITION = "[SeqAutoRunCCWH52A] Check Init Condition"; // Check Init Condition
const string SEQ_FORK_ENCODER_MONITOR = "[SeqAutoRunCCWH52A] Fork Encoder Monitor";
const string SEQ_ENCODER_MONITOR = "[SeqAutoRunCCWH52A] Check Encoder Monitor";
const string SEQ_JOIN_ENCODER_MONITOR = "[SeqAutoRunCCWH52A] Join Encoder Monitor";
@ -115,6 +114,10 @@ namespace ILSOS_CCW_H52A.Sequences
private uint _TodayProduct;
private uint _TotalProduct;
private double _LaserPowerByLBAD;
private int _CompletedJigNo;
private static bool isWeled;
private bool _ModulationMode;
private DateTime _AutoRunStartTime;
@ -127,9 +130,6 @@ namespace ILSOS_CCW_H52A.Sequences
private double _CellMeasureCenterOffsetX;
private double _CellMeasureCenterOffsetY;
private double _LaserPowerByLBAD;
private int _CompletedJigNo;
// MOTF
private TimeSpan _WeldInterval;
@ -147,12 +147,10 @@ namespace ILSOS_CCW_H52A.Sequences
private bool isTheSecondListWrite;
private bool isTheFirstListExecute;
private int _RecipeNo;
private static bool isWeled;
private bool _WeldingDone;
private bool UsePlcShotThemAll { get; set; } = false;
private bool UsePlcPositionCompensation { get; set; } = false;
private string RecipeFileName { get; set; } = "";
private enum InitErrorList
{
SUCCESS = 0,
@ -163,7 +161,6 @@ namespace ILSOS_CCW_H52A.Sequences
MOTF_OFF,
PLC_ALARM,
}
public SequenceBuilder Builder()
{
var sb = new SequenceBuilder(1000, true);
@ -174,18 +171,19 @@ namespace ILSOS_CCW_H52A.Sequences
sb.AddFork(SEQ_FORK_ENCODER_MONITOR);
sb.AddAction(SEQ_ENCODER_MONITOR, EncoderMonitor);
sb.AddJoin(SEQ_JOIN_ENCODER_MONITOR);
sb.AddAction(SEQ_CHECK_LOAD_COMPLETE, CheckLoadComplete);
sb.AddAction(SEQ_CHECK_SCANNER_LIST_COMPLETE, CheckScannerListComplete);
sb.AddDecision(SEQ_READY_SCANNER_LIST, ReadyScannerList);
sb.AddAction(SEQ_SET_PARAMS_RECEIVE_CELL_INFO_SEQ, SetReceiveCellInfo_SeqParams);
sb.AddSubsequence(SEQ_DO_ID_RECEIVE_CELL_INFO_SEQ, SequenceManager.GetSeqBuilder_SeqReceiveCellInfo());
sb.AddAction(SEQ_GET_PARAMS_RECEIVE_CELL_INFO_SEQ, GetReceiveCellInfo_SeqResult);
sb.AddAction(SEQ_SET_PARAMS_UPLOAD_WELDING_LIST_SEQ, SetUploadWeldingList_SeqParams);
sb.AddSubsequence(SEQ_DO_ID_UPLOAD_WELDING_LIST_SEQ, SequenceManager.GetSeqBuilder_SeqUploadWeldingList());
sb.AddAction(SEQ_GET_RESULT_UPLOAD_WELDING_LIST_SEQ, GetUploadWeldingList_SeqResult);
sb.AddAction(SEQ_SET_PARAMS_RECEIVE_CELL_INFO_SEQ, SetReceiveCellInfo_SeqParams); // Cell 정보를 받아와 입력한다.
sb.AddSubsequence(SEQ_DO_ID_RECEIVE_CELL_INFO_SEQ, SequenceManager.GetSeqBuilder_SeqReceiveCellInfo()); // cell 정보를 받아오는 Sub Seq 실행
sb.AddAction(SEQ_GET_PARAMS_RECEIVE_CELL_INFO_SEQ, GetReceiveCellInfo_SeqResult); // Cell 정보를 가져온다
sb.AddAction(SEQ_EXECUTE_WELDING, ExecuteWelding);
sb.AddAction(SEQ_REQUEST_UNLOAD_CELL, RequestUnloadCell);
@ -218,7 +216,11 @@ namespace ILSOS_CCW_H52A.Sequences
sb.Flows(sb[SEQ_CHECK_INIT_CONDITION] > sb[SEQ_INIT_CONDITION_ERROR] > sb.Final);
sb.Flows(sb[SEQ_FORK_ENCODER_MONITOR] > sb[SEQ_ENCODER_MONITOR] > sb[SEQ_JOIN_ENCODER_MONITOR] > sb[SEQ_COMPLETE]);
#region
#region
//sb.Flows(sb[SEQ_FORK_ENCODER_MONITOR] > sb[SEQ_ENCODER_MONITOR]);
////sb.Flows(sb[SEQ_FORK_ENCODER_MONITOR] > sb[SEQ_CHECK_LOAD_COMPLETE]);
//sb.Flows(sb[SEQ_JOIN_ENCODER_MONITOR] > sb[SEQ_COMPLETE]);
///
//// 1. 시퀀스 시작 ~ 포크
//sb.Flows(sb.Init > sb[SEQ_ENTER] > sb[SEQ_CHECK_INIT_CONDITION] > sb[SEQ_FORK_ENCODER_MONITOR]);
@ -276,7 +278,6 @@ namespace ILSOS_CCW_H52A.Sequences
//return null;
}
if (InitSequenceVariable(context) == false)
{
//AlarmManager.Alarm(AlarmCode.ALARM_SEQUENCE_AutoRun_InitVariableError);
@ -365,7 +366,12 @@ namespace ILSOS_CCW_H52A.Sequences
private bool CheckCondition_Interlock()
{
// PLC, Data, IO 등 Interlock checking
// Config checking
//if (_Scanner.Config.UseMarkingOnTheFly == false)
//{
// Log.E("ERROR Config Setting : Scanner Marking on the fly (OFF)");
// return false;
//}
return true;
}
@ -487,8 +493,8 @@ namespace ILSOS_CCW_H52A.Sequences
WaitingScannerList.Reset();
CompleteScannerList.Reset();
isTheFirstListWrite = true; // 작업 시작 시 처음 2개의 List는 입력하고 시작한다
isTheSecondListWrite = true;
isTheFirstListWrite = false; // 작업 시작 시 처음 2개의 List는 입력하고 시작한다
isTheSecondListWrite = false;
isTheFirstListExecute = true; // 제일 첫 List는 ExecuteList 필요. 이후는 AutoChange
InitAutoRunBit(); // GetRotaryCurrentPosition() 호출 이후 AutoStatus True 변경
@ -561,7 +567,7 @@ namespace ILSOS_CCW_H52A.Sequences
context.PutValue(ContextKey.KEY_SEQUENCE_RESULT, false);
return SEQ_INIT_CONDITION_ERROR;
}
// AutoMode 전환 시점
Status.EquipmentMode = eEquipmentMode.AUTO;
var startTime = DateTime.Now;
@ -612,6 +618,7 @@ namespace ILSOS_CCW_H52A.Sequences
{
isTheFirstListWrite = false;
Log.I("Write the 1st scanner list");
}
else
{
@ -619,6 +626,7 @@ namespace ILSOS_CCW_H52A.Sequences
{
isTheSecondListWrite = false;
Log.I("Write the 2nd scanner list");
}
else
{
@ -632,6 +640,7 @@ namespace ILSOS_CCW_H52A.Sequences
Log.I("ERR_SCANNER_LIST_PROCESSING_TIMEOVER");
return SequenceAction.Error();
// WON : 2칸 전에 용접을 진행하지 않아 현재 Angle이 CompleteScannerList.StartAngle + 45 범위를 벗어난 경우라면 에러 상황이 아니므로 에러로 처리 할 필요가 없다
// 위에 CheckCurrentEncoderAngle if문 조건 대신 아래 내용으로 테스트 해본 뒤에 적용 필요
//if (!CheckCurrentEncoderAngle(CompleteScannerList.StartAngle)) {
@ -665,9 +674,6 @@ namespace ILSOS_CCW_H52A.Sequences
_LotId = CompleteScannerList.LotId;
_CellId = CompleteScannerList.CellId;
_LaserPowerByLBAD = StreamLightLBAD.LaserPowerByLBAD[CompleteScannerList.JigNo];
_CompletedJigNo = CompleteScannerList.JigNo;
Log.I(string.Format("JigNo : {0}, Weld start : {1}, Weld End : {2}, WeldTime : {3}, interval : {4:F3}",
CompleteScannerList.JigNo, _WeldingStartTime.ToString("HH:mm:ss.fff"), _WeldEndTime.ToString("HH:mm:ss.fff"), _WeldingSpanTime.TotalMilliseconds, _WeldInterval.TotalSeconds));
@ -678,6 +684,7 @@ namespace ILSOS_CCW_H52A.Sequences
}
UpdateProductCount(context);
UpdateProductInfoForView();
SaveCellAPD();
}
//if (_SystemParameter.BypassModeLBAD == false) {
@ -729,17 +736,11 @@ namespace ILSOS_CCW_H52A.Sequences
if (currentAngle < startAngle + 45)// 다음 리스트 구간이 끝나기 전까지는 완료가 되어야 한다
{
Log.I(string.Format("Current encoder check OK, startAngle : {0}, currentAngle : {1})", startAngle, currentAngle));
_WeldingDone = true;
return true;
}
else Log.I(string.Format("Current encoder check NG(Too late), startAngle : {0}, currentAngle : {1})", startAngle, currentAngle));
}
else
{
Log.I(string.Format("Current encoder check NG(Too early), startAngle : {0}, currentAngle : {1})", startAngle, currentAngle));
_WeldingDone = false;
}
else Log.I(string.Format("Current encoder check NG(Too early), startAngle : {0}, currentAngle : {1})", startAngle, currentAngle));
return false;
}
@ -983,7 +984,6 @@ namespace ILSOS_CCW_H52A.Sequences
{
return null;
}
return SequenceAction.Ok();
}
@ -1021,7 +1021,6 @@ namespace ILSOS_CCW_H52A.Sequences
return SequenceAction.Ok();
}
private SequenceActionResult EncoderMonitor(SequenceContext context, string id, SequenceActionResult param)
{
int EncoderLogCount = 0;
@ -1040,7 +1039,6 @@ namespace ILSOS_CCW_H52A.Sequences
if (InputScannerList[(int)_WeldingScannerListNo - 1].CanExist)
{
Log.I($"Fork Before Min Rotate Encoder X : ({encoderX}), Encoder Y : ({currentAngle}), PLC Rotary : ({CurrentPosPLC}), List {_WeldingScannerListNo}, JigNo : ({InputScannerList[(int)_WeldingScannerListNo - 1].JigNo})");
EncoderLogCount = 0;
if (!_SystemParameter.BypassModeLBAD)
{
if (InputScannerList[(int)_WeldingScannerListNo - 1].CheckSendCellinfo == false)
@ -1067,13 +1065,15 @@ namespace ILSOS_CCW_H52A.Sequences
{
InputScannerList[(int)_WeldingScannerListNo - 1].WeldStartTime = DateTime.Now;
InputScannerList[(int)_WeldingScannerListNo - 1].WeldComplete = true;
EncoderLogCount = 0;
Log.I($"Laser On, Welding Complete. JigNo : ({InputScannerList[(int)_WeldingScannerListNo - 1].JigNo})");
}
if (EncoderLogCount == 0)
{
Log.I($"Fork Laser On Encoder X : ({encoderX}), Encoder Y : ({currentAngle}), PLC Rotary : ({CurrentPosPLC}), List {_WeldingScannerListNo} JigNo : ({InputScannerList[(int)_WeldingScannerListNo - 1].JigNo})");
Log.I($"Fork Laser On Encoder X : ({encoderX}), Encoder Y : ({currentAngle}), PLC Rotary : ({CurrentPosPLC}), List {_WeldingScannerListNo}, JigNo : ({InputScannerList[(int)_WeldingScannerListNo - 1].JigNo})");
}
EncoderLogCount = (EncoderLogCount + 1) % 10;
EncoderLogCount = (EncoderLogCount + 1) % 7;
}
for (int i = 0; i < _RotaryJigCount; i++)
@ -1156,6 +1156,7 @@ namespace ILSOS_CCW_H52A.Sequences
return SequenceAction.Ok();
}
private static string CheckCycleStop(SequenceContext context, string id, ICollection<string> branches, SequenceActionResult param)
{
Status.SetWorkingPosition(eWorkingPosition.CHECKING_CYCLE);
@ -1178,7 +1179,6 @@ namespace ILSOS_CCW_H52A.Sequences
}
// END ALL
#endregion
private static string CheckCanWelded(SequenceContext context, string id, ICollection<string> branches, SequenceActionResult param)
{
if (isWeled)
@ -1186,15 +1186,19 @@ namespace ILSOS_CCW_H52A.Sequences
else
return SEQ_CHECK_CYCLE_STOP;
}
private SequenceActionResult SaveResultData(SequenceContext context, string id, SequenceActionResult param)
private void SaveCellAPD()
{
if (Status.GetProcessingWeldingData().APD.Count > 0)
{
string directoryPath = "D:\\ILSOSConfig\\APD_History";
string fileName = Status.GetProcessingWeldingData().APD.First().Date.ToString("HHmmss") + "_" + Status.GetProcessingWeldingData().APD.First().CellID;
string fileName = DateTime.Now.ToString("HH") + "_CellAPD";
string fullPath = Path.Combine(directoryPath, Status.GetProcessingWeldingData().APD.First().Date.ToString("yyyy-MM-dd"), fileName);
Status.GetProcessingWeldingData().APD.CreateFiles(fullPath);
}
}
private SequenceActionResult SaveResultData(SequenceContext context, string id, SequenceActionResult param)
{
context.PutValue(ContextKey.KEY_SEQUENCE_RESULT, true);
return SequenceAction.Ok();
@ -1319,7 +1323,6 @@ namespace ILSOS_CCW_H52A.Sequences
private void OnSeqActionStop()
{
// ManualMode 전환 시점
Status.EquipmentMode = eEquipmentMode.MANUAL;
//PLC All BIT OFF
@ -1362,10 +1365,20 @@ namespace ILSOS_CCW_H52A.Sequences
}
}
// For CSV 저장용
public class CenterPositionData : NotifyPropertyChangedBase
{
private double _CenterX;
public double CenterX { get => _CenterX; set => SetProperty(ref _CenterX, value); }
private double _CenterY;
public double CenterY { get => _CenterY; set => SetProperty(ref _CenterY, value); }
}
public class SeqAutoRunCCWH52A_InitParam : InitParam
{
public ScoutSeqParams ScoutSeqParams { get; set; }
public bool UseStream { get; set; }
}
public class SeqAutoRunCCWH52A_OutParam : OutParam

View File

@ -79,8 +79,12 @@ namespace WeldingCommon.Data
{
public DateTime Date { get => _Date; set => SetProperty(ref _Date, value); }
private DateTime _Date;
public string LotID { get => Status.GetProcessingWeldingData().LotId; }
public string CellID { get => Status.GetProcessingWeldingData().CellId; }
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 WeldType { get => _WeldType; set => SetProperty(ref _WeldType, value); }
private string _WeldType;
public bool EncoderCheck { get => _EncoderCheck; set => SetProperty(ref _EncoderCheck, value); }

View File

@ -724,6 +724,8 @@ namespace WeldingCommon.Sequences {
laserLog.StartPointY = obj.PF1.Y;
laserLog.EndPointX = obj.PF2.X;
laserLog.EndPointY = obj.PF2.Y;
laserLog.LotID = Status.GetProcessingWeldingData().WorkLotId;
laserLog.CellID = Status.GetProcessingWeldingData().WorkCellId;
Status.GetProcessingWeldingData().APD.Add(laserLog);
}
@ -1658,6 +1660,8 @@ namespace WeldingCommon.Sequences {
laserLog.StartPointY = obj.PF1.Y;
laserLog.EndPointX = obj.PF2.X;
laserLog.EndPointY = obj.PF2.Y;
laserLog.LotID = Status.GetProcessingWeldingData().WorkLotId;
laserLog.CellID = Status.GetProcessingWeldingData().WorkCellId;
Status.GetProcessingWeldingData().APD.Add(laserLog);
if (obj.MadebyRCC) {
@ -1926,6 +1930,8 @@ namespace WeldingCommon.Sequences {
laserLog.StartPointY = obj.PF1.Y;
laserLog.EndPointX = obj.PF2.X;
laserLog.EndPointY = obj.PF2.Y;
laserLog.LotID = Status.GetProcessingWeldingData().WorkLotId;
laserLog.CellID = Status.GetProcessingWeldingData().WorkCellId;
Status.GetProcessingWeldingData().APD.Add(laserLog);
if (obj.MadebyRCC) {