1058 lines
47 KiB
C#
1058 lines
47 KiB
C#
using Aurora;
|
|
using Aurora.Api.Devices;
|
|
using Aurora.Api;
|
|
using AuroraACS;
|
|
using AuroraLaser.Views;
|
|
using Hermes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Documents;
|
|
using WeldingCommon;
|
|
using WeldingCommon.Settings;
|
|
using ACS.SPiiPlusNET;
|
|
using ILSOS_PrismaticGun.Process;
|
|
using System.Security.RightsManagement;
|
|
using static ILSOS_PrismaticGun.Recipes.MainRecipe;
|
|
using System.Threading;
|
|
using CoreUnit.Control.UserControl.Canvas;
|
|
using ILSOS_PrismaticGun.Settings;
|
|
using AuroraMotionBoard.Ajin;
|
|
using System.Diagnostics;
|
|
using VisionCommon;
|
|
using ILSOS_PrismaticGun.Tools;
|
|
using WeldingCommon.Utils;
|
|
|
|
namespace ILSOS_PrismaticGun.Device.ACS
|
|
{
|
|
// ACS 함수가 너무 많아서.. 실제 사용부에서 편하게 사용하려고...
|
|
public interface IPrismaticGunACS
|
|
{
|
|
bool IsActivated();
|
|
bool SetOneShot(eStage stage, int msecShotTime, double secPhzShotPulse);
|
|
bool SetLineShot(eStage stage, double pulse, double startPos, double endPos, double velocity);
|
|
bool SetWeldingVel(eStage stage, double acc, double svel, double cvel);
|
|
bool SetWeldingPos(eStage stage, double startPosX, double startPosY, double endPosX, double endPosY);
|
|
bool SetWeldingArc(eStage stage, double point1, double point2, double point3, double point4);
|
|
|
|
bool SetWeldingType(eStage stage, eOutType type); // << 추후 추가 할 예정
|
|
bool SetWeldingPulse(eStage stage, double spulse, double cpulse);
|
|
bool SetLaserOnOff(eStage stage, double onPosX, double onOffSet, double offPosX, double offOffSet);
|
|
bool SetRamppingOffParameter(eStage stage, double pos, double overlap, double endpower);
|
|
bool SetRamppingOnParameter(eStage stage, double pos, double overlap, double startpower);
|
|
bool SetLCILserOn(eStage stage, bool on);
|
|
|
|
bool AllAxisHomeStart();
|
|
bool AllAxisHomeStop();
|
|
bool CheckAllAxisHome();
|
|
bool OneShotStart(eStage stage);
|
|
bool OneShotStop(eStage stage);
|
|
bool CheckOneShotComp(eStage stage);
|
|
bool LineShotStart(eStage stage);
|
|
bool CheckLineShotComp(eStage stage);
|
|
bool WeldingStart(eStage stage);
|
|
bool WeldingStop(eStage stage);
|
|
bool CheckWeldingComp(eStage stage);
|
|
bool ClampStart(eStage stage);
|
|
bool ClampStop(eStage stage);
|
|
bool CheckClampComp(eStage stage);
|
|
int CheckClampStep(eStage stage);
|
|
bool UnClampStart(eStage stage);
|
|
bool UnClampStop(eStage stage);
|
|
bool CheckUnclampComp(eStage stage);
|
|
int CheckUnclampStep(eStage stage);
|
|
bool SetWeldingTeachingPosition1(eStage stage, double PosX, double PosY);
|
|
bool SetWeldingTeachingPosition2(eStage stage, double PosX, double PosY);
|
|
bool SetWeldingTeachingPosition3(eStage stage, double PosX, double PosY);
|
|
bool SetWeldingTeachingPosition4(eStage stage, double PosX, double PosY);
|
|
bool SetWeldingTeachingPosition5(eStage stage, double PosX, double PosY);
|
|
bool SetWeldingTeachingPosition6(eStage stage, double PosX, double PosY);
|
|
bool SetWeldingTeachingPosition7(eStage stage, double PosX, double PosY);
|
|
bool SetWeldingTeachingPosition8(eStage stage, double PosX, double PosY);
|
|
bool CheckACSWeldingEnable(eStage stage);
|
|
bool ResetAlarm();
|
|
bool SetWeldingReset(eStage stage);
|
|
bool IsLaserOn(eStage stage);
|
|
}
|
|
public partial class PrismaticGunACS : ACSDevice, IPrismaticGunACS
|
|
{
|
|
private ACSDeviceSetting _setting;
|
|
private LaserPowerCalParam _calibration;
|
|
|
|
private TeachingPositionSetting _teachingSetting;
|
|
private ACSMotor AX, AY, BX, BY;
|
|
private AJINMotor AZ, BZ;
|
|
|
|
#region ACS Parameters
|
|
public MotionVariableCollection MotionVariables { get => _MotionVariables; }
|
|
private MotionVariableCollection _MotionVariables = new MotionVariableCollection();
|
|
|
|
public bool HasHeavyAlarm { get; private set; }
|
|
public bool HasLightAlarm { get; private set; }
|
|
public int[] HaveAlarmCodes { get => _HaveAlarmCodes; }
|
|
private int[] _HaveAlarmCodes = new int[11];
|
|
#endregion
|
|
|
|
public PrismaticGunACS(bool isSimulation, bool useTerminateUMD = false) : base(isSimulation, useTerminateUMD)
|
|
{
|
|
MotionVariables.Add(new MotionVariable(eStage.A));
|
|
MotionVariables.Add(new MotionVariable(eStage.B));
|
|
}
|
|
protected override int DoActivate(IDeviceConfig config)
|
|
{
|
|
if (base.DoActivate(config) != E1.OK)
|
|
return E2.ABORTED;
|
|
|
|
var env = Application.Current.AuroraEnv();
|
|
_setting = env.SettingEntry[SettingIds.ACS] as ACSDeviceSetting;
|
|
_calibration = env.SettingEntry[CommonSettingIds.LaserPowerCalParam] as LaserPowerCalParam;
|
|
_teachingSetting = env.SettingEntry[SettingIds.TeachingPos] as TeachingPositionSetting;
|
|
|
|
AX = env.DeviceManager[MotorIds.ALineX] as ACSMotor;
|
|
AY = env.DeviceManager[MotorIds.ALineY] as ACSMotor;
|
|
AZ = env.DeviceManager[MotorIds.ALineZ] as AJINMotor;
|
|
BX = env.DeviceManager[MotorIds.BLineX] as ACSMotor;
|
|
BY = env.DeviceManager[MotorIds.BLineY] as ACSMotor;
|
|
BZ = env.DeviceManager[MotorIds.BLineZ] as AJINMotor;
|
|
|
|
|
|
SetMonitoringService(UpdateACSParam, 50);
|
|
StartMonitoringService();
|
|
|
|
return E1.OK;
|
|
}
|
|
|
|
private void UpdateACSParam()
|
|
{
|
|
// Stage A Motor Parameter
|
|
MotionVariables[eStage.A].XAxisPosition = AX.GetActualPos();
|
|
MotionVariables[eStage.A].XInPosition = AX.IsInpos();
|
|
MotionVariables[eStage.A].XAxisVelocity = AX.GetFeedbackVelocity();
|
|
MotionVariables[eStage.A].XAxisLoadFactor = 0.0; // LoadFactorX(eStage.A);
|
|
|
|
MotionVariables[eStage.A].YAxisPosition = AY.GetActualPos();
|
|
MotionVariables[eStage.A].YInPosition = AY.IsInpos();
|
|
MotionVariables[eStage.A].YAxisVelocity = AY.GetFeedbackVelocity();
|
|
MotionVariables[eStage.A].YAxisLoadFactor = 0.0; // LoadFactorY(eStage.A);
|
|
|
|
MotionVariables[eStage.A].ZAxisPosition = AZ.GetCurrentPosition();
|
|
MotionVariables[eStage.A].ZInPosition = AZ.ReadInposition();
|
|
MotionVariables[eStage.A].IsHome = ReadVariableInt(AStageXHomeComp) > 0 && ReadVariableInt(AStageYHomeComp) > 0;
|
|
|
|
// Stage A Position Parameter
|
|
MotionVariables[eStage.A].IsLoadPosition = CheckTeachingPosition(eStage.A, eTeachingPosition.Load);
|
|
MotionVariables[eStage.A].IsUnloadPosition = CheckTeachingPosition(eStage.A, eTeachingPosition.UnLoad);
|
|
MotionVariables[eStage.A].IsSafetyPosition = CheckTeachingPosition(eStage.A, eTeachingPosition.SafetyPosition);
|
|
MotionVariables[eStage.A].IsWeldingStartPosition = CheckTeachingPosition(eStage.A, eTeachingPosition.StageWeldingStartPos);
|
|
|
|
MotionVariables[eStage.A].IsLoadEnable = CheckStageLoadingEnable(eStage.A);
|
|
//if (ChangeChecker.IsChangedBool("ALoadEnable", MotionVariables[eStage.A].IsLoadEnable))
|
|
// Debug.WriteLine($"A Load Enable [{!MotionVariables[eStage.A].IsLoadEnable} -> {MotionVariables[eStage.A].IsLoadEnable}] >> XPos[{MotionVariables[eStage.A].XAxisPosition}] YPos[{MotionVariables[eStage.A].YAxisPosition}] Home[{MotionVariables[eStage.A].IsHome}] ACS Active[{IsActivated}]");
|
|
|
|
MotionVariables[eStage.A].IsUnloadEnable = CheckStageUnloadingEnable(eStage.A);
|
|
//if (ChangeChecker.IsChangedBool("AUnloadEnable", MotionVariables[eStage.A].IsUnloadEnable))
|
|
// Debug.WriteLine($"A Unload Enable [{!MotionVariables[eStage.A].IsUnloadEnable} -> {MotionVariables[eStage.A].IsUnloadEnable}] >> XPos[{MotionVariables[eStage.A].XAxisPosition}] YPos[{MotionVariables[eStage.A].YAxisPosition}] Home[{MotionVariables[eStage.A].IsHome}] ACS Active[{IsActivated}]");
|
|
|
|
// Stage B Motor Parameter
|
|
MotionVariables[eStage.B].XAxisPosition = BX.GetActualPos();
|
|
MotionVariables[eStage.B].XInPosition = BX.IsInpos();
|
|
MotionVariables[eStage.B].XAxisVelocity = BX.GetFeedbackVelocity();
|
|
MotionVariables[eStage.B].XAxisLoadFactor = 0.0; // LoadFactorX(eStage.B);
|
|
|
|
MotionVariables[eStage.B].YAxisPosition = BY.GetActualPos();
|
|
MotionVariables[eStage.B].YInPosition = BY.IsInpos();
|
|
MotionVariables[eStage.B].YAxisVelocity = BY.GetFeedbackVelocity();
|
|
MotionVariables[eStage.B].YAxisLoadFactor = 0.0; // LoadFactorY(eStage.B);
|
|
|
|
MotionVariables[eStage.B].ZAxisPosition = BZ.GetCurrentPosition();
|
|
MotionVariables[eStage.B].ZInPosition = BZ.ReadInposition();
|
|
MotionVariables[eStage.B].IsHome = ReadVariableInt(BStageXHomeComp) > 0 && ReadVariableInt(BStageYHomeComp) > 0;
|
|
|
|
// Stage B Position Parameter
|
|
MotionVariables[eStage.B].IsLoadPosition = CheckTeachingPosition(eStage.B, eTeachingPosition.Load);
|
|
MotionVariables[eStage.B].IsUnloadPosition = CheckTeachingPosition(eStage.B, eTeachingPosition.UnLoad);
|
|
MotionVariables[eStage.B].IsSafetyPosition = CheckTeachingPosition(eStage.B, eTeachingPosition.SafetyPosition);
|
|
MotionVariables[eStage.B].IsWeldingStartPosition = CheckTeachingPosition(eStage.B, eTeachingPosition.StageWeldingStartPos);
|
|
|
|
MotionVariables[eStage.B].IsLoadEnable = CheckStageLoadingEnable(eStage.B);
|
|
//if (ChangeChecker.IsChangedBool("BLoadEnable", MotionVariables[eStage.B].IsLoadEnable))
|
|
// Debug.WriteLine($"B Load Enable [{!MotionVariables[eStage.B].IsLoadEnable} -> {MotionVariables[eStage.B].IsLoadEnable}] >> XPos[{MotionVariables[eStage.B].XAxisPosition}] YPos[{MotionVariables[eStage.B].YAxisPosition}] Home[{MotionVariables[eStage.B].IsHome}] ACS Active[{IsActivated}]");
|
|
|
|
MotionVariables[eStage.B].IsUnloadEnable = CheckStageUnloadingEnable(eStage.B);
|
|
//if (ChangeChecker.IsChangedBool("BUnloadEnable", MotionVariables[eStage.B].IsUnloadEnable))
|
|
// Debug.WriteLine($"B Unload Enable [{!MotionVariables[eStage.B].IsUnloadEnable} -> {MotionVariables[eStage.B].IsUnloadEnable}] >> XPos[{MotionVariables[eStage.B].XAxisPosition}] YPos[{MotionVariables[eStage.B].YAxisPosition}] Home[{MotionVariables[eStage.B].IsHome}] ACS Active[{IsActivated}]");
|
|
|
|
|
|
HasHeavyAlarm = ReadVariableInt(HeavyAlarm) == 1;
|
|
HasLightAlarm = ReadVariableInt(LightAlarm) == 1;
|
|
ReadVariableIntArrRef(AlarmCodes, ref _HaveAlarmCodes, ProgramBuffer.ACSC_NONE, 0, 10);
|
|
}
|
|
|
|
protected override int DoDeactivate()
|
|
{
|
|
StopMonitoringService();
|
|
return base.DoDeactivate();
|
|
}
|
|
bool IPrismaticGunACS.AllAxisHomeStart()
|
|
{
|
|
eLabel Label = eLabel.ALLAXIS_HOME;
|
|
var label = _setting.BufferInfoList[Label];
|
|
var Buffer = _setting.BufferInfoList[label];
|
|
if (RunBuffer((ProgramBuffer)Buffer, label)) {
|
|
Log.D("SetAllAxisHome >> Complete");
|
|
return true;
|
|
}
|
|
|
|
Log.D("SetAllAxisHome >> Fail");
|
|
return false;
|
|
}
|
|
|
|
bool IPrismaticGunACS.AllAxisHomeStop()
|
|
{
|
|
eLabel Label = eLabel.ALLAXIS_HOME;
|
|
var label = _setting.BufferInfoList[Label];
|
|
var Buffer = _setting.BufferInfoList[label];
|
|
StopBuffer((ProgramBuffer)Buffer);
|
|
Log.D("StopAllAxisHome >> Complete");
|
|
return true;
|
|
}
|
|
|
|
bool IPrismaticGunACS.CheckAllAxisHome()
|
|
{
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.AllHomeComp]) > 0;
|
|
}
|
|
|
|
bool IPrismaticGunACS.OneShotStart(eStage stage)
|
|
{
|
|
eLabel Label;
|
|
if (stage is eStage.A)
|
|
Label = eLabel.ASTAGE_ONESHOT;
|
|
else
|
|
Label = eLabel.BSTAGE_ONESHOT;
|
|
|
|
var label = _setting.BufferInfoList[Label];
|
|
var buffer = _setting.BufferInfoList[label];
|
|
|
|
if (RunBuffer((ProgramBuffer)buffer, label)) {
|
|
Log.D($"{Enum.GetName(typeof(eLabel), Label)} >> Complete");
|
|
return true;
|
|
}
|
|
|
|
Log.D("SetALineOneShotStart >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.LineShotStart(eStage stage)
|
|
{
|
|
eLabel Label;
|
|
if (stage is eStage.A)
|
|
Label = eLabel.ASTAGE_LINESHOT;
|
|
else
|
|
Label = eLabel.BSTAGE_LINESHOT;
|
|
|
|
var label = _setting.BufferInfoList[Label];
|
|
var Buffer = _setting.BufferInfoList[label];
|
|
if (RunBuffer((ProgramBuffer)Buffer, label)) {
|
|
Log.D($"{stage} : SetLineShotStart >> Complete");
|
|
return true;
|
|
}
|
|
|
|
Log.D($"{stage} : SetLineShotStart >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.WeldingStart(eStage stage)
|
|
{
|
|
if (IsSimul)
|
|
return true;
|
|
|
|
eLabel Label;
|
|
if (stage is eStage.A)
|
|
Label = eLabel.ASTAGE_WELDING;
|
|
else
|
|
Label = eLabel.BSTAGE_WELDING;
|
|
|
|
var label = _setting.BufferInfoList[Label];
|
|
var buffer = _setting.BufferInfoList[label];
|
|
|
|
if (RunBuffer((ProgramBuffer)buffer, label)) {
|
|
Log.I($"{Enum.GetName(typeof(eLabel), Label)} >> Complete");
|
|
return true;
|
|
}
|
|
|
|
Log.D($"{Enum.GetName(typeof(eLabel), Label)} >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.WeldingStop(eStage stage)
|
|
{
|
|
string command = string.Empty;
|
|
if (stage is eStage.A) {
|
|
command = "iPCset_ALINE_MOVE_STOP";
|
|
} else {
|
|
command = "iPCset_BLINE_MOVE_STOP";
|
|
}
|
|
if (WriteRealVariable(command, 1.0)) {
|
|
Log.D($"{stage} : SetWeldingVel >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetWeldingVel >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.ClampStart(eStage stage)
|
|
{
|
|
eLabel CLAMP;
|
|
if (stage is eStage.A) {
|
|
CLAMP = eLabel.ASTAGE_CLAMP;
|
|
} else {
|
|
CLAMP = eLabel.BSTAGE_CLAMP;
|
|
}
|
|
|
|
var Label = _setting.BufferInfoList[CLAMP];
|
|
var Buffer = _setting.BufferInfoList[Label];
|
|
if (RunBuffer((ProgramBuffer)Buffer, Label)) {
|
|
Log.D($"{Enum.GetName(typeof(eLabel), CLAMP)} >> Complete");
|
|
return true;
|
|
}
|
|
|
|
Log.D($"{Enum.GetName(typeof(eLabel), CLAMP)} >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.ClampStop(eStage stage)
|
|
{
|
|
eLabel CLAMP;
|
|
if (stage is eStage.A) {
|
|
CLAMP = eLabel.ASTAGE_CLAMP;
|
|
} else {
|
|
CLAMP = eLabel.BSTAGE_CLAMP;
|
|
}
|
|
|
|
var Label = _setting.BufferInfoList[CLAMP];
|
|
var Buffer = _setting.BufferInfoList[Label];
|
|
StopBuffer((ProgramBuffer)Buffer);
|
|
Log.D($"{Enum.GetName(typeof(eLabel), CLAMP)} Stop >> Complete");
|
|
|
|
return true;
|
|
}
|
|
bool IPrismaticGunACS.UnClampStart(eStage stage)
|
|
{
|
|
eLabel UNCLAMP;
|
|
|
|
if (stage is eStage.A) {
|
|
UNCLAMP = eLabel.ASTAGE_UNCLAMP;
|
|
} else {
|
|
UNCLAMP = eLabel.BSTAGE_UNCLAMP;
|
|
}
|
|
|
|
var Label = _setting.BufferInfoList[UNCLAMP];
|
|
var Buffer = _setting.BufferInfoList[Label];
|
|
if (RunBuffer((ProgramBuffer)Buffer, Label)) {
|
|
Log.D($"{Enum.GetName(typeof(eLabel), UNCLAMP)} >> Complete");
|
|
return true;
|
|
}
|
|
|
|
Log.D($"{Enum.GetName(typeof(eLabel), UNCLAMP)} >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.UnClampStop(eStage stage)
|
|
{
|
|
eLabel CLAMP;
|
|
if (stage is eStage.A) {
|
|
CLAMP = eLabel.ASTAGE_UNCLAMP;
|
|
} else {
|
|
CLAMP = eLabel.BSTAGE_UNCLAMP;
|
|
}
|
|
|
|
var Label = _setting.BufferInfoList[CLAMP];
|
|
var Buffer = _setting.BufferInfoList[Label];
|
|
StopBuffer((ProgramBuffer)Buffer);
|
|
Log.D($"{Enum.GetName(typeof(eLabel), CLAMP)} Stop >> Complete");
|
|
|
|
return true;
|
|
}
|
|
bool IPrismaticGunACS.SetOneShot(eStage stage, int msecShotTime, double secPhzShotPulse)
|
|
{
|
|
#warning calibration 제어 값이 Percent to watt로 써야하는건지 확인필요
|
|
//var calPower = _calibration.CalibratePercentToWatt(secPhzShotPulse);
|
|
|
|
eGlobalVariable ShotTime;
|
|
eGlobalVariable ShotPulse;
|
|
|
|
if (stage is eStage.A) {
|
|
ShotTime = eGlobalVariable.AStageShotTime;
|
|
ShotPulse = eGlobalVariable.AStageShotPulse;
|
|
} else {
|
|
ShotTime = eGlobalVariable.BStageShotTime;
|
|
ShotPulse = eGlobalVariable.BStageShotPulse;
|
|
}
|
|
|
|
// 셋팅파일하고, enum하고 중복정의하고 싶지 않은데.. 매칭이 까다로움
|
|
if (WriteRealVariable(_setting.VariableValueList[ShotTime], msecShotTime) &
|
|
WriteRealVariable(_setting.VariableValueList[ShotPulse], secPhzShotPulse)) {
|
|
Log.D($"{stage} : SetOneShot >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetOneShot >> Fail");
|
|
return false;
|
|
}
|
|
|
|
bool IPrismaticGunACS.SetLineShot(eStage stage, double pulse, double startPos, double endPos, double velocity)
|
|
{
|
|
#warning calibration 제어 값이 Percent to watt로 써야하는건지 확인필요
|
|
//var calPower = _calibration.CalibratePercentToWatt(pulse);
|
|
|
|
eGlobalVariable LineShotPulse;
|
|
eGlobalVariable LineShotStartPos;
|
|
eGlobalVariable LineShotEndPos;
|
|
eGlobalVariable LineShotVelocity;
|
|
if (stage is eStage.A) {
|
|
LineShotPulse = eGlobalVariable.AStageLineShotPulse;
|
|
LineShotStartPos = eGlobalVariable.AStageLineShotStartPos;
|
|
LineShotEndPos = eGlobalVariable.AStageLineShotEndPos;
|
|
LineShotVelocity = eGlobalVariable.AStageLineShotVelocity;
|
|
} else {
|
|
LineShotPulse = eGlobalVariable.BStageLineShotPulse;
|
|
LineShotStartPos = eGlobalVariable.BStageLineShotStartPos;
|
|
LineShotEndPos = eGlobalVariable.BStageLineShotEndPos;
|
|
LineShotVelocity = eGlobalVariable.BStageLineShotVelocity;
|
|
}
|
|
|
|
// 셋팅파일하고, enum하고 중복정의하고 싶지 않은데.. 매칭이 까다로움
|
|
if (WriteRealVariable(_setting.VariableValueList[LineShotPulse], pulse) &
|
|
WriteRealVariable(_setting.VariableValueList[LineShotStartPos], startPos) &
|
|
WriteRealVariable(_setting.VariableValueList[LineShotEndPos], endPos) &
|
|
WriteRealVariable(_setting.VariableValueList[LineShotVelocity], velocity)) {
|
|
Log.D($"{stage} : SetLineShot >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetLineShot >> Fail");
|
|
return false;
|
|
}
|
|
|
|
bool IPrismaticGunACS.SetWeldingVel(eStage stage, double acc, double svel, double cvel)
|
|
{
|
|
eGlobalVariable WeldingAcceleration;
|
|
eGlobalVariable WeldingStraightVelocity;
|
|
eGlobalVariable WeldingCurveVelocity;
|
|
if (stage is eStage.A) {
|
|
WeldingAcceleration = eGlobalVariable.AStageWeldingAcceleration;
|
|
WeldingStraightVelocity = eGlobalVariable.AStageWeldingStraightVelocity;
|
|
WeldingCurveVelocity = eGlobalVariable.AStageWeldingCurveVelocity;
|
|
} else {
|
|
WeldingAcceleration = eGlobalVariable.BStageWeldingAcceleration;
|
|
WeldingStraightVelocity = eGlobalVariable.BStageWeldingStraightVelocity;
|
|
WeldingCurveVelocity = eGlobalVariable.BStageWeldingCurveVelocity;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingAcceleration], acc) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingStraightVelocity], svel) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingCurveVelocity], cvel)) {
|
|
Log.D($"{stage} : SetWeldingVel >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetWeldingVel >> Fail");
|
|
return false;
|
|
}
|
|
|
|
bool IPrismaticGunACS.SetWeldingPos(eStage stage, double startPosX, double startPosY, double endPosX, double endPosY)
|
|
{
|
|
eGlobalVariable WeldingStartPosX;
|
|
eGlobalVariable WeldingStartPosY;
|
|
eGlobalVariable WeldingEndPosX;
|
|
eGlobalVariable WeldingEndPosY;
|
|
if (stage is eStage.A) {
|
|
WeldingStartPosX = eGlobalVariable.AStageWeldingStartPosX;
|
|
WeldingStartPosY = eGlobalVariable.AStageWeldingStartPosY;
|
|
WeldingEndPosX = eGlobalVariable.AStageWeldingEndPosX;
|
|
WeldingEndPosY = eGlobalVariable.AStageWeldingEndPosY;
|
|
} else {
|
|
WeldingStartPosX = eGlobalVariable.BStageWeldingStartPosX;
|
|
WeldingStartPosY = eGlobalVariable.BStageWeldingStartPosY;
|
|
WeldingEndPosX = eGlobalVariable.BStageWeldingEndPosX;
|
|
WeldingEndPosY = eGlobalVariable.BStageWeldingEndPosY;
|
|
}
|
|
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingStartPosX], startPosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingStartPosY], startPosY) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingEndPosX], endPosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingEndPosY], endPosY)) {
|
|
Log.D($"{stage} : SetWeldingPos >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetWeldingPos >> Fail");
|
|
return false;
|
|
}
|
|
|
|
bool IPrismaticGunACS.SetWeldingArc(eStage stage, double point1, double point2, double point3, double point4)
|
|
{
|
|
eGlobalVariable WeldingArc1;
|
|
eGlobalVariable WeldingArc2;
|
|
eGlobalVariable WeldingArc3;
|
|
eGlobalVariable WeldingArc4;
|
|
|
|
|
|
if (stage is eStage.A) {
|
|
WeldingArc1 = eGlobalVariable.AStageWeldingEdgePointRad1;
|
|
WeldingArc2 = eGlobalVariable.AStageWeldingEdgePointRad2;
|
|
WeldingArc3 = eGlobalVariable.AStageWeldingEdgePointRad3;
|
|
WeldingArc4 = eGlobalVariable.AStageWeldingEdgePointRad4;
|
|
} else {
|
|
WeldingArc1 = eGlobalVariable.BStageWeldingEdgePointRad1;
|
|
WeldingArc2 = eGlobalVariable.BStageWeldingEdgePointRad2;
|
|
WeldingArc3 = eGlobalVariable.BStageWeldingEdgePointRad3;
|
|
WeldingArc4 = eGlobalVariable.BStageWeldingEdgePointRad4;
|
|
}
|
|
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingArc1], point1) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingArc2], point2) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingArc3], point3) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingArc4], point4)) {
|
|
Log.D($"{stage} : SetWeldingArc >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetWeldingArc >> Fail");
|
|
return false;
|
|
}
|
|
// 현재 Voltage 고정적으로 사용
|
|
bool IPrismaticGunACS.SetWeldingType(eStage stage, eOutType type)
|
|
{
|
|
eGlobalVariable outType;
|
|
if (stage is eStage.A) {
|
|
outType = eGlobalVariable.AStageWeldingStraightPulse;
|
|
} else {
|
|
outType = eGlobalVariable.BStageWeldingStraightPulse;
|
|
}
|
|
|
|
if (WriteRealVariable(_setting.VariableValueList[outType], (int)type)) {
|
|
Log.D($"{stage} : SetWeldingPulse >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetWeldingPulse >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetWeldingPulse(eStage stage, double spulse, double cpulse)
|
|
{
|
|
eGlobalVariable sPulseVariable;
|
|
eGlobalVariable cPulseVariable;
|
|
if (stage is eStage.A) {
|
|
sPulseVariable = eGlobalVariable.AStageWeldingStraightPulse;
|
|
cPulseVariable = eGlobalVariable.AStageWeldingCurvePulse;
|
|
} else {
|
|
sPulseVariable = eGlobalVariable.BStageWeldingStraightPulse;
|
|
cPulseVariable = eGlobalVariable.BStageWeldingCurvePulse;
|
|
}
|
|
|
|
if (WriteRealVariable(_setting.VariableValueList[sPulseVariable], spulse) &
|
|
WriteRealVariable(_setting.VariableValueList[cPulseVariable], cpulse)) {
|
|
Log.D($"{stage} : SetWeldingPulse >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetWeldingPulse >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetLaserOnOff(eStage stage, double onPosX, double onOffSet, double offPosX, double offOffSet)
|
|
{
|
|
eGlobalVariable WeldingLaserOnPosX;
|
|
eGlobalVariable WeldingLaserOnOffSet;
|
|
eGlobalVariable WeldingLaserOffPosX;
|
|
eGlobalVariable WeldingLaserOffOffSet;
|
|
if (stage is eStage.A) {
|
|
WeldingLaserOnPosX = eGlobalVariable.AStageWeldingLaserOnPosX;
|
|
WeldingLaserOnOffSet = eGlobalVariable.AStageWeldingLaserOnOffSet;
|
|
WeldingLaserOffPosX = eGlobalVariable.AStageWeldingLaserOffPosX;
|
|
WeldingLaserOffOffSet = eGlobalVariable.AStageWeldingLaserOffOffSet;
|
|
} else {
|
|
WeldingLaserOnPosX = eGlobalVariable.BStageWeldingLaserOnPosX;
|
|
WeldingLaserOnOffSet = eGlobalVariable.BStageWeldingLaserOnOffSet;
|
|
WeldingLaserOffPosX = eGlobalVariable.BStageWeldingLaserOffPosX;
|
|
WeldingLaserOffOffSet = eGlobalVariable.BStageWeldingLaserOffOffSet;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingLaserOnPosX], onPosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingLaserOnOffSet], onOffSet) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingLaserOffPosX], offPosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingLaserOffOffSet], offOffSet)) {
|
|
Log.D($"{stage} : SetLaserOnOff >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetLaserOnOff >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetLCILserOn(eStage stage, bool on)
|
|
{
|
|
eGlobalVariable LCILaserOn;
|
|
if (stage is eStage.A)
|
|
{
|
|
LCILaserOn = eGlobalVariable.ALASER_SHOT_MODE;
|
|
}
|
|
else
|
|
{
|
|
LCILaserOn = eGlobalVariable.BLASER_SHOT_MODE;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[LCILaserOn], on ? 1 : 0))
|
|
{
|
|
Log.D($"{stage} : LCILaserOn >> Complete [LaserUSE {on}]");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : LCILaserOn >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetRamppingOffParameter(eStage stage, double pos, double overlap, double endpower)
|
|
{
|
|
eGlobalVariable WeldingRampStartPosX;
|
|
eGlobalVariable WeldingRampOverlapDistance;
|
|
eGlobalVariable WeldingRampOverlapEndPower;
|
|
|
|
if (stage is eStage.A) {
|
|
WeldingRampStartPosX = eGlobalVariable.AStageWeldingRampOffStartPosX;
|
|
WeldingRampOverlapDistance = eGlobalVariable.AStageWeldingRampOffOverlapDistance;
|
|
WeldingRampOverlapEndPower = eGlobalVariable.AStageWeldingRampOffEndPower;
|
|
} else {
|
|
WeldingRampStartPosX = eGlobalVariable.BStageWeldingRampOffStartPosX;
|
|
WeldingRampOverlapDistance = eGlobalVariable.BStageWeldingRampOffOverlapDistance;
|
|
WeldingRampOverlapEndPower = eGlobalVariable.BStageWeldingRampOffEndPower;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingRampStartPosX], pos) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingRampOverlapDistance], overlap) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingRampOverlapEndPower], endpower)) {
|
|
Log.D($"{stage} : SetRamppingStartPos >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetRamppingStartPos >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetRamppingOnParameter(eStage stage, double pos, double overlap, double startpower)
|
|
{
|
|
eGlobalVariable WeldingRampStartPosX;
|
|
eGlobalVariable WeldingRampOverlapDistance;
|
|
eGlobalVariable WeldingRampStartPower;
|
|
|
|
if (stage is eStage.A) {
|
|
WeldingRampStartPosX = eGlobalVariable.AStageWeldingRampOnStartPosX;
|
|
WeldingRampOverlapDistance = eGlobalVariable.AStageWeldingRampOnOverlapDistance;
|
|
WeldingRampStartPower = eGlobalVariable.AStageWeldingRampOnStartPower;
|
|
} else {
|
|
WeldingRampStartPosX = eGlobalVariable.BStageWeldingRampOnStartPosX;
|
|
WeldingRampOverlapDistance = eGlobalVariable.BStageWeldingRampOnOverlapDistance;
|
|
WeldingRampStartPower = eGlobalVariable.BStageWeldingRampOnStartPower;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingRampStartPosX], pos) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingRampOverlapDistance], overlap) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingRampStartPower], startpower)) {
|
|
Log.D($"{stage} : SetRamppingStartPos >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetRamppingStartPos >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetWeldingTeachingPosition1(eStage stage, double PosX, double PosY)
|
|
{
|
|
eGlobalVariable WeldingPosX;
|
|
eGlobalVariable WeldingPosY;
|
|
if (stage is eStage.A) {
|
|
|
|
WeldingPosX = eGlobalVariable.AStageWeldingPosition1X;
|
|
WeldingPosY = eGlobalVariable.AStageWeldingPosition1Y;
|
|
} else {
|
|
WeldingPosX = eGlobalVariable.BStageWeldingPosition1X;
|
|
WeldingPosY = eGlobalVariable.BStageWeldingPosition1Y;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingPosX], PosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingPosY], PosY)) {
|
|
Log.D($"{stage} : Set Welding Pos1 ({PosX} / {PosY}) >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : Set Welding Pos1 >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetWeldingTeachingPosition2(eStage stage, double PosX, double PosY)
|
|
{
|
|
eGlobalVariable WeldingPosX;
|
|
eGlobalVariable WeldingPosY;
|
|
if (stage is eStage.A) {
|
|
WeldingPosX = eGlobalVariable.AStageWeldingPosition2X;
|
|
WeldingPosY = eGlobalVariable.AStageWeldingPosition2Y;
|
|
} else {
|
|
WeldingPosX = eGlobalVariable.BStageWeldingPosition2X;
|
|
WeldingPosY = eGlobalVariable.BStageWeldingPosition2Y;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingPosX], PosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingPosY], PosY)) {
|
|
Log.D($"{stage} : Set Welding Pos2 ({PosX} / {PosY}) >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : Set Welding Pos2 >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetWeldingTeachingPosition3(eStage stage, double PosX, double PosY)
|
|
{
|
|
eGlobalVariable WeldingPosX;
|
|
eGlobalVariable WeldingPosY;
|
|
if (stage is eStage.A) {
|
|
WeldingPosX = eGlobalVariable.AStageWeldingPosition3X;
|
|
WeldingPosY = eGlobalVariable.AStageWeldingPosition3Y;
|
|
} else {
|
|
WeldingPosX = eGlobalVariable.BStageWeldingPosition3X;
|
|
WeldingPosY = eGlobalVariable.BStageWeldingPosition3Y;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingPosX], PosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingPosY], PosY)) {
|
|
Log.D($"{stage} : Set Welding Pos3 ({PosX} / {PosY}) >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : Set Welding Pos3 >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetWeldingTeachingPosition4(eStage stage, double PosX, double PosY)
|
|
{
|
|
eGlobalVariable WeldingPosX;
|
|
eGlobalVariable WeldingPosY;
|
|
if (stage is eStage.A) {
|
|
WeldingPosX = eGlobalVariable.AStageWeldingPosition4X;
|
|
WeldingPosY = eGlobalVariable.AStageWeldingPosition4Y;
|
|
} else {
|
|
WeldingPosX = eGlobalVariable.BStageWeldingPosition4X;
|
|
WeldingPosY = eGlobalVariable.BStageWeldingPosition4Y;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingPosX], PosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingPosY], PosY)) {
|
|
Log.D($"{stage} : Set Welding Pos4 ({PosX} / {PosY}) >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : Set Welding Pos4 >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetWeldingTeachingPosition5(eStage stage, double PosX, double PosY)
|
|
{
|
|
eGlobalVariable WeldingPosX;
|
|
eGlobalVariable WeldingPosY;
|
|
if (stage is eStage.A) {
|
|
WeldingPosX = eGlobalVariable.AStageWeldingPosition5X;
|
|
WeldingPosY = eGlobalVariable.AStageWeldingPosition5Y;
|
|
} else {
|
|
WeldingPosX = eGlobalVariable.BStageWeldingPosition5X;
|
|
WeldingPosY = eGlobalVariable.BStageWeldingPosition5Y;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingPosX], PosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingPosY], PosY)) {
|
|
Log.D($"{stage} : Set Welding Pos5 ({PosX} / {PosY}) >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : Set Welding Pos5 >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetWeldingTeachingPosition6(eStage stage, double PosX, double PosY)
|
|
{
|
|
eGlobalVariable WeldingPosX;
|
|
eGlobalVariable WeldingPosY;
|
|
if (stage is eStage.A) {
|
|
WeldingPosX = eGlobalVariable.AStageWeldingPosition6X;
|
|
WeldingPosY = eGlobalVariable.AStageWeldingPosition6Y;
|
|
} else {
|
|
WeldingPosX = eGlobalVariable.BStageWeldingPosition6X;
|
|
WeldingPosY = eGlobalVariable.BStageWeldingPosition6Y;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingPosX], PosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingPosY], PosY)) {
|
|
Log.D($"{stage} : Set Welding Pos6 ({PosX} / {PosY}) >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : Set Welding Pos6 >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetWeldingTeachingPosition7(eStage stage, double PosX, double PosY)
|
|
{
|
|
eGlobalVariable WeldingPosX;
|
|
eGlobalVariable WeldingPosY;
|
|
if (stage is eStage.A) {
|
|
WeldingPosX = eGlobalVariable.AStageWeldingPosition7X;
|
|
WeldingPosY = eGlobalVariable.AStageWeldingPosition7Y;
|
|
} else {
|
|
WeldingPosX = eGlobalVariable.BStageWeldingPosition7X;
|
|
WeldingPosY = eGlobalVariable.BStageWeldingPosition7Y;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingPosX], PosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingPosY], PosY)) {
|
|
Log.D($"{stage} : Set Welding Pos7 ({PosX} / {PosY}) >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : Set Welding Pos7 >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.SetWeldingTeachingPosition8(eStage stage, double PosX, double PosY)
|
|
{
|
|
eGlobalVariable WeldingPosX;
|
|
eGlobalVariable WeldingPosY;
|
|
if (stage is eStage.A) {
|
|
WeldingPosX = eGlobalVariable.AStageWeldingPosition8X;
|
|
WeldingPosY = eGlobalVariable.AStageWeldingPosition8Y;
|
|
} else {
|
|
WeldingPosX = eGlobalVariable.BStageWeldingPosition8X;
|
|
WeldingPosY = eGlobalVariable.BStageWeldingPosition8Y;
|
|
}
|
|
if (WriteRealVariable(_setting.VariableValueList[WeldingPosX], PosX) &
|
|
WriteRealVariable(_setting.VariableValueList[WeldingPosY], PosY)) {
|
|
Log.D($"{stage} : Set Welding Pos8 ({PosX} / {PosY}) >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : Set Welding Pos8 >> Fail");
|
|
return false;
|
|
}
|
|
bool IPrismaticGunACS.CheckOneShotComp(eStage stage)
|
|
{
|
|
if (stage is eStage.A) {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.AStageShotComp]) > 0;
|
|
} else {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.BStageShotComp]) > 0;
|
|
}
|
|
}
|
|
|
|
bool IPrismaticGunACS.CheckLineShotComp(eStage stage)
|
|
{
|
|
if (stage is eStage.A) {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.AStageLineShotComp]) > 0;
|
|
} else {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.BStageLineShotComp]) > 0;
|
|
}
|
|
}
|
|
|
|
bool IPrismaticGunACS.CheckWeldingComp(eStage stage)
|
|
{
|
|
if (IsSimul)
|
|
return true;
|
|
|
|
if (stage is eStage.A) {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.AStageWeldingComp]) > 0;
|
|
} else {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.BStageWeldingComp]) > 0;
|
|
}
|
|
}
|
|
|
|
bool IPrismaticGunACS.CheckClampComp(eStage stage)
|
|
{
|
|
if (stage is eStage.A) {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.AStageClampStep]) > 0;
|
|
} else {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.BStageClampStep]) > 0;
|
|
}
|
|
}
|
|
|
|
int IPrismaticGunACS.CheckClampStep(eStage stage)
|
|
{
|
|
if (stage is eStage.A) {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.AStageClampComp]);
|
|
} else {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.BStageClampComp]);
|
|
}
|
|
}
|
|
|
|
bool IPrismaticGunACS.CheckUnclampComp(eStage stage)
|
|
{
|
|
if (stage is eStage.A) {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.AStageUnClampComp]) > 0;
|
|
} else {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.BStageUnClampComp]) > 0;
|
|
}
|
|
}
|
|
int IPrismaticGunACS.CheckUnclampStep(eStage stage)
|
|
{
|
|
if (stage is eStage.A) {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.AStageUnClampStep]);
|
|
} else {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.BStageUnClampStep]);
|
|
}
|
|
}
|
|
|
|
bool IPrismaticGunACS.IsActivated() => IsActivated;
|
|
|
|
bool IPrismaticGunACS.CheckACSWeldingEnable(eStage stage)
|
|
{
|
|
if (IsSimul)
|
|
return true;
|
|
|
|
if (stage is eStage.A) {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.BStageWeldingStart]) == 0;
|
|
} else {
|
|
return ReadVariableInt(_setting.VariableValueList[eGlobalVariable.AStageWeldingStart]) == 0;
|
|
}
|
|
}
|
|
|
|
bool IPrismaticGunACS.ResetAlarm()
|
|
{
|
|
return WriteVariableInt(AlarmReset, 1);
|
|
}
|
|
|
|
bool IPrismaticGunACS.SetWeldingReset(eStage stage)
|
|
{
|
|
string WeldingStep, WeldingStartPos;
|
|
if (stage is eStage.A) {
|
|
WeldingStep = AStageWeldingStep;
|
|
WeldingStartPos = AStageWeldingStart;
|
|
} else {
|
|
WeldingStep = BStageWeldingStep;
|
|
WeldingStartPos = BStageWeldingStart;
|
|
}
|
|
if (WriteVariableInt(WeldingStep, 0) & WriteVariableInt(WeldingStartPos, 0)) {
|
|
Log.D($"{stage} : Set Welding Reset >> Complete");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : Set Welding Reset >> Fail");
|
|
return false;
|
|
}
|
|
|
|
bool IPrismaticGunACS.IsLaserOn(eStage stage)
|
|
{
|
|
if (!IsActivated || !IsConnected)
|
|
return false;
|
|
|
|
if (stage is eStage.A)
|
|
return ReadVariableInt(IsLaserOn) > 0 && ReadVariableInt(AStageWeldingStart) > 0;
|
|
else
|
|
return ReadVariableInt(IsLaserOn) > 0 && ReadVariableInt(BStageWeldingStart) > 0;
|
|
|
|
}
|
|
private bool CheckTeachingPosition(eStage stage, eTeachingPosition teachingPos)
|
|
{
|
|
if (IsSimul)
|
|
return true;
|
|
|
|
var targetPos = _teachingSetting.Get(stage, teachingPos);
|
|
if ((MotionVariables[stage].XAxisPosition.CheckInside(targetPos.AxisX, 0.1) & MotionVariables[stage].XInPosition)
|
|
& (MotionVariables[stage].YAxisPosition.CheckInside(targetPos.AxisY, 0.1) & MotionVariables[stage].YInPosition)
|
|
& (MotionVariables[stage].ZAxisPosition.CheckInside(targetPos.AxisZ, 0.05) & MotionVariables[stage].ZInPosition))
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
private bool CheckStageLoadingEnable(eStage stage)
|
|
{
|
|
if (!MotionVariables[stage].IsHome)
|
|
return false;
|
|
|
|
var LoadNLimit = _teachingSetting.Get(stage, ePLCEnableLimitPosition.LoadNegativeLimit);
|
|
var LoadPLimit = _teachingSetting.Get(stage, ePLCEnableLimitPosition.LoadPositiveLimit);
|
|
|
|
if ((LoadNLimit.AxisX < MotionVariables[stage].XAxisPosition && MotionVariables[stage].XAxisPosition < LoadPLimit.AxisX))
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
public bool CheckStageUnloadingEnable(eStage stage)
|
|
{
|
|
if (!MotionVariables[stage].IsHome)
|
|
return false;
|
|
|
|
var UnloadNLimit = _teachingSetting.Get(stage, ePLCEnableLimitPosition.UnloadNegativeLimit);
|
|
var UnloadPLimit = _teachingSetting.Get(stage, ePLCEnableLimitPosition.UnloadPositiveLimit);
|
|
|
|
if ((UnloadNLimit.AxisX < MotionVariables[stage].XAxisPosition && MotionVariables[stage].XAxisPosition < UnloadPLimit.AxisX))
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
internal bool IsReachedTeachingPosition(eStage stage, eTeachingPosition targetPos)
|
|
{
|
|
switch (targetPos) {
|
|
case eTeachingPosition.Load:
|
|
return MotionVariables[stage].IsLoadPosition;
|
|
case eTeachingPosition.UnLoad:
|
|
return MotionVariables[stage].IsUnloadPosition;
|
|
case eTeachingPosition.SafetyPosition:
|
|
return MotionVariables[stage].IsSafetyPosition;
|
|
case eTeachingPosition.StageWeldingStartPos:
|
|
return MotionVariables[stage].IsWeldingStartPosition;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
public bool OneShotStop(eStage stage)
|
|
{
|
|
eLabel Label;
|
|
if (stage is eStage.A)
|
|
Label = eLabel.ASTAGE_ONESHOT;
|
|
else
|
|
Label = eLabel.BSTAGE_ONESHOT;
|
|
|
|
var label = _setting.BufferInfoList[Label];
|
|
var Buffer = _setting.BufferInfoList[label];
|
|
|
|
IPrismaticGunACS motion = this;
|
|
motion.SetLCILserOn(stage, false);
|
|
StopBuffer((ProgramBuffer)Buffer);
|
|
|
|
Log.D("StopBuffer");
|
|
return true;
|
|
}
|
|
|
|
public void RemarkUseStageB(bool use)
|
|
{
|
|
WriteVariableInt(BStageRemarkUse, use ? 1 : 0);
|
|
}
|
|
|
|
public double LoadFactorX(eStage stage) {
|
|
double value = 0.0;
|
|
if(stage is eStage.A)
|
|
ReadVariableReal(AXLoadFactor, out value);
|
|
else
|
|
ReadVariableReal(BXLoadFactor, out value);
|
|
|
|
return value;
|
|
}
|
|
public double LoadFactorY(eStage stage)
|
|
{
|
|
double value = 0.0;
|
|
if (stage is eStage.A)
|
|
ReadVariableReal(AYLoadFactor, out value);
|
|
else
|
|
ReadVariableReal(BYLoadFactor, out value);
|
|
|
|
return value;
|
|
}
|
|
|
|
// 외부 모듈 참조 함수
|
|
public double extAXVelocity() => MotionVariables[eStage.A].XAxisVelocity;
|
|
public double extAXPosition() => MotionVariables[eStage.A].XAxisPosition;
|
|
public double extAYVelocity() => MotionVariables[eStage.A].YAxisVelocity;
|
|
public double extAYPosition() => MotionVariables[eStage.A].YAxisPosition;
|
|
public double extBXVelocity() => MotionVariables[eStage.B].XAxisVelocity;
|
|
public double extBXPosition() => MotionVariables[eStage.B].XAxisPosition;
|
|
public double extBYVelocity() => MotionVariables[eStage.B].YAxisVelocity;
|
|
public double extBYPosition() => MotionVariables[eStage.B].YAxisPosition;
|
|
|
|
public bool SetOutputType(eStage stage, eOutType type)
|
|
{
|
|
if (WriteVariableInt(BStageLCIType, (int)type + 1)) {
|
|
Log.D($"{stage} : SetOutputType >> Complete[{Enum.GetName(typeof(eOutType), type)}]");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetOutputType >> Fail");
|
|
return false;
|
|
}
|
|
|
|
public bool SetPfmCtrlType(eStage stage, double PulseWidth, double PulseInterval)
|
|
{
|
|
if (WriteRealVariable(PfmPulseWidth, PulseWidth) &
|
|
WriteRealVariable(PfmPulseInterval, PulseInterval)) {
|
|
Log.D($"{stage} : SetPfmCtrlType >> Complete >> PulseWidth[{PulseWidth}] / PulseInterval[{PulseInterval}");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetPfmCtrlType >> Fail");
|
|
return false;
|
|
}
|
|
public bool SetPwmCtrlType(eStage stage, double PulseFrequency, double MaxPulseWidth, double MinPulseWidth)
|
|
{
|
|
if (WriteRealVariable(PwmPulseFrequency, PulseFrequency) &
|
|
WriteRealVariable(PwmMaxPulseWidth, MaxPulseWidth) &
|
|
WriteRealVariable(PwmMinPulseWidth, MinPulseWidth)) {
|
|
Log.D($"{stage} : SetPwmCtrlType >> Complete >> Freq[{PulseFrequency}] / Freq[{MaxPulseWidth}] / Freq[{MinPulseWidth}]");
|
|
return true;
|
|
}
|
|
Log.D($"{stage} : SetPwmCtrlType >> Fail");
|
|
return false;
|
|
}
|
|
|
|
}
|
|
}
|