예제 #1
0
 public int getValueInt(int id)
 {
     try
     {
         int i = Convert.ToInt16(PlcSvr.GetInstance().getVal(id));
         return(i);
     }
     catch
     {
         return(0);
     }
 }
예제 #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 + ":");
            }
        }
예제 #3
0
파일: OpcHelp.cs 프로젝트: rcw0125/o-p-c
        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);
        }
예제 #4
0
파일: OpcHelp.cs 프로젝트: rcw0125/o-p-c
        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);
        }
예제 #5
0
 public double getValue(int id)
 {
     return(Convert.ToDouble(PlcSvr.GetInstance().getVal(id)));
 }
예제 #6
0
 public int getValueInt(int id)
 {
     return(Convert.ToInt16(PlcSvr.GetInstance().getVal(id)));
 }