Commit 556fc0fa 几米阳光

出料时批量上下轴要先下降,叉子才能下降。修改压紧轴运动代码

1 个父辈 5b74988c
...@@ -31,8 +31,10 @@ ...@@ -31,8 +31,10 @@
<add key="CodeParamPath" value="\CodeParam\" /> <add key="CodeParamPath" value="\CodeParam\" />
<add key="InOutDefaultPosition" value="10000" /> <add key="InOutDefaultPosition" value="10000" />
<add key="Config_Pwd" value="123456" /> <add key="Config_Pwd" value="123456" />
<!--5000脉冲对应1mm--> <!--批量上下料轴5000脉冲对应1mm-->
<add key="AxisChangeValue" value="5000" /> <add key="AxisChangeValue" value="5000" />
<!--压紧轴计量检测信号亮1次的脉冲值-->
<add key ="ComAxisChangeValue" value ="2400"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -87,7 +87,7 @@ namespace OnlineStore.AutoInOutStore ...@@ -87,7 +87,7 @@ namespace OnlineStore.AutoInOutStore
//txtUpDownP1.Text = ktkPosition.UpDownAxis_DoorOPosition_P1.ToString(); //txtUpDownP1.Text = ktkPosition.UpDownAxis_DoorOPosition_P1.ToString();
} }
txtSpeed.Text = store.Config.CompressAxis_EndSpeed.ToString();
List<string> port = new List<string>(SerialPort.GetPortNames()); List<string> port = new List<string>(SerialPort.GetPortNames());
comboBoxPortName.DataSource = port; comboBoxPortName.DataSource = port;
if (port.IndexOf(store.Config.CompressAxis_PortName) >= 0) if (port.IndexOf(store.Config.CompressAxis_PortName) >= 0)
...@@ -1433,7 +1433,9 @@ namespace OnlineStore.AutoInOutStore ...@@ -1433,7 +1433,9 @@ namespace OnlineStore.AutoInOutStore
} }
private void btnGetPosition_Click(object sender, EventArgs e) private void btnGetPosition_Click(object sender, EventArgs e)
{ {
ShuoKeControls.GetABSPosition(store.Config.CompressAxis_Slv); int value = ShuoKeControls.GetABSPosition(store.Config.CompressAxis_Slv);
lblComMsg.Text=DateTime.Now.ToLongTimeString() + "实时位置:" + value;
} }
private void btnStop_Click(object sender, EventArgs e) private void btnStop_Click(object sender, EventArgs e)
{ {
...@@ -1460,7 +1462,8 @@ namespace OnlineStore.AutoInOutStore ...@@ -1460,7 +1462,8 @@ namespace OnlineStore.AutoInOutStore
} }
private void btnStatusSearch_Click(object sender, EventArgs e) private void btnStatusSearch_Click(object sender, EventArgs e)
{ {
ShuoKeControls.GetStatus(store.Config.CompressAxis_Slv); ShuoKeInfo info = ShuoKeControls.GetStatus(store.Config.CompressAxis_Slv);
lblComMsg.Text = info.ToShowStr();
} }
private void FormComStatus(bool isOpen) private void FormComStatus(bool isOpen)
{ {
......
...@@ -63,7 +63,7 @@ X12_上料机构出料检测信号: ...@@ -63,7 +63,7 @@ X12_上料机构出料检测信号:
X16_压紧轴机构计量检测: X16_压紧轴机构计量检测:
此信号每4mm就会亮一次,压紧轴运动过程中需要检测此信号闪的次数。 此信号每4mm就会亮一次,压紧轴运动过程中需要检测此信号闪的次数。
X04_安全光栅: X04_安全光栅:
光栅默认为High,每次开关门之前都要验证。 光栅默认为High,每次开关门之前都要验证。
...@@ -72,7 +72,13 @@ X22_气压检测: ...@@ -72,7 +72,13 @@ X22_气压检测:
20181219-20181224修改
批量出库时,轴先移动到检测点亮,然后下降指定的高度,叉子出到批量装置时,把料盘放在批量上下轴上。
增加配置:上料轴最大出料高度,
上料轴出料时需要距离检测信号下降的高度。
压紧轴改为同步返回数据模式,压紧轴增加计量检测功能。
......
...@@ -76,5 +76,7 @@ namespace OnlineStore.Common ...@@ -76,5 +76,7 @@ namespace OnlineStore.Common
/// 是否是代码运行,不需要连接设备 /// 是否是代码运行,不需要连接设备
/// </summary> /// </summary>
public static string CodeRun = "CodeRun"; public static string CodeRun = "CodeRun";
public static string ComAxisChangeValue = "ComAxisChangeValue";
} }
} }
...@@ -456,7 +456,7 @@ namespace OnlineStore.Common ...@@ -456,7 +456,7 @@ namespace OnlineStore.Common
#endregion #endregion
#region 十六进制字符串转字节型 #region 十六进制字符串转字节型
/// <summary> /// <summary>
/// 打包方法,可以将十六制字符串转成byte[] ,字符串没有空格 /// 打包方法,可以将十六制字符串转成byte[] ,字符串没有空格
/// </summary> /// </summary>
......
...@@ -116,9 +116,9 @@ namespace OnlineStore.Common ...@@ -116,9 +116,9 @@ namespace OnlineStore.Common
private static byte[] buildCheckData(byte[] sendData, int length) private static byte[] buildCheckData(byte[] sendData, int length)
{ {
ushort pChecksum = 0; ushort pChecksum = 0;
SerialBean.CalculateCRC(sendData, length, out pChecksum); AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16); string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr); byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1) if (checkByte.Length == 1)
{ {
sendData[length] = checkByte[0]; sendData[length] = checkByte[0];
......
...@@ -461,23 +461,23 @@ namespace OnlineStore.Common ...@@ -461,23 +461,23 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
/// <param name="s"></param> /// <param name="s"></param>
/// <returns></returns> /// <returns></returns>
public static byte[] StringToByte(string s) //public static byte[] StringToByte(string s)
{ //{
string temps = ReplaceSpace(s); // string temps = ReplaceSpace(s);
if (temps.Length % 2 != 0) // if (temps.Length % 2 != 0)
{ // {
temps = "0" + temps; // temps = "0" + temps;
} // }
byte[] tempb = new byte[50]; // byte[] tempb = new byte[50];
int j = 0; // int j = 0;
for (int i = 0; i < temps.Length; i = i + 2, j++) // for (int i = 0; i < temps.Length; i = i + 2, j++)
{ // {
tempb[j] = Convert.ToByte(temps.Substring(i, 2), 16); // tempb[j] = Convert.ToByte(temps.Substring(i, 2), 16);
} // }
byte[] send = new byte[j]; // byte[] send = new byte[j];
Array.Copy(tempb, send, j); // Array.Copy(tempb, send, j);
return send; // return send;
} //}
//除去空格 //除去空格
public static string ReplaceSpace(string str) public static string ReplaceSpace(string str)
...@@ -525,33 +525,33 @@ namespace OnlineStore.Common ...@@ -525,33 +525,33 @@ namespace OnlineStore.Common
pChecksum = check; pChecksum = check;
} }
public static void CalculateCRC(byte[] pByte, int nNumberOfBytes, out ushort pChecksum) //public static void CalculateCRC(byte[] pByte, int nNumberOfBytes, out ushort pChecksum)
{ //{
int nBit; // int nBit;
ushort nShiftedBit; // ushort nShiftedBit;
pChecksum = 0xFFFF; // pChecksum = 0xFFFF;
for (int nByte = 0; nByte < nNumberOfBytes; nByte++) // for (int nByte = 0; nByte < nNumberOfBytes; nByte++)
{ // {
pChecksum ^= pByte[nByte]; // pChecksum ^= pByte[nByte];
for (nBit = 0; nBit < 8; nBit++) // for (nBit = 0; nBit < 8; nBit++)
{ // {
if ((pChecksum & 0x1) == 1) // if ((pChecksum & 0x1) == 1)
{ // {
nShiftedBit = 1; // nShiftedBit = 1;
} // }
else // else
{ // {
nShiftedBit = 0; // nShiftedBit = 0;
} // }
pChecksum >>= 1; // pChecksum >>= 1;
if (nShiftedBit != 0) // if (nShiftedBit != 0)
{ // {
pChecksum ^= 0xA001; // pChecksum ^= 0xA001;
} // }
} // }
} // }
} //}
#endregion #endregion
} }
......
...@@ -67,12 +67,13 @@ ...@@ -67,12 +67,13 @@
<Compile Include="PanasonicServo\ACCMDManager.cs" /> <Compile Include="PanasonicServo\ACCMDManager.cs" />
<Compile Include="PanasonicServo\ACServerManager.cs" /> <Compile Include="PanasonicServo\ACServerManager.cs" />
<Compile Include="PanasonicServo\ACServerManager_Partial.cs" /> <Compile Include="PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="ShuoKe\MeteringSignalBean.cs" />
<Compile Include="ShuoKe\ShuoKeController.cs" />
<Compile Include="store\LineMoveP.cs" /> <Compile Include="store\LineMoveP.cs" />
<Compile Include="store\LineAlarm.cs"> <Compile Include="store\LineAlarm.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ShuoKe\ShuoKeControls.cs" />
<Compile Include="store\model\AxisAlarmInfo.cs" /> <Compile Include="store\model\AxisAlarmInfo.cs" />
<Compile Include="store\model\FixtureCodeInfo.cs" /> <Compile Include="store\model\FixtureCodeInfo.cs" />
<Compile Include="store\InOrOutStoreParam.cs"> <Compile Include="store\InOrOutStoreParam.cs">
......
...@@ -141,9 +141,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -141,9 +141,9 @@ namespace OnlineStore.DeviceLibrary
public static byte[] buildCheckData(byte[] sendData, int length) public static byte[] buildCheckData(byte[] sendData, int length)
{ {
ushort pChecksum = 0; ushort pChecksum = 0;
SerialBean.CalculateCRC(sendData, length, out pChecksum); AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16); string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr); byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1) if (checkByte.Length == 1)
{ {
sendData[length] = checkByte[0]; sendData[length] = checkByte[0];
...@@ -186,7 +186,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -186,7 +186,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8]; byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_WriteCoil; sendData[1] = CMD_WriteCoil;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -198,7 +198,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -198,7 +198,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(dataValue); byte[] dataByte = AcSerialBean.StringToByte(dataValue);
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
...@@ -219,7 +219,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -219,7 +219,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8]; byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_ReadCoil; sendData[1] = CMD_ReadCoil;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -231,7 +231,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -231,7 +231,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(length.ToString()); byte[] dataByte = AcSerialBean.StringToByte(length.ToString());
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
...@@ -262,7 +262,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -262,7 +262,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8 ]; byte[] sendData = new byte[8 ];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_ReadRegisters; sendData[1] = CMD_ReadRegisters;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -274,7 +274,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -274,7 +274,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(length.ToString()); byte[] dataByte = AcSerialBean.StringToByte(length.ToString());
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
...@@ -304,7 +304,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -304,7 +304,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8]; byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_WriteRegisters; sendData[1] = CMD_WriteRegisters;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -316,7 +316,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -316,7 +316,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(dataValue); byte[] dataByte = AcSerialBean.StringToByte(dataValue);
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
......
...@@ -246,8 +246,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -246,8 +246,8 @@ namespace OnlineStore.DeviceLibrary
public static void RelMove(string portName, int slvAddr, int position) public static void RelMove(string portName, int slvAddr, int position)
{ {
//int position = Convert.ToInt32(txtPosition.Text); //int position = Convert.ToInt32(txtPosition.Text);
byte[] positionData = SerialBean.StringToByte(position.ToString("X8")); byte[] positionData = AcSerialBean.StringToByte(position.ToString("X8"));
byte[] data = SerialBean.StringToByte("0110480C 000408 10000111EC78FFFF ffff"); byte[] data = AcSerialBean.StringToByte("0110480C 000408 10000111EC78FFFF ffff");
data[0] = (byte)slvAddr; data[0] = (byte)slvAddr;
data[data.Length - 1] = 0x00; data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00; data[data.Length - 2] = 0x00;
...@@ -397,8 +397,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -397,8 +397,8 @@ namespace OnlineStore.DeviceLibrary
public static void AbsMove(string portName, int slvAddr, int position) public static void AbsMove(string portName, int slvAddr, int position)
{ {
//int position = Convert.ToInt32(txtPosition.Text, 10); //int position = Convert.ToInt32(txtPosition.Text, 10);
byte[] positionData = SerialBean.StringToByte(position.ToString("X8")); byte[] positionData = AcSerialBean.StringToByte(position.ToString("X8"));
byte[] data = SerialBean.StringToByte("01104808 000408 10000211 EC78FFFF ffff"); byte[] data = AcSerialBean.StringToByte("01104808 000408 10000211 EC78FFFF ffff");
data[0] = (byte)slvAddr; data[0] = (byte)slvAddr;
data[data.Length - 1] = 0x00; data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00; data[data.Length - 2] = 0x00;
......
...@@ -41,7 +41,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -41,7 +41,7 @@ namespace OnlineStore.DeviceLibrary
//} //}
public static void SendStrAndSleep(string portName, string str, int sleepS) public static void SendStrAndSleep(string portName, string str, int sleepS)
{ {
byte[] data = SerialBean.StringToByte(str); byte[] data = AcSerialBean.StringToByte(str);
data[data.Length - 1] = 0x00; data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00; data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2); data = ACCMDManager.buildCheckData(data, data.Length - 2);
...@@ -50,7 +50,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -50,7 +50,7 @@ namespace OnlineStore.DeviceLibrary
} }
public static void SendStr(string portName, string str) public static void SendStr(string portName, string str)
{ {
byte[] data = SerialBean.StringToByte(str); byte[] data = AcSerialBean.StringToByte(str);
data[data.Length - 1] = 0x00; data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00; data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2); data = ACCMDManager.buildCheckData(data, data.Length - 2);
...@@ -283,7 +283,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -283,7 +283,7 @@ namespace OnlineStore.DeviceLibrary
public static void SendStr(string portName, int slvAddr, string str) public static void SendStr(string portName, int slvAddr, string str)
{ {
//string str = txtSendStr.Text; //string str = txtSendStr.Text;
byte[] data = SerialBean.StringToByte(str); byte[] data = AcSerialBean.StringToByte(str);
data[data.Length - 1] = 0x00; data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00; data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2); data = ACCMDManager.buildCheckData(data, data.Length - 2);
......
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 压紧机构计量检测信号处理
/// </summary>
public class MeteringSignal
{
public static int ComAxisChangeValue = ConfigAppSettings.GetIntValue(Setting_Init.ComAxisChangeValue);
/// <summary>
/// 信号变化次数
/// </summary>
public static int SignalChangeCount=0;
public static int TragetChangeCount = 0;
public static IO_VALUE PreSignalValue = IO_VALUE.LOW;
private static System.Timers.Timer timer = null;
public static void StartCheck(int targetPositon, int currPosition)
{
int chazhi = Math.Abs(targetPositon - currPosition);
int count = chazhi / ComAxisChangeValue;
if (count > 0 && chazhi > ComAxisChangeValue)
{
StartCheck(count);
}
}
private static void StartCheck(int targetCount)
{
TragetChangeCount = targetCount;
if (timer == null)
{
timer = new System.Timers.Timer();
timer.Interval = 50;
timer.AutoReset = true;
timer.Elapsed += Timer_Elapsed;
timer.Enabled = false;
}
LogUtil.debug("开始压紧轴计量检测,预计变化" + TragetChangeCount + "次");
IsInProcess = false;
PreSignalValue = IO_VALUE.LOW;
SignalChangeCount = 0;
timer.Start();
}
public static void StopCheck()
{
if(timer==null)
{ return; }
timer.Stop();
}
private static bool IsInProcess = false;
protected static void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
if (IsInProcess) { return; }
IsInProcess = true;
IO_VALUE value = KND.IOValue(IO_Type.CompressAxis_Check);
if (value.Equals(IO_VALUE.HIGH) && PreSignalValue.Equals(IO_VALUE.LOW))
{
SignalChangeCount++;
LogUtil.debug("检测到信号变化,已经变化" + SignalChangeCount + "次");
}
PreSignalValue = value;
if (TragetChangeCount <= SignalChangeCount)
{
timer.Stop();
}
IsInProcess = false;
}
}
}
...@@ -94,9 +94,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -94,9 +94,9 @@ namespace OnlineStore.DeviceLibrary
//校验 //校验
ushort pChecksum = 0; ushort pChecksum = 0;
SerialBean.CalculateCRC(bits, bits.Length - 2, out pChecksum); AcSerialBean.CalculateCRC(bits, bits.Length - 2, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16); string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr); byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1) if (checkByte.Length == 1)
{ {
if (!bits[bits.Length - 2].Equals(checkByte[0])) if (!bits[bits.Length - 2].Equals(checkByte[0]))
...@@ -299,7 +299,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -299,7 +299,7 @@ namespace OnlineStore.DeviceLibrary
sendData[5] = 0x00; sendData[5] = 0x00;
sendData[6] = 0x00; sendData[6] = 0x00;
string speed = Convert.ToString(position, 16); string speed = Convert.ToString(position, 16);
byte[] speedByte = SerialBean.StringToByte(speed); byte[] speedByte = AcSerialBean.StringToByte(speed);
for (int i = 0; i < speedByte.Length; i++) for (int i = 0; i < speedByte.Length; i++)
{ {
...@@ -349,7 +349,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -349,7 +349,7 @@ namespace OnlineStore.DeviceLibrary
sendData[5] = 0x00; sendData[5] = 0x00;
sendData[6] = 0x00; sendData[6] = 0x00;
string speed = Convert.ToString(dataValue, 16); string speed = Convert.ToString(dataValue, 16);
byte[] speedByte = SerialBean.StringToByte(speed); byte[] speedByte = AcSerialBean.StringToByte(speed);
for (int i = 0; i < speedByte.Length; i++) for (int i = 0; i < speedByte.Length; i++)
{ {
...@@ -367,9 +367,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -367,9 +367,9 @@ namespace OnlineStore.DeviceLibrary
private static byte[] buildCheckData(byte[] sendData, int length) private static byte[] buildCheckData(byte[] sendData, int length)
{ {
ushort pChecksum = 0; ushort pChecksum = 0;
SerialBean.CalculateCRC(sendData, length, out pChecksum); AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16); string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr); byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1) if (checkByte.Length == 1)
{ {
sendData[length] = checkByte[0]; sendData[length] = checkByte[0];
......
...@@ -139,7 +139,8 @@ PRO,(轴五)上料轴最大误差脉冲值,BatchAxis_ErrorCountMax,1000,,,,,,, ...@@ -139,7 +139,8 @@ PRO,(轴五)上料轴最大误差脉冲值,BatchAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴五)上料轴最小限位,BatchAxis_PositionMin,0,,,,,,, PRO,(轴五)上料轴最小限位,BatchAxis_PositionMin,0,,,,,,,
PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,, PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,300,,,,,,, PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,300,,,,,,,
,,,,,,,,,, PRO,(轴五)上料轴出料时距离检测信号需要下降的高度,BatchAxis_OutDownPosition,3000,,,,,,,
PRO,(轴五)上料轴最最大料盘高度,到达后无法批量出库,BatchAxis_MaxHeight,100,,,,,,,
,,,,,,,,,, ,,,,,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,192.168.202.11#16;192.168.200.12#4,,,,,, , PRO,IO模块对应的DI数量,IO_DILength,192.168.202.11#16;192.168.200.12#4,,,,,, ,
PRO,模块对应的DO数量,IO_DOLength,192.168.202.11#16;192.168.200.12#4,,,,,,, PRO,模块对应的DO数量,IO_DOLength,192.168.202.11#16;192.168.200.12#4,,,,,,,
...@@ -292,24 +292,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -292,24 +292,24 @@ namespace OnlineStore.DeviceLibrary
{ {
string portName = Config.InOut_Axis.DeviceName; string portName = Config.InOut_Axis.DeviceName;
int slvAddr = Config.InOut_Axis.GetAxisValue(); int slvAddr = Config.InOut_Axis.GetAxisValue();
if (ACServerManager.GetHomeEndStatus(portName, slvAddr).Equals(1) //if (ACServerManager.GetHomeEndStatus(portName, slvAddr).Equals(1)
&& ACServerManager.GetHomeSingle(portName, slvAddr).Equals(1)) // && ACServerManager.GetHomeSingle(portName, slvAddr).Equals(1))
{ //{
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutMove); // StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutMove);
LogUtil.info(LOGGER, StoreName + "复位中,进出轴原点亮且已经原点返回过,先相对走-5000"); // LogUtil.info(LOGGER, StoreName + "复位中,进出轴原点亮且已经原点返回过,先相对走-5000");
int currPos = ACServerManager.GetActualtPosition(portName, slvAddr); // int currPos = ACServerManager.GetActualtPosition(portName, slvAddr);
int targetPos = currPos - 5000; // int targetPos = currPos - 5000;
ACAxisMove(Config.InOut_Axis, targetPos, Config.InoutAxis_HomeLowSpeed); // ACAxisMove(Config.InOut_Axis, targetPos, Config.InoutAxis_HomeLowSpeed);
ResetCloseDoor(); // ResetCloseDoor();
} //}
else //else
{ //{
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack);
LogUtil.info(LOGGER, StoreName + "复位中,进出轴开始原点返回"); LogUtil.info(LOGGER, StoreName + "复位中,进出轴开始原点返回");
ACAxisHomeMove(Config.InOut_Axis); ACAxisHomeMove(Config.InOut_Axis);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000)); StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
ResetCloseDoor(); ResetCloseDoor();
} //}
} }
/// <summary> /// <summary>
/// 复位处理 /// 复位处理
...@@ -426,9 +426,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -426,9 +426,17 @@ namespace OnlineStore.DeviceLibrary
} }
private void ComMoveToPosition(int targetPosition) private void ComMoveToPosition(int targetPosition)
{ {
ComMoveToPosition(targetPosition, false);
}
private void ComMoveToPosition(int targetPosition, bool isNeedCheckSingle)
{
if (IsHasCompress_Axis) if (IsHasCompress_Axis)
{ {
LogUtil.debug("压紧轴绝对运动目标位置:" + targetPosition); LogUtil.debug("压紧轴绝对运动目标位置:" + targetPosition);
if (isNeedCheckSingle)
{
MeteringSignal.StartCheck(targetPosition, ShuoKeControls.GetABSPosition(Config.CompressAxis_Slv));
}
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, targetPosition, false)); StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, targetPosition, false));
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, targetPosition); ShuoKeControls.AbsMove(Config.CompressAxis_Slv, targetPosition);
Thread.Sleep(100); Thread.Sleep(100);
......
...@@ -204,29 +204,32 @@ namespace OnlineStore.DeviceLibrary ...@@ -204,29 +204,32 @@ namespace OnlineStore.DeviceLibrary
} }
else if (wait.WaitType == (int)Wait_Type.ShuoKe_5) else if (wait.WaitType == (int)Wait_Type.ShuoKe_5)
{ {
ShuoKeInfo info = null; string msg = "";
if (wait.IsHomeMove) wait.IsEnd = ShuoKeIsEnd(wait, out msg);
{ NotOkMsg = NotOkMsg + " " + msg;
wait.IsEnd = ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out info); //ShuoKeInfo info = null;
} //if (wait.IsHomeMove)
else //{
{ // wait.IsEnd = ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out info);
wait.IsEnd = ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out info); //}
} //else
if (!wait.IsEnd) //{
{ // wait.IsEnd = ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out info);
if (info == null) //}
{ //if (!wait.IsEnd)
//{
// if (info == null)
// {
NotOkMsg += "info=null;"; // NotOkMsg += "info=null;";
} // }
else // else
{ // {
NotOkMsg += "" + info.ToShowStr(); // NotOkMsg += "" + info.ToShowStr();
} // }
ShuoKeControls.GetStatus(wait.SlvAddr); // ShuoKeControls.GetStatus(wait.SlvAddr);
} //}
} }
if (wait.IsEnd) if (wait.IsEnd)
{ {
...@@ -269,6 +272,36 @@ namespace OnlineStore.DeviceLibrary ...@@ -269,6 +272,36 @@ namespace OnlineStore.DeviceLibrary
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType); Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
} }
} }
private bool ShuoKeIsEnd(WaitResultInfo wait, out string msg)
{
//bool result = false;
msg = "";
if (wait.IsHomeMove)
{
return ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out msg);
}
else
{
bool isend = ShuoKeControls.IsMoveEnd(wait.SlvAddr, wait.TargetPosition, StoreMove.LastSetpTime, out msg);
if (isend)
{
bool isCheckOk = (MeteringSignal.TragetChangeCount <= MeteringSignal.SignalChangeCount);
if (isCheckOk || MeteringSignal.TragetChangeCount <= 0)
{
MeteringSignal.StopCheck();
return true;
}
else
{
msg = "压紧轴计量检测目标【" + MeteringSignal.TragetChangeCount + "】实际【" + MeteringSignal.SignalChangeCount + "】";
LogUtil.error("压紧轴已经停止运动,但是 " + msg);
return false;
}
}
}
return false;
}
#endregion #endregion
...@@ -397,7 +430,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -397,7 +430,7 @@ namespace OnlineStore.DeviceLibrary
{ {
InStoreLog("入库:SI_06 压紧轴压紧,压紧轴到P2 "); InStoreLog("入库:SI_06 压紧轴压紧,压紧轴到P2 ");
StoreMove.NextMoveStep(StoreMoveStep.SI_06_CompressWork); StoreMove.NextMoveStep(StoreMoveStep.SI_06_CompressWork);
ComMoveToPosition(moveP.ComPress_P2); ComMoveToPosition(moveP.ComPress_P2,true);
} }
else else
{ {
...@@ -471,7 +504,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -471,7 +504,7 @@ namespace OnlineStore.DeviceLibrary
//SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd); //SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd);
StoreMove.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag); StoreMove.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag);
ComMoveToPosition(moveP.ComPress_P3); ComMoveToPosition(moveP.ComPress_P3,true);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed); ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
} }
else if (StoreMove.MoveStep == StoreMoveStep.SI_12_PutWareToBag) else if (StoreMove.MoveStep == StoreMoveStep.SI_12_PutWareToBag)
...@@ -587,6 +620,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -587,6 +620,13 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
} }
int height = param.GetACPosition().BagHeight;
if (AutomaticBaiting.BatchOutStoreHeight+ height > Config.BatchAxis_MaxHeight)
{
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,当前高【"+ AutomaticBaiting.BatchOutStoreHeight + "】出库料盘高【"+ height + "】,最大高【"+ Config.BatchAxis_MaxHeight + "】");
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,批量上下料机构已满,请先拿出料盘");
return false;
}
storeStatus = StoreStatus.OutStoreExecute; storeStatus = StoreStatus.OutStoreExecute;
LogUtil.info(LOGGER, StoreName + logMsg); LogUtil.info(LOGGER, StoreName + logMsg);
...@@ -630,10 +670,35 @@ namespace OnlineStore.DeviceLibrary ...@@ -630,10 +670,35 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SO_02_DeviceBack) else if (StoreMove.MoveStep == StoreMoveStep.SO_02_DeviceBack)
{ {
StoreMove.NextMoveStep(StoreMoveStep.SO_03_ToBagPosition); StoreMove.NextMoveStep(StoreMoveStep.SO_03_ToBagPosition);
if (StoreMove.IsBatchInOutStore)
{
int targetValue = GetBatchTargetValue(Config.BatchAxis_OutDownPosition);
if (targetValue >= 1000 + moveP.BatchAxis_DownValue)
{
StoreMove.TimeOutSeconds = 120;
ACAxisMove(Config.Batch_Axis, targetValue, Config.BatchAxis_P1_Speed);
OutStoreLog("出库:SO_03 批量上下料轴下降【" + Config.BatchAxis_OutDownPosition + "】目标【" + targetValue + "】 ");
}
else
{
AutomaticBaiting.BatchOutStoreCount++;
AutomaticBaiting.BatchOutStoreHeight =1000;
OutStoreLog("出库:SO_03批量上下料轴需要下降【" + Config.BatchAxis_OutDownPosition + "】目标【" + targetValue + "】 ,请检查料盘是否已满");
//停止出库
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
storeStatus = StoreStatus.StoreOnline;
LogUtil.error(LOGGER, StoreName + " 【" + posId + "】 出库中断,请检查料盘是否已满,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!");
StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore);
return;
}
}
OutStoreLog("出库:SO_03 走到库位,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)"); OutStoreLog("出库:SO_03 走到库位,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)");
ComMoveToPosition(moveP.ComPress_P3); ComMoveToPosition(moveP.ComPress_P3);
ACAxisMove(Config.Middle_Axis, StoreMove.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed); ACAxisMove(Config.Middle_Axis, StoreMove.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed); ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed);
} }
else if (StoreMove.MoveStep == StoreMoveStep.SO_03_ToBagPosition) else if (StoreMove.MoveStep == StoreMoveStep.SO_03_ToBagPosition)
{ {
...@@ -645,7 +710,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -645,7 +710,7 @@ namespace OnlineStore.DeviceLibrary
{ {
OutStoreLog("出库:SO_05 拿起物品,升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点) "); OutStoreLog("出库:SO_05 拿起物品,升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点) ");
StoreMove.NextMoveStep(StoreMoveStep.SO_05_BagWareToDevice); StoreMove.NextMoveStep(StoreMoveStep.SO_05_BagWareToDevice);
ComMoveToPosition(moveP.ComPress_P2); ComMoveToPosition(moveP.ComPress_P2,true);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed); ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed);
} }
else if (StoreMove.MoveStep == StoreMoveStep.SO_05_BagWareToDevice) else if (StoreMove.MoveStep == StoreMoveStep.SO_05_BagWareToDevice)
...@@ -707,11 +772,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -707,11 +772,11 @@ namespace OnlineStore.DeviceLibrary
{ {
StoreMove.NextMoveStep(StoreMoveStep.SO_11_PutTray); StoreMove.NextMoveStep(StoreMoveStep.SO_11_PutTray);
OutStoreLog("出库:SO_11_PutTray 放下料盘,升降轴到P8(出库低点),压紧轴至P3(压紧前点)"); OutStoreLog("出库:SO_11_PutTray 放下料盘,升降轴到P8(出库低点),压紧轴至P3(压紧前点)");
ComMoveToPosition(StoreMove.MoveParam.MoveP.ComPress_P3); ComMoveToPosition(StoreMove.MoveParam.MoveP.ComPress_P3,true);
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_OutLow_P8, Config.UpDownAxis_P8_Speed); ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_OutLow_P8, Config.UpDownAxis_P8_Speed);
} }
else if (KND.IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.HIGH)) else if (KND.IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.HIGH))
{ {
StoreMove.NextMoveStep(StoreMoveStep.SO_21_OpenDoor); StoreMove.NextMoveStep(StoreMoveStep.SO_21_OpenDoor);
OutStoreLog("出库:SO_21打开仓门,压紧轴至P3(压紧前点),定位气缸下降"); OutStoreLog("出库:SO_21打开仓门,压紧轴至P3(压紧前点),定位气缸下降");
ComMoveToPosition(StoreMove.MoveParam.MoveP.ComPress_P3); ComMoveToPosition(StoreMove.MoveParam.MoveP.ComPress_P3);
...@@ -770,15 +835,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -770,15 +835,19 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
private void BatchAxisUpTrayHeight() private int GetBatchTargetValue(int downValue)
{ {
//上料轴需要向下走
int currPosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis); int currPosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis);
if (currPosition.Equals(-1)) if (currPosition.Equals(-1))
{ {
currPosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis); currPosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis);
} }
int targetValue = currPosition - StoreMove.MoveParam.MoveP.BatchAxis_DownValue; int targetValue = currPosition - downValue;
return targetValue;
}
private void BatchAxisUpTrayHeight()
{
int targetValue = GetBatchTargetValue(StoreMove.MoveParam.MoveP.BatchAxis_DownValue);
//记录高度 //记录高度
AutomaticBaiting.BatchOutStoreCount++; AutomaticBaiting.BatchOutStoreCount++;
AutomaticBaiting.BatchOutStoreHeight += StoreMove.MoveParam.GetACPosition().BagHeight; AutomaticBaiting.BatchOutStoreHeight += StoreMove.MoveParam.GetACPosition().BagHeight;
......
...@@ -566,6 +566,19 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -566,6 +566,19 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary> /// <summary>
/// PRO(轴五)上料轴出料时距离检测信号需要下降的高度 BatchAxis_OutDownPosition
///</summary>
[ConfigProAttribute("BatchAxis_OutDownPosition", true)]
public int BatchAxis_OutDownPosition { get; set; }
/// <summary>
/// PRO(轴五)上料轴最最大料盘高度,到达后无法批量出库 BatchAxis_MaxHeight
///</summary>
[ConfigProAttribute("BatchAxis_MaxHeight", true)]
public int BatchAxis_MaxHeight { get; set; }
/// <summary>
/// PRO,默认的料盘宽度(不可更改),Default_TrayWidth,7 /// PRO,默认的料盘宽度(不可更改),Default_TrayWidth,7
/// </summary> /// </summary>
[ConfigProAttribute("Default_TrayWidth")] [ConfigProAttribute("Default_TrayWidth")]
...@@ -581,6 +594,8 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -581,6 +594,8 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("IO_DOLength")] [ConfigProAttribute("IO_DOLength")]
public string IO_DOLength { get; set; } public string IO_DOLength { get; set; }
private Dictionary<string, ushort> DILengthMap = null; private Dictionary<string, ushort> DILengthMap = null;
private Dictionary<string, ushort> DOLengthMap = null; private Dictionary<string, ushort> DOLengthMap = null;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!