Exemple #1
0
        public static IU[] StrToIU(string _data)
        {
            DateTime dt0 = DateTime.Now;

            if (_data == null)
            {
                return(null);
            }
            if (_data.Length == 0)
            {
                return(null);
            }
            int pos   = 0;
            int count = Convert.ToInt32(_data.Substring(pos, 8));

            pos += 9;
            IU[] iu = new IU[count];
            for (int i = 0; i < count; i++)
            {
                //                string aaa = _data.Substring(pos, 7).Replace(".",",");
                iu[i]   = new IU();
                iu[i].I = Convert.ToDouble(_data.Substring(pos, 7).Replace(".", ","));
                pos    += 8;
                iu[i].U = Convert.ToDouble(_data.Substring(pos, 7).Replace(".", ","));
                pos    += 8;
            }
            DateTime dt1 = DateTime.Now;
            int      ms  = (dt1 - dt0).Milliseconds;

            return(iu);
        }
Exemple #2
0
        public static IU[] StrToIUfloat(string _data)
        {
            DateTime dt0 = DateTime.Now;

            if (_data == null)
            {
                return(null);
            }
            if (_data.Length == 0)
            {
                return(null);
            }
            string[] M       = _data.Split(';');
            int      packets = Convert.ToInt32(M[0]);

            IU[] iu = new IU[packets];
            for (int p = 0; p < packets; p++)
            {
                string[] mm = M[p + 1].Split(' ');
                iu[p] = new IU(Convert.ToDouble(mm[0]), Convert.ToDouble(mm[1]));
            }
            int ms = (DateTime.Now - dt0).Milliseconds;

            return(iu);
        }
Exemple #3
0
        static public bool Check(IU _iu, EStartPoint _sp)
        {
            switch (_sp)
            {
            case EStartPoint.IH:
                return(_iu.I > 0);

            case EStartPoint.IL:
                return(_iu.I < 0);

            case EStartPoint.UH:
                return(_iu.U > 0);

            case EStartPoint.UL:
                return(_iu.U < 0);
            }
            return(false);
        }
Exemple #4
0
 public IU(IU _iu)
 {
     I = _iu.I;
     U = _iu.U;
 }