Commit 8e68d72e 刘韬

加入2号超声波传感器

1 个父辈 39cbccd1
......@@ -63,7 +63,7 @@
//
// timer1
//
this.timer1.Interval = 300;
this.timer1.Interval = 500;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// groupBoxDowrite
......
......@@ -229,8 +229,8 @@ namespace OnlineStore.ACSingleStore
txtAI4.Text = ai4Value.ToString();
//txtAI3.Text = ai3Value.ToString();
txtAIResult1.Text = ConvertAI(ai1Value,boxBean.Config.AIDI1_DefaultPosition).ToString();
txtAIResult2.Text = ConvertAI(ai2Value, boxBean.Config.AIDI2_DefaultPosition).ToString();
txtAIResult1.Text = ConvertAI(ai1Value, boxBean.Config.AIDI1_DefaultPosition , boxBean.Config.AIDI1_DefaultGap).ToString();
txtAIResult2.Text = ConvertAI(ai2Value, boxBean.Config.AIDI2_DefaultPosition , boxBean.Config.AIDI2_DefaultGap).ToString();
txtAIResult3.Text = ConvertAI(ai3Value, boxBean.Config.AIDI3_DefaultPosition).ToString();
txtAIResult4.Text = ConvertAI(ai4Value, boxBean.Config.AIDI4_DefaultPosition).ToString();
//txtAIResult3.Text = AIManager.ConvertAI(ai3Value, boxBean.Config.AIDI3_DefaultPosition).ToString();
......@@ -238,10 +238,12 @@ namespace OnlineStore.ACSingleStore
txtHeight.Text = boxBean.GetHeight().ToString();
txtSize.Text = boxBean.GetSize().ToString();
}
public static double ConvertAI(double aiValue, double defaultValue)
public static double ConvertAI(double aiValue, double defaultValue, double gap=0)
{
double xishu = (double)StoreManager.Config.AI_ConvertPosition;
double result = Math.Round(Math.Abs(aiValue - defaultValue) / xishu, 2);
if (result > 4)
result -= gap;
return result;
}
private void btnOpenDoor_Click(object sender, EventArgs e)
......
......@@ -55,7 +55,11 @@ namespace OnlineStore.ACSingleStore
{
byte[] x = new byte[] { 0x0A, 0x02, 0x03 };
var s = BitConverter.ToString(x);
//DauxiKS107Controller dauxiKS107 = new DauxiKS107Controller();
//var a = dauxiKS107.Distance;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
......
......@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SO951-HC-ACSingleStore 0399105cb374afe8fabf1f8f43f3d8f5ff67b31e")]
[assembly: AssemblyProduct("SO951-HC-ACSingleStore 39cbccd1b04f1b91cb5ca10b7992a369f1626a37")]
[assembly: AssemblyCopyright("Copyright ? 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......
......@@ -31,10 +31,15 @@
this.components = new System.ComponentModel.Container();
this.groupAxis = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lblAlarmcode = new System.Windows.Forms.Label();
this.label54 = new System.Windows.Forms.Label();
this.lblhomeSts = new System.Windows.Forms.Label();
this.label50 = new System.Windows.Forms.Label();
this.label53 = new System.Windows.Forms.Label();
this.label56 = new System.Windows.Forms.Label();
this.label55 = new System.Windows.Forms.Label();
this.label52 = new System.Windows.Forms.Label();
this.lblAlarmcode = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.lblhomeSts = new System.Windows.Forms.Label();
this.lblAxEncAcc = new System.Windows.Forms.Label();
this.lblINP = new System.Windows.Forms.Label();
this.lblBUSY = new System.Windows.Forms.Label();
......@@ -45,16 +50,11 @@
this.lblEMG = new System.Windows.Forms.Label();
this.lblWARN = new System.Windows.Forms.Label();
this.lblALM = new System.Windows.Forms.Label();
this.label53 = new System.Windows.Forms.Label();
this.label56 = new System.Windows.Forms.Label();
this.label55 = new System.Windows.Forms.Label();
this.label52 = new System.Windows.Forms.Label();
this.lblAxEncVel = new System.Windows.Forms.Label();
this.lblAxPrfVel = new System.Windows.Forms.Label();
this.lblAxEncPos = new System.Windows.Forms.Label();
this.lblAxPrfPos = new System.Windows.Forms.Label();
this.lblAxisPrfMode = new System.Windows.Forms.Label();
this.label50 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtBusyStatus = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
......@@ -159,17 +159,6 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "轴状态监控";
//
// lblAlarmcode
//
this.lblAlarmcode.AutoSize = true;
this.lblAlarmcode.Location = new System.Drawing.Point(433, 65);
this.lblAlarmcode.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAlarmcode.Name = "lblAlarmcode";
this.lblAlarmcode.Size = new System.Drawing.Size(68, 17);
this.lblAlarmcode.TabIndex = 19;
this.lblAlarmcode.Text = "错误码:160";
this.lblAlarmcode.Visible = false;
//
// label54
//
this.label54.AutoSize = true;
......@@ -180,15 +169,67 @@
this.label54.TabIndex = 18;
this.label54.Text = "回原状态:";
//
// lblhomeSts
// label50
//
this.lblhomeSts.AutoSize = true;
this.lblhomeSts.Location = new System.Drawing.Point(275, 121);
this.lblhomeSts.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblhomeSts.Name = "lblhomeSts";
this.lblhomeSts.Size = new System.Drawing.Size(17, 17);
this.lblhomeSts.TabIndex = 17;
this.lblhomeSts.Text = "...";
this.label50.AutoSize = true;
this.label50.Location = new System.Drawing.Point(267, 65);
this.label50.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label50.Name = "label50";
this.label50.Size = new System.Drawing.Size(59, 17);
this.label50.TabIndex = 1;
this.label50.Text = "规划模式:";
//
// label53
//
this.label53.AutoSize = true;
this.label53.Location = new System.Drawing.Point(134, 104);
this.label53.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label53.Name = "label53";
this.label53.Size = new System.Drawing.Size(59, 17);
this.label53.TabIndex = 1;
this.label53.Text = "规划速度:";
//
// label56
//
this.label56.AutoSize = true;
this.label56.Location = new System.Drawing.Point(10, 104);
this.label56.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label56.Name = "label56";
this.label56.Size = new System.Drawing.Size(59, 17);
this.label56.TabIndex = 1;
this.label56.Text = "实际速度:";
//
// label55
//
this.label55.AutoSize = true;
this.label55.Location = new System.Drawing.Point(10, 65);
this.label55.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label55.Name = "label55";
this.label55.Size = new System.Drawing.Size(59, 17);
this.label55.TabIndex = 1;
this.label55.Text = "实际位置:";
//
// label52
//
this.label52.AutoSize = true;
this.label52.Location = new System.Drawing.Point(134, 65);
this.label52.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label52.Name = "label52";
this.label52.Size = new System.Drawing.Size(59, 17);
this.label52.TabIndex = 1;
this.label52.Text = "规划位置:";
//
// lblAlarmcode
//
this.lblAlarmcode.AutoSize = true;
this.lblAlarmcode.Location = new System.Drawing.Point(433, 65);
this.lblAlarmcode.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAlarmcode.Name = "lblAlarmcode";
this.lblAlarmcode.Size = new System.Drawing.Size(68, 17);
this.lblAlarmcode.TabIndex = 19;
this.lblAlarmcode.Text = "错误码:160";
this.lblAlarmcode.Visible = false;
this.lblAlarmcode.Click += new System.EventHandler(this.lblAlarmcode_Click);
//
// label2
//
......@@ -201,6 +242,16 @@
this.label2.Text = "实际加速度:";
this.label2.Visible = false;
//
// lblhomeSts
//
this.lblhomeSts.AutoSize = true;
this.lblhomeSts.Location = new System.Drawing.Point(275, 121);
this.lblhomeSts.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblhomeSts.Name = "lblhomeSts";
this.lblhomeSts.Size = new System.Drawing.Size(17, 17);
this.lblhomeSts.TabIndex = 17;
this.lblhomeSts.Text = "...";
//
// lblAxEncAcc
//
this.lblAxEncAcc.AutoSize = true;
......@@ -302,46 +353,6 @@
this.lblALM.Text = "报警";
this.lblALM.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label53
//
this.label53.AutoSize = true;
this.label53.Location = new System.Drawing.Point(134, 104);
this.label53.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label53.Name = "label53";
this.label53.Size = new System.Drawing.Size(59, 17);
this.label53.TabIndex = 1;
this.label53.Text = "规划速度:";
//
// label56
//
this.label56.AutoSize = true;
this.label56.Location = new System.Drawing.Point(10, 104);
this.label56.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label56.Name = "label56";
this.label56.Size = new System.Drawing.Size(59, 17);
this.label56.TabIndex = 1;
this.label56.Text = "实际速度:";
//
// label55
//
this.label55.AutoSize = true;
this.label55.Location = new System.Drawing.Point(10, 65);
this.label55.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label55.Name = "label55";
this.label55.Size = new System.Drawing.Size(59, 17);
this.label55.TabIndex = 1;
this.label55.Text = "实际位置:";
//
// label52
//
this.label52.AutoSize = true;
this.label52.Location = new System.Drawing.Point(134, 65);
this.label52.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label52.Name = "label52";
this.label52.Size = new System.Drawing.Size(59, 17);
this.label52.TabIndex = 1;
this.label52.Text = "规划位置:";
//
// lblAxEncVel
//
this.lblAxEncVel.AutoSize = true;
......@@ -393,16 +404,6 @@
this.lblAxisPrfMode.Tag = "not";
this.lblAxisPrfMode.Text = "...";
//
// label50
//
this.label50.AutoSize = true;
this.label50.Location = new System.Drawing.Point(267, 65);
this.label50.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label50.Name = "label50";
this.label50.Size = new System.Drawing.Size(59, 17);
this.label50.TabIndex = 1;
this.label50.Text = "规划模式:";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txtBusyStatus);
......
......@@ -441,5 +441,11 @@ namespace OnlineStore.DUOStore
return null;
}
private void lblAlarmcode_Click(object sender, EventArgs e)
{
MessageBox.Show(string.Join(",", HuichuanLibrary.HCBoardManager.GetAxisErrorDetail(SlvAddr)));
}
}
}
......@@ -385,7 +385,7 @@ namespace OnlineStore.ACSingleStore.useControl
{
if (store.autoNext)
{
store.autoNext = false;
store.StopautoNext = true;
btnStartAuTo.Text = StartAuto;
}
else
......@@ -402,13 +402,13 @@ namespace OnlineStore.ACSingleStore.useControl
store.autoPositionIndex = currIndex;
store.AutoStartIndex = currIndex;
store.Double_Alternate = checkBox_Double_Alternate.Checked;
store.Alternate = false;
store.StopautoNext = false;
store.hasDoublePlate = false;
string poText = cmbPosition.Text;
store.autoMsg = AutoIn + ":" + poText;
LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
//store.StartOutStoreMove(new InOutStoreParam("", poText));
store.StartInStoreMove(new InOutStoreParam("", poText));
store.StartInStoreMove(new InOutStoreParam("newreel", poText));
}
btnStartAuTo.Text = StopAuto;
}
......@@ -664,7 +664,7 @@ namespace OnlineStore.ACSingleStore.useControl
store.Double_Alternate = obj.Checked;
if (obj.Checked)
{
txtJiange.Text = "1";
txtJiange.Text = "2";
txtJiange.Enabled = false;
}
else
......
......@@ -191,6 +191,7 @@ namespace OnlineStore.Common
/// 料盘高
/// </summary>
public static string plateH = "plateH";
public static string barcode = "barcode";
/// <summary>
/// 料仓ID
/// </summary>
......
......@@ -18,7 +18,7 @@ public class DauxiKS107Controller
private SerialPort _serialPort = null;
string comPortName;
System.Timers.Timer timer;
public int Distance;
public volatile int Distance;
public bool IsRunning { get => timer.Enabled; }
public DauxiKS107Controller(int Elapsms=5000)
{
......@@ -28,12 +28,13 @@ public class DauxiKS107Controller
timer.Enabled = false;
}
~DauxiKS107Controller() {
LogUtil.info($"液位传感器退出");
LogUtil.info($"{comPortName}液位传感器退出");
timer.Enabled = false;
if (_serialPort != null) {
_serialPort.Close();
}
}
List<int> distantlist=new List<int>() { 1000, 100, 100, 100, 10 };
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
bool readok = true;
......@@ -41,11 +42,20 @@ public class DauxiKS107Controller
{
if (Quary(out int value, out string errmsg))
{
Debug.WriteLine($"读取到液位:{value}mm,err:{errmsg}");
Debug.WriteLine($"{comPortName}读取到液位:{value}mm,err:{errmsg}");
readok = true;
if (value > 0)
if (value > 0 && value<500)
{
Distance = value;
//Distance = value;
lock (distantlist)
{
distantlist.Add(value);
if (distantlist.Count > 5)
{
distantlist.RemoveAt(0);
}
Distance= TrimMean(distantlist, 0.8);
}
return;
}
}
......@@ -55,9 +65,9 @@ public class DauxiKS107Controller
}
if (!readok)
{
LogUtil.info($"液位传感器读取失败,重新打开");
LogUtil.info($"{comPortName}液位传感器读取失败,重新打开");
if (!OpenPort(comPortName, out string errmsg)) {
LogUtil.info($"液位传感器打开失败:"+ errmsg);
LogUtil.info($"{comPortName}液位传感器打开失败:"+ errmsg);
}
}
}
......@@ -71,26 +81,30 @@ public class DauxiKS107Controller
comPortName = _comport;
//如果串口是打开的,先关闭
errmsg = "";
if (_serialPort == null)
{
_serialPort = new SerialPort(comPortName, baudRate, parity, dataBits, stopBits);
_serialPort.RtsEnable = true; //自动请求
_serialPort.ReadTimeout = 100;//超时
}
errmsg += "初始化.";
if (_serialPort.IsOpen)
_serialPort.Close();
errmsg = "";
bool ok = false;
try
{
//打开串口
errmsg += "打开串口.";
_serialPort.Open();
for (int i = 1; i < 10; i++) {
Thread.Sleep(100);
Quary(out int value, out _);
errmsg += "检测数据.";
Quary(out int value, out string err);
errmsg += err;
if (value > 0)
{
timer.Enabled = true;
......@@ -123,7 +137,7 @@ public class DauxiKS107Controller
}
else
{
errmsg = "返回数据不正确:"+BitConverter.ToString(buf);
errmsg = $"{comPortName}返回数据不正确:" + BitConverter.ToString(buf);
return false;
}
}
......@@ -133,5 +147,25 @@ public class DauxiKS107Controller
}
return true;
}
public static int TrimMean(List<int> array, double percent)
{
try
{
if (array.Count < 4)
{
return array[0];
}
List<int> templist = new List<int>(array);
templist.Sort();
templist.RemoveAt(0);
templist.RemoveAt(templist.Count - 1);
return (int)templist.Average();
}catch (Exception ex)
{
LogUtil.error(ex.ToString());
return 0;
}
}
}
......@@ -90,6 +90,7 @@ PRO,压紧轴(轴4)P1速度,CompAxis_P1_Speed,200000,,,,,,
PRO,压紧轴(轴4)P2速度,CompAxis_P2_Speed,200000,,,,,,
PRO,压紧轴(轴4)P3速度,CompAxis_P3_Speed,200000,,,,,,
PRO,出料门(轴5)开关门速度,DoorAxis_Run_Speed,180000,,,,,,
PRO,出料门(轴5)开关门行程,DoorAxis_Run_Length,600000,,,,,,
PRO,(轴一)旋转轴停止时可误差的脉冲数的最小值,MiddleAxis_ErrorCountMin,10,,,,,,
PRO,(轴二)升降轴轴停止时可误差的脉冲数的最小值,UpdownAxis_ErrorCountMin,10,,,,,,
PRO,(轴三)进出轴停止时可误差的脉冲数的最小值,InoutAxis_ErrorCountMin,100,,,,,,
......@@ -117,6 +118,8 @@ PRO,模拟信号1默认高度,AIDI1_DefaultPosition,5456,,,,,,
PRO,模拟信号2默认高度,AIDI2_DefaultPosition,5456,,,,,,
PRO,模拟信号3默认高度,AIDI3_DefaultPosition,5650,,,,,,
PRO,模拟信号4默认高度,AIDI4_DefaultPosition,5650,,,,,,
PRO,模拟信号1默认落差,AIDI1_DefaultGap,0,,,,,,
PRO,模拟信号2默认落差,AIDI2_DefaultGap,8,,,,,,
,,,,,,,,,
PRO,模拟信号1的地址,AIDI1_Addr,0,,,,,,
PRO,模拟信号2的地址,AIDI2_Addr,1,,,,,,
......@@ -126,6 +129,7 @@ PRO,模拟信号4的地址(15寸高度),AIDI4_Addr,3,,,,,,
PRO,模拟转换系数,AI_ConvertPosition,62,,,,,,
,,,,,,,,,
PRO,超声波测距1端口,Ultrasonic1_Port,COM3,,,,,,
PRO,超声波测距2端口,Ultrasonic2_Port,,,,,,,
,,,,,,,,,
PRO,默认的料盘宽度(多种尺寸为0),Default_TrayWidth,0,,,,,,
PRO,特殊二维码尺寸配置,CodeSizeConfig,XA=13x48#XB=13x32,,,,,,
......
......@@ -53,6 +53,7 @@ namespace OnlineStore.DeviceLibrary
private int OutStoreWaitSeconds = ConfigAppSettings.GetIntValue(Setting_Init.OutStoreWaitSeconds);
public static DauxiKS107Controller Ultrasonic1 = null;
public static DauxiKS107Controller Ultrasonic2 = null;
public AC_SA_BoxBean(AC_SA_Config config)
{
......@@ -123,7 +124,17 @@ namespace OnlineStore.DeviceLibrary
return;
}
}
LogUtil.info(StoreName + "Ultrasonic2_Port:" + Config.Ultrasonic2_Port);
if (!string.IsNullOrWhiteSpace(Config.Ultrasonic2_Port))
{
Ultrasonic2 = new DauxiKS107Controller(300);
if (!Ultrasonic2.OpenPort(Config.Ultrasonic2_Port, out string errmsg))
{
SetWarnMsg(ResourceControl.CustAlarm, errmsg);
LogUtil.error(StoreName + errmsg);
return;
}
}
mainTimer.Enabled = false;
......@@ -1370,7 +1381,7 @@ namespace OnlineStore.DeviceLibrary
// LogUtil.info(LOGGER, StoreName + "已经累计出入库" + CurrInOutCount + "次,需要复位一下旋转轴");
// }
//}
else if(!IsDebug)
else if(!IsDebug || autoNext)
{
//调试状态不处理出库任务
FixtureCodeInfo currInOutFixture = null;
......@@ -1790,13 +1801,11 @@ namespace OnlineStore.DeviceLibrary
}
public int GetHeight()
{
if (CodeManager.IsServerAccess())
return 0;
if (Ultrasonic1!=null) {
return CalHeight(ConvertAI(StoreManager.Store.GetADIO(1), Config.AIDI1_DefaultPosition));
}
if (CodeManager.IsServerAccess())
return 0;
if (Config.Default_TrayWidth.Equals(Width_7))
{
return GetSmallHeight();
......@@ -2330,8 +2339,11 @@ namespace OnlineStore.DeviceLibrary
string posIdStr = data[ParamDefine.posId];
string plateWStr = data[ParamDefine.plateW];
string plateHStr = data[ParamDefine.plateH];
string code = "";
if (!data.TryGetValue("code", out code))
data.TryGetValue(ParamDefine.barcode, out code);
LogUtil.info(LOGGER, "收到服务器出库消息:poaIs=" + posIdStr + ",platew=" + plateWStr + ",plateh=" + plateHStr);
LogUtil.info(LOGGER, "收到服务器出库消息:poaIs=" + posIdStr + ",platew=" + plateWStr + ",plateh=" + plateHStr+ ",code=" + code);
char splitChar = '|';
string[] posIdArray = posIdStr.Split(splitChar);
string[] plateWArray = plateWStr.Split(splitChar);
......
......@@ -18,11 +18,14 @@ namespace OnlineStore.DeviceLibrary
return Ultrasonic1.Distance;
else
if (StoreManager.Config.AIDI1_Addr>=0)
return IOManager.GetADIOValue(StoreManager.Config.AIDI1_Addr);
return IOManager.GetADIOValue(StoreManager.Config.AIDI1_Addr);
break;
case 2:
if (StoreManager.Config.AIDI2_Addr >= 0)
return IOManager.GetADIOValue(StoreManager.Config.AIDI2_Addr);
if (Ultrasonic2 != null)
return Ultrasonic2.Distance;
else
if (StoreManager.Config.AIDI2_Addr >= 0)
return IOManager.GetADIOValue(StoreManager.Config.AIDI2_Addr);
break;
case 3:
if (StoreManager.Config.AIDI3_Addr >= 0)
......@@ -37,18 +40,39 @@ namespace OnlineStore.DeviceLibrary
}
return -1;
}
DebounceFilter TrayCheck_DoorFilter = new DebounceFilter(10);
IO_VALUE Last_TrayCheck_Door;
DateTime Last_TrayCheck_Door_Time = DateTime.Now;
IO_VALUE TrayCheck_Door
{
get
{
if (Ultrasonic1 != null)
{
var xx = Math.Abs(Ultrasonic1.Distance - Config.AIDI1_DefaultPosition);
var vv = xx >= 5 ? IO_VALUE.HIGH : IO_VALUE.LOW;
var Filter = TrayCheck_DoorFilter.Filter(vv);
LogUtil.info("Ultrasonic1.Distance:" + Ultrasonic1.Distance + "," + xx + "," + vv + ",Filter=" + Filter);
return Filter;
lock (Ultrasonic1) {
var xx = Math.Abs(Ultrasonic1.Distance - Config.AIDI1_DefaultPosition);
var vv = xx >= 3 ? IO_VALUE.HIGH : IO_VALUE.LOW;
var Filter = vv;
if (vv != Last_TrayCheck_Door)
{
Last_TrayCheck_Door = vv;
Last_TrayCheck_Door_Time = DateTime.Now;
}
if (vv == IO_VALUE.LOW && (DateTime.Now - Last_TrayCheck_Door_Time).TotalMilliseconds < 1800)
Filter = IO_VALUE.HIGH;
if (Ultrasonic2 != null)
{
var x2 = Math.Abs(Ultrasonic2.Distance - Config.AIDI2_DefaultPosition);
var v2 = x2 >= 3 ? IO_VALUE.HIGH : IO_VALUE.LOW;
if (v2 == IO_VALUE.HIGH)
Filter = IO_VALUE.HIGH;
LogUtil.info($"Ultrasonic1.Distance:{Ultrasonic1.Distance},U2:{Ultrasonic2.Distance},{xx},{vv},Filter={Filter},v2:{v2}");
}
else
LogUtil.info("Ultrasonic1.Distance:" + Ultrasonic1.Distance + "," + xx + "," + vv + ",Filter=" + Filter);
return Filter;
}
}
else
return IOManager.IOValue(IO_Type.TrayCheck_Door);
......
......@@ -18,11 +18,12 @@ namespace OnlineStore.DeviceLibrary
DoorRunMonitorThread = new Thread(new ThreadStart(DoorRunMonitor));
DoorRunMonitorThread.Start();
GC.KeepAlive(DoorRunMonitorThread);
LogUtil.info(StoreName + "出料门运行监控开始");
if (Config.Door_Axis != null)
{
DoorAccSpeed = (int)(Config.DoorAxis_Run_Speed * 3);
}
LogUtil.info(StoreName + "出料门运行监控开始 DoorAccSpeed:" + DoorAccSpeed);
}
bool DoorRunMonitorEnable = false;
public void OpenDoor(bool needwait = true)
......@@ -32,7 +33,7 @@ namespace OnlineStore.DeviceLibrary
if (Config.Door_Axis != null)
{
CheckDoorState();
ACServerManager.RelMove(Config.Door_Axis.DeviceName, Config.Door_Axis.GetAxisValue(),600000, Config.DoorAxis_Run_Speed, DoorAccSpeed, DoorAccSpeed);
ACServerManager.RelMove(Config.Door_Axis.DeviceName, Config.Door_Axis.GetAxisValue(), Config.DoorAxis_Run_Length, Config.DoorAxis_Run_Speed, DoorAccSpeed, DoorAccSpeed);
LogUtil.info(StoreName + "出料门开门,速度: " + Config.DoorAxis_Run_Speed.ToString());
}
else
......@@ -61,7 +62,7 @@ namespace OnlineStore.DeviceLibrary
{
CheckDoorState();
//ACServerManager.SpeedMove(Config.Door_Axis.DeviceName,Config.Door_Axis.GetAxisValue(),-Config.DoorAxis_Run_Speed, DoorAccSpeed, DoorAccSpeed);
ACServerManager.RelMove(Config.Door_Axis.DeviceName, Config.Door_Axis.GetAxisValue(), -600000, Config.DoorAxis_Run_Speed, DoorAccSpeed, DoorAccSpeed);
ACServerManager.RelMove(Config.Door_Axis.DeviceName, Config.Door_Axis.GetAxisValue(), -Config.DoorAxis_Run_Length, Config.DoorAxis_Run_Speed, DoorAccSpeed, DoorAccSpeed);
LogUtil.info(StoreName + "出料门关门,速度: -"+Config.DoorAxis_Run_Speed.ToString());
}
......
......@@ -114,7 +114,13 @@ namespace OnlineStore
{
try
{
if (camera == null)
return;
LogUtil.info(Name + "库位文件名:" + filename);
if (filename.IndexOf("oldreel@") > 0)
return;
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp != null)
{
......
......@@ -231,7 +231,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回");
StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true));
AddAxisMoveTime(moveAxis);
var HomeAddSpeed = moveAxis.HomeAddSpeed > 0 ? moveAxis.HomeAddSpeed : moveAxis.HomeHighSpeed * 8;
var HomeAddSpeed = moveAxis.HomeAddSpeed > 0 ? moveAxis.HomeAddSpeed : moveAxis.HomeHighSpeed * 4;
var HomeLowSpeed = moveAxis.HomeLowSpeed > 0 ? moveAxis.HomeLowSpeed : moveAxis.HomeHighSpeed / 10;
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed, HomeLowSpeed, HomeAddSpeed);
......@@ -319,7 +319,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + StoreMove.CanWhileCount + "]次");
//LogUtil.error(LOGGER, StoreName + moveAxis.DisplayStr + "重新回原点");
var HomeAddSpeed = moveAxis.HomeAddSpeed > 0 ? moveAxis.HomeAddSpeed : moveAxis.HomeHighSpeed * 6;
var HomeAddSpeed = moveAxis.HomeAddSpeed > 0 ? moveAxis.HomeAddSpeed : moveAxis.HomeHighSpeed * 4;
var HomeLowSpeed = moveAxis.HomeLowSpeed > 0 ? moveAxis.HomeLowSpeed : moveAxis.HomeHighSpeed / 10;
ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed, HomeLowSpeed, HomeAddSpeed);
StoreMove.CanWhileCount--;
......
......@@ -86,6 +86,7 @@ namespace OnlineStore.LoadCSVLibrary
}
foreach (string key in cvsTitleList)
{
try
{
if (allTitleIndex.ContainsKey(key))
......@@ -98,6 +99,7 @@ namespace OnlineStore.LoadCSVLibrary
string proName = proNameList[proIndexMap[key]];
checkFiledList.Remove(proName);
PropertyInfo prop = props.First(c => c.Name == proName);//获取同名属性
if (prop != null && !value.Equals(""))
{
if (value.Equals("") && prop.PropertyType.Name.ToLower().Contains("int"))
......@@ -126,7 +128,7 @@ namespace OnlineStore.LoadCSVLibrary
LOGGER.Error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString());
}
}
bllIns.CheckField();
// bllIns.CheckField();
configList.Add(bllIns);
}
index++;
......
......@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
......
......@@ -456,6 +456,18 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("AIDI4_DefaultPosition", false )]
public double AIDI4_DefaultPosition { get; set; }
/// <summary>
/// PRO,模拟信号1默认高度,AIDI1_DefaultPosition,1,,,,,,,
/// </summary>
[ConfigProAttribute("AIDI1_DefaultGap", false )]
public double AIDI1_DefaultGap { get; set; }
/// <summary>
/// PRO,模拟信号2默认高度,AIDI2_DefaultPosition,1,,,,,,,
/// </summary>
[ConfigProAttribute("AIDI2_DefaultGap", false )]
public double AIDI2_DefaultGap { get; set; }
/// <summary>
/// PRO 模拟信号1的地址 AIDI1_Addr 7
/// </summary>
[ConfigProAttribute("AIDI1_Addr", true)]
......@@ -545,6 +557,11 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
[ConfigProAttribute("DoorAxis_Run_Speed",false)]
public int DoorAxis_Run_Speed { get; set; }
/// <summary>
///出料门(轴5)开关门距离
/// </summary>
[ConfigProAttribute("DoorAxis_Run_Length", false)]
public int DoorAxis_Run_Length { get; set; }
/// <summary>
......@@ -561,9 +578,14 @@ namespace OnlineStore.LoadCSVLibrary
/// PRO
/// 测距1端口 Ultrasonic1_Port
/// </summary>
[ConfigProAttribute("Ultrasonic1_Port")]
[ConfigProAttribute("Ultrasonic1_Port", false)]
public string Ultrasonic1_Port { get; set; }
/// <summary>
/// PRO
/// 测距2端口 Ultrasonic1_Port
/// </summary>
[ConfigProAttribute("Ultrasonic2_Port",false)]
public string Ultrasonic2_Port { get; set; }
/// <summary>
/// 轴5出料门
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!