Esempio n. 1
0
 /// <summary>
 /// 读取负载值
 /// </summary>
 /// <param name="wAddr"></param>
 /// <param name="loadSet"></param>
 /// <param name="er"></param>
 /// <returns></returns>
 public bool ReadLoadSet(int wAddr, ref CrLoad loadSet, out string er)
 {
     try
     {
         string cmd0  = "02";
         string cmd1  = "05";
         string wCmd  = cmd0 + cmd1;
         string wData = string.Empty;
         wData = CalDataFromDDCmd(wAddr, wCmd, wData);
         string rData = string.Empty;
         int    rLen  = 16;
         if (!SendCmdToDDLoad(wData, rLen, out rData, out er))
         {
             return(false);
         }
         for (int i = 0; i < rData.Length / 2; i++)
         {
             loadSet.loadVal[i] = ((double)System.Convert.ToInt32(rData.Substring(i * 2, 2), 16)) / 10;
         }
         return(true);
     }
     catch (Exception ex)
     {
         er = ex.ToString();
         return(false);
     }
 }
Esempio n. 2
0
        public CrLoad Clone()
        {
            CrLoad para = new CrLoad();

            for (int i = 0; i < 8; i++)
            {
                para.loadVal[i] = this.loadVal[i];
            }

            return(para);
        }
Esempio n. 3
0
        /// <summary>
        /// 读取负载设置
        /// </summary>
        /// <param name="addr"></param>
        /// <param name="er"></param>
        /// <returns></returns>
        private bool readLoadSet(int addr, out string er)
        {
            er = string.Empty;

            try
            {
                _syncLock.AcquireWriterLock(-1);

                Thread.Sleep(_delayMs);

                CrLoad para = new CrLoad();

                if (!_devMon.ReadLoadSet(addr, ref para, out er))
                {
                    Thread.Sleep(_delayMs);

                    if (!_devMon.ReadLoadSet(addr, ref para, out er))
                    {
                        er = _Mon[addr].ToString() + "读数据;";
                        return(false);
                    }
                }

                _Mon[addr].Para.LoadRead = para.Clone();

                _Mon[addr].Para.rLoad_OP = EOP.读取OK;

                return(true);
            }
            catch (Exception ex)
            {
                er = ex.ToString();
                return(false);
            }
            finally
            {
                _syncLock.ReleaseWriterLock();
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 读取负载设置
 /// </summary>
 /// <param name="wAddr"></param>
 /// <param name="loadSet"></param>
 /// <param name="er"></param>
 /// <returns></returns>
 public bool ReadLoadSet(int wAddr, ref CrLoad loadSet, out string er)
 {
     return(_devMon.ReadLoadSet(wAddr, ref loadSet, out er));
 }