Example #1
0
        public int SetCurValue(ref string pName, ref object val)
        {
            int j;

            PiLink.declare pk = new PiLink.declare();

            j = pk.SetCurValue(ref pName, ref val);

            return(j);
        }
Example #2
0
        /// <summary>
        /// 打开PI连接
        /// </summary>
        /// <param name="serverName"></param>
        /// <param name="userName"></param>
        /// <param name="userPwd"></param>
        /// <returns></returns>
        public static int OpenPi()
        {
            PiLink.declare pk = new PiLink.declare();

            int i = 200;

            string serverName = IniHelper.ReadIniData("RTDB", "DBIP", null);   // System.Configuration.ConfigurationSettings.AppSettings["piserver"].ToString();
            string userName   = IniHelper.ReadIniData("RTDB", "DBUser", null); // System.Configuration.ConfigurationSettings.AppSettings["piuser"].ToString();
            string userPwd    = IniHelper.ReadIniData("RTDB", "DBPwd", null);  //System.Configuration.ConfigurationSettings.AppSettings["pipwd"].ToString();

            i = pk.ConnectToServer(ref serverName, ref userName, ref userPwd);

            return(i);
        }
Example #3
0
        /// <summary>
        /// 打开PI连接
        /// </summary>
        /// <param name="serverName"></param>
        /// <param name="userName"></param>
        /// <param name="userPwd"></param>
        /// <returns></returns>
        public static int OpenPi()
        {
            PiLink.declare pk = new PiLink.declare();

            int i = 200;

            string serverName = IniHelper.ReadIniData("RTDB", "DBIP", null);// System.Configuration.ConfigurationSettings.AppSettings["piserver"].ToString();
            string userName = IniHelper.ReadIniData("RTDB", "DBUser", null);// System.Configuration.ConfigurationSettings.AppSettings["piuser"].ToString();
            string userPwd = IniHelper.ReadIniData("RTDB", "DBPwd", null); //System.Configuration.ConfigurationSettings.AppSettings["pipwd"].ToString();

            i = pk.ConnectToServer(ref serverName, ref userName, ref userPwd);

            return i;
        }
Example #4
0
        public int SetHisValue(ref string pName, ref string time, ref object val)
        {
            PiLink.declare pk = new PiLink.declare();

            object drval = null;
            object bval  = null;
            object bsize = null;
            object istat = null;
            object flags = null;

            int j = pk.SetHistValue(ref pName, ref val, ref time);

            return(j);
        }
Example #5
0
        /// <summary>
        /// 返回历史值
        /// </summary>
        /// <param name="tagName"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        public static double returnValueByTagName(string tagName, string time)
        {
            PiLink.declare pk = new PiLink.declare();

            object drval = null;
            object bval = null;
            object bsize = null;
            object istat = null;
            object flags = null;

            int j = pk.GetHistValue(ref tagName, ref  drval, ref bval, ref bsize, ref istat, ref flags, ref time);

            if (j == 0)
            { return Convert.ToDouble(drval.ToString()); }
            else
            { return Convert.ToDouble(drval.ToString()); }
        }
Example #6
0
        /// <summary>
        /// 返回历史值
        /// </summary>
        /// <param name="tagName"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        static public double returnValueByTagName(string tagName, string time)
        {
            PiLink.declare pk = new PiLink.declare();

            object drval = null;
            object bval  = null;
            object bsize = null;
            object istat = null;
            object flags = null;

            int j = pk.GetHistValue(ref tagName, ref drval, ref bval, ref bsize, ref istat, ref flags, ref time);

            if (j == 0)
            {
                return(Convert.ToDouble(drval.ToString()));
            }
            else
            {
                return(Convert.ToDouble(drval.ToString()));
            }
        }
Example #7
0
        /// <summary>
        /// 取历史值
        /// </summary>
        /// <param name="pName"></param>
        /// <param name="time"></param>
        /// <param name="val"></param>
        public void GetHisValue(string pName, string time, ref double val)
        {
            PiLink.declare pk = new PiLink.declare();

            object drval = null;
            object bval  = null;
            object bsize = null;
            object istat = null;
            object flags = null;

            int j = pk.GetHistValue(ref pName, ref drval, ref bval, ref bsize, ref istat, ref flags, ref time);

            if (j == 0)
            {
                val = double.Parse(drval.ToString());
            }
            else
            {
                val = 0;
            }
        }
Example #8
0
 /// <summary>
 /// 释放Pi数据库的连接
 /// </summary>
 /// <returns></returns>
 public static object closePi()
 {
     PiLink.declare pk = new PiLink.declare();
     return(pk.DisConnect());
 }
Example #9
0
 /// <summary>
 /// 释放Pi数据库的连接
 /// </summary>
 /// <returns></returns>
 public static object closePi()
 {
     PiLink.declare pk = new PiLink.declare();
     return pk.DisConnect();
 }
Example #10
0
        public int SetHisValue(ref string pName, ref string time, ref object val)
        {
            PiLink.declare pk = new PiLink.declare();

            object drval = null;
            object bval = null;
            object bsize = null;
            object istat = null;
            object flags = null;

            int j = pk.SetHistValue(ref pName, ref val, ref time);

            return j;
        }
Example #11
0
        public int SetCurValue(ref string pName, ref object val)
        {
            int j;

            PiLink.declare pk = new PiLink.declare();

            j = pk.SetCurValue(ref pName, ref val);

            return j;
        }
Example #12
0
        /// <summary>
        /// 取历史值
        /// </summary>
        /// <param name="pName"></param>
        /// <param name="time"></param>
        /// <param name="val"></param>
        public void GetHisValue(string pName, string time, ref double val)
        {
            PiLink.declare pk = new PiLink.declare();

            object drval = null;
            object bval = null;
            object bsize = null;
            object istat = null;
            object flags = null;

            int j = pk.GetHistValue(ref pName, ref  drval, ref bval, ref bsize, ref istat, ref flags, ref time);

            if (j == 0)
                val = double.Parse(drval.ToString());
            else
            //val = 0;
            { val = -1000000; }
        }