Beispiel #1
0
 public int getValueInt(int id)
 {
     try
     {
         int i = Convert.ToInt16(PlcSvr.GetInstance().getVal(id));
         return(i);
     }
     catch
     {
         return(0);
     }
 }
Beispiel #2
0
        public int getValueInt(int id)
        {
            try
            {
                string val = PlcSvr.GetInstance().getVal(id);
                int    i   = Convert.ToInt16(val);
                return(i);
            }
            catch (Exception ex)
            {
                return(0);

                throw new Exception(ex.ToString() + id + ":");
            }
        }
Beispiel #3
0
        public static List <valRes> GetValById(int id)
        {
            List <valRes> listRes = new List <valRes>();
            valRes        curRes  = new valRes();

            curRes.id = id;
            List <L1tag> listtag = OpcHelp.GetTagList();
            L1tag        item    = listtag.Find(o => o.id == id);
            string       val     = "0";

            if (item == null)
            {
                val = "-9999";
            }
            else
            {
                if (item.type == 0)
                {
                    val = PlcSvr.GetInstance().getVal(id);
                }
                else if (item.type == 1)
                {
                    val = WinccBof.GetInstance().getVal(id);
                }
                else if (item.type == 2)
                {
                    val = WinccBof_B.GetInstance().getVal(id);
                }
                else if (item.type == 3)
                {
                    val = WinccCcm.GetInstance().getVal(id);
                }
                else if (item.type == 4)
                {
                    val = WinccCcm_B.GetInstance().getVal(id);
                }
                else if (item.type == 5)
                {
                    val = KepServer.GetInstance().getVal(id);
                }
            }
            curRes.val = val;
            listRes.Add(curRes);
            return(listRes);
        }
Beispiel #4
0
        public static List <valRes> GetOpcVal(List <valReq> listQes)
        {
            List <valRes> listRes = new List <valRes>();

            if (listQes == null)
            {
                return(listRes);
            }
            foreach (var item in listQes)
            {
                valRes curRes = new valRes();
                curRes.id = item.id;
                if (item.type == 0)
                {
                    curRes.val = PlcSvr.GetInstance().getVal(item.id);
                }
                else if (item.type == 1)
                {
                    curRes.val = WinccBof.GetInstance().getVal(item.id);
                }
                else if (item.type == 2)
                {
                    curRes.val = WinccBof_B.GetInstance().getVal(item.id);
                }
                else if (item.type == 3)
                {
                    curRes.val = WinccCcm.GetInstance().getVal(item.id);
                }
                else if (item.type == 4)
                {
                    curRes.val = WinccCcm_B.GetInstance().getVal(item.id);
                }
                listRes.Add(curRes);
            }
            return(listRes);
        }
Beispiel #5
0
 public double getValue(int id)
 {
     return(Convert.ToDouble(PlcSvr.GetInstance().getVal(id)));
 }
Beispiel #6
0
 public int getValueInt(int id)
 {
     return(Convert.ToInt16(PlcSvr.GetInstance().getVal(id)));
 }