Commit 322170bb 张东亮

存储机构-添加进出轴扭矩打印

1 个父辈 1fa71d78
......@@ -158,6 +158,14 @@ namespace OnlineStore.DeviceLibrary
}
return false;
}
/// <summary>
/// 获取轴扭矩
/// </summary>
/// <param name="slvAddr"></param>
/// <returns></returns>
public short GetAxActTorq(short slvAddr)
{
return HCBoardManager.GetAxActTorq(slvAddr);
}
}
}
......@@ -454,7 +454,10 @@ namespace OnlineStore.DeviceLibrary
/// 料仓入库:料斗拉取进出轴到P1(待机点),检查另一边入库情况
/// </summary>
SI_19_InoutBack,
/// <summary>
/// 料仓入库:如果上料机构入料口有料,则去待机点
/// </summary>
SI_20_ToStandby,
#endregion
#region 存储机构自动对位功能 400开始
......


using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
......@@ -14,8 +14,8 @@ using System.Timers;
namespace OnlineStore.DeviceLibrary
{
public abstract class EquipBase : DeviceBase
{
public bool IsDebug = false;
{
public bool IsDebug = false;
public bool MoveStop = false;
protected int TimerMaxSeconds = 3;
......@@ -26,10 +26,10 @@ namespace OnlineStore.DeviceLibrary
mainTimer.Enabled = open;
ledProcessTimer.Enabled = open;
}
protected abstract void BaseTimerProcess();
protected override void mainTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
TimerProcess();
......@@ -60,7 +60,7 @@ namespace OnlineStore.DeviceLibrary
}
this.alarmType = alarmType;
if (alarmType.Equals(AlarmType.SuddenStop) || alarmType.Equals(AlarmType.NoAirpressure_Check) ||
alarmType.Equals(AlarmType.AxisAlarm)||alarmType.Equals(AlarmType.AxisMoveError))
alarmType.Equals(AlarmType.AxisAlarm) || alarmType.Equals(AlarmType.AxisMoveError))
{
StopMove();
}
......@@ -85,8 +85,8 @@ namespace OnlineStore.DeviceLibrary
ResetProcess();
}
if (MoveInfo.MoveType.Equals(MoveType.InStore))
{
InstoreProcess();
{
InstoreProcess();
}
else if (MoveInfo.MoveType.Equals(MoveType.OutStore))
{
......@@ -142,9 +142,9 @@ namespace OnlineStore.DeviceLibrary
//取新的Io状态
IO_VALUE fuweiValue = IOValue(IO_Type.Reset_BTN);
if (DILastValueMap.ContainsKey(IO_Type.Reset_BTN))
{
{
IO_VALUE lastFuwei = DILastValueMap[IO_Type.Reset_BTN];
bool isAutoStart = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun) == 1;
bool isAutoStart = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun) == 1;
//收到复位信号后启动
if (isAutoStart && fuweiValue.Equals(IO_VALUE.HIGH) && lastFuwei.Equals(IO_VALUE.LOW))
{
......@@ -193,47 +193,47 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("IOTimeOutProcess出错:", ex);
}
}
public bool CanStartRun()
public bool CanStartRun()
{
string canResult = StoreManager.XLRStore.CanStart();
if (String.IsNullOrEmpty(canResult).Equals(false))
{
SetWarnMsg(Name+ canResult);
SetWarnMsg(Name + canResult);
return false;
}
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
SetWarnMsg(Name +"启动失败:急停未开");
{
SetWarnMsg(Name + "启动失败:急停未开");
return false;
}
else if (this.baseConfig.DType.Equals(DeviceType.InputEquip)&& IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW))
{
else if (this.baseConfig.DType.Equals(DeviceType.InputEquip) && IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW))
{
SetWarnMsg(Name + "启动失败:没有气压信号");
return false;
}
return true;
}
}
public void ChangeDebug(bool isDebug)
{
}
{
}
#region 伺服运动
public bool RunAxis(bool isCheck, AxisBean axis)
{
{
string msg = "";
bool result = axis.Open(isCheck, out msg);
if (result && String.IsNullOrEmpty(msg))
{
{
return true;
}
}
return false;
}
public void CloseAxis(AxisBean axis)
{
axis.ServoOff();
{
axis.ServoOff();
}
......@@ -248,9 +248,9 @@ namespace OnlineStore.DeviceLibrary
if (alarmIo.Equals(1))
{
WarnMsg = Name + " " + axisInfo.AxisName + "报警";
LogUtil.error(WarnMsg);
LogUtil.error(WarnMsg);
if (NeedAlarm)
{
Alarm(AlarmType.AxisAlarm);
......@@ -262,11 +262,12 @@ namespace OnlineStore.DeviceLibrary
return false;
}
#endregion
#region CheckWait处理
protected DateTime preRWTime = DateTime.Now;
short curTor, preTor;
internal void CheckWait(DeviceMoveInfo moveInfo)
{
try
......@@ -312,6 +313,21 @@ namespace OnlineStore.DeviceLibrary
// LogInfo($"移栽升降轴 目标位置:{wait.TargetPosition},当前位置:{outCount}");
//}
wait.IsEnd = AxisBean.ACAxisMoveIsEnd(moveInfo, wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
try
{
if (wait.AxisInfo.DeviceName.Equals("料斗拉取进出轴"))
{
short axisNo = wait.AxisInfo.GetAxisValue();
preTor = curTor;
curTor = ((HCAxisManager)AxisManager.instance).GetAxActTorq(axisNo);
if (!preTor.Equals(curTor))
LogInfo($"料斗拉取进出轴 扭矩:{curTor}");
}
}
catch (Exception e)
{
LogUtil.error("获取料斗拉取进出轴轴距失败", e);
}
}
if (!msg.Equals(""))
{
......@@ -381,7 +397,7 @@ namespace OnlineStore.DeviceLibrary
{
wait.IsEnd = CheckWaitResult(moveInfo, wait);
}
if (wait.IsEnd)
{
if (moveInfo.OneWaitCanEndStep)
......@@ -403,17 +419,17 @@ namespace OnlineStore.DeviceLibrary
{
if (moveInfo.WaitList.Count > cutWLcount && !moveInfo.OneWaitCanEndStep)
{
LogUtil.info(moveInfo.Name+" moveInfo.WaitList.Count:" + moveInfo.WaitList.Count.ToString()+ ",cutWLcount:"+ cutWLcount.ToString()); ;
LogUtil.info(moveInfo.Name + " moveInfo.WaitList.Count:" + moveInfo.WaitList.Count.ToString() + ",cutWLcount:" + cutWLcount.ToString()); ;
}
moveInfo.EndStepWait();
moveInfo.EndStepWait();
}
else if (span.TotalSeconds > moveInfo.TimeOutSeconds)
{
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待" + NotOkMsg
+ "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
//int second = 10;
//second = (int)(span.TotalSeconds/moveInfo.TimeOutSeconds ) * 10;
//if (second > 120)
//{
......@@ -424,7 +440,7 @@ namespace OnlineStore.DeviceLibrary
// second = 10;
//}
LogUtil.error(WarnMsg, moveInfo.ErrorLogType, moveInfo.logSeconds());
Alarm(AlarmType.IoSingleTimeOut);
Alarm(AlarmType.IoSingleTimeOut);
}
}
catch (Exception ex)
......@@ -442,7 +458,7 @@ namespace OnlineStore.DeviceLibrary
#region 日志打印
internal int WorkLogLevel = 1;
protected void InoutLog(string msg,int level=1)
protected void InoutLog(string msg, int level = 1)
{
if (level < 0)
{
......@@ -453,42 +469,42 @@ namespace OnlineStore.DeviceLibrary
level = WorkLogLevel;
}
string code = "";
if (MoveInfo.MoveParam != null &&MoveInfo.MoveParam.PosInfo!=null&& MoveInfo.MoveParam.PosInfo.barcode != null)
if (MoveInfo.MoveParam != null && MoveInfo.MoveParam.PosInfo != null && MoveInfo.MoveParam.PosInfo.barcode != null)
{
if (!MoveInfo.MoveParam.PosInfo.barcode.Equals(""))
{
code = MoveInfo.MoveParam.PosInfo.barcode;
code = MoveInfo.MoveParam.PosInfo.barcode;
}
}
if (level.Equals(1))
{
LogUtil.info(MoveInfo.Name + "[" + code + "]" + "[" + MoveInfo.MoveStep + "] " + msg);
}
else
{
else
{
LogUtil.debug(MoveInfo.Name + "[" + code + "]" + "[" + MoveInfo.MoveStep + "] " + msg);
}
}
public virtual string GetMoveStr()
{
string msg = "";
int tLength = 15;
msg += "runS: " + runStatus + "\n";
int tLength = 15;
msg += "runS: " + runStatus + "\n";
msg += "alarm: " + alarmType + " " + LastAlarmTime.ToLongTimeString() + "\n";
msg += "MoveT:" + MoveInfo.MoveType + "\n";
msg += "MoveS :" + MoveInfo.MoveStep + "\n";
msg += "MoveS :" + MoveInfo.MoveStep + "\n";
return msg;
}
#endregion
#region 灯光处理
protected void CloseLed()
{
......@@ -531,7 +547,7 @@ namespace OnlineStore.DeviceLibrary
{
yellowMove = true;
}
......
......@@ -371,10 +371,20 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SI_19_InoutBack:
if (!CheckInStoreOtherSideInfo())
{
SetBoxStatus(DeviceStatus.StoreOnline, RunStatus.Runing);
LogInfo($"入库 {MoveInfo.SLog}:入库结束[{MoveInfo.MoveParam.PosInfo.PosId}][耗时:{(DateTime.Now - startTime).TotalSeconds.ToString("f2")}秒][{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
MoveInfo.EndMove();
AutoInout.InOutEndProcess(this, MoveType.InStore);
if(InDoorSigCheck())
{
MoveInfo.NextMoveStep(StepEnum.SI_20_ToStandby);
LogInfo($"入库 {MoveInfo.SLog}:入料口有料,行走机构去待机点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
MoveAxisToP1();
}
else
{
SetBoxStatus(DeviceStatus.StoreOnline, RunStatus.Runing);
LogInfo($"入库 {MoveInfo.SLog}:入库结束[{MoveInfo.MoveParam.PosInfo.PosId}][耗时:{(DateTime.Now - startTime).TotalSeconds.ToString("f2")}秒][{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
MoveInfo.EndMove();
AutoInout.InOutEndProcess(this, MoveType.InStore);
}
}
else
{
......@@ -387,6 +397,12 @@ namespace OnlineStore.DeviceLibrary
}
break;
case StepEnum.SI_20_ToStandby:
SetBoxStatus(DeviceStatus.StoreOnline, RunStatus.Runing);
LogInfo($"入库 {MoveInfo.SLog}:入库结束[{MoveInfo.MoveParam.PosInfo.PosId}][耗时:{(DateTime.Now - startTime).TotalSeconds.ToString("f2")}秒][{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
MoveInfo.EndMove();
AutoInout.InOutEndProcess(this, MoveType.InStore);
break;
}
}
#endregion
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!