Beispiel #1
0
        /// <summary>
        /// 读取负载数据
        /// </summary>
        /// <param name="addr"></param>
        /// <param name="er"></param>
        /// <returns></returns>
        private bool readLoadData(int addr, out string er)
        {
            er = string.Empty;

            try
            {
                _syncLock.AcquireWriterLock(-1);

                Thread.Sleep(_delayMs);

                CData loadData = new CData();

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

                    if (!_devMon.ReadLoadValue(addr, ref loadData, out er))
                    {
                        er = _devMon.ToString() + "[" + addr.ToString("D2") + "]" + CLanguage.Lan("读电流") + ";";
                        return(false);
                    }
                }

                _Mon[addr].Data.inv_status = loadData.inv_status;
                _Mon[addr].Data.alarmInfo  = loadData.alarmInfo;
                _Mon[addr].Data.rCmd       = loadData.rCmd;
                for (int i = 0; i < _Mon[addr].Data.chan.Count; i++)
                {
                    _Mon[addr].Data.chan[i].ch_status = loadData.chan[i].ch_status;
                    _Mon[addr].Data.chan[i].alarmInfo = loadData.chan[i].alarmInfo;
                    _Mon[addr].Data.chan[i].input_ac  = loadData.chan[i].input_ac;
                    _Mon[addr].Data.chan[i].volt      = loadData.chan[i].volt;
                    _Mon[addr].Data.chan[i].current   = loadData.chan[i].current;
                }

                return(true);
            }
            catch (Exception ex)
            {
                er = ex.ToString();
                return(false);
            }
            finally
            {
                _syncLock.ReleaseWriterLock();
            }
        }
Beispiel #2
0
 /// <summary>
 /// 读取负载数据
 /// </summary>
 /// <param name="wAddr"></param>
 /// <param name="data"></param>
 /// <param name="er"></param>
 /// <returns></returns>
 public bool ReadLoadValue(int wAddr, ref CData data, out string er)
 {
     return(_devMon.ReadLoadValue(wAddr, ref data, out er));
 }