Commit a63d2c11 刘韬

1

1 个父辈 df76da28
......@@ -64,5 +64,14 @@ namespace OnlineStore.Common
public static MyConfig<double> XRay_Current = 0.6;
[MyConfigComment("X高压点亮后延迟,毫秒")]
public static MyConfig<int> XRay_Light_Delay = 2500;
[MyConfigComment("条码类型")]
public static MyConfig<string> Camera_CodeType = "QR Code#Data Matrix ECC 200";
[MyConfigComment("条码解码参数路径")]
public static MyConfig<string> Camera_CodeParamPath = "";
[MyConfigComment("筛选条码数量")]
public static MyConfig<int> Camera_QRCodeCount = 3;
[MyConfigComment("解码的超时时间")]
public static MyConfig<int> Camera_CodeTimeOut = 2000;
}
}
......@@ -70,12 +70,12 @@ namespace DeviceLibrary
DeviceSuddenStop();
ok = false;
}
if (IOManager.GetDIValue("",0,16).Equals(IO_VALUE.LOW))
{
ok = false;
DeviceSuddenStop();
Msg.add(crc.GetString("device_safedoor_open", "贴标或出料机构门禁被打开"), MsgLevel.warning);
}
//if (IOManager.GetDIValue("",0,16).Equals(IO_VALUE.LOW))
//{
// ok = false;
// DeviceSuddenStop();
// Msg.add(crc.GetString("device_safedoor_open", "贴标或出料机构门禁被打开"), MsgLevel.warning);
//}
lastSafeCheckStatus = ok;
return ok;
}
......
......@@ -32,6 +32,7 @@ namespace DeviceLibrary
XRay_01_LocationDown,
XRay_02_RunIn,
XRay_02_CheckReel,
XRay_03_CloseDoor,
XRay_04_OpenXray,
XRay_04_CheckXray,
......
......@@ -113,7 +113,7 @@ namespace DeviceLibrary
}
else
{
if (IOValue(IO_XRay_Type.Manual_Confirm_BTN).Equals(IO_VALUE.HIGH))
if (IOValue(IO_XRay_Type.SafetyLightCurtains).Equals(IO_VALUE.HIGH))
{
FeedingMoveinfo.NextMoveStep(MoveStep.Feeding_06_Goto_Xray);
FeedingMoveinfo.log($"按下入料按钮, 定位气缸下降");
......@@ -201,17 +201,17 @@ namespace DeviceLibrary
var Tray15 = Math.Max(Tray15_L, Tray15_R);
Debug.WriteLine($"Tray7:{Tray7},Tray13:{Tray13},Tray15:{Tray15}");
int v=0;
if (Tray15 < overhight && Tray15>0)
if (Tray15 < overhight && Tray15>4)
{
if (SensorDebounce.Debounce(Tray15, out v))
TrayWidth = 15;
}
else if (Tray13 < overhight && Tray13>0)
else if (Tray13 < overhight && Tray13>4)
{
if (SensorDebounce.Debounce(Tray13, out v))
TrayWidth = 13;
}
else if (Tray7 < overhight && Tray7 > 0)
else if (Tray7 < overhight && Tray7 > 4)
{
if (SensorDebounce.Debounce(Tray7, out v))
TrayWidth = 7;
......
......@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CodeLibrary;
using ConfigHelper;
using Newtonsoft.Json;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
......@@ -27,6 +28,7 @@ namespace DeviceLibrary
bool ExitLine_Reel_IsSafe {
get => SideMoveInfo.MoveStep == MoveStep.Wait || SideMoveInfo.MoveStep >= MoveStep.SideMove_07;
}
int ZDiff = 0;
void SideMoveProcess()
{
if (CheckWait(SideMoveInfo))
......@@ -41,6 +43,13 @@ namespace DeviceLibrary
SideMoveInfo.ReelParam = ExitLine_Reel_Info.clone();
SideMoveInfo.log("检测到料盘到位");
}
else if (ExitLine_Reel_Info != null)
{
if (SideMoveInfo.IsTimeOut(10)) {
Msg.add("等待料盘到达横移机构超时", MsgLevel.warning);
SideMoveInfo.log("等待料盘到达横移机构超时");
}
}
else
{
Msg.add("横移机构等待料盘", MsgLevel.info);
......@@ -48,7 +57,6 @@ namespace DeviceLibrary
break;
case MoveStep.SideMove_01:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_02);
ExitLine_Location_Axis.AbsMove(SideMoveInfo, Config.ExitLine_Location_P1, Config.ExitLine_Location_P1_speed);
SideMove_Z_Axis.AbsMove(SideMoveInfo, Config.SideMove_Z_P1, Config.SideMove_Z_P1_speed);
SideMoveInfo.log("出料档停退到P1");
suckReelRetryTimes = 0;
......@@ -61,12 +69,16 @@ namespace DeviceLibrary
case MoveStep.SideMove_03:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_04);
var p2 = Config.SideMove_Z_P2 - (SideMoveInfo.ReelParam.PlateH - 8 - suckReelRetryTimes*4) * 1000;
p2 = Config.SideMove_Z_P2;
SideMove_Z_Axis.AbsMove(SideMoveInfo, p2, Config.SideMove_Z_P2_speed);
CylinderMove(SideMoveInfo, IO_XRay_Type.SideMove_SuckerReel_Off, IO_XRay_Type.SideMove_SuckerReel_On, IO_VALUE.HIGH);
SideMoveInfo.log("升降轴到取料点P2:"+ p2);
break;
case MoveStep.SideMove_04:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_05);
var ah = SideMove_Z_Axis.GetAclPosition();
ZDiff = Config.SideMove_Z_P2 - ah;
SideMoveInfo.log($"升降轴下降高度:P2:{Config.SideMove_Z_P2}-AH:{ah} = {ZDiff}");
break;
case MoveStep.SideMove_05:
SideMoveInfo.NextMoveStep(MoveStep.SideMove_06);
......
......@@ -29,6 +29,7 @@ namespace DeviceLibrary
public int relmove;
const string xraydir = @"\Image\Xray";
Task GetResultTask = null;
bool needhome = false;
void WorkProcess()
{
if (CheckWait(MoveInfo))
......@@ -45,7 +46,7 @@ namespace DeviceLibrary
CylinderMove(null, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open, IO_VALUE.HIGH);
break;
case MoveStep.XRay_02_RunIn:
MoveInfo.NextMoveStep(MoveStep.XRay_03_CloseDoor);
MoveInfo.NextMoveStep(MoveStep.XRay_02_CheckReel);
MoveInfo.log($"入料伺服相对运转");
//Line_Entry_Axis.RelMove(ResetMoveInfo, Config.Line_Entry_Relative, Config.Line_Entry_Relative_speed);
Line_Entry_Axis.SpeedMove(Config.Line_Entry_Relative_speed);
......@@ -53,6 +54,19 @@ namespace DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_XRay_Type.Tray_Inside_Check, IO_VALUE.HIGH));
break;
case MoveStep.XRay_02_CheckReel:
if (IOValue(IO_XRay_Type.Tray_Inside_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.XRay_03_CloseDoor);
MoveInfo.log($"点料机检测到料盘");
}
else
{
Msg.add("点料机内没有检测到料盘", MsgLevel.warning);
MoveInfo.log($"点料机内没有检测到料盘");
RobotManage.UserPause(true);
}
break;
case MoveStep.XRay_03_CloseDoor:
MoveInfo.NextMoveStep(MoveStep.XRay_04_OpenXray);
MoveInfo.log($"关闭点料机入口门");
......@@ -177,10 +191,16 @@ namespace DeviceLibrary
if (ExitLine_Reel_IsSafe && ExitLine_Reel_Info==null)
{
MoveInfo.NextMoveStep(MoveStep.XRay_10_CloseOutDoor);
MoveInfo.log($"打开出口门,送出到贴标机构");
Line_In_Axis.SpeedMove(Config.Line_In_Relative_speed * 2);
MoveInfo.log($"打开出口门,送出到贴标机构,W:{MoveInfo.ReelParam.PlateW}");
Line_In_Axis.RelMove(MoveInfo, Config.Line_In_Relative, Config.Line_In_Relative_speed);
IOMove(IO_XRay_Type.ExitLine_Reel_Run, IO_VALUE.HIGH);
MoveInfo.StopwatchLog(false, "开始送出");
if (MoveInfo.ReelParam.PlateW == 7)
ExitLine_Location_Axis.AbsMove(MoveInfo, Config.ExitLine_Location_7, Config.ExitLine_Location_7_speed);
else if (MoveInfo.ReelParam.PlateW == 13)
ExitLine_Location_Axis.AbsMove(MoveInfo, Config.ExitLine_Location_13, Config.ExitLine_Location_13_speed);
else if (MoveInfo.ReelParam.PlateW == 15)
ExitLine_Location_Axis.AbsMove(MoveInfo, Config.ExitLine_Location_15, Config.ExitLine_Location_15_speed);
}
else if (MoveInfo.IsTimeOut(30))
......@@ -192,12 +212,19 @@ namespace DeviceLibrary
case MoveStep.XRay_10_CloseOutDoor:
if (IOValue(IO_XRay_Type.ExitLine_Reel_Check).Equals(IO_VALUE.HIGH))
{
IOMove(IO_XRay_Type.ExitLine_Reel_Run, IO_VALUE.LOW);
IOMove(IO_XRay_Type.ExitLine_Reel_Run, IO_VALUE.HIGH,false,2000);
MoveInfo.NextMoveStep(MoveStep.XRay_11_GetCoutResult);
MoveInfo.log($"关闭出口门,停止X光机内线体");
Line_In_Axis.SuddenStop();
CylinderMove(null, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open, IO_VALUE.LOW);
MoveInfo.StopwatchLog(false, "到达阻挡");
var nextpos = Line_In_Axis.GetAclPosition() + Config.Line_In_Relative;
var nextpresent = (double)nextpos / 1900000d - Math.Truncate((double)nextpos / 1917285d);
needhome = nextpresent >= 0.744437056;
MoveInfo.log($"当前位置:{Line_In_Axis.GetAclPosition()},下一个运行点位置:{nextpos},计算比例:{nextpresent},需要回原:{needhome}");
if (needhome)
Line_In_Axis.HomeMove(MoveInfo);
}
else if (MoveInfo.IsTimeOut(10))
{
......
......@@ -129,7 +129,8 @@ namespace DeviceLibrary
{
ProcessMsgEventFire(Msg);
//ProcessMoveinfoEventFire(MoveInfo.List);
Msg.Clear();
if (canRunning && mstart)
Msg.Clear();
}
}
LogUtil.info($"{DeviceName} 主线程已退出.");
......@@ -218,7 +219,13 @@ namespace DeviceLibrary
case MoveStep.H01_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
ResetMoveInfo.log("正在回原, 托盘下降,门打开");
CylinderMove(ResetMoveInfo, IO_XRay_Type.Location_Cylinder_Down, IO_XRay_Type.Location_Cylinder_Up,IO_VALUE.LOW);
if (IOValue(IO_XRay_Type.ExitLine_Reel_Check).Equals(IO_VALUE.LOW))
{
ExitLine_Reel_Info = null;
ResetMoveInfo.log("出料线没有检测到料盘, 删除缓存数据");
}
CylinderMove(ResetMoveInfo, IO_XRay_Type.Location_Cylinder_Down, IO_XRay_Type.Location_Cylinder_Up,IO_VALUE.HIGH);
CylinderMove(ResetMoveInfo, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open);
CylinderMove(ResetMoveInfo, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open);
SideMove_Z_Axis.HomeMove(ResetMoveInfo);
......@@ -226,14 +233,17 @@ namespace DeviceLibrary
break;
case MoveStep.H02_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H03_HomeReset);
Line_Entry_Axis.RelMove(ResetMoveInfo, Config.Line_Entry_Relative*2, Config.Line_Entry_Relative_speed);
Line_Entry_Axis.SpeedMove(Config.Line_Entry_Relative_speed);
Line_In_Axis.RelMove(ResetMoveInfo, Config.Line_In_Relative*2, Config.Line_In_Relative_speed);
IOMove(IO_XRay_Type.ExitLine_Reel_Run, IO_VALUE.HIGH);
SideMove_X_Axis.HomeMove(ResetMoveInfo);
ResetMoveInfo.log("正在回原");
break;
case MoveStep.H03_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset);
ResetMoveInfo.log("正在回原, 门关闭");
IOMove(IO_XRay_Type.ExitLine_Reel_Run, IO_VALUE.LOW);
Line_Entry_Axis.SuddenStop();
CylinderMove(ResetMoveInfo, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open,IO_VALUE.LOW);
CylinderMove(ResetMoveInfo, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open, IO_VALUE.LOW);
CylinderMove(ResetMoveInfo, IO_XRay_Type.Location_Cylinder_Down, IO_XRay_Type.Location_Cylinder_Up, IO_VALUE.HIGH);
......@@ -241,8 +251,10 @@ namespace DeviceLibrary
case MoveStep.HEND_HomeReset:
ResetMoveInfo.log("回源完成");
ResetMoveInfo.EndMove();
//MoveInfo.NewMove(MoveStep.Feeding_05_Goto_Xray);
runStatus = RunStatus.Running;
FeedingMoveinfo.EndMove();
MoveInfo.EndMove();
SideMoveInfo.EndMove();
break;
}
}
......
......@@ -159,7 +159,7 @@ namespace DeviceLibrary
int errorCount = Math.Abs(outCount - targetPosition);
if (isOk)
{
if (errorCount <= axis.CanErrorCountMax)
if (errorCount <= axis.CanErrorCountMax || GetLimitPositiveSingle(axis) == 1)
{
return true;
}
......@@ -200,6 +200,16 @@ namespace DeviceLibrary
}
return false;
}
static int GetLimitPositiveSingle(ConfigMoveAxis axis)
{
var p = AxisManager.GetLimitPositiveSingle(axis.DeviceName, axis.GetAxisValue());
if (p == 1)
{
LogUtil.info($"{axis.Explain}[{axis.GetAxisValue()}] 正极限 {(p == 1 ? "点亮" : "未亮")}");
return p;
}
return 0;
}
public static bool ACAxisRELMoveIsEnd(MoveInfo MoveInfo, ConfigMoveAxis axis, int targetPosition, int targetSpeed, out string msg)
{
msg = "";
......
......@@ -44,10 +44,14 @@ namespace DeviceLibrary
set
{
_WareCode = value;
var w = _WareCode.Split('|');
if (w.Length == 5) {
PN = w[0];
ReeID = w[3];
if (!string.IsNullOrEmpty(_WareCode))
{
var w = _WareCode.Split('|');
if (w.Length == 5)
{
PN = w[0];
ReeID = w[3];
}
}
}
}
......
......@@ -50,8 +50,9 @@
<Reference Include="halcondotnet">
<HintPath>..\..\RC1271-DUOStore\dll\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="HuichuanLibrary">
<HintPath>..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath>
<Reference Include="HuichuanLibrary, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
......
......@@ -110,7 +110,7 @@ namespace DeviceLibrary
public void SpeedMove(string portName, short slvAddr, int speed)
{
HCBoardManager.SpeedMove(slvAddr, speed);
HCBoardManager.SpeedMove(slvAddr, speed, speed * 4, speed * 4);
}
public void SuddenStop(string portName, short slvAddr)
{
......
......@@ -457,7 +457,6 @@ namespace AutoCountMachine
this.Controls.Add(this.btn_stop);
this.Controls.Add(this.btn_run);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Neo Counter X800";
......
......@@ -214,4 +214,7 @@
<Content Include="icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>start $(TargetDir)</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -361,7 +361,7 @@ namespace AutoCountMachine
RobotManage.xrayMachine.IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.HIGH);
Task.Delay(1000).Wait();
RobotManage.XRay.Start();
Task.Delay(2000).Wait();
Task.Delay(5000).Wait();
var b = RobotManage.xrayImage.GenerateTemplate(2);
b.Wait();
if (b.Result)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!