|
|
@ -1,37 +1,37 @@
|
|
|
|
using HslCommunication.Profinet.Siemens;
|
|
|
|
//using HslCommunication.Profinet.Siemens;
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
//using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
//using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
//using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
//using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
//using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.Pl
|
|
|
|
//namespace Mesnac.Action.ChemicalWeighing.Pl
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
public class PlcConnect
|
|
|
|
// public class PlcConnect
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Lazy<SiemensS7Net> lazy = new Lazy<SiemensS7Net>(() => new PlcConnect().SiemensS7NetConnection());
|
|
|
|
// private static readonly Lazy<SiemensS7Net> lazy = new Lazy<SiemensS7Net>(() => new PlcConnect().SiemensS7NetConnection());
|
|
|
|
public static SiemensS7Net Instance => lazy.Value;
|
|
|
|
// public static SiemensS7Net Instance => lazy.Value;
|
|
|
|
|
|
|
|
|
|
|
|
private PlcConnect()
|
|
|
|
// private PlcConnect()
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SiemensS7Net SiemensS7NetConnection()
|
|
|
|
// private SiemensS7Net SiemensS7NetConnection()
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
SiemensPLCS siemensPLCS = SiemensPLCS.S1500;
|
|
|
|
// SiemensPLCS siemensPLCS = SiemensPLCS.S1500;
|
|
|
|
SiemensS7Net s7 = new SiemensS7Net(siemensPLCS);
|
|
|
|
// SiemensS7Net s7 = new SiemensS7Net(siemensPLCS);
|
|
|
|
s7.IpAddress = PlcAddressUtil.IpAddress;
|
|
|
|
// s7.IpAddress = PlcAddressUtil.IpAddress;
|
|
|
|
s7.Port = PlcAddressUtil.Port;
|
|
|
|
// s7.Port = PlcAddressUtil.Port;
|
|
|
|
s7.ConnectServer();
|
|
|
|
// s7.ConnectServer();
|
|
|
|
return s7;
|
|
|
|
// return s7;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
//}
|
|
|
|