This commit is contained in:
2025-03-24 15:21:16 +08:00
parent 8aec9ba7fa
commit 447cf4326b
6 changed files with 363 additions and 71 deletions

View File

@ -45,12 +45,19 @@ namespace DH.Devices.PLC
TcpNet.DataFormat = HslCommunication.Core.DataFormat.ABCD;
TcpNet.Station = 1;
TcpNet.Series = XinJESeries.XD;
PLCItem itemSpeed = PLCItemList.FirstOrDefault(u => u.Name == "转盘速度");
if(itemSpeed== null)
{
return false;
}
OperateResult ret = TcpNet.ConnectServer();
if (ret.IsSuccess)
{
Connected = true;
MonitorPieces();
TurntableOpen(12000,true);
TurntableOpen(Convert.ToInt32(itemSpeed.Value) , true);
return true;
}
@ -58,6 +65,8 @@ namespace DH.Devices.PLC
{
return false;
}
}
catch
{
@ -438,6 +447,9 @@ namespace DH.Devices.PLC
private void MonitorPiecesImpl()
{
PLCItem pLCItem= PLCItemList.FirstOrDefault(u => u.Name == "产品计数");
if (pLCItem == null)
return;
DateTime startTime = DateTime.Now;
DateTime endTime = startTime;
TimeSpan timeSpan = endTime - startTime;
@ -448,7 +460,7 @@ namespace DH.Devices.PLC
Stopwatch sw = new Stopwatch();
uint tmpPieceNumber = 0;
sw.Start();
var ret = TcpNet.ReadUInt16("D1016");
sw.Stop();