Пример #1
0
        private UlUT55AEthernetClient(
            string name, int slaveAddr, int SlaveCount, int scanTime, EEthernetProtocol protocol, int timeout)
            : base(name, scanTime, EEthernetProtocol.Tcp, timeout)
        {
            this.SlaveAddr  = slaveAddr;
            this.SlaveCount = SlaveCount;

            tcpClient.ReceiveTimeout = timeout;

            master      = null;
            Values      = new float[SlaveCount][];
            logStr      = new StringBuilder(128);
            dicRegRatio = new Dictionary <int, Dictionary <EUT55ARegisterAddress, float> >();

            for (int i = 0; i < SlaveCount; i++)
            {
                Dictionary <EUT55ARegisterAddress, float> dic = new Dictionary <EUT55ARegisterAddress, float>();

                foreach (EUT55ARegisterAddress reg in Enum.GetValues(typeof(EUT55ARegisterAddress)))
                {
                    dic.Add(reg, csDefaultRatio);
                }

                dicRegRatio.Add(SlaveAddr + i, dic);

                Values[i] = new float[csRegisterCount];
            }
        }
Пример #2
0
 private UlGM10EthernetClient(
     string name, int length, int scanTime, EEthernetProtocol protocol, int timeout)
     : base(name, scanTime, protocol, timeout)
 {
     recvPacket = new UlGM10StringPacket(csMaxCount, InvalidFloatValue);
     Values     = new float[length];
 }
Пример #3
0
 public UlMasterKEthernetClient(
     string name, IPEndPoint ipPoint, string block, int length, int scanTime,
     EEthernetProtocol protocol = EEthernetProtocol.Tcp, int timeout = 1000)
     : this(name, block, length, scanTime, protocol, timeout)
 {
     IpPoint = ipPoint;
 }
Пример #4
0
 private UlWT330EthernetClient(
     string name, EWT330Phase phase, int scanTime, EEthernetProtocol protocol, int timeout)
     : base(name, scanTime, protocol, timeout)
 {
     this.Phase  = phase;
     this.packet = " ";
     Mode        = EEthernetMode.Real;
     Values      = new float[ItemLength];
 }
Пример #5
0
 public UlWT330EthernetClient(
     string name, EWT330Phase phase, IPEndPoint ipPoint,
     int scanTime = 250,
     EEthernetProtocol protocol = EEthernetProtocol.Tcp,
     int timeout = 1000)
     : this(name, phase, scanTime, protocol, timeout)
 {
     IpPoint = ipPoint;
 }
Пример #6
0
        private UlMasterKEthernetClient(
            string name, string block, int length, int scanTime,
            EEthernetProtocol protocol, int timeout)
            : base(name, scanTime, protocol, timeout)
        {
            this.block  = block;
            this.length = length;

            valuePacket = " ";
            recvPacket  = new StringBuilder(1024);
            Values      = new UInt16[length];
        }
Пример #7
0
        public UlMasterKEthernetClient(
            string name, string ip, int port, string block, int length, int scanTime,
            EEthernetProtocol protocol = EEthernetProtocol.Tcp, int timeout = 1000)
            : this(name, block, length, scanTime, protocol, timeout)
        {
            try
            {
                IpPoint = new IPEndPoint(IPAddress.Parse(ip), port);
            }
            catch (Exception e)
            {
                Log(EEthernetLogItem.Exception, e.Message);

                throw new MasterKException(
                          "Occurred invalid IP and Port in UlMasterKEthernetClient.Creater",
                          EMasterKException.InvalidIPandPort);
            }
        }
Пример #8
0
        public UlWT330EthernetClient(
            string name, EWT330Phase phase, string ip, int port,
            int scanTime = 250,
            EEthernetProtocol protocol = EEthernetProtocol.Tcp,
            int timeout = 1000)
            : this(name, phase, scanTime, protocol, timeout)
        {
            try
            {
                IpPoint = new IPEndPoint(IPAddress.Parse(ip), port);
            }
            catch (Exception e)
            {
                Log(EEthernetLogItem.Exception, e.Message);

                throw new WT330Exception(
                          "Occurred invalid IP and Port in UlWT330EthernetClient.Creater",
                          EWT330Exception.InvalidIPandPort);
            }
        }
Пример #9
0
        public UlEthernetClient(
            string name, int scanTime, EEthernetProtocol protocol, int timeout)
        {
            InvalidFloatValue = float.NaN;
            ScanTime          = scanTime;
            Protocol          = protocol;
            Timeout           = timeout;
            Name = name;

            Mode = EEthernetMode.Real;

            rand = new Random();

            stopWatch = new Stopwatch();

            CreateClient();

            if (ScanTime > 0)
            {
                scaner = new UlEthernetScanerThread(this, ScanTime);
            }
            else
            {
                scaner = null;
            }

            Logging = EEthernetLogging.None;

            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = "";
            logger.FName  = "EthernetClientLog";

            logger.Clear();
            logger.AddTag("CONNECT");
            logger.AddTag("DISCONNECT");
            logger.AddTag("PC->Device");
            logger.AddTag("PC<-Device");
            logger.AddTag("NOTE");
            logger.AddTag("EXCEPTION");
        }