Compare commits

..

No commits in common. "main" and "reFac" have entirely different histories.
main ... reFac

18 changed files with 68 additions and 1451 deletions

View File

@ -26,7 +26,7 @@ namespace AuroraCellTracker
public class CellTracker : Device
{
Logger _Logger = new Logger("CellTracker");
public ICellTracker _CellTracker;
ICellTracker _CellTracker;
public CellTrackerConfig _CellTrackerConfig { get; set; }
private ICellTracker[] _MultiCellTrackerObj = new ICellTracker[4];

View File

@ -149,8 +149,6 @@ namespace AuroraCellTracker.DaekhonCoporation
{
string lotId = "", cellId = "";
bool gotNew = false;
if (selectedMode == eMode.Queue) {
if (null != dllSocketCtrl) {
string str = dllSocketCtrl.DllSocket_GetReceiveMessageInQueue(true, true);
@ -160,7 +158,6 @@ namespace AuroraCellTracker.DaekhonCoporation
CalcCellInfo(str, out lotId, out cellId);
SetCellInfo(lotId, cellId);
gotNew = true;
} else
CellInfoStrings.ReceiveStrInQueue = "Receive Length is 0";
} else
@ -170,32 +167,26 @@ namespace AuroraCellTracker.DaekhonCoporation
} else if (selectedMode == eMode.Callback) {
// Callback 방식의 경우, 자체 ConcurrentQueue에서 Deque해서 가져와야 함
CellInfoStr info;
if (CellInfoQueue.TryDequeue(out info)) {
SetCellInfo(info.LotID, info.CellID);
gotNew = true;
}
}
// Queue 방식인데 Cell Tracker에서 메세지가 안 왔거나,
// Callback 방식인데 실제 수신이 없거나(또는 같은 값이 연속으로 들어오는 경우),
// Queue 방식인데 Cell Tracker에서 메세지가 안 왔거나, Callback 방식인데 Cell Tracker API 함수가 Callback 안 된 경우(ex : ECS 오프라인 모드),
// Lot ID/Cell ID를 ES 지정사양에 맞추어 생성
if (!gotNew || (OldLotId == CellInfoStrings.LotID && OldCellId == CellInfoStrings.CellID)) {
if (OldLotId == CellInfoStrings.LotID && OldCellId == CellInfoStrings.CellID) {
CalcCellInfo("", out lotId, out cellId);
AddCellInfo(lotId, cellId);
CellInfoStr info;
if (CellInfoQueue.TryDequeue(out info)) {
if (CellInfoQueue.TryDequeue(out info))
{
SetCellInfo(info.LotID, info.CellID);
} else {
// 새로운 값이 안들어와도 일단 보여줌
SetCellInfo(lotId, cellId);
}
}
OldLotId = CellInfoStrings.LotID;
OldCellId = CellInfoStrings.CellID;
_Logger.I($"Received CellInfo >> count({CellInfoQueue.Count})");
}
public void SendData(string str, bool isSendToUpperSystem = false)

View File

@ -33,38 +33,6 @@ 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

@ -66,7 +66,6 @@ namespace ILSOS_CCW_H52A.Device
public bool CheckSendCellinfo { get; set; }
public bool CheckSendPLCLaserPower { get; set; }
public bool ReportComplete { get; set; }
public void SetReportComplete(bool comp) => ReportComplete = comp;
public override string ToString() => string.Format("{0},WriteTime({1}),WeldingCount({2}),StartAngle({3}),JigNo({4}),CanExist({5}),LotId({6}),CellId({7})",
ListNo, WriteTime.ToString("HHmmss.fff"), WeldingCount, StartAngle, JigNo, CanExist, LotId, CellId);

View File

@ -141,7 +141,6 @@ namespace ILSOS_CCW_H52A
public override void RegisterDevices(IDeviceRegistry registry)
{
registry.Register(CommonDeviceIds.Scanner, () => new ScannerCCWH52A(CommonDeviceIds.Scanner), new ScannerConfig());
base.RegisterDevices(registry);
var isSimul = ApplicationExt.IsSimulation;
@ -155,6 +154,8 @@ namespace ILSOS_CCW_H52A
() => _plc, PLCMelsecNetConfig.GetDefaultConfig(),
device => new UCPLCDevice() { DataContext = new UCPLCDeviceViewModel(AuroraEnv, _plc) });
registry.Register(CommonDeviceIds.Scanner, () => new ScannerCCWH52A(CommonDeviceIds.Scanner), new ScannerConfig());
var ioController = new IOController_CCW_H52A(AuroraEnv, CommonDeviceIds.IODevice);
registry.Register(CommonDeviceIds.IODevice, () => ioController, new IOUnitConfig());

View File

@ -106,10 +106,8 @@
<Compile Include="Recipes\RecipeEventHelper.cs" />
<Compile Include="RMS\EDC.cs" />
<Compile Include="Sequences\Monitoring\AlarmMonitoring.cs" />
<Compile Include="Sequences\ProcessObjects\ProcessManager.cs" />
<Compile Include="Sequences\ProcessObjects\ReceivedCellInfo.cs" />
<Compile Include="Sequences\ProcessManager.cs" />
<Compile Include="Sequences\SeqAutoRunCCWH52A.cs" />
<Compile Include="Sequences\SeqAutoRunRMOTF.cs" />
<Compile Include="Sequences\SequenceContextEx.cs" />
<Compile Include="Views\Main\UCMainAutoRun.xaml.cs">
<DependentUpon>UCMainAutoRun.xaml</DependentUpon>

View File

@ -5,34 +5,16 @@ using AuroraLaserScanner;
using AuroraPLC;
using ILSOS_CCW_H52A.Device;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using WeldingCommon;
using WeldingCommon.Data;
using static ILSOS_CCW_H52A.Device.PLCControllerCCWH52A;
namespace ILSOS_CCW_H52A.Sequences.ProcessObjects
namespace ILSOS_CCW_H52A.Sequences
{
public class ProcessManager
{
private static ProcessManager _Instance;
public static ProcessManager Instance {
get {
if (_Instance is null) {
_Instance = new ProcessManager();
}
return _Instance;
}
}
private IAuroraEnvironment _env;
private PLCControllerCCWH52A _plc;
private ScannerCCWH52A _scanner;
private bool usedAnalyzerLog = false;
private readonly Logger _log = new Logger("ProcessManager");
@ -42,21 +24,26 @@ namespace ILSOS_CCW_H52A.Sequences.ProcessObjects
public double DegreePerJig { get => RotaryMaxAngle / RotaryJigCount; }
public double HalfDegreePerJig { get => DegreePerJig / 2; }
//public ConcurrentQueue<ReceivedCellInfo>
public void Init(IAuroraEnvironment env)
private readonly IAuroraEnvironment _env;
private readonly PLCControllerCCWH52A _plc;
private readonly Scanner _scanner;
public ProcessManager()
{
_env = env;
_plc = _env.DeviceManager[DeviceIds.PLCDevice] as PLCControllerCCWH52A;
_scanner = _env.DeviceManager[DeviceIds.Scanner] as ScannerCCWH52A;
_scanner = _env.DeviceManager[DeviceIds.Scanner] as Scanner;
}
public IEnumerable<bool> CheckRotaryState()
{
List<bool> rotaryStates = new List<bool>();
for (int i = 0; i < RotaryJigCount; i++) {
var rotaryProcessState = _plc.ReadBit(eBitInput.PLC_USE_WELD_JIG_1 + i).data;
rotaryStates.Add(rotaryProcessState);
//if (rotaryProcessState == false)
// _plc.ToggleBit(eBitInput.PLC_USE_WELD_JIG_1 + i, eBitOutput.PC_WELD_COMPLETE_1 + i);
if (rotaryProcessState == false)
_plc.ToggleBit(eBitInput.PLC_USE_WELD_JIG_1 + i, eBitOutput.PC_WELD_COMPLETE_1 + i);
}
if (usedAnalyzerLog) {
@ -70,6 +57,8 @@ namespace ILSOS_CCW_H52A.Sequences.ProcessObjects
public bool GetRotaryCanExist(int jigNo)
{
//var RotaryStates = CheckRotaryState();
if (jigNo == 0)
jigNo = 1;

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ILSOS_CCW_H52A.Sequences.ProcessObjects
{
public class ReceivedCellInfo
{
public ReceivedCellInfo() {
}
}
}

View File

@ -1,10 +1,8 @@
using Aurora;
using Aurora.Api;
using Aurora.Api.Manager;
using Aurora.Util.HislogPlus;
using Aurora.View;
using AuroraCellTracker;
using AuroraCellTracker.DaekhonCoporation;
using AuroraIO;
using AuroraLaser;
using AuroraLaserScanner;
@ -460,8 +458,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
_PLC.WriteBit(eBitOutput.PC_AUTO_STATUS, true);
@ -1033,10 +1031,6 @@ namespace ILSOS_CCW_H52A.Sequences
return null;
}
// 중복 보고 방지 플래그 세팅
CompleteScannerList.SetReportComplete(true);
isWeled = false;
return SequenceAction.Ok();
}
@ -1060,23 +1054,12 @@ namespace ILSOS_CCW_H52A.Sequences
}
// END ALL
#endregion
private string CheckCanWelded(SequenceContext context, string id, ICollection<string> branches, SequenceActionResult param)
private static string CheckCanWelded(SequenceContext context, string id, ICollection<string> branches, SequenceActionResult param)
{
// 중복 보고 방지:
// - CanExist=false (skip 대상) 는 보고하지 않음(미사용)
// - WeldComplete=false (레이저 ON 감지/완료 처리 전) 는 보고하지 않음(미사용)
// - ReportComplete=true (이미 보고 완료) 는 다시 보고하지 않음
// .시퀀스가 너무 빨리 내려가서 보고하는 케이스로 예상
// 보고 누락:
// - 첫번째, 두번째는 UploadWeldingList를 해야하기 때문에 일단 넘긴다.
if (isWeled
//CompleteScannerList.CanExist &&
//CompleteScannerList.WeldComplete &&
&& !CompleteScannerList.ReportComplete)
if (isWeled)
return SEQ_SET_PARAMS_REPORT_CELL_RESULT_SEQ;
return SEQ_CHECK_CYCLE_STOP;
else
return SEQ_CHECK_CYCLE_STOP;
}
private void SaveCellAPD()
@ -1211,13 +1194,6 @@ namespace ILSOS_CCW_H52A.Sequences
{
Status.EquipmentMode = eEquipmentMode.MANUAL;
if((_CellTracker._CellTracker as CellTrackerDaekhon) != null && _CellTracker._CellTracker is CellTrackerDaekhon tracker){
Log.I($"Stoped Seq >> CellTracker Recv Queue count ({tracker.CellInfoQueue.Count})");
foreach (var info in tracker.CellInfoQueue.Select((value, index) => (value, index))) {
Log.I($"[{info.index}]Queue >> CellId[{info.value.CellID}] / LotId[{info.value.LotID}]");
}
}
//PLC All BIT OFF
for (int i = 0; i < _RotaryJigCount; i++)
_PLC.WriteBit(eBitOutput.PC_WELD_COMPLETE_1 + i, false);

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,6 @@ 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));
@ -62,7 +61,7 @@ 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.HeadNo, item.WeldType, item.EncoderCheck,
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,
@ -82,10 +81,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

@ -345,22 +345,27 @@ namespace WeldingCommon.Sequences
_FindPatternCount = 0;
return SEQ_DECISION_CHECK_OFFSET;
}
}
if (_InitParam.Is1StepCalibration) {
_Is1stepCount++;
Log.I(string.Format($"Is1stepCount : {_Is1stepCount} "));
return SEQ_FIND_PATTERN;
}
if (_NotFoundCount > 5) {
Log.I(string.Format($"Pattern Not Found. NotFoundCount OverFlow. Next Sequnece : SetVisionPositionFailed."));
} else {
if (_InitParam.Is1StepCalibration)
{
_Is1stepCount++;
Log.I(string.Format($"Is1stepCount : {_Is1stepCount} "));
return SEQ_FIND_PATTERN;
}
else
{
if(_NotFoundCount > 5)
{
Log.I(string.Format($"Pattern Not Found. NotFoundCount OverFlow. Next Sequnece : SetVisionPositionFailed."));
return SEQ_SET_VISION_POSITION_FAILED;
}
else {
_NotFoundCount++;
Log.I(string.Format($"NotFoundCount : {_NotFoundCount} "));
return SEQ_FIND_PATTERN;
else
{
_NotFoundCount++;
Log.I(string.Format($"NotFoundCount : {_NotFoundCount} "));
return SEQ_FIND_PATTERN;
}
}
}
}
@ -407,15 +412,12 @@ namespace WeldingCommon.Sequences
{
Log.I(string.Format($"Find Pattern Result Offset:[{_PatternOffsetX},{_PatternOffsetY}] Score:[{_Score}]"));
// Pattern Find OK
if (Math.Max(Math.Abs(_PatternOffsetX), Math.Abs(_PatternOffsetY)) < _InitParam.CheckOffset) {
Log.FuncI(string.Format($"Check Offset Result True Criteria:[{_InitParam.CheckOffset}] Max Offset:[{Math.Max(Math.Abs(_PatternOffsetX), Math.Abs(_PatternOffsetY))}"));
Log.I(string.Format($"Check Offset Result True Criteria:[{_InitParam.CheckOffset}] Max Offset:[{Math.Max(Math.Abs(_PatternOffsetX), Math.Abs(_PatternOffsetY))}"));
return SEQ_SET_VISION_POSITION;
}
// Pattern Find nOK >> 설정 범위 넘어감
else if (_FindPatternCount < 10) {
} else if (_FindPatternCount < 10) {
_CheckOffsetCount++;
Log.FuncI(string.Format($"Find Pattern Count[{_FindPatternCount}]"));
Log.I(string.Format($"Check Offset Result True Criteria:[{_InitParam.CheckOffset}] Max Offset:[{Math.Max(Math.Abs(_PatternOffsetX), Math.Abs(_PatternOffsetY))}"));
return SEQ_FIND_PATTERN;
} else {
Log.E(String.Format("ERROR_CHECK_OFFSET_COUNT_OVER"));

View File

@ -726,7 +726,6 @@ 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);
}

View File

@ -52,14 +52,12 @@ namespace WeldingCommon.Settings
var forRecipes = VisionRecipeManager.GetFovRecipes(forInfos);
if (forRecipes == null)
return;
#warning 여기서 이거 왜 새로 저장하는건지 확인 필요함
//foreach (var forRecipe in forRecipes) {
// // PixelSize
// forRecipe.CalFovRecipe.PixelSize.X = SysParam.CameraPixelSize;
// forRecipe.CalFovRecipe.PixelSize.Y = SysParam.CameraPixelSize;
//}
//RecipeFileManager.SaveVisionRecipe();
foreach (var forRecipe in forRecipes) {
// PixelSize
forRecipe.CalFovRecipe.PixelSize.X = SysParam.CameraPixelSize;
forRecipe.CalFovRecipe.PixelSize.Y = SysParam.CameraPixelSize;
}
RecipeFileManager.SaveVisionRecipe();
}
}
}

View File

@ -1,45 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WeldingCommon.Utils
{
public class ChangeChecker
{
private static Dictionary<string, bool> mapping = new Dictionary<string, bool>();
public static bool IsChangedBool(string Resource, bool value, bool defaultVal = false)
{
if (mapping.ContainsKey(Resource) == false) {
mapping[Resource] = defaultVal;
return false;
}
if (mapping[Resource] == value) {
return false;
}
mapping[Resource] = value;
return true;
}
public static bool IsChangedBoolMonitoring(string Resource, bool value, bool MonitoringValue, bool defaultVal = false)
{
if (mapping.ContainsKey(Resource) == false) {
mapping[Resource] = defaultVal;
return false;
}
if (mapping[Resource] == value) {
return false;
}
mapping[Resource] = value;
if(mapping[Resource] == MonitoringValue)
return true;
return false;
}
}
}

View File

@ -61,15 +61,6 @@
<DataGridTextColumn Header="Master Y" Binding="{Binding MasterY}"/>
<DataGridTextColumn Header="Vision X" Binding="{Binding VisionX}"/>
<DataGridTextColumn Header="Vision Y" Binding="{Binding VisionY}"/>
<DataGridTemplateColumn Header="Get Center Count">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Click"
Command="{Binding DataContext.CMD_GetCenterCnt, RelativeSource={RelativeSource AncestorType=DataGrid}}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>

View File

@ -44,7 +44,6 @@ namespace WeldingCommon.Views
public ICommand CMD_StopScannerCalibration { get; }
public ICommand CMD_FindPattern { get; }
public ICommand CMD_CalculateDistance { get; }
public ICommand CMD_GetCenterCnt { get; }
//public ICommand CMD_ChangedCaltype { get; }
//public ICommand CMD_SeqStop { get; }
@ -183,7 +182,6 @@ namespace WeldingCommon.Views
CMD_StopScannerCalibration = new DelegateCommand(PerformCmdStopScannerCalibration);
CMD_FindPattern = new DelegateCommand(PerformCmdFindPattern);
CMD_CalculateDistance = new DelegateCommand(PerformCmdCalculateDistance);
CMD_GetCenterCnt = new DelegateCommand(PerformCmdGetCenterCount);
_MonitorTimer = new DispatcherTimer();
_MonitorTimer.Tick += OnMonitoring;
@ -193,7 +191,6 @@ namespace WeldingCommon.Views
_Aurora.EventObservable.AsObservable(CommonSequenceIds.SeqScannerCalibration)
.ObserveOnDispatcher().Subscribe(x => OnUpdateCorrectionTable(x));
}
private void InitVariable()
{
GridRowCount = 13;
@ -621,19 +618,6 @@ namespace WeldingCommon.Views
Log.W($"{e.Message}");
}
}
private void PerformCmdGetCenterCount(object obj)
{
_Scanner.GetXYPos(out double currentX, out double currentY);
// Vision Scanner Calibration인 경우
int visionBitX = (int)(currentX * _Scanner.Config.ScaleXYFactor);
int visionBitY = (int)(currentY * _Scanner.Config.ScaleXYFactor);
VisionCorrectionList[SelectedRowIndex].VisionX = visionBitX;
VisionCorrectionList[SelectedRowIndex].VisionY = visionBitY;
}
}
public class CorrectionUnit : NotifyPropertyChangedBase
{
@ -663,4 +647,5 @@ namespace WeldingCommon.Views
private double _Distance;
public double Distance { get => _Distance; set => SetProperty(ref _Distance, value); }
}
}

View File

@ -248,7 +248,6 @@
<Compile Include="Settings\SystemParameter.cs" />
<Compile Include="Settings\SystemParameterManager.cs" />
<Compile Include="Status.cs" />
<Compile Include="Utils\ChangeChecker.cs" />
<Compile Include="Utils\CSV_Manager.cs" />
<Compile Include="Utils\ExcelManagementUnit.cs" />
<Compile Include="Utils\ImageUtil.cs" />