Esempio n. 1
0
        public override void FromString(params string[] ParaList)
        {
            if (ParaList.Length != 3)
            {
                throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring");
            }
            GuiStringList.Clear();
            foreach (var it in ParaList)
            {
                GuiStringList.Add(it);
            }

            var L1 = GuiStringList[0].Split('_');

            //Name
            Enum.TryParse(L1[0], out EnumDeviceName Dn);
            DeviceName = Dn;

            //LocalIndex
            LocalIndex = int.Parse(L1[1]);

            Function = 0x23;

            //GlobalIndex
            GlobalIndex = int.Parse(GuiStringList[2]);
        }
Esempio n. 2
0
        public override void FromString(params string[] ParaList)
        {
            if (ParaList.Length != 11)
            {
                throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring");
            }
            GuiStringList.Clear();
            foreach (var it in ParaList)
            {
                GuiStringList.Add(it);
            }



            Name          = GuiStringList[0];
            Function      = GuiStringList[1];
            Plug_Sequence = GuiStringList[2];

            Enum.TryParse(StrEnumResolution.Where(a => a.Value.Equals(GuiStringList[3])).First().Key.ToString(), out EnumHL5002Resolution resolution);
            Enum.TryParse(StrEnumRevolution.Where(a => a.Value.Equals(GuiStringList[4])).First().Key.ToString(), out EnumHL5002Revolution revolution);
            Resolution = resolution;
            Revolution = revolution;

            PresetValue = GuiStringList[5];


            ResPara1 = GuiStringList[6];
            ResPara2 = GuiStringList[7];
            ResPara3 = GuiStringList[8];
            ResPara4 = GuiStringList[9];
            ResPara5 = GuiStringList[10];
        }
Esempio n. 3
0
        protected override void SetProfile()
        {
            GuiStringList.Clear();

            GuiStringList.Add(Name);

            GuiStringList.Add(Function);

            GuiStringList.Add(Plug_Sequence);
        }
Esempio n. 4
0
        public override List <string> ToStringList()
        {
            GuiStringList.Clear();
            //Name_LocalIndex
            GuiStringList.Add($"{DeviceName.ToString()}_{LocalIndex}");
            //Function
            GuiStringList.Add("DO8xDC24V 2.0A");
            //GlobalIndex
            GuiStringList.Add($"{GlobalIndex}");

            return(GuiStringList);
        }
Esempio n. 5
0
 public override void FromString(params string[] ParaList)
 {
     if (ParaList.Length != GuiStringListNumber)
     {
         throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring");
     }
     GuiStringList.Clear();
     foreach (var it in ParaList)
     {
         GuiStringList.Add(it);
     }
     Name          = GuiStringList[0];
     Function      = GuiStringList[1];
     Plug_Sequence = GuiStringList[2];
 }
        public override void FromString(params string[] ParaList)
        {
            InputTypeDic.Clear();
            AccuracyDic.Clear();

            InputTypeDic.Add(0x00, "Normal");
            InputTypeDic.Add(0x01, "4-20mA");
            InputTypeDic.Add(0x02, "0-20mA");
            for (byte i = 3; i < 11; i++)
            {
                InputTypeDic.Add(i, $"Reserved{i}");
            }

            AccuracyDic.Add(0x0A, "10bits sampling");
            AccuracyDic.Add(0x0C, "12bits sampling");
            AccuracyDic.Add(0x10, "16bits sampling");

            if (ParaList.Length != 11)
            {
                throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring");
            }

            GuiStringList.Clear();
            foreach (var it in ParaList)
            {
                GuiStringList.Add(it);
            }
            var L1 = GuiStringList[0].Split('_');

            //Name
            Enum.TryParse(L1[0], out EnumDeviceName Dn);
            DeviceName = Dn;

            //LocalIndex
            LocalIndex = int.Parse(L1[1]);

            Function = 0x32;

            //GlobalIndex
            GlobalIndex = int.Parse(GuiStringList[2]);

            for (int i = 0; i < 4; i++)
            {
                ChInputTypeArr[i] = InputTypeDic.Where(a => a.Value.Equals(GuiStringList[2 * i + 3])).First().Key;
                ChAccuracyArr[i]  = AccuracyDic.Where(a => a.Value.Equals(GuiStringList[2 * i + 4])).First().Key;
            }
        }
        public override List <string> ToStringList()
        {
            GuiStringList.Clear();
            //Name_LocalIndex
            GuiStringList.Add($"{DeviceName.ToString()}_{LocalIndex}");
            //Function
            GuiStringList.Add("AIx4Ch. 4-20mA");
            //GlobalIndex
            GuiStringList.Add($"{GlobalIndex}");

            for (int i = 0; i < 4; i++)
            {
                GuiStringList.Add($"{InputTypeDic[ChInputTypeArr[i]]}");
                GuiStringList.Add($"{AccuracyDic[ChAccuracyArr[i]]}");
            }

            return(GuiStringList);
        }
Esempio n. 8
0
        protected override void SetProfile()
        {
            GuiStringList.Clear();
            GetListFromStr(GuiStringList,
                           Name,
                           Function,
                           Plug_Sequence,
                           StrEnumType[Ch1_Output_Type],
                           StrEnumAccuracy[Ch1_Accuracy],

                           StrEnumType[Ch2_Output_Type],
                           StrEnumAccuracy[Ch2_Accuracy],

                           StrEnumType[Ch3_Output_Type],
                           StrEnumAccuracy[Ch3_Accuracy],

                           StrEnumType[Ch4_Output_Type],
                           StrEnumAccuracy[Ch4_Accuracy]);
        }
Esempio n. 9
0
        public override void FromString(params string[] ParaList)
        {
            if (ParaList.Length != GuiStringListNumber)
            {
                throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring");
            }
            GuiStringList.Clear();
            foreach (var it in ParaList)
            {
                GuiStringList.Add(it);
            }

            Name          = GuiStringList[0];
            Function      = GuiStringList[1];
            Plug_Sequence = GuiStringList[2];

            Enum.TryParse(StrEnumType.Where(a => a.Value.Equals(GuiStringList[3])).FirstOrDefault().Key.ToString(), out EnumHL1001Type type);
            Type = type;
        }
        public override void FromString(params string[] ParaList)
        {
            if (ParaList.Length != 11)
            {
                throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring");
            }

            GuiStringList.Clear();
            foreach (var it in ParaList)
            {
                GuiStringList.Add(it);
            }


            var L1 = GuiStringList[0].Split('_');

            //Name
            Enum.TryParse(L1[0], out EnumDeviceName Dn);
            DeviceName = Dn;


            //LocalIndex
            LocalIndex = int.Parse(L1[1]);

            Function = 0x51;

            //GlobalIndex
            GlobalIndex = int.TryParse(GuiStringList[2], out int globalIndex) ? globalIndex : 0;

            //CounterLimitH
            CounterLimitH = byte.TryParse(GuiStringList[3], out byte counterLimitH)? counterLimitH : (byte)0;

            //CounterLimitL
            CounterLimitL = byte.TryParse(GuiStringList[4], out byte counterLimitL) ? counterLimitL : (byte)0;

            //ResPara
            for (int i = 0; i < 6; i++)
            {
                ResParaArr[i] = byte.TryParse(GuiStringList[i + 5], out byte resPara)? resPara:(byte)0;
            }
        }
        public override List <string> ToStringList()
        {
            GuiStringList.Clear();
            //Name_LocalIndex
            GuiStringList.Add($"{DeviceName.ToString()}_{LocalIndex}");
            //Function
            GuiStringList.Add("DI8xDC24V");
            //GlobalIndex
            GuiStringList.Add($"{GlobalIndex}");
            //LimitH
            GuiStringList.Add($"{CounterLimitH}");
            //LimitL
            GuiStringList.Add($"{CounterLimitL}");

            for (int i = 0; i < 6; i++)
            {
                GuiStringList.Add($"{ResParaArr[i]}");
            }

            return(GuiStringList);
        }
Esempio n. 12
0
        public override void FromString(params string[] ParaList)
        {
            EnumHL3001Type     type;
            EnumHL3001Accuracy acc;

            if (ParaList.Length != GuiStringListNumber)
            {
                throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring");
            }
            GuiStringList.Clear();
            foreach (var it in ParaList)
            {
                GuiStringList.Add(it);
            }
            Name          = GuiStringList[0];
            Function      = GuiStringList[1];
            Plug_Sequence = GuiStringList[2];



            Enum.TryParse(StrEnumType.Where(a => a.Value.Equals(GuiStringList[3])).FirstOrDefault().Key.ToString(), out type);
            Enum.TryParse(StrEnumAccuracy.Where(a => a.Value.Equals(GuiStringList[4])).FirstOrDefault().Key.ToString(), out acc);
            Ch1_Input_Type = type;
            Ch1_Accuracy   = acc;
            Enum.TryParse(StrEnumType.Where(a => a.Value.Equals(GuiStringList[5])).FirstOrDefault().Key.ToString(), out type);
            Enum.TryParse(StrEnumAccuracy.Where(a => a.Value.Equals(GuiStringList[6])).FirstOrDefault().Key.ToString(), out acc);
            Ch2_Input_Type = type;
            Ch2_Accuracy   = acc;


            Enum.TryParse(StrEnumType.Where(a => a.Value.Equals(GuiStringList[7])).FirstOrDefault().Key.ToString(), out type);
            Enum.TryParse(StrEnumAccuracy.Where(a => a.Value.Equals(GuiStringList[8])).FirstOrDefault().Key.ToString(), out acc);
            Ch3_Input_Type = type;
            Ch3_Accuracy   = acc;

            Enum.TryParse(StrEnumType.Where(a => a.Value.Equals(GuiStringList[9])).FirstOrDefault().Key.ToString(), out type);
            Enum.TryParse(StrEnumAccuracy.Where(a => a.Value.Equals(GuiStringList[10])).FirstOrDefault().Key.ToString(), out acc);
            Ch4_Input_Type = type;
            Ch4_Accuracy   = acc;
        }
        public override List <string> ToStringList()
        {
            GuiStringList.Clear();

            //Name_LocalIndex
            GuiStringList.Add($"{DeviceName.ToString()}_{LocalIndex}");
            //Function
            GuiStringList.Add("AbsEncoder SSI");
            //GlobalIndex
            GuiStringList.Add($"{GlobalIndex}");
            //Resolution
            GuiStringList.Add($"{ResolutionDic[Resolution]}");
            //Revolution
            GuiStringList.Add($"{RevolutionDic[Revolution]}");

            GuiStringList.Add($"{PresetValue}");

            for (int i = 0; i < 5; i++)
            {
                GuiStringList.Add($"{ResParaArr[i]}");
            }

            return(GuiStringList);
        }
Esempio n. 14
0
        public override void FromString(params string[] ParaList)
        {
            if (ParaList.Length != 11)
            {
                throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring");
            }
            GuiStringList.Clear();
            foreach (var it in ParaList)
            {
                GuiStringList.Add(it);
            }

            Name          = GuiStringList[0];
            Function      = GuiStringList[1];
            Plug_Sequence = GuiStringList[2];
            CounterLimitH = GuiStringList[3];
            CounterLimitL = GuiStringList[4];
            ResPara1      = GuiStringList[5];
            ResPara2      = GuiStringList[6];
            ResPara3      = GuiStringList[7];
            ResPara4      = GuiStringList[8];
            ResPara5      = GuiStringList[9];
            ResPara6      = GuiStringList[10];
        }
        public override void FromString(params string[] ParaList)
        {
            TypeDic.Clear();
            for (int i = 0; i < TypeList.Count(); i++)
            {
                TypeDic.Add(TypeList[i], TypeStringList[i]);
            }

            if (ParaList.Length != GuiStringListNumber)
            {
                throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring");
            }

            GuiStringList.Clear();
            foreach (var it in ParaList)
            {
                GuiStringList.Add(it);
            }

            var L1 = GuiStringList[0].Split('_');

            //Name
            Enum.TryParse(L1[0], out EnumDeviceName Dn);
            DeviceName = Dn;

            //LocalIndex
            LocalIndex = int.Parse(L1[1]);

            Function = 0x11;

            //GlobalIndex
            GlobalIndex = int.Parse(GuiStringList[2]);

            //Type
            Type = TypeDic.Where(a => a.Value.Equals(GuiStringList[3])).First().Key;
        }
Esempio n. 16
0
 protected override void SetProfile()
 {
     GuiStringList.Clear();
     GetListFromStr(GuiStringList, Name, Function, Plug_Sequence, StrEnumResolution[Resolution], StrEnumRevolution[Revolution], PresetValue,
                    ResPara1, ResPara2, ResPara3, ResPara4, ResPara5);
 }
        public override void FromString(params string[] ParaList)
        {
            ResolutionDic.Clear();
            RevolutionDic.Clear();
            ResolutionDic.Add(0, "Normal");
            RevolutionDic.Add(0, "Normal");
            for (byte i = 1; i < 17; i++)
            {
                ResolutionDic.Add(i, $"{i}bits");
                RevolutionDic.Add(i, $"{i}bits");
            }

            if (ParaList.Length != 11)
            {
                throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring");
            }
            GuiStringList.Clear();
            foreach (var it in ParaList)
            {
                GuiStringList.Add(it);
            }

            var L1 = GuiStringList[0].Split('_');

            //Name
            Enum.TryParse(L1[0], out EnumDeviceName Dn);
            DeviceName = Dn;


            //LocalIndex
            LocalIndex = int.Parse(L1[1]);

            Function = 0x52;

            //GlobalIndex
            GlobalIndex = int.Parse(GuiStringList[2]);

            //Resolution
            Resolution = ResolutionDic.Where(a => a.Value.Equals(GuiStringList[3])).First().Key;

            //Revolution
            Revolution = RevolutionDic.Where(a => a.Value.Equals(GuiStringList[4])).First().Key;

            //PresetValue
            if (UInt32.TryParse(GuiStringList[5], out UInt32 presetValue))
            {
                PresetValue = presetValue;
            }
            else
            {
                PresetValue = 0;
            }

            //ResPara
            for (int i = 0; i < 5; i++)
            {
                if (byte.TryParse(GuiStringList[i + 6], out byte resValue))
                {
                    ResParaArr[i] = resValue;
                }
                else
                {
                    ResParaArr[i] = 0;
                }
            }
        }
Esempio n. 18
0
 protected override void SetProfile()
 {
     GuiStringList.Clear();
     GetListFromStr(GuiStringList, Name, Function, Plug_Sequence, CounterLimitH, CounterLimitL, ResPara1,
                    ResPara2, ResPara3, ResPara4, ResPara5, ResPara6);
 }
Esempio n. 19
0
 protected override void SetProfile()
 {
     GuiStringList.Clear();
     GetListFromStr(GuiStringList, Name, Function, Plug_Sequence, StrEnumType[Type]);
 }