using HslCommunication.Instrument.DLT; using HslCommunication.Profinet.Siemens; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; namespace DataBlockHelper { public class PlcConnect { public static PlcConfig Config; private static readonly Lazy lazy = new Lazy(() => new PlcConnect().SiemensS7NetConnection()); public static SiemensS7Net Instance => lazy.Value; private PlcConnect() { } public SiemensS7Net SiemensS7NetConnection() { SiemensPLCS siemensPLCS = SiemensPLCS.S1500; SiemensS7Net s7 = new SiemensS7Net(siemensPLCS); s7.IpAddress = "192.168.0.100"; s7.Port = 7788; s7.ConnectServer(); return s7; } } public class PlcConfig { public PlcConfig() { IpAddress = "192.168.1.50"; Port = 102; } public string IpAddress { get; set; } public int Port { get; set; } } }