Commit 0c8f976c 几米阳光

轴速度设置错误

1 个父辈 70741fd3
......@@ -242,6 +242,7 @@
this.axis_1_Alarm = new UserFromControl.IOStatusControl();
this.axis_3_Alarm = new UserFromControl.IOStatusControl();
this.axis_2_Alarm = new UserFromControl.IOStatusControl();
this.btnUpdateSpeed = new System.Windows.Forms.Button();
this.groupBox5.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
......@@ -276,6 +277,7 @@
//
this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox5.Controls.Add(this.btnUpdateSpeed);
this.groupBox5.Controls.Add(this.btnUpdateStatus);
this.groupBox5.Controls.Add(this.label24);
this.groupBox5.Controls.Add(this.label26);
......@@ -2751,6 +2753,21 @@
this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_2_Alarm.TabIndex = 265;
//
// btnUpdateSpeed
//
this.btnUpdateSpeed.BackColor = System.Drawing.SystemColors.Control;
this.btnUpdateSpeed.Cursor = System.Windows.Forms.Cursors.Default;
this.btnUpdateSpeed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateSpeed.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnUpdateSpeed.Location = new System.Drawing.Point(312, 156);
this.btnUpdateSpeed.Name = "btnUpdateSpeed";
this.btnUpdateSpeed.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnUpdateSpeed.Size = new System.Drawing.Size(90, 33);
this.btnUpdateSpeed.TabIndex = 310;
this.btnUpdateSpeed.Text = "更改速度";
this.btnUpdateSpeed.UseVisualStyleBackColor = true;
this.btnUpdateSpeed.Click += new System.EventHandler(this.btnUpdateSpeed_Click);
//
// FrmStoreBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
......@@ -3018,6 +3035,7 @@
public System.Windows.Forms.TextBox txtUpdownP2;
public System.Windows.Forms.Button btnUpdownP2;
private System.Windows.Forms.Label lblBatchMsg;
public System.Windows.Forms.Button btnUpdateSpeed;
}
}
......@@ -147,6 +147,8 @@ namespace OnlineStore.AutoInOutStore
private bool LoadOk = false;
private void FrmTest_Load(object sender, EventArgs e)
{
int slvAddrStr = 1;
LogUtil.logBox = this.richTextBox1;
this.ShowInTaskbar = true;
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
......@@ -1642,5 +1644,13 @@ namespace OnlineStore.AutoInOutStore
txtTemp.Text = param.Temperate.ToString();
txtHum.Text = param.Humidity.ToString();
}
private void btnUpdateSpeed_Click(object sender, EventArgs e)
{
string portName = txtAxisDeviceName.Text;
int SlvAddr = FormUtil.GetIntValue(txtAxisValue);
int speed = FormUtil.GetIntValue(txtASpeed);
ACServerManager.SetSpeed(portName, SlvAddr, speed);
}
}
}
......@@ -46,7 +46,7 @@
如果是未扫到码或者没有入库成功,需要将料盘送出,送出之后批量上料功能才能继续。
批量轴报警单独处理。
入库时,叉子深入料盘之后,开始下降时就给服务器发送入库位结束消息。
需要修改还未修改的:
......
......@@ -323,7 +323,7 @@ namespace OnlineStore.Common
catch (Exception ex)
{
isOk = false;
LogUtil.error(LOGGER, "SendCommand ERROR:" + ex.ToString(), 20);
LogUtil.error( "SendCommand ERROR:" + ex.ToString(), 20);
}
finally
{
......@@ -511,6 +511,18 @@ namespace OnlineStore.Common
}
return returnStr;
}
public static string byteToHexStr(byte[] bytes,string spilChar)
{
string returnStr = "";
if (bytes != null)
{
for (int i = 0; i < bytes.Length; i++)
{
returnStr += bytes[i].ToString("X2")+ spilChar;
}
}
return returnStr;
}
#endregion
#region 计算校验码
......
......@@ -111,7 +111,7 @@ namespace OnlineStore.Common
}
catch (Exception e)
{
LogUtil.error(LOGGER, "POST ERROR:" + e.StackTrace, 1);
LogUtil.error( "POST ERROR:" + e.StackTrace, 1);
}
if (!result.Contains("null") && result.Length != 0)
{
......@@ -145,7 +145,7 @@ namespace OnlineStore.Common
}
catch (Exception e)
{
LogUtil.error(LOGGER, "HTTP GET ERROR:" + e.Message, 2);
LogUtil.error( "HTTP GET ERROR:" + e.Message, 2);
}
return "";
}
......
......@@ -101,7 +101,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER,"Connect to " + serverIP + ":" + serverPort + " fail!" + ex.ToString(),3);
LogUtil.error("Connect to " + serverIP + ":" + serverPort + " fail!" + ex.ToString(),3);
m_clientSocket = null;
}
return false;
......@@ -153,7 +153,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER,"socket received error:" + ex.ToString(),4);
LogUtil.error("socket received error:" + ex.ToString(),4);
}
}
}
......
......@@ -158,11 +158,11 @@ namespace OnlineStore.Common
}
catch (SocketException e)
{
LogUtil.error(LOGGER, e.ToString(), 6);
LogUtil.error( e.ToString(), 6);
}
catch (Exception ex)
{
LogUtil.error(LOGGER, ex.ToString(), 5);
LogUtil.error( ex.ToString(), 5);
}
}
//private void ReceiveMessages(Client client)
......
......@@ -324,8 +324,12 @@ namespace OnlineStore.DeviceLibrary
}
else if (dataByte.Length == 2)
{
sendData[4] = dataByte[1];
sendData[5] = dataByte[0];
sendData[4] = dataByte[0];
sendData[5] = dataByte[1];
//sendData[4] = dataByte[1];
//sendData[5] = dataByte[0];
}
sendData = buildCheckData(sendData, sendData.Length - 2);
......
......@@ -333,28 +333,42 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(SleepMSendons);
OpenAndCloseSTB(portName, slvAddr);
}
public static void SpeedMove(string portName, int slvAddr, int speed)
public static void SetSpeed(string portName, int slvAddr, int speed)
{
int preSpeed = GetAddrValue(portName, ACCMDManager.Speed_Addr);
if ((preSpeed.Equals(-1)) || (!preSpeed.Equals(Math.Abs(speed))))
{
byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4601", string.Format("{0:X2}", Math.Abs(speed)), 2);
SendData(portName, data);
string v1 = slvAddr + "064601 " + ACServerManager.SpeedToStr(speed, 4) + " ffff";
LogUtil.debug("轴【" + portName + "】更新速度为【" + speed + "】,发送数据【" + v1 + "】");
SendStrAndSleep(portName, v1, SleepMSendons);
UpdateAddrValue(portName, ACCMDManager.Speed_Addr, Math.Abs(speed));
//byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4601", string.Format("{0:X2}", Math.Abs(speed)), 2);
//string msg = AcSerialBean.byteToHexStr(data, " ");
//SendData(portName, data);
//UpdateAddrValue(portName, ACCMDManager.Speed_Addr, Math.Abs(speed));
Thread.Sleep(SleepMSendons);
}
}
}
public static void SpeedMove(string portName, int slvAddr, int speed)
{
SetSpeed(portName, slvAddr, speed);
//int preSpeed = GetAddrValue(portName, ACCMDManager.Speed_Addr);
//if ((preSpeed.Equals(-1)) || (!preSpeed.Equals(Math.Abs(speed))))
//{
// byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4601", string.Format("{0:X2}", Math.Abs(speed)), 2);
// string msg = AcSerialBean.byteToHexStr(data," ");
// LogUtil.info("轴【"+portName+"】更新速度为【"+speed+"】,发送数据【"+msg+"】");
// SendData(portName, data);
// UpdateAddrValue(portName, ACCMDManager.Speed_Addr, Math.Abs(speed));
// Thread.Sleep(SleepMSendons);
//}
if (speed > 0)
{
//byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_VolMove0, 2);
//SendData(portName, data);
{
UpdateBlock(portName, slvAddr, ACCMDManager.Block_VolMove0);
}
else
{
//byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_VolMove1, 2);
//SendData(portName, data);
{
UpdateBlock(portName, slvAddr, ACCMDManager.Block_VolMove1);
}
//Thread.Sleep(SleepMSendons);
......
......@@ -462,13 +462,6 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SI_11_DeviceToBag)
{
InStoreLog("入库:SI_12 放下物品,升降轴至P4(库位入料缓冲点),压紧轴至P3(压紧前点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag);
ComMoveToPosition(moveP.ComPress_P3);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_12_PutWareToBag)
{
InStoreLog("入库:SI_13 叉子从库位中返回,进出轴至P1(待机点) ");
// 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
lastPosId = posId;
......@@ -477,6 +470,14 @@ namespace OnlineStore.DeviceLibrary
//手动发给服务器状态,防止没有手动
//SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd);
StoreMove.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag);
ComMoveToPosition(moveP.ComPress_P3);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_12_PutWareToBag)
{
InStoreLog("入库:SI_13 叉子从库位中返回,进出轴至P1(待机点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_13_InoutBack);
InOutBackToP1(moveP.InOut_P1);
}
......
......@@ -253,7 +253,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.info(Name + " 入料 ,轴上升到检测到料盘,速度【"+ StoreManager.Config.Batch_Axis.TargetSpeed + "】");
LogUtil.info(Name + " 入料 ,轴上升到检测到料盘,速度【" + StoreManager.Config.Batch_Axis.TargetSpeed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed);
}
}
......@@ -322,6 +322,9 @@ namespace OnlineStore.DeviceLibrary
EndMovePosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue());
LastHeight = Math.Abs(EndMovePosition - StartMovePosition) / AxisChangeValue;
LogUtil.info(Name + "入料: 计算高度:上升前位置【" + StartMovePosition + "】实时位置【" + EndMovePosition + "】,计算后高度【" + LastHeight + "】");
if (LastHeight > 12) { LastHeight = 24; }
else if (LastHeight >= 8) { LastHeight = 12; }
else if (LastHeight > 0) { LastHeight = 8; }
LastSize = StoreManager.Config.Default_TrayWidth;
LogUtil.info(Name + "入料: 从服务器获取入库PosId,尺寸:【" + LastSize + "*" + LastHeight + "】二维码【" + LastCode + "】");
......
......@@ -19,6 +19,7 @@ namespace OnlineStore.DeviceLibrary
//AutoAxisIsMove = 1;
StartMovePosition = ACServerManager.GetActualtPosition(moveAxis.DeviceName, moveAxis.GetAxisValue());
EndMovePosition = StartMovePosition;
LogUtil.info("当前坐标:"+StartMovePosition+",批量上料轴开始匀速"+targetSpeed+"上升");
StoreMove.WaitList.Add(WaitResultInfo.WaitBatchAxisStop(moveAxis));
ACServerManager.SpeedMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetSpeed);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!