240 lines
8.9 KiB
C#
240 lines
8.9 KiB
C#
using Aurora.Api;
|
|
using Aurora.Api.Devices;
|
|
using Aurora.View;
|
|
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Reactive;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
#region 26.04.13
|
|
using static WeldingCommon.Recipes.MainRecipe;
|
|
using WeldingCommon.Recipes;
|
|
#endregion
|
|
namespace WeldingCommon.Recipes
|
|
{
|
|
public class MainRecipe : NotifyPropertyChangedBase, IRecipeItem, ICloneable
|
|
{
|
|
public enum eOutType
|
|
{
|
|
Analog, // V
|
|
Interval, // hz
|
|
}
|
|
public MainRecipe()
|
|
{
|
|
CurveParam = new LineParameter();
|
|
StraightParam = new LineParameter();
|
|
}
|
|
|
|
// Laser Parameter
|
|
public LineParameter CurveParam { get; set; }
|
|
public LineParameter StraightParam { get; set; }
|
|
|
|
// Motion Parameter
|
|
public double WeldingAcc { get; set; }
|
|
//public double AxisTPosition { get; set; }
|
|
public double AxisZPosition { get; set; }
|
|
|
|
public ProcessUnit StartPos { get; set; } = new ProcessUnit();
|
|
public ProcessUnit EndPos { get; set; } = new ProcessUnit();
|
|
|
|
public ProcessUnit MarkPos { get; set; } = new ProcessUnit();
|
|
public double MarkVoltage { get; set; }
|
|
public int MarkShotTimeMsec { get; set; }
|
|
|
|
//Binding된 객체가 []로 호출 시, 최초 데이터를 저장(생성)하지 못함.
|
|
//public ObservableCollection<ProcessArc> Arc { get; set; } = new ObservableCollection<ProcessArc>(new List<ProcessArc>(4));
|
|
public ProcessArc Arc1 { get; set; } = new ProcessArc();
|
|
public ProcessArc Arc2 { get; set; } = new ProcessArc();
|
|
public ProcessArc Arc3 { get; set; } = new ProcessArc();
|
|
public ProcessArc Arc4 { get; set; } = new ProcessArc();
|
|
public ObservableCollection<ProcessUnit> Units { get; set; } = new ObservableCollection<ProcessUnit>(new List<ProcessUnit>(8));
|
|
|
|
public bool HeightMeasureSkip { get; set; }
|
|
/*
|
|
장변 편차 (인덱스 번호 1번-4번, 5번-8번 편차)
|
|
단변 편차(인덱스 번호 1번-5번, 4번-8번 편차)
|
|
4 3 2 1
|
|
8 7 6 5
|
|
*/
|
|
public double JudgeLimit { get; set; }
|
|
public ObservableCollection<HeightMeareUnit> HeightSensorMeasurePoints { get; set; } = new ObservableCollection<HeightMeareUnit>();
|
|
|
|
public double LaserOnPosition { get; set; }
|
|
//public double LaserOnPositionOffset { get; set; }
|
|
//public double LaserOffPosition { get; set; }
|
|
//public double LaserOffPositionOffset { get; set; }
|
|
//public double RampingOnStartPos { get; set; }
|
|
public double RampingOnOverlapDist { get; set; }
|
|
public double RampingOnStartPower { get; set; }
|
|
public double RampingOffStartPos { get; set; }
|
|
public double RampingOffOverlapDist { get; set; }
|
|
public double RampingOffEndPower { get; set; }
|
|
// Min, Max 고민 필요
|
|
public double N2PressMFC { get; set; }
|
|
|
|
// notused Laser
|
|
public bool IsReviewMode { get => _IsReviewMode; set => SetProperty(ref _IsReviewMode, value); }
|
|
private bool _IsReviewMode;
|
|
public bool IsMarkMode { get; set; } = false;
|
|
|
|
public YAxisType YAxisUseType { get; set; }
|
|
public enum YAxisType
|
|
{
|
|
Y1,
|
|
Y2
|
|
}
|
|
|
|
public object Clone()
|
|
{
|
|
MainRecipe newRecipe = new MainRecipe();
|
|
newRecipe.CurveParam = CurveParam.Clone() as LineParameter;
|
|
newRecipe.StraightParam = StraightParam.Clone() as LineParameter;
|
|
newRecipe.WeldingAcc = WeldingAcc;
|
|
newRecipe.AxisZPosition = AxisZPosition;
|
|
newRecipe.StartPos = StartPos.Clone() as ProcessUnit;
|
|
newRecipe.EndPos = EndPos.Clone() as ProcessUnit;
|
|
newRecipe.MarkPos = MarkPos.Clone() as ProcessUnit;
|
|
newRecipe.MarkVoltage = MarkVoltage;
|
|
newRecipe.MarkShotTimeMsec = MarkShotTimeMsec;
|
|
newRecipe.Arc1 = Arc1.Clone() as ProcessArc;
|
|
newRecipe.Arc2 = Arc2.Clone() as ProcessArc;
|
|
newRecipe.Arc3 = Arc3.Clone() as ProcessArc;
|
|
newRecipe.Arc4 = Arc4.Clone() as ProcessArc;
|
|
|
|
for (int i = 0; i < Units.Count; i++)
|
|
newRecipe.Units.Add(Units[i].Clone() as ProcessUnit);
|
|
|
|
newRecipe.HeightMeasureSkip = HeightMeasureSkip;
|
|
newRecipe.JudgeLimit = JudgeLimit;
|
|
|
|
for (int i = 0; i < HeightSensorMeasurePoints.Count; i++)
|
|
newRecipe.HeightSensorMeasurePoints.Add(HeightSensorMeasurePoints[i].Clone() as HeightMeareUnit);
|
|
|
|
newRecipe.LaserOnPosition = LaserOnPosition;
|
|
newRecipe.RampingOnOverlapDist = RampingOnOverlapDist;
|
|
newRecipe.RampingOnStartPower = RampingOnStartPower;
|
|
newRecipe.RampingOffStartPos = RampingOffStartPos;
|
|
newRecipe.RampingOffOverlapDist = RampingOffOverlapDist;
|
|
newRecipe.RampingOffEndPower = RampingOffEndPower;
|
|
newRecipe.N2PressMFC = N2PressMFC;
|
|
newRecipe.IsReviewMode = IsReviewMode;
|
|
newRecipe.IsMarkMode = IsMarkMode; ;
|
|
newRecipe.YAxisUseType = YAxisUseType;
|
|
|
|
return newRecipe;
|
|
}
|
|
/*
|
|
var coreRatio = _mainRecipe.StraightParam.StraightCorePowerW / (_mainRecipe.StraightParam.StraightCorePowerW + _mainRecipe.StraightParam.StraightCorePowerW);
|
|
var Max = 3000;
|
|
var CoreMax = Max * coreRatio;
|
|
var StraightVoltage = (_mainRecipe.StraightParam.StraightCorePowerW / CoreMax) * 10;
|
|
var CornerVoltage = (_mainRecipe.StraightParam.CornerCorePowerW / CoreMax) * 10;
|
|
_mainRecipe.StraightParam.CornerRingPowerW = _mainRecipe.StraightParam.CornerRingPowerW * (1 - coreRatio / coreRatio);
|
|
|
|
_laser.SetData(csWriteNodeNo.IW03, (int)coreRatio);
|
|
*/
|
|
}
|
|
}
|
|
public class LineParameter : NotifyPropertyChangedBase, ICloneable
|
|
{
|
|
public double ShotTime { get => _ShotTime; set => _ShotTime = value; }
|
|
private double _ShotTime;
|
|
// Min, Max 고민 필요
|
|
public double Velocity { get; set; }
|
|
|
|
#region ACS Output Param
|
|
public eOutType OutputType { get => _OutputType; set => _OutputType = value; }
|
|
private eOutType _OutputType;
|
|
public double Output { get => _Output; set => _Output = value; }
|
|
private double _Output;
|
|
#endregion
|
|
|
|
#region Laser Out Param
|
|
public double CorePowerW { get => _CorePowerW; set => SetProperty(ref _CorePowerW, value); }
|
|
public double _CorePowerW;
|
|
public double RingPowerW { get => _RingPowerW; set => SetProperty(ref _RingPowerW, value); }
|
|
public double _RingPowerW;
|
|
|
|
public object Clone()
|
|
{
|
|
LineParameter newItem = new LineParameter();
|
|
newItem.ShotTime = ShotTime;
|
|
newItem.Velocity = Velocity;
|
|
newItem.OutputType = OutputType;
|
|
newItem.Output = Output;
|
|
newItem.CorePowerW = CorePowerW;
|
|
newItem.RingPowerW = RingPowerW;
|
|
return newItem;
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
public class ProcessUnit : NotifyPropertyChangedBase, ICloneable
|
|
{
|
|
public int Index { get => _Index; set => SetProperty(ref _Index, value); }
|
|
private int _Index;
|
|
|
|
public double PosX { get => _PosX; set => SetProperty(ref _PosX, value); }
|
|
private double _PosX;
|
|
|
|
public double PosY { get => _PosY; set => SetProperty(ref _PosY, value); }
|
|
private double _PosY;
|
|
|
|
public object Clone()
|
|
{
|
|
ProcessUnit newItem = new ProcessUnit();
|
|
newItem.Index = Index;
|
|
newItem.PosX = PosX;
|
|
newItem.PosY = PosY;
|
|
return newItem;
|
|
}
|
|
}
|
|
|
|
public class ProcessArc : NotifyPropertyChangedBase, ICloneable
|
|
{
|
|
public int Index { get => _Index; set => SetProperty(ref _Index, value); }
|
|
private int _Index;
|
|
|
|
public double Size { get => _Size; set => SetProperty(ref _Size, value); }
|
|
private double _Size;
|
|
|
|
public object Clone()
|
|
{
|
|
ProcessArc newItem = new ProcessArc();
|
|
newItem.Index = Index;
|
|
newItem.Size = Size;
|
|
return newItem;
|
|
}
|
|
}
|
|
|
|
public class HeightMeareUnit : NotifyPropertyChangedBase, ICloneable
|
|
{
|
|
public int Index { get => _Index; set => SetProperty(ref _Index, value); }
|
|
private int _Index;
|
|
|
|
public double PosX { get => _PosX; set => SetProperty(ref _PosX, value); }
|
|
private double _PosX;
|
|
|
|
public double PosY { get => _PosY; set => SetProperty(ref _PosY, value); }
|
|
private double _PosY;
|
|
|
|
public object Clone()
|
|
{
|
|
HeightMeareUnit newItem = new HeightMeareUnit();
|
|
newItem.Index = Index;
|
|
newItem.PosX = PosX;
|
|
newItem.PosY = PosY;
|
|
return newItem;
|
|
}
|
|
|
|
//public double LoadDirRefBase { get => _LoadDirRefBase; set => SetProperty(ref _LoadDirRefBase, value); }
|
|
//private double _LoadDirRefBase;
|
|
|
|
//public double UnloadDirRefBase { get => _UnloadDirRefBase; set => SetProperty(ref _UnloadDirRefBase, value); }
|
|
//private double _UnloadDirRefBase;
|
|
} |