Commit 1538b02e LN

超声波差异大时未报警。2.颜色调整

1 个父辈 5ecb48bb
...@@ -240,10 +240,14 @@ namespace OnlineStore.Common ...@@ -240,10 +240,14 @@ namespace OnlineStore.Common
public static MyConfig<int> Device_DauxiKS107_BaseValue = 1000; public static MyConfig<int> Device_DauxiKS107_BaseValue = 1000;
[MyConfigComment("红外传感器_最大误差值")] [MyConfigComment("红外传感器_最大误差值")]
public static MyConfig<int> Device_DauxiKS107_ErrorValue = 10000; public static MyConfig<int> Device_DauxiKS107_ErrorValue = 10000;
[MyConfigComment("红外传感器_调试状态,打印实时值")]
public static MyConfig<bool> Device_DauxiKS107_Debug = true ;
[MyConfigComment("重力传感器_端口号")] [MyConfigComment("重力传感器_端口号")]
public static MyConfig<string> Device_WeightSensor_PortName = ""; public static MyConfig<string> Device_WeightSensor_PortName = "";
[MyConfigComment("重力传感器_上限值")] [MyConfigComment("重力传感器_上限值")]
public static MyConfig<int> Device_WeightSensor_MaxValue =10000; public static MyConfig<int> Device_WeightSensor_MaxValue =10000;
} }
public enum InOut_Roller_Mode public enum InOut_Roller_Mode
{ {
......
...@@ -253,7 +253,7 @@ namespace DeviceLibrary ...@@ -253,7 +253,7 @@ namespace DeviceLibrary
} }
void debuglog(string msg) void debuglog(string msg)
{ {
loge.Info(Name + $"[{comPortName}]" + ":" + msg); loge.Debug(Name + $"[{comPortName}]" + ":" + msg);
Console.WriteLine(msg); Console.WriteLine(msg);
} }
static class CommandByte static class CommandByte
......
using OnlineStore; using OnlineStore;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.Eventing.Reader; using System.Diagnostics.Eventing.Reader;
...@@ -9,6 +10,7 @@ using System.Text; ...@@ -9,6 +10,7 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Timers; using System.Timers;
using System.Web.UI;
using static System.Windows.Forms.AxHost; using static System.Windows.Forms.AxHost;
namespace DeviceLibrary namespace DeviceLibrary
...@@ -19,11 +21,12 @@ namespace DeviceLibrary ...@@ -19,11 +21,12 @@ namespace DeviceLibrary
private bool rgbLedInitOk = false; private bool rgbLedInitOk = false;
public string lastColor = ""; public string lastColor = "";
public string lastS = "";
System.Threading.Timer ledRgbTimer; System.Threading.Timer ledRgbTimer;
public bool CloseRgbLed() public bool CloseRgbLed()
{ {
if(rgbLedInitOk) if (rgbLedInitOk)
{ {
rGB_Controller.Dispose(); rGB_Controller.Dispose();
} }
...@@ -36,7 +39,7 @@ namespace DeviceLibrary ...@@ -36,7 +39,7 @@ namespace DeviceLibrary
string port = Setting_Init.Device_LedLight_PortName; string port = Setting_Init.Device_LedLight_PortName;
if (port == "") if (port == "")
{ {
LogUtil.info( "未配置LED灯端口号"); LogUtil.info("未配置LED灯端口号");
return false; return false;
} }
rGB_Controller = new Flyelectronic_485_RGB_Controller("LED"); rGB_Controller = new Flyelectronic_485_RGB_Controller("LED");
...@@ -60,10 +63,11 @@ namespace DeviceLibrary ...@@ -60,10 +63,11 @@ namespace DeviceLibrary
{ {
rGB_Controller.CloseLed(); rGB_Controller.CloseLed();
lastColor = ""; lastColor = "";
lastS = "";
} }
public void ShowColor(Color color) public void ShowColor(Color color)
{ {
if (lastColor!=""&& lastColor.Equals(color.Name.ToString())) if (lastColor != "" && lastColor.Equals(color.Name.ToString()))
{ {
return; return;
} }
...@@ -97,76 +101,110 @@ namespace DeviceLibrary ...@@ -97,76 +101,110 @@ namespace DeviceLibrary
//流动黄: 出库, //流动黄: 出库,
//白色: 等待用户响应(等待取走盘等), //白色: 等待用户响应(等待取走盘等),
//蓝色: 扫码检测 //蓝色: 扫码检测
if (runStatus == RunStatus.Stop)
bool inPut = false;
bool scanCode = false;
bool inOut = false;
bool waitTake = false;
if (runStatus == RunStatus.Running)
{ {
//未启动 黑色 var h = NGDoor_Tray_Test_Reel;
ShowColor(Color.Black);
}
else if (isInSuddenDown) //出入库 绿闪 黄闪
if (StoreMoveInfo.MoveStep >= MoveStep.StoreOut10)
{ {
//红色: 急停, inOut = true;
ShowColor(Color.Red);
} }
else if (hasAlarm) else if (StoreMoveInfo.MoveStep >= MoveStep.StoreIn01)
{
inPut = true;
}
else if (StringMoveInfo.MoveStep >= MoveStep.StringReadyGet && StringMoveInfo.MoveStep <= MoveStep.StringReelGetFail)
{ {
//紫色: 异常,
ShowColor(Color.Purple);
} //温度超限 inPut = true;
else if (IsTHoutRange()) }
else if (StringMoveInfo.MoveStep >= MoveStep.StringReelPut && StringMoveInfo.MoveStep <= MoveStep.StringReelPut_05)
{ {
//紫色: 异常, inOut = true;
ShowColor(Color.Purple);
} }
//温度超限30分钟
else if (IsTHoutRangeOver30m()) if (ClampMoveInfo.IsStep(MoveStep.ReelClamp_10) && (!RobotManage.InoutDebugMode) && (!ClampMoveInfo.MoveParam.IsNg))
{ {
//紫色: 异常, scanCode = true;
ShowColor(Color.Purple);
} }
else if (runStatus == RunStatus.Running) if (h != null && h.Value && UserPause)
{ {
var h = NGDoor_Tray_Test_Reel; waitTake = true;
}
}
if (h != null && h.Value) if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW) || isInSuddenDown)
{ {
//等待料盘拿走 //红色: 急停,
//白色: 等待用户响应(等待取走盘等), ShowColor(Color.Red);
//蓝色: 扫码检测 lastS = "suddenStop";
ShowColor(Color.White); }
else if (runStatus == RunStatus.Stop)
{
//未启动 黑色
ShowColor(Color.Black);
lastS = "stop";
} }
else if (ClampMoveInfo.IsStep(MoveStep.ReelClamp_10) && (!RobotManage.InoutDebugMode) && (!ClampMoveInfo.MoveParam.IsNg))
else if (scanCode)
{ {
//蓝色: 扫码检测 //蓝色: 扫码检测
ShowColor(Color.Blue); ShowColor(Color.Blue);
lastS = "scanCode";
} }
//出入库 绿闪 黄闪 //出入库 绿闪 黄闪
else if (StoreMoveInfo.MoveStep >= MoveStep.StoreOut10) else if (inOut)
{ {
////流动黄: 出库, ////流动黄: 出库,
//if (lastColor.Equals("yellowRun"))
//{
// return;
//}
ShowYellowLight(); ShowYellowLight();
lastS = "storeOut";
} }
else if (StoreMoveInfo.MoveStep >= MoveStep.StoreIn01) else if (inPut)
{ {
////流动绿: 入库
//if (lastColor.Equals("yellowRun"))
//{
// return;
//}
ShowGreenLight(); ShowGreenLight();
lastS = "storeIn";
}
else if (waitTake)
{
//暂停等待料盘拿走
//白色: 等待用户响应(等待取走盘等),
//蓝色: 扫码检测
ShowColor(Color.White);
lastS = "waitTask";
}
else if (hasAlarm)
{
//紫色: 异常,
ShowColor(Color.Purple);
lastS = "hasAlarm";
} //温度超限
else if (IsTHoutRange())
{
//紫色: 异常,
ShowColor(Color.Purple);
lastS = "IsTHoutRange";
} }
//温度超限30分钟
else if (IsTHoutRangeOver30m())
{
//紫色: 异常,
ShowColor(Color.Purple);
lastS = "IsTHoutRangeOver30m";
} }
else else
{ {
//待机 蓝绿 //待机 蓝绿
ShowColor(Color.FromArgb(0, 128, 128)); ShowColor(Color.FromArgb(0, 128, 128));
lastS = "waiting";
} }
} }
} }
......
...@@ -671,13 +671,13 @@ namespace DeviceLibrary ...@@ -671,13 +671,13 @@ namespace DeviceLibrary
{ {
ResetMoveInfo.NextMoveStep(MoveStep.H27_HomeCheck); ResetMoveInfo.NextMoveStep(MoveStep.H27_HomeCheck);
InOut_Axis.AbsMove(ResetMoveInfo, Config.InOut_P1, Config.InOut_P1_speed); InOut_Axis.AbsMove(ResetMoveInfo, Config.InOut_P1, Config.InOut_P1_speed);
ResetMoveInfo.log($"{FixPos.posid}:进出轴返回待机点【{Config.InOut_P1}】【{Config.InOut_P1_speed}】"); ResetMoveInfo.log($"{FixPos.posid}:声波传感器OK,进出轴返回待机点【{Config.InOut_P1}】【{Config.InOut_P1_speed}】");
} }
else else
{ {
//直接到报警步骤 //直接到报警步骤
ResetMoveInfo.NextMoveStep(MoveStep.H31_HomeError); ResetMoveInfo.NextMoveStep(MoveStep.H31_HomeError);
ResetMoveInfo.log($"{FixPos.posid}:声波感应器误差过大,需要报警"); ResetMoveInfo.log($"{FixPos.posid}:声波传感器误差过大,需要报警");
} }
break; break;
...@@ -692,12 +692,13 @@ namespace DeviceLibrary ...@@ -692,12 +692,13 @@ namespace DeviceLibrary
case MoveStep.H28_HomeCheck: case MoveStep.H28_HomeCheck:
ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset);
ResetMoveInfo.log("声波感应器检测OK"); ResetMoveInfo.log("声波传感器检测OK");
break; break;
case MoveStep.H31_HomeError: case MoveStep.H31_HomeError:
ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset);
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000)); ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
Msg.add(crc.GetString("shengboError", "声波感应器误差过大,请检查后重新复位"), MsgLevel.alarm); Msg.add(crc.GetString("shengboError", "声波传感器误差过大,请检查后重新复位"), MsgLevel.alarm);
ResetMoveInfo.log(crc.GetString("shengboError", "声波传感器误差过大,请检查后重新复位"));
break; break;
// H22_HomeCheck,//旋转轴到校准为止,升降轴到高点,压紧轴压紧 // H22_HomeCheck,//旋转轴到校准为止,升降轴到高点,压紧轴压紧
//H23_HomeCheck,//进出轴进入 //H23_HomeCheck,//进出轴进入
......
...@@ -324,13 +324,14 @@ namespace DeviceLibrary ...@@ -324,13 +324,14 @@ namespace DeviceLibrary
} }
if (RobotManage.dauxiKS107Controller.Quary(out int value, out string errMsg)) if (RobotManage.dauxiKS107Controller.Quary(out int value, out string errMsg))
{ {
int cha = value - Setting_Init.Device_DauxiKS107_BaseValue; int cha =Math.Abs( value - Setting_Init.Device_DauxiKS107_BaseValue);
LogUtil.info($"传感器检测:当前值{value},基准值{Setting_Init.Device_DauxiKS107_BaseValue},最大误差值:{Setting_Init.Device_DauxiKS107_ErrorValue}");
if (cha > Setting_Init.Device_DauxiKS107_ErrorValue) if (cha > Setting_Init.Device_DauxiKS107_ErrorValue)
{ {
TimeSpan span = DateTime.Now - RobotManage.LastResetTime; TimeSpan span = DateTime.Now - RobotManage.LastResetTime;
RobotManage.SensorNeedReset = true; RobotManage.SensorNeedReset = true;
if (span.TotalHours > 1) if (span.TotalHours < 1)
{ {
LogUtil.error($"传感器误差过大,需要复位:当前值:{value},基准值:{Setting_Init.Device_DauxiKS107_BaseValue},SensorErroCount={RobotManage.SensorNeedReset}, 最大误差:{Setting_Init.Device_DauxiKS107_ErrorValue}," + LogUtil.error($"传感器误差过大,需要复位:当前值:{value},基准值:{Setting_Init.Device_DauxiKS107_BaseValue},SensorErroCount={RobotManage.SensorNeedReset}, 最大误差:{Setting_Init.Device_DauxiKS107_ErrorValue}," +
$"上次复位时间{RobotManage.LastResetTime.ToShortDateString()},一小时内出现红外传感器检测错误,需要报警"); $"上次复位时间{RobotManage.LastResetTime.ToShortDateString()},一小时内出现红外传感器检测错误,需要报警");
...@@ -340,6 +341,7 @@ namespace DeviceLibrary ...@@ -340,6 +341,7 @@ namespace DeviceLibrary
else else
{ {
LogUtil.error($"传感器误差过大,需要复位:当前值:{value},基准值:{Setting_Init.Device_DauxiKS107_BaseValue},SensorErroCount={RobotManage.SensorNeedReset},最大误差:{Setting_Init.Device_DauxiKS107_ErrorValue}"); LogUtil.error($"传感器误差过大,需要复位:当前值:{value},基准值:{Setting_Init.Device_DauxiKS107_BaseValue},SensorErroCount={RobotManage.SensorNeedReset},最大误差:{Setting_Init.Device_DauxiKS107_ErrorValue}");
return false;
} }
} }
} }
......
...@@ -166,7 +166,7 @@ namespace TheMachine ...@@ -166,7 +166,7 @@ namespace TheMachine
{ {
if (Setting_Init.Device_LedLight_PortName != "") if (Setting_Init.Device_LedLight_PortName != "")
{ {
lblLed.Text = "LED" + Setting_Init.Device_LedLight_PortName + ":" + RobotManage.mainMachine.lastColor.ToString(); lblLed.Text = "LED" + Setting_Init.Device_LedLight_PortName +","+RobotManage.mainMachine.lastS+ ":" + RobotManage.mainMachine.lastColor.ToString();
} }
else else
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!