Commit c2b136f3 ke.sun

调试修改

1 个父辈 88520123
......@@ -43,6 +43,8 @@
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.btnCloseAxisBreak = new System.Windows.Forms.Button();
this.btnOpenAxisBreak = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
......@@ -56,6 +58,8 @@
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnCloseAxisBreak);
this.groupBox1.Controls.Add(this.btnOpenAxisBreak);
this.groupBox1.Controls.Add(this.btnLocationDown);
this.groupBox1.Controls.Add(this.btnLocationUp);
this.groupBox1.Controls.Add(this.btnCloseDoor);
......@@ -88,7 +92,7 @@
// btnLocationDown
//
this.btnLocationDown.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLocationDown.Location = new System.Drawing.Point(144, 326);
this.btnLocationDown.Location = new System.Drawing.Point(144, 308);
this.btnLocationDown.Name = "btnLocationDown";
this.btnLocationDown.Size = new System.Drawing.Size(102, 34);
this.btnLocationDown.TabIndex = 251;
......@@ -99,7 +103,7 @@
// btnLocationUp
//
this.btnLocationUp.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLocationUp.Location = new System.Drawing.Point(27, 326);
this.btnLocationUp.Location = new System.Drawing.Point(27, 308);
this.btnLocationUp.Name = "btnLocationUp";
this.btnLocationUp.Size = new System.Drawing.Size(102, 34);
this.btnLocationUp.TabIndex = 250;
......@@ -110,7 +114,7 @@
// btnCloseDoor
//
this.btnCloseDoor.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCloseDoor.Location = new System.Drawing.Point(144, 282);
this.btnCloseDoor.Location = new System.Drawing.Point(144, 270);
this.btnCloseDoor.Name = "btnCloseDoor";
this.btnCloseDoor.Size = new System.Drawing.Size(102, 34);
this.btnCloseDoor.TabIndex = 249;
......@@ -121,7 +125,7 @@
// btnOpenDoor
//
this.btnOpenDoor.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpenDoor.Location = new System.Drawing.Point(27, 282);
this.btnOpenDoor.Location = new System.Drawing.Point(27, 270);
this.btnOpenDoor.Name = "btnOpenDoor";
this.btnOpenDoor.Size = new System.Drawing.Size(102, 34);
this.btnOpenDoor.TabIndex = 248;
......@@ -166,7 +170,7 @@
// btnReadAllDo
//
this.btnReadAllDo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReadAllDo.Location = new System.Drawing.Point(144, 238);
this.btnReadAllDo.Location = new System.Drawing.Point(144, 232);
this.btnReadAllDo.Name = "btnReadAllDo";
this.btnReadAllDo.Size = new System.Drawing.Size(102, 34);
this.btnReadAllDo.TabIndex = 245;
......@@ -188,7 +192,7 @@
// btnReadAllDi
//
this.btnReadAllDi.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReadAllDi.Location = new System.Drawing.Point(27, 238);
this.btnReadAllDi.Location = new System.Drawing.Point(27, 232);
this.btnReadAllDi.Name = "btnReadAllDi";
this.btnReadAllDi.Size = new System.Drawing.Size(102, 34);
this.btnReadAllDi.TabIndex = 244;
......@@ -376,6 +380,28 @@
this.tableLayoutPanel1.Size = new System.Drawing.Size(173, 386);
this.tableLayoutPanel1.TabIndex = 102;
//
// btnCloseAxisBreak
//
this.btnCloseAxisBreak.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCloseAxisBreak.Location = new System.Drawing.Point(144, 346);
this.btnCloseAxisBreak.Name = "btnCloseAxisBreak";
this.btnCloseAxisBreak.Size = new System.Drawing.Size(102, 34);
this.btnCloseAxisBreak.TabIndex = 253;
this.btnCloseAxisBreak.Text = "关闭刹车";
this.btnCloseAxisBreak.UseVisualStyleBackColor = true;
this.btnCloseAxisBreak.Click += new System.EventHandler(this.btnCloseAxisBreak_Click);
//
// btnOpenAxisBreak
//
this.btnOpenAxisBreak.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpenAxisBreak.Location = new System.Drawing.Point(27, 346);
this.btnOpenAxisBreak.Name = "btnOpenAxisBreak";
this.btnOpenAxisBreak.Size = new System.Drawing.Size(102, 34);
this.btnOpenAxisBreak.TabIndex = 252;
this.btnOpenAxisBreak.Text = "打开刹车";
this.btnOpenAxisBreak.UseVisualStyleBackColor = true;
this.btnOpenAxisBreak.Click += new System.EventHandler(this.btnOpenAxisBreak_Click);
//
// FrmIOStatus
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......@@ -428,8 +454,8 @@
private System.Windows.Forms.Button btnOpenDoor;
private System.Windows.Forms.Button btnLocationDown;
private System.Windows.Forms.Button btnLocationUp;
private System.Windows.Forms.Button btnCloseAxisBreak;
private System.Windows.Forms.Button btnOpenAxisBreak;
}
}
......@@ -261,5 +261,16 @@ namespace OnlineStore.ACSingleStore
{
SetSkin(this);
}
private void btnOpenAxisBreak_Click(object sender, EventArgs e)
{
boxBean.KNDIOMove(IO_Type.Axis_Brake, IO_VALUE.HIGH);
}
private void btnCloseAxisBreak_Click(object sender, EventArgs e)
{
boxBean.KNDIOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
}
}
}
......@@ -142,13 +142,17 @@ namespace OnlineStore.ACSingleStore
//验证运动是否完成
//CheckWait();
string portName = txtAxisDeviceName.Text;
int SlvAddr = FormUtil.GetIntValue(txtAxisValue);
string portName = GetPortName();
int SlvAddr = GetSlaveAddr();
//判断私服是否打开、
if (ACServerManager.ServerOnStatus(portName, SlvAddr) )
{
lblServerOn.Text = "伺服ON";
lblServerOn.Text = "伺服ON";
int lOutPulse = ACServerManager.GetTargetPosition(portName, SlvAddr);
lblOutPulse.Text = string.Format("{0:d}", lOutPulse);
int lCountPulse = ACServerManager.GetActualtPosition(portName, SlvAddr);
lblCountPulse.Text = string.Format("{0:d}", lCountPulse);
}
else
{
......@@ -169,8 +173,7 @@ namespace OnlineStore.ACSingleStore
{
txtAxisRunTime.Text = store.GetAxisRunTime(store.Config.Middle_Axis.GetAxisValue()).ToString(@"dd\.hh\:mm\:ss");
txtStoreRunTime.Text = store.GetStoreRunTime().ToString(@"dd\.hh\:mm\:ss");
}
}
//复位按钮状态显示
if (复位ToolStripMenuItem.Enabled == false)
......@@ -235,6 +238,7 @@ namespace OnlineStore.ACSingleStore
private void ReadPosistion()
{
string deviceName = GetPortName();
if (ACServerManager.ServerOnStatus(store.Config.Middle_Axis.DeviceName, store.Config.Middle_Axis.GetAxisValue()))
{
axis_1_Alarm.IOValue = ACServerManager.GetAlarmStatus(store.Config.Middle_Axis.DeviceName, store.Config.Middle_Axis.GetAxisValue());
......@@ -244,7 +248,11 @@ namespace OnlineStore.ACSingleStore
int lCountPulse1 = ACServerManager.GetActualtPosition(store.Config.Middle_Axis.DeviceName, store.Config.Middle_Axis.GetAxisValue());
lblCountPulse1.Text = string.Format("{0:d}", lCountPulse1);
txtMiddleTarget.Text = store.Config.Middle_Axis.TargetPosition.ToString();
if (deviceName.Equals(store.Config.Middle_Axis.DeviceName))
{
lblOutPulse.Text = lblOutPulse1.Text;
lblCountPulse.Text = lblCountPulse1.Text;
}
}
if (ACServerManager.ServerOnStatus(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue()))
{
......@@ -255,6 +263,11 @@ namespace OnlineStore.ACSingleStore
int lCountPulse2 = ACServerManager.GetActualtPosition(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue());
lblCountPulse2.Text = string.Format("{0:d}", lCountPulse2);
txtInoutTarget.Text = store.Config.InOut_Axis.TargetPosition.ToString();
if (deviceName.Equals(store.Config.UpDown_Axis.DeviceName))
{
lblOutPulse.Text = lblOutPulse2.Text;
lblCountPulse.Text = lblCountPulse2.Text;
}
}
if (ACServerManager.ServerOnStatus(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue()))
{
......@@ -264,6 +277,11 @@ namespace OnlineStore.ACSingleStore
int lCountPulse3 = ACServerManager.GetActualtPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
lblCountPulse3.Text = string.Format("{0:d}", lCountPulse3);
txtUpdownTarget.Text = store.Config.UpDown_Axis.TargetPosition.ToString();
if (deviceName.Equals(store.Config.InOut_Axis.DeviceName))
{
lblOutPulse.Text = lblOutPulse3.Text;
lblCountPulse.Text = lblCountPulse3.Text;
}
}
}
......@@ -409,18 +427,19 @@ namespace OnlineStore.ACSingleStore
ConfigMoveAxis SlvAddr = store.moveAxisList[cmbAxisList.SelectedIndex];
txtAxisDeviceName.Text = SlvAddr.DeviceName;
txtAxisValue.Text = SlvAddr.GetAxisValue().ToString();
if (SlvAddr.Equals(store.Config.InOut_Axis))
{
txtASpeed.Text = store.Config.InOutAxis_P1_Speed.ToString();
}
else if (SlvAddr.Equals(store.Config.Middle_Axis))
{
txtASpeed.Text = store.Config.MiddleAxis_P1_Speed.ToString();
}
else if (SlvAddr.Equals(store.Config.UpDown_Axis))
{
txtASpeed.Text = store.Config.UpDownAxis_P1_Speed.ToString();
}
txtASpeed.Text = SlvAddr.TargetSpeed.ToString();
//if (SlvAddr.Equals(store.Config.InOut_Axis))
//{
// txtASpeed.Text = store.Config.InOutAxis_P1_Speed.ToString();
//}
//else if (SlvAddr.Equals(store.Config.Middle_Axis))
//{
// txtASpeed.Text = store.Config.MiddleAxis_P1_Speed.ToString();
//}
//else if (SlvAddr.Equals(store.Config.UpDown_Axis))
//{
// txtASpeed.Text = store.Config.UpDownAxis_P1_Speed.ToString();
//}
}
}
......@@ -884,8 +903,8 @@ namespace OnlineStore.ACSingleStore
this.btnUpDownP6.ForeColor = System.Drawing.Color.Red;
this.btnUpDownP7.ForeColor = System.Drawing.Color.Red;
this.btnUpDownP8.ForeColor = System.Drawing.Color.Red;
this.lblWarnMsg.ForeColor = System.Drawing.Color.Red;
this.lblThisSta.ForeColor = System.Drawing.Color.Red;
//this.lblWarnMsg.ForeColor = System.Drawing.Color.Red;
//this.lblThisSta.ForeColor = System.Drawing.Color.Red;
this.btnComP1.ForeColor = System.Drawing.Color.Purple;
this.btnComP3.ForeColor = System.Drawing.Color.Purple;
......@@ -1024,6 +1043,15 @@ namespace OnlineStore.ACSingleStore
}
private int GetSlaveAddr()
{
return FormUtil.GetShortValue(txtAxisValue);
}
private string GetPortName()
{
return txtAxisDeviceName.Text;
}
private void btnAxisReturnHome_Click(object sender, EventArgs e)
{
string portName = txtAxisDeviceName.Text;
......@@ -1036,6 +1064,24 @@ namespace OnlineStore.ACSingleStore
private void btnReadPosition_Click(object sender, EventArgs e)
{
ReadPosistion();
}
}
private void btnGetAlarm_Click(object sender, EventArgs e)
{
int value = ACServerManager.GetAlarmStatus(GetPortName(), GetSlaveAddr());
this.txtAlarmStatus.Text = value.ToString();
}
private void button1_Click_1(object sender, EventArgs e)
{
int value = ACServerManager.GetBusyStatus(GetPortName(), GetSlaveAddr());
this.txtBusyStatus.Text = value.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
int value = ACServerManager.GetHomeEndStatus(GetPortName(), GetSlaveAddr());
this.txtHomeStatus.Text = value.ToString();
}
}
}
......@@ -13,7 +13,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public partial class ACServerManager
{
private static int SleepMSendons = 10;
private static int SleepMSendons = 100;
public static bool OpenPort(string portName)
{
if (serialBeanMap.ContainsKey(portName))
......@@ -225,30 +225,23 @@ namespace OnlineStore.DeviceLibrary
data = ACCMDManager.GetWriteData(slvAddr, 06, ACCMDManager.BlockNo, ACCMDManager.Block_RelMove, 2);
SendData(portName, data);
//Thread.Sleep(100);
Thread.Sleep(SleepMSendons);
OpenAndCloseSTB(portName, slvAddr);
}
public static void HomeMove(string portName, int slvAddr, int speed)
{
byte[] date = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4637", string.Format("{0:X2}", Math.Abs(speed)), 1);
SendData(portName, date);
Thread.Sleep(SleepMSendons);
date = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4638", string.Format("{0:X2}", Math.Abs(speed / 2)), 1);
SendData(portName, date);
Thread.Sleep(SleepMSendons);
//if (speed > 0)
//{
//byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_HomeMove0, 2);
//SendData(portName, data);
//}
//else
//{
//byte[] date = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4637", string.Format("{0:X2}", Math.Abs(speed)), 1);
//SendData(portName, date);
//Thread.Sleep(SleepMSendons);
//date = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4638", string.Format("{0:X2}", Math.Abs(speed / 2)), 1);
//SendData(portName, date);
//Thread.Sleep(SleepMSendons);
//默认负方向原点返回
byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_HomeMove1, 2);
SendData(portName, data);
//}
//Thread.Sleep(100);
SendData(portName, data);
Thread.Sleep(SleepMSendons);
OpenAndCloseSTB(portName, slvAddr);
}
......@@ -267,7 +260,7 @@ namespace OnlineStore.DeviceLibrary
data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_VolMove1, 2);
SendData(portName, data);
}
//Thread.Sleep(100);
Thread.Sleep(SleepMSendons);
OpenAndCloseSTB(portName, slvAddr);
}
public static void AbsMove(string portName, int slvAddr, int targetPosition, int targetSpeed)
......@@ -321,7 +314,7 @@ namespace OnlineStore.DeviceLibrary
}
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(portName, data);
System.Threading.Thread.Sleep(SleepMSendons);
Thread.Sleep(SleepMSendons);
data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_AbsMove, 2);
SendData(portName, data);
Thread.Sleep(SleepMSendons);
......
......@@ -31,15 +31,13 @@ namespace OnlineStore.DeviceLibrary
public static void RunBlock(string portName, int slvAddr, int index)
{
//运动
byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4414", index.ToString(), 2);
byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, index.ToString(), 2);
SendData(portName, data);
//开始
byte[] data1 = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, ACCMDManager.STB_Addr, "0000", 2);
SendData(portName, data1);
System.Threading.Thread.Sleep(100);
byte[] data2 = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, ACCMDManager.STB_Addr, "ff00", 2);
SendData(portName, data2);
Thread.Sleep(100);
CloseSTB(portName,slvAddr);
Thread.Sleep(100);
OnlyOpenSTB(portName,slvAddr);
}
public static void SendStrAndSleep(string portName, string str)
{
......
......@@ -28,12 +28,12 @@ AXIS,(轴一)旋转轴,Middle_Axis,1,COM3,0,,,,
AXIS,(轴二)升降轴轴,UpDown_Axis,1,COM4,0,,,,
AXIS,(轴三)进出轴,InOut_Axis,1,COM5,0,,,,
PRO,温湿度传感器地址,Temperate_ServerAddress,192.168.200.14,,,,,,
PRO,升降轴 进料口取料点 P1,UpDownAxis_DoorOPosition_P1,-10000,,,,,,
PRO,升降轴 进料口出料前点 P2,UpDownAxis_DoorIPosition_P2,-10000,,,,,,
PRO,升降轴 进料口取料缓冲点 P7,UpDownAxis_DoorOBPosition_P7,-10000,,,,,,
PRO,升降轴 进料口出料缓冲点 P8,UpDownAxis_DoorIBPosition_P8,-10000,,,,,,
,进出轴进料口取料点 P2,InOutAxis_DoorPosition_P2,9,,,,,,
PRO,旋转轴(轴1)P1 待机原位点,MiddleAxis_P1_Position,5000,,,,,,
PRO,升降轴 进料口取料点 P1,UpDownAxis_DoorOPosition_P1,700000,,,,,,
PRO,升降轴 进料口出料前点 P2,UpDownAxis_DoorIPosition_P2,702000,,,,,,
PRO,升降轴 进料口取料缓冲点 P7,UpDownAxis_DoorOBPosition_P7,702000,,,,,,
PRO,升降轴 进料口出料缓冲点 P8,UpDownAxis_DoorIBPosition_P8,700000,,,,,,
,进出轴进料口取料点 P2,InOutAxis_DoorPosition_P2,4000,,,,,,
PRO,旋转轴(轴1)P1 待机原位点,MiddleAxis_P1_Position,230000,,,,,,
PRO,进出轴(轴3)P1待机原位点,InOutAxis_P1_Position,1000,,,,,,
PRO,押金轴(轴4)P1待机原位点,CompressAxis_P1_Position,360,,,,,,
,,,,,,,,,
......@@ -46,21 +46,21 @@ PRO,预警湿度,WarnHumidity,80,,,,,,
PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,100,,,,,,
PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,30,,,,,,
PRO,(轴一)旋转轴减速度,MiddleAxis_DelSpeed,30,,,,,,
PRO,(轴一)旋转轴原点低速度,MiddleAxis_HomeLowSpeed,50,,,,,,
PRO,(轴一)旋转轴原点高速,MiddleAxis_HomeHighSpeed,100,,,,,,
PRO,(轴一)旋转轴原点加速度,MiddleAxis_HomeAddSpeed,30,,,,,,
PRO,(轴一)旋转轴原点低速度,MiddleAxis_HomeLowSpeed,20,,,,,,
PRO,(轴一)旋转轴原点高速,MiddleAxis_HomeHighSpeed,40,,,,,,
PRO,(轴一)旋转轴原点加速度,MiddleAxis_HomeAddSpeed,10,,,,,
PRO,(轴二)升降轴轴目标速度,UpdownAxis_TargetSpeed,100,,,,,,
PRO,(轴二)升降轴轴加速度,UpdownAxis_AddSpeed,30,,,,,,
PRO,(轴二)升降轴轴减速度,UpdownAxis_DelSpeed,30,,,,,,
PRO,(轴二)升降轴轴原点低速度,UpdownAxis_HomeLowSpeed,50,,,,,,
PRO,(轴二)升降轴轴原点高速,UpdownAxis_HomeHighSpeed,100,,,,,,
PRO,(轴二)升降轴轴原点加速度,UpdownAxis_HomeAddSpeed,30,,,,,,
PRO,(轴二)升降轴轴原点低速度,UpdownAxis_HomeLowSpeed,20,,,,,,
PRO,(轴二)升降轴轴原点高速,UpdownAxis_HomeHighSpeed,40,,,,,
PRO,(轴二)升降轴轴原点加速度,UpdownAxis_HomeAddSpeed,10,,,,,
PRO,(轴三)进出轴目标速度,InoutAxis_TargetSpeed,100,,,,,,
PRO,(轴三)进出轴加速度,InoutAxis_AddSpeed,30,,,,,,
PRO,(轴三)进出轴减速度,InoutAxis_DelSpeed,30,,,,,,
PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,50,,,,,,
PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,100,,,,,,
PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,30,,,,,,
PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,40,,,,,,
PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,60,,,,,,
PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,20,,,,,,
PRO,升降轴(轴2)P1速度,UpDownAxis_P1_Speed,100,,,,,,
PRO,升降轴(轴2)P2速度,UpDownAxis_P2_Speed,100,,,,,,
PRO,升降轴(轴2)P3速度,UpDownAxis_P3_Speed,100,,,,,,
......
......@@ -50,7 +50,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
IsConnectServer = true;
//IsConnectServer = true;
}
CheckEnum(typeof(StoreMoveStep));
CheckEnum(typeof(StoreStatus));
......
......@@ -246,9 +246,9 @@ namespace OnlineStore.DeviceLibrary
protected void ACAxisHomeMove(ConfigMoveAxis moveAxis)
{
moveAxis.TargetPosition = 0;
LogUtil.debug(LOGGER, "DeviceName=" + moveAxis.DeviceName + ",AxisNo=" + moveAxis.GetAxisValue() + ",speed=" + moveAxis.TargetSpeed + "开始原点返回");
LogUtil.debug(LOGGER, moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回");
AddAxisMoveTime(moveAxis);
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.TargetSpeed);
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed);
StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true));
}
......@@ -271,51 +271,76 @@ namespace OnlineStore.DeviceLibrary
msg = "";
string deviceName = moveAxis.DeviceName;
short axisNo = moveAxis.GetAxisValue();
bool isend =ACServerManager.IsHomeMoveEnd(deviceName, axisNo);
int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition);
if (isend)
bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0);
if (isOk)
{
int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition);
if (errorCount > moveAxis.CanErrorCountMax)
{
//判断是否需要重新运动
if (StoreMove.CanWhileCount > 0)
{
LogUtil.error(LOGGER, StoreName + " storeMoveStep=" + StoreMove.MoveStep + ", DeviceName=" + deviceName + ",AxisNo=" + axisNo + ",targetPosition=" + targetPosition + ",targetSpeed=" + targetSpeed + ",当前outCount=" + outCount +
",误差值大于最大误差【" + moveAxis.CanErrorCountMax + "】,但是轴已经停止运动,还有【" + StoreMove.CanWhileCount + "】次可以重复运动的次数");
LogUtil.error(LOGGER, StoreName + " storeMoveStep=" + StoreMove.MoveStep + ", DeviceName=" + deviceName + ",AxisNo=" + axisNo + ",targetPosition=" + targetPosition + "开始重新运动");
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition,targetSpeed);
LogUtil.error(LOGGER, StoreName + " storeMoveStep=" + StoreMove.MoveStep +moveAxis.DisplayStr+ "目标位置[" + targetPosition + "]速度[" + targetSpeed + "]当前位置[" + outCount +
"],误差值大于最大误差[" + moveAxis.CanErrorCountMax + "],但是轴已经停止运动,还有[" + StoreMove.CanWhileCount + "]次可以重复运动的次数");
LogUtil.error(LOGGER, StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]重新开始运动");
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
StoreMove.CanWhileCount--;
}
else
{
msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + ", DeviceName=" + deviceName + ",AxisNo=" + axisNo + ",targetPosition=" + targetPosition + ",targetSpeed=" + targetSpeed + ",当前outCount=" + outCount + ",误差值大于最大误差【" + moveAxis.CanErrorCountMax + "】,但是轴已经停止运动,需要报警";
msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount
+ "]误差值大于最大误差[" + moveAxis.CanErrorCountMax + "],但是轴已经停止运动,需要报警";
LogUtil.error(LOGGER, msg);
return false;
}
}
else
{
{
return true;
}
}
else if (errorCount < moveAxis.CanErrorCountMin)
{
LogUtil.info(LOGGER, " storeMoveStep=" + StoreMove.MoveStep + ", DeviceName=" + deviceName + ",AxisNo=" + axisNo + ",targetPosition=" + targetPosition + ",当前outCount=" + outCount +
",误差值小于最小误差【" + moveAxis.CanErrorCountMin + "】,默认轴已经停止运动");
return true;
}
//else if (errorCount < moveAxis.CanErrorCountMin)
//{
// LogUtil.info(LOGGER, " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + ",targetPosition=" + targetPosition + ",当前outCount=" + outCount +
// ",误差值小于最小误差【" + moveAxis.CanErrorCountMin + "】,默认轴已经停止运动");
// return true;
//}
return false;
}
protected bool ACHomeMoveIsEnd(ConfigMoveAxis moveAxis)
protected bool ACHomeMoveIsEnd(ConfigMoveAxis moveAxis,out string msg)
{
msg = "";
if (ACServerManager.IsHomeMoveEnd(moveAxis.DeviceName, moveAxis.GetAxisValue()) )
{
{
//原点完成并且位置=0
int outCount = ACServerManager.GetActualtPosition(moveAxis.DeviceName, moveAxis.GetAxisValue());
int errorCount = Math.Abs(outCount );
if (errorCount > moveAxis.CanErrorCountMax)
{
//判断是否需要重新运动
if (StoreMove.CanWhileCount > 0)
{
LogUtil.error(LOGGER, StoreName + moveAxis.DisplayStr + "收到原点完成信号,当前位置["+outCount+"],还有[" + StoreMove.CanWhileCount + "]次可以重复运动的次数");
LogUtil.error(LOGGER, StoreName + moveAxis.DisplayStr + "重新回原点");
ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed);
StoreMove.CanWhileCount--;
}
else
{
msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差值大于[" + moveAxis.CanErrorCountMax + "],需要报警";
LogUtil.error(LOGGER, msg);
return false;
}
}
else
{
return true;
}
return true;
}
return false;
......
......@@ -218,7 +218,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 料仓原点返回和重置步骤,,轴三进出轴返回原点后,需要等待500毫秒,然后再清空
/// </summary>
BOX_H_InOutBackWait = 012,
//BOX_H_InOutBackWait = 012,
/// <summary>
/// 料仓原点返回和重置步骤,,轴三返回P1点
/// </summary>
......@@ -227,10 +227,10 @@ namespace OnlineStore.DeviceLibrary
/// 料仓原点返回和重置步骤,,升降轴,旋转轴,压紧轴原点返回
/// </summary>
BOX_H_OtherAxisBack = 014,
/// <summary>
/// 清理轴位置
/// </summary>
BOX_H_WaitAxisCountClear = 015,
///// <summary>
///// 清理轴位置
///// </summary>
//BOX_H_WaitAxisCountClear = 015,
/// <summary>
/// 旋转轴返回P1
/// </summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!