Commit eac4b66e 刘韬
2 个父辈 a67b93fe 80107032

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.5.33414.496
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject
......
......@@ -38,11 +38,37 @@ namespace OnlineStore.Common
public static string FixBuffInfo = "FixBuffInfo";
[MyConfigComment("进出轴运动负载阈值")]
public static MyConfig<float> Device_InOutMaxLoadRate=50;
public static MyConfig<float> Device_InOutMaxLoadRate = 50;
[MyConfigComment("管理员密码")]
public static MyConfig<string> User_AdminPassword = "123456";
[MyConfigComment("启用管理员密码")]
public static MyConfig<bool> User_Enable = false;
#region 料盘高度计算参数
[MyConfigComment("启用自定义厚度计算策略")]
public static MyConfig<bool> Switch_UseCustHeightList = false;
/// <summary>
/// 宽度15料盘,厚度自减mm
/// </summary>
[MyConfigComment("宽度15料盘,厚度自减mm")]
public static MyConfig<int> Param_CalHeight_Width15HeightSubVal = 2;
/// <summary>
/// 宽度13料盘,厚度自减mm
/// </summary>
[MyConfigComment("宽度13料盘,厚度自减mm")]
public static MyConfig<int> Param_CalHeight_Width13HeightSubVal = 1;
[MyConfigComment("如果计算出的厚度小于指定值,都归类为8mm")]
public static MyConfig<int> Param_CalHeight_Height8MaxVal = 12;
[MyConfigComment("自定义厚度列表")]
public static MyConfig<string[]> Param_CalHeight_HeightList = new string[] { "12=12#16", "16=16#24", "24=24#32", "32=32#44", "44=44#56", "56=56#60" };
#endregion
[MyConfigComment("出库厚度检测下偏差的值")]
public static MyConfig<int> OutstoreHeightCheckLowerDeviation = 5;
[MyConfigComment("出库厚度检测上偏差的值")]
public static MyConfig<int> OutstoreHeightCheckUpperDeviation = 3;
[MyConfigComment("出库料盘定位信号对射触发位置高度偏差")]
public static MyConfig<int> ReelCheckTriggerDeviation = 5;
}
}
......@@ -141,6 +141,7 @@ namespace OnlineStore.Common
tray_detect_reel_01,
system_running_cantmove,
before_FrmPositionTool_stopmuchine,
temp
temp,
outstore_abnormal_reel
}
}
......@@ -22,188 +22,15 @@ namespace OnlineStore.Common
Interlocked.Increment(ref seq);
return seq;
}
public static string GetValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetValue(keyStr);
}
else
{
return config.AppSettings.Settings[key].Value;
}
}
public static decimal GetNumValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
decimal a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetNumValue(keyStr);
}
else
{
{
Decimal.TryParse(config.AppSettings.Settings[key].Value, out a);
}
}
return a;
}
public static int GetIntValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
int a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetIntValue(keyStr);
}
else
{
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
}
} return a;
}
public static string GetValue(string key)
{
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return "";
}
else
{
return config.AppSettings.Settings[key].Value;
}
}
public static decimal GetNumValue(string key)
{
decimal a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
{
{
Decimal.TryParse(config.AppSettings.Settings[key].Value, out a);
}
}
return a;
}
public static int GetIntValue(string key)
{
int a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
public static T GetValue<T>(string key, T defaultVal = default(T), string comment = "")
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
ConfigHelper.Config.SetComment(key, comment);
return ConfigHelper.Config.Get(key, defaultVal);
}
else
public static void SetValue<T>(string key, T defaultVal = default(T))
{
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
}
} return a;
}
public static void SaveValue(string key, int value)
{
SaveValue(key, value.ToString());
}
public static void SaveValue(string key, string value)
{
try
{
if (key.Equals("") || value.Equals(""))
{
return;
}
//增加的内容写在appSettings段下 <add key="RegCode" value="0"/>
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
SetValue(key, value);
}
else
{
UpdateConfig(key, value);
}
}
catch (Exception ex)
{
LogUtil.error( "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + ",",ex);
}
}
public static string GetValue(object debugDeviceId)
{
throw new NotImplementedException();
}
/// <summary>
/// 更新配置文件信息
/// </summary>
/// <param name="name">配置文件字段名称</param>
/// <param name="Xvalue">值</param>
private static void UpdateConfig(string name, string Xvalue)
{
try
{
XmlDocument doc = new XmlDocument();
doc.Load(Application.ExecutablePath + ".config");
XmlNode node = doc.SelectSingleNode(@"//add[@key='" + name + "']");
XmlElement ele = (XmlElement)node;
ele.SetAttribute("value", Xvalue);
doc.Save(Application.ExecutablePath + ".config");
}
catch (Exception ex)
{
LogUtil.error( "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + ",",ex);
}
}
///<summary>
///向.config文件的appKey结写入信息AppValue 保存设置
///</summary>
///<param name="AppKey">节点名</param>
///<param name="AppValue">值</param>
private static void SetValue(String AppKey, String AppValue)
{
try
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(System.Windows.Forms.Application.ExecutablePath + ".config");
XmlNode xNode;
XmlElement xElem1;
XmlElement xElem2;
xNode = xDoc.SelectSingleNode("//appSettings");
xElem1 = (XmlElement)xNode.SelectSingleNode("//add[@key='" + AppKey + "']");
if (xElem1 != null)
xElem1.SetAttribute("value", AppValue);
else
{
xElem2 = xDoc.CreateElement("add");
xElem2.SetAttribute("key", AppKey);
xElem2.SetAttribute("value", AppValue);
xNode.AppendChild(xElem2);
}
xDoc.Save(System.Windows.Forms.Application.ExecutablePath + ".config");
}
catch (Exception ex)
{
LogUtil.error( "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + ",",ex);
}
ConfigHelper.Config.Set(key, defaultVal);
}
}
}
......@@ -32,6 +32,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AGVLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\DLL\AGVLib\AGVLib\bin\Debug\AGVLib.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.8384.25672, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\CodeLibrary.dll</HintPath>
......@@ -90,6 +94,7 @@
<Compile Include="theMachine\Common.cs" />
<Compile Include="theMachine\JobList.cs" />
<Compile Include="theMachine\LabelParam.cs" />
<Compile Include="theMachine\MainMachine_AGV.cs" />
<Compile Include="theMachine\MainMachine_ServerControl.cs" />
<Compile Include="theMachine\MainMachine _BtnProcess.cs" />
<Compile Include="theMachine\MainMachine _Common.cs" />
......
......@@ -160,6 +160,7 @@ namespace DeviceLibrary
var DelSpeed = Config.DelSpeed > 0 ? Config.DelSpeed : targetSpeed * 4;
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, AddSpeed, DelSpeed);// Config.AddSpeed, Config.DelSpeed);
}
LogUtil.info(AxisName + $" AbsMove:{targetPosition},{targetSpeed}");
}
public void SpeedMove(int targetSpeed)
......
......@@ -191,6 +191,7 @@ namespace DeviceLibrary
ConfigHelper.Config.Get("CamTestReel_Ability", false);
ConfigHelper.Config.Set("CamTestReel_debug", false);
ConfigHelper.Config.Get("Device_1315_ReelHeight_Compensation", 0);
initAgv();
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
......@@ -275,6 +276,7 @@ namespace DeviceLibrary
if (runStatus == RunStatus.Running)
{
ioMonitor();
AGVProcess();
StringProcess();
ClampProcess();
boxTransport.Process();
......@@ -646,11 +648,11 @@ namespace DeviceLibrary
//ok = false;
StringDoorSuddenStop();
}
//else if (!lastStringSafetyStatus)
//{
else if (!lastStringDoorSafetyStatus)
{
// StringDoor.ResumeSingle();
// lastStringSafetyStatus = true;
//}
lastStringDoorSafetyStatus = true;
}
}
if (!ConfigHelper.Config.Get("Device_Disable_DoorSafeCheck", false))
{
......@@ -711,9 +713,10 @@ namespace DeviceLibrary
}
}
}
bool lastStringDoorSafetyStatus=true;
void StringDoorSuddenStop()
{
//if (lastSafeCheckStatus)
if (lastStringDoorSafetyStatus)
{
AxisBean axis = StringDoor.axisBean;
AxisBean.StopMultiAxis(new List<AxisBean> { axis });
......@@ -723,6 +726,7 @@ namespace DeviceLibrary
{
ResetMoveInfo.NewMove(MoveStep.H01_HomeReset);
}
lastStringDoorSafetyStatus=false;
}
}
/// <summary>
......
using AGVLib;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace DeviceLibrary
{
public partial class MainMachine
{
string serverIp = ConfigAppSettings.GetValue("AGV_ServerIp", "127.0.0.1", "AGV服务软件所在电脑IP");
int serverPort = ConfigAppSettings.GetValue("AGV_ServerPort", 12000, "AGV服务接口");
int nodeId = ConfigAppSettings.GetValue("AGV_NodeId", 1, "AGV节点编号");
string nodeName = ConfigAppSettings.GetValue("AGV_NodeName", "MIMO", "AGV节点名称");
Client client;
Node curNode;
MoveInfo AGVMoveInfo;
void initAgv()
{
if (!UseAgv())
return;
AGVMoveInfo = new MoveInfo("AGV模块");
curNode = new Node()
{
id = nodeId,
name = nodeName,
};
client = new Client(new List<Node> { curNode });
client.ConnectedEvent += Client_ConnectedEvent;
client.ReceivedEvent += Client_ReceivedEvent;
client.Connect(serverIp, serverPort);
LogUtil.LOGGER.Info($"初始化AGV节点,并连接服务端:{serverIp}:{serverPort}");
}
public bool UseAgv()
{
return ConfigAppSettings.GetValue("AGV_Enable", false, "是否启用AGV");
}
public void SetStatus(NodeStatus nodeStatus)
{
curNode.status = nodeStatus;
client.SetStatus(curNode);
}
private void Client_ReceivedEvent(Node node)
{
if (curNode.id == nodeId && curNode.name.Equals(node.name))
{
curNode.status = node.status;
curNode.shelf_id = node.shelf_id;
curNode.level = node.level;
LogUtil.LOGGER.Info($"收到AGV服务端信息:【{node.name}】【{node.status}】【{node.shelf_id}】");
}
}
private void Client_ConnectedEvent(bool status)
{
if (status)
LogUtil.LOGGER.Info("已连接AGV服务端");
else
{
LogUtil.LOGGER.Info("已断开AGV服务");
}
}
NodeStatus curNodeStatus;
/// <summary>
/// 呼叫AGV--需要料串
/// </summary>
void needEnter(NodeStatus nodeStatus)
{
if (nodeStatus.Equals(NodeStatus.NeedEnter) ||
nodeStatus.Equals(NodeStatus.NeedEnter_Empty) ||
nodeStatus.Equals(NodeStatus.NeedEnter_Full))
{
if (AGVMoveInfo.IsStep(MoveStep.Wait))
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_In01);
curNodeStatus = nodeStatus;
AGVMoveInfo.log($"需要进入料串,{curNodeStatus}");
}
}
}
/// <summary>
/// 呼叫AGV--送出料串
/// </summary>
void needLeave(NodeStatus nodeStatus)
{
if (nodeStatus.Equals(NodeStatus.NeedLeave) ||
nodeStatus.Equals(NodeStatus.NeedLeave_Full) ||
nodeStatus.Equals(NodeStatus.NeedLeave_Empty))
{
if (AGVMoveInfo.IsStep(MoveStep.Wait))
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_Out01);
curNodeStatus = nodeStatus;
AGVMoveInfo.log($"需要离开料串,{curNodeStatus}");
}
}
}
public void AGVProcess()
{
if (!UseAgv())
{
return;
}
if (CheckWait(AGVMoveInfo))
return;
Node curnode = curNode;
if (curnode == null)
{
LogUtil.LOGGER.Error("无节点信息,请检查配置");
return;
}
switch (AGVMoveInfo.MoveStep)
{
case MoveStep.Wait:
if (StringMoveInfo.IsStep(MoveStep.StringOut_Released) || StringMoveInfo.IsStep(MoveStep.Wait))
{
if (curnode.status.Equals(NodeStatus.RequsetDock) || curnode.status.Equals(NodeStatus.Arrive))
{
//AGV已到达,请求开门
AGVMoveInfo.NextMoveStep(MoveStep.AGV_OpenDoor);
AGVMoveInfo.log($"Wait,AGV到达,准备开门");
//AGV已到达,请求开门
OpenDoor(AGVMoveInfo);
}
else if (curnode.status.Equals(NodeStatus.DetachOk))
{
//AGV分离完成,可关门
AGVMoveInfo.NextMoveStep(MoveStep.AGV_CloseDoor);
CloseDoor(AGVMoveInfo);
AGVMoveInfo.log($"Wait,收到脱离脱离信号,关闭折叠门");
}
else
{
AGVMoveInfo.log($"Wait,收到{curnode.status}信号,不处理");
}
}
else//料串不在正常状态
{
if (curnode.status.Equals(NodeStatus.RequsetDock) || curnode.status.Equals(NodeStatus.Arrive))
{
//AGV已到达,请求开门
SetStatus(NodeStatus.RejectDock);
AGVMoveInfo.log($"收到AGV的{NodeStatus.RequsetDock}/{NodeStatus.Arrive}信号,当前料串正在使用,拒绝停靠");
}
else if (curnode.status.Equals(NodeStatus.RequestEnter))
{
//AGV请求出料到料仓
SetStatus(NodeStatus.RejectEnter);
AGVMoveInfo.log($"收到AGV的{NodeStatus.RequestEnter}信号,当前料串正在使用,拒绝AGV出料");
}
else if (curnode.status.Equals(NodeStatus.RequestLeave))
{
//AGV请求进料到AGV
SetStatus(NodeStatus.RejectLeave);
AGVMoveInfo.log($"收到AGV的{NodeStatus.RequestLeave}信号,当前料串正在使用,拒绝AGV进料");
}
}
break;
#region 进料
case MoveStep.AGV_In01:
AGVMoveInfo.NextMoveStep(MoveStep.AGV_In02);
RobotManage.mainMachine.SetStatus(curNodeStatus);
AGVMoveInfo.log($"设置{curnode.name}状态为{curNodeStatus}");
break;
case MoveStep.AGV_In02:
if (IOMonitor.IODebound(IO_Type.StringFront_Check, Config, IO_VALUE.HIGH, 2000) ||
IOMonitor.IODebound(IO_Type.StringBack_Check, Config, IO_VALUE.HIGH, 2000))
{
RobotManage.mainMachine.SetStatus(NodeStatus.None);
AGVMoveInfo.log($"前端信号/后端信号亮,取消呼叫AGV送料串");
AGVMoveInfo.EndMove();
}
else if (AGVMoveInfo.IsTimeOut(5) && curnode.status != curNodeStatus)
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_In02);
RobotManage.mainMachine.SetStatus(curNodeStatus);
AGVMoveInfo.log($"AGV状态不是{curNodeStatus},重新呼叫AGV");
}
else
{
if (curnode.status.Equals(NodeStatus.RequsetDock) || curnode.status.Equals(NodeStatus.Arrive))
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_OpenDoor);
AGVMoveInfo.log($"AGV到达,准备开门");
//AGV已到达,请求开门
OpenDoor(AGVMoveInfo);
}
}
break;
case MoveStep.AGV_In03:
AGVMoveInfo.NextMoveStep(MoveStep.AGV_In04);
break;
case MoveStep.AGV_In04:
AGVMoveInfo.NextMoveStep(MoveStep.AGV_In05);
Line.LineRun("n", false, 10);
AGVMoveInfo.log($"收到AGV的{NodeStatus.RequestEnter}信号,允许进料");
break;
case MoveStep.AGV_In05:
if (curnode.status == NodeStatus.MayEnter)
{
if (IOValue(IO_Type.StringBack_Check).Equals(IO_VALUE.HIGH))
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_In06);
RobotManage.mainMachine.SetStatus(NodeStatus.FinishEnter);
AGVMoveInfo.log($"料串到位");
AGVMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
}
else
{
// ShowInfo("等待料串到位");
}
}
else
{
RobotManage.mainMachine.SetStatus(NodeStatus.MayEnter);
}
break;
case MoveStep.AGV_In06:
AGVMoveInfo.NextMoveStep(MoveStep.AGV_DetachOK);
RobotManage.mainMachine.SetStatus(NodeStatus.Detach);
AGVMoveInfo.log($"向AGV发送脱离信号");
break;
#endregion
#region 出料
case MoveStep.AGV_Out01:
AGVMoveInfo.NextMoveStep(MoveStep.AGV_Out02);
RobotManage.mainMachine.SetStatus(curNodeStatus);
AGVMoveInfo.log($"设置{curnode.name}状态为{curNodeStatus}");
break;
case MoveStep.AGV_Out02:
if (IOValue(IO_Type.StringFront_Check).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.StringBack_Check).Equals(IO_VALUE.LOW))
{
RobotManage.mainMachine.SetStatus(NodeStatus.None);
AGVMoveInfo.log($"前端信号和后端信号均灭,取消呼叫AGV接料串");
AGVMoveInfo.EndMove();
}
else if (AGVMoveInfo.IsTimeOut(5) && curnode.status != curNodeStatus)
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_Out02);
RobotManage.mainMachine.SetStatus(curNodeStatus);
AGVMoveInfo.log($"AGV状态不是{curNodeStatus},重新呼叫AGV");
}
else
{
if (curnode.status.Equals(NodeStatus.RequsetDock) || curnode.status.Equals(NodeStatus.Arrive))
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_OpenDoor);
AGVMoveInfo.log($"AGV到达,准备开门");
//AGV已到达,请求开门
OpenDoor(AGVMoveInfo);
}
}
break;
case MoveStep.AGV_Out03:
AGVMoveInfo.NextMoveStep(MoveStep.AGV_Out04);
break;
case MoveStep.AGV_Out04:
AGVMoveInfo.NextMoveStep(MoveStep.AGV_Out05);
Line.LineRun("n", true, 2);
AGVMoveInfo.log($"收到AGV的{NodeStatus.RequestLeave}信号,允许出料");
break;
case MoveStep.AGV_Out05:
if (curnode.status != NodeStatus.MayLeave)
{
RobotManage.mainMachine.SetStatus(NodeStatus.MayLeave);
}
else
{
if (IOValue(IO_Type.StringBack_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Type.StringFront_Check).Equals(IO_VALUE.LOW))
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_Out06);
RobotManage.mainMachine.SetStatus(NodeStatus.FinishLeave);
AGVMoveInfo.log($"料串离开");
AGVMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
}
}
break;
case MoveStep.AGV_Out06:
AGVMoveInfo.NextMoveStep(MoveStep.AGV_DetachOK);
RobotManage.mainMachine.SetStatus(NodeStatus.Detach);
AGVMoveInfo.log($"向AGV发送脱离信号");
break;
#endregion
case MoveStep.AGV_OpenDoor:
if (curnode.status == NodeStatus.RequestEnter)
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_In03);
RobotManage.mainMachine.SetStatus(NodeStatus.MayEnter);
CylinderMove(StringMoveInfo, IO_Type.StringFix_Bottom, IO_Type.StringFix_Top, IO_VALUE.LOW);
Line.LineRun("n", false, 2);
AGVMoveInfo.log($"收到AGV的{NodeStatus.RequestEnter}信号,无料串,允许进料");
}
else if (curnode.status == NodeStatus.RequestLeave)
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_Out03);
RobotManage.mainMachine.SetStatus(NodeStatus.MayLeave);
CylinderMove(StringMoveInfo, IO_Type.StringFix_Bottom, IO_Type.StringFix_Top, IO_VALUE.LOW);
Line.LineRun("n", true, 2);
AGVMoveInfo.log($"收到AGV的{NodeStatus.RequestLeave}信号,有料串,允许出料");
}
else if (curnode.status.Equals(NodeStatus.RequsetDock))
{
if(IOValue(IO_Type.StringDoor_Open).Equals(IO_VALUE.HIGH))
{
RobotManage.mainMachine.SetStatus(NodeStatus.MayDock);
}
}
break;
case MoveStep.AGV_DetachOK:
if (curnode.status == NodeStatus.DetachOk)
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_CloseDoor);
CloseDoor(AGVMoveInfo);
AGVMoveInfo.log($"收到脱离脱离信号,关闭折叠门");
}
else if (AGVMoveInfo.IsTimeOut())
{
AGVMoveInfo.NextMoveStep(MoveStep.AGV_CloseDoor);
CloseDoor(AGVMoveInfo);
AGVMoveInfo.log($"收到脱离脱离信号超时,关闭折叠门");
}
break;
case MoveStep.AGV_CloseDoor:
AGVMoveInfo.EndMove();
break;
}
}
void OpenDoor(MoveInfo moveInfo)
{
StringDoorOpen(moveInfo);
}
void CloseDoor(MoveInfo moveInfo)
{
StringDoorClose(moveInfo);
}
}
}
......@@ -104,9 +104,9 @@ namespace DeviceLibrary
break;
case MoveStep.ReelClamp_04:
ClampMoveInfo.NextMoveStep(MoveStep.ReelClamp_05);
ClampMoveInfo.log($"关闭翻板门,检测盘宽");
//CylinderMove(ClampMoveInfo, IO_Type.StringPosChecker_Home, IO_Type.StringPosChecker_Work, IO_VALUE.HIGH);
ClampMoveInfo.MoveParam.PlateW = GetWidth();
ClampMoveInfo.log($"关闭翻板门,检测盘宽={ClampMoveInfo.MoveParam.PlateW}");
CloseFlipDoor(ClampMoveInfo);
break;
case MoveStep.ReelClamp_05:
......@@ -122,8 +122,8 @@ namespace DeviceLibrary
else
{
ClampErrorCount = 0;
ReelGetted();
ClampMoveInfo.log($"检测到盘,盘宽:{ClampMoveInfo.MoveParam.PlateW},通知料串料已取走");
ReelGetted();
}
break;
case MoveStep.ReelClamp_WaitGaugeHeight:
......
......@@ -69,7 +69,7 @@ namespace DeviceLibrary
// //RobotManage.UserPause(crc.GetString("Res0004", "收到出库任务,但料叉上有料,无法启动,请检查"));
//}
//else
Msg.add(crc.GetString("Res0004", "收到出库任务,但料叉上有料,无法启动,请检查"), MsgLevel.warning);
Msg.add(crc.GetString("Res0004", "收到出库任务,但料叉上有料,无法启动,请检查"), MsgLevel.alarm);
RobotManage.UserPause(crc.GetString("Res0004", "收到出库任务,但料叉上有料,无法启动,请检查"));
return;
}
......@@ -101,7 +101,7 @@ namespace DeviceLibrary
// //RobotManage.UserPause("收到出库任务,但料叉上有料,无法启动,请检查");
//}
//else
Msg.add(crc.GetString("Res0004", "收到出库任务,但料叉上有料,无法启动,请检查"), MsgLevel.warning);
Msg.add(crc.GetString("Res0004", "收到出库任务,但料叉上有料,无法启动,请检查"), MsgLevel.alarm);
RobotManage.UserPause(crc.GetString("Res0004", "收到出库任务,但料叉上有料,无法启动,请检查"));
return;
}
......
......@@ -9,6 +9,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeviceLibrary
{
......@@ -120,6 +121,7 @@ namespace DeviceLibrary
StringMoveInfo.log($"当前没有料串");
StringState = StringStateE.None;
LastStringState = StringStateE.None;
needEnter(AGVLib.NodeStatus.NeedEnter);
}
else if (IOValue(IO_Type.StringFront_Check).Equals(IO_VALUE.HIGH))
{
......@@ -202,7 +204,8 @@ namespace DeviceLibrary
break;
case MoveStep.StringLoad_04:
StringMoveInfo.NextMoveStep(MoveStep.StringLoad_04b);
LastOutDownPosition = Batch_Axis.GetAclPosition();
//OffsetEmptyToTrayCheck 空料串到P2点与料盘定位信号补偿值
LastOutDownPosition = Batch_Axis.GetAclPosition() + ConfigHelper.Config.Get("OffsetEmptyToTrayCheck", 10) * Config.Batch_PoToMM;
if (LastStringState == StringStateE.OutStore)
{
StringMoveInfo.log($"恢复上次料串信息为出库料串");
......@@ -215,7 +218,7 @@ namespace DeviceLibrary
StringState = StringStateE.OutStore;
if (ConfigHelper.Config.Get("Device_String_StandbyAtBottom", true) && OutStoreJobList.Count == 0 && ServerCM.queueTaskCount <= 0 && boxTransport.IsComplateOrFree)
{
SetReelHeight(GetHeight(StringMoveInfo));
SetReelHeight(GetHeight(ClampMoveInfo));
StringMoveInfo.log($"当前空料串, 并且没有出库任务, 料串下降待机");
StringMoveInfo.NextMoveStep(MoveStep.StringOut_01);
}
......@@ -239,7 +242,7 @@ namespace DeviceLibrary
SetReelHeight(GetHeight(ClampMoveInfo));
newreel = false;
StringMoveInfo.log($"料串有盘下降5mm");
StringMoveInfo.log($"料串有盘下降{Config.Batch_DetectDownMM}mm");
var tpos2 = Batch_Axis.GetAclPosition() - Config.Batch_PoToMM * Config.Batch_DetectDownMM;
if (tpos2 < 0)
{
......@@ -264,7 +267,7 @@ namespace DeviceLibrary
if (StringState == StringStateE.InStore)
{
StringMoveInfo.NextMoveStep(MoveStep.StringReadyGet);
StringMoveInfo.log($"料串有盘上升5mm");
StringMoveInfo.log($"料串有盘上升{Config.Batch_DetectDownMM + 2}mm");
var tpos4 = Batch_Axis.GetAclPosition() + Config.Batch_PoToMM * (Config.Batch_DetectDownMM + 2);
Batch_Axis.AbsMove(StringMoveInfo, tpos4, Config.Batch_P1_speed);
CylinderMove(StringMoveInfo, IO_Type.Clamping_Relax, IO_Type.Clamping_Work, IO_VALUE.LOW);
......@@ -279,7 +282,7 @@ namespace DeviceLibrary
{
tpos2 = 0;
}
StringMoveInfo.log($"料串出库模式,下降{Config.Batch_OutStoreDownMM}cm,={tpos2},{Batch_Axis.GetAclPosition()}");
StringMoveInfo.log($"料串出库模式,下降{Config.Batch_OutStoreDownMM}mm,={tpos2},{Batch_Axis.GetAclPosition()}");
Batch_Axis.AbsMove(StringMoveInfo, tpos2, Config.Batch_P1_speed);
StringType = StringTypeE.Out;
}
......@@ -349,7 +352,7 @@ namespace DeviceLibrary
else if (tpos > Config.Batch_P1 + Config.Batch_PoToMM * maxReelHeight)
{
StringMoveInfo.NextMoveStep(MoveStep.StringReadyPut);
StringMoveInfo.log($"料盘放入料串,下降{StringMoveInfo.MoveParam.PlateH}+{3}cm");
StringMoveInfo.log($"料盘放入料串,下降{StringMoveInfo.MoveParam.PlateH}+{3}mm");
Batch_Axis.AbsMove(StringMoveInfo, tpos, Config.Batch_P1_speed);
}
else if (!downCheck3)
......@@ -384,10 +387,18 @@ namespace DeviceLibrary
StringMoveInfo.NextMoveStep(MoveStep.StringReelPut_05);
var heightcheck = (LastOutDownPosition - Batch_Axis.GetAclPosition()) / Config.Batch_PoToMM;
StringMoveInfo.log($"LastOutDownPosition={LastOutDownPosition},CurrentPosition={Batch_Axis.GetAclPosition()},heightcheck={heightcheck}");
if (heightcheck <= 5)
int height = StringMoveInfo.MoveParam.PlateH + 3;
int outstoreHeightCheckLowDevia = Setting_Init.OutstoreHeightCheckLowerDeviation;
int outstoreHeightCheckUpDevia = Setting_Init.OutstoreHeightCheckUpperDeviation;
if (heightcheck <= Setting_Init.ReelCheckTriggerDeviation)
{
Msg.add("出库时料盘未成功放入料串,请检查", MsgLevel.alarm);
RobotManage.UserPause("出库时料盘未成功放入料串,请检查");
Msg.add(crc.GetString(L.outstore_abnormal_reel, "出库时料盘未成功放入料串,请检查"), MsgLevel.alarm);
RobotManage.UserPause(crc.GetString(L.outstore_abnormal_reel, "出库时料盘未成功放入料串,请检查"));
}
else if ((heightcheck < height - outstoreHeightCheckLowDevia) || (heightcheck > height + outstoreHeightCheckUpDevia))//
{
Msg.add(crc.GetString(L.outstore_abnormal_reel, "出库时料盘未成功放入料串,请检查"), MsgLevel.alarm);
RobotManage.UserPause(crc.GetString(L.outstore_abnormal_reel, "出库时料盘未成功放入料串,请检查"));
}
break;
case MoveStep.StringReelPut_05:
......@@ -418,7 +429,9 @@ namespace DeviceLibrary
break;
case MoveStep.StringOut_02:
StringMoveInfo.NextMoveStep(MoveStep.StringOut_03);
StringMoveInfo.log($"打开门");
needLeave(AGVLib.NodeStatus.NeedLeave);
StringMoveInfo.log($"呼叫AGV取料串");
// StringMoveInfo.log($"打开门");
//CylinderMove(StringMoveInfo, IO_Type.StringDoor_Close, IO_Type.StringDoor_Open, IO_VALUE.HIGH);
break;
case MoveStep.StringOut_03:
......@@ -564,6 +577,9 @@ namespace DeviceLibrary
string LastCode = "";
private int GetHeight(MoveInfo moveInfo)
{
int w15SubVal = Setting_Init.Param_CalHeight_Width15HeightSubVal;
int w13SubVal = Setting_Init.Param_CalHeight_Width13HeightSubVal;
int w8MaxVal = Setting_Init.Param_CalHeight_Height8MaxVal;
int LastHeight = 0;
int AxisChangeValue = Config.Batch_PoToMM;
//计算高度
......@@ -571,6 +587,8 @@ namespace DeviceLibrary
StartMovePosition += RealPulse;
float height = (float)Math.Ceiling(1F * Math.Abs(EndMovePosition - StartMovePosition) / AxisChangeValue);
string buchongStr = "";
string prefix = $"料盘高度计算({moveInfo.Name})--";
LogUtil.info($"{prefix}计算的原始厚度 {height}mm");
if (Batch_Axis.IsInPosition(Config.Batch_P2))
{
buchongStr = $"(最后一盘料已补充{Config.LastTrayAddHeight})";
......@@ -578,37 +596,95 @@ namespace DeviceLibrary
}
if (moveInfo.MoveParam.PlateW == 15)
{
height -= 2;
height -= w15SubVal;
LogUtil.info($"{prefix}宽度15料盘,厚度自减{w15SubVal}mm");
}
else if (moveInfo.MoveParam.PlateW == 13)
{
height -= 1;
height -= w13SubVal;
LogUtil.info($"{prefix}宽度13料盘,厚度自减{w13SubVal}mm");
}
//如果检测出<=15,都按照8计算
if (height < 12)
else
{
LogUtil.info($"{prefix}宽度为{moveInfo.MoveParam.PlateW}mm");
}
if (height < w8MaxVal)
{
LastHeight = 8;
LogUtil.info($"{prefix}计算出的厚度小于{w8MaxVal},认为是8mm料盘");
}
else
{
if (Setting_Init.Switch_UseCustHeightList)
{
try
{
string[] heights = Setting_Init.Param_CalHeight_HeightList;
foreach (var item in heights)
{
string[] s1 = item.Split('=');
int curHeight;
int min, max;
curHeight = int.Parse(s1[0]);
string[] s2 = s1[1].Split('#');
min = int.Parse(s2[0]);
max = int.Parse(s2[1]);
if (height >= min && height < max)
{
LastHeight = curHeight;
break;
}
}
}
catch (Exception e)
{
LogUtil.error($"{prefix}使用自定义高度列表异常", e);
List<int> heightList = new List<int> { 8, 12, 16, 24, 32, 44, 56 };
float minCha = float.MaxValue;
foreach (int h in heightList)
{
float curCha = Math.Abs(height - h);
if (curCha < minCha)
{
LastHeight = h;
minCha = curCha;
}
}
// List<int> heightList = new List<int> { 8, 12, 16, 24, 32, 44, 56 };
// foreach (int h in heightList)
// {
// if (height > h)
// {
// LastHeight = h;
// }
// }
}
}
else
{
List<int> heightList = new List<int> { 8, 12, 16, 24, 32, 44, 56 };
//heightList = (from m in heightList orderby m descending select m).ToList<int>();
//float minCha = height;
float minCha = float.MaxValue;
foreach (int h in heightList)
{
if (height > h)
float curCha = Math.Abs(height - h);
if (curCha < minCha)
{
LastHeight = h;
minCha = curCha;
}
}
}
}
if (LastHeight <= 8) { LastHeight = 8; }
//string code = CodeManager.ProcessCode(LastCodeList);
string msg = Name + $" 计算盘高:上升前 [" + StartMovePosition + $"]实时[ " + EndMovePosition + $"]差值[" + (EndMovePosition - StartMovePosition) + $"]系数[" + AxisChangeValue + $"] 计算后" + buchongStr + "[" + height + "]" + $",归类为【" + LastHeight + $"mm】条码【" + LastCode + "】";
string msg = Name + prefix + "上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + "[" + height + "]," + buchongStr + ",归类为【" + LastHeight + "mm】条码【" + LastCode + "】";
LogUtil.info(msg);
return LastHeight;
}
public void StringDoorOpen(MoveInfo moveInfo)
{
if (StringDoor != null)
......
......@@ -157,6 +157,26 @@ namespace DeviceLibrary
StoreTS16,
StoreTS17,
StoreTS18,
//AGV
AGV_In01,
AGV_In02,
AGV_In03,
AGV_In04,
AGV_In05,
AGV_In06,
AGV_In07,
AGV_In08,
AGV_Out01,
AGV_Out02,
AGV_Out03,
AGV_Out04,
AGV_Out05,
AGV_Out06,
AGV_Out07,
AGV_OpenDoor,
AGV_DetachOK,
AGV_CloseDoor,
}
......
......@@ -25,7 +25,7 @@ namespace TheMachine
InitializeComponent();
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
//chbAutoRun.Enabled = false;
chbAutoRun.Checked = Convert.ToBoolean(ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun));
chbAutoRun.Checked = Convert.ToBoolean(ConfigAppSettings.GetValue(Setting_Init.App_AutoRun,0, "系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要"));
this.chbAutoRun.CheckedChanged += new System.EventHandler(this.chbAutoRun_CheckedChanged);
//chbAutoRun.Enabled = true;
for (int i = 0; i < 20; i++)
......@@ -80,12 +80,12 @@ namespace TheMachine
{
if (chbAutoRun.Checked)
{
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 1);
ConfigAppSettings.SetValue(Setting_Init.App_AutoRun, 1);
AutoRun(Application.ExecutablePath, true);
}
else
{
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 0);
ConfigAppSettings.SetValue(Setting_Init.App_AutoRun, 0);
AutoRun(Application.ExecutablePath, false);
}
}
......
......@@ -401,3 +401,4 @@ l_flipDoor_no_work 左侧翻板水平信号未亮 The left flap horizontal signa
r_flipDoor_no_work 右侧翻板水平信号未亮 The right flap horizontal signal is not lit
reel_not_in_right_status 料盘放置异常 The reel is placed abnormally
confirm_no_reel_in_com 请确保料盘已从库位中取出 Make sure that the reel has been removed from the location
outstore_abnormal_reel The material tray is not successfully put into the string, please check
\ No newline at end of file
......@@ -403,3 +403,4 @@ l_flipDoor_no_work 左侧翻板水平信号未亮 左フラップ水平信号が
r_flipDoor_no_work 右侧翻板水平信号未亮 右フラップ水平信号が点灯しない
reel_not_in_right_status 料盘放置异常 リールが異常に配置されている
confirm_no_reel_in_com 请确保料盘已从库位中取出 リールがその場所から取り外されていることを確認してください
outstore_abnormal_reel 倉庫を出るとき、材料トレイがひもにうまく入れられていません、確認してください
\ No newline at end of file
......@@ -376,7 +376,7 @@ string_not_onposition 回原时X09,X10信号异常,料串可能不在正确位
tray_detect_reel_01 料叉传感器X30感应到有料,请人工确认 料叉传感器X30感应到有料,请人工确认
system_running_cantmove 系统正在运行,不能手动控制伺服
before_FrmPositionTool_stopmuchine 运行库位校准程序前,需要先停止料仓的运行
outstore_abnormal_reel 出库时料盘未成功放入料串,请检查
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!