Exemple #1
0
        /// <summary>
        /// 设置快充板状态
        /// </summary>
        /// <param name="startAddr"></param>
        /// <param name="status"></param>
        public bool SetQCV(int addr, COnOffPara para, out string er)
        {
            er = string.Empty;

            try
            {
                if (!_Mon.ContainsKey(addr))
                {
                    er = "控制板地址[" + addr.ToString("D2") + "不存在";
                    return(false);
                }

                _Mon[addr].Para.Timer.wQCType = para.wQCType;

                for (int i = 0; i < _Mon[addr].Para.Timer.wQCVolt.Length; i++)
                {
                    _Mon[addr].Para.Timer.wQCVolt[i] = para.wQCVolt[i];
                }

                _Mon[addr].Para.QCV_OP = EOP.写入;

                return(true);
            }
            catch (Exception ex)
            {
                er = ex.ToString();
                return(false);
            }
            finally
            {
            }
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="wAddr"></param>
        /// <param name="wPara"></param>
        /// <param name="er"></param>
        /// <returns></returns>
        public bool ReadGJM_RunQC_Para(int wAddr, ref COnOffPara rPara, out string er)
        {
            er = string.Empty;

            try
            {
                string wCmd  = string.Empty;
                string rData = string.Empty;
                string rVal  = string.Empty;
                wCmd = wAddr.ToString("X2") + "02" + "0E" + "04";
                wCmd = SOI + wCmd + CalCheckSum(wCmd) + EOI;
                int rLen = 1 + 1 + 2 + 1 + 5 + 1 + 1;
                if (!com.send(wCmd, rLen, out rData, out er, _TimeOut))
                {
                    return(false);
                }
                if (!ToCheckSum(rData, ref rVal))
                {
                    er = "检验和错误:" + rData;
                    return(false);
                }
                rPara.wQCType = System.Convert.ToInt16(rVal.Substring(0, 2), 16);
                for (int i = 0; i < 4; i++)
                {
                    rPara.wQCVolt[i] = System.Convert.ToInt16(rVal.Substring(2 + i * 2, 2), 16);
                }
                return(true);
            }
            catch (Exception e)
            {
                er = e.ToString();
                return(false);
            }
        }
Exemple #3
0
 /// <summary>
 /// 设定快充参数
 /// </summary>
 /// <param name="wAddr"></param>
 /// <param name="rPara"></param>
 /// <param name="er"></param>
 /// <returns></returns>
 public bool SetGJM_RunQC_Para(int wAddr, COnOffPara wPara, out string er)
 {
     er = string.Empty;
     try
     {
         string wCmd  = string.Empty;
         string rData = string.Empty;
         string rVal  = string.Empty;
         wCmd += wPara.wQCType.ToString("X2");
         for (int i = 0; i < 4; i++)
         {
             wCmd += wPara.wQCVolt[i].ToString("X2");
         }
         wCmd = chkSOIEOI(wCmd);
         wCmd = wAddr.ToString("X2") + "01" + "15" + "09" + wCmd;
         wCmd = SOI + wCmd + CalCheckSum(wCmd) + EOI;
         int rLen = 0;
         if (!com.send(wCmd, rLen, out rData, out er, _TimeOut))
         {
             return(false);
         }
         return(true);
     }
     catch (Exception e)
     {
         er = e.ToString();
         return(false);
     }
 }
Exemple #4
0
        public COnOffPara Clone()
        {
            COnOffPara para = new COnOffPara();

            para.BIToTime = this.BIToTime;

            for (int i = 0; i < 4; i++)
            {
                para.wOnOff[i]  = this.wOnOff[i];
                para.wON[i]     = this.wON[i];
                para.wOFF[i]    = this.wOFF[i];
                para.wQCVolt[i] = this.wQCVolt[i];
            }

            para.wQCType = this.wQCType;

            return(para);
        }
Exemple #5
0
        /// <summary>
        /// 读取时序
        /// </summary>
        /// <param name="addr"></param>
        /// <param name="er"></param>
        /// <returns></returns>
        private bool readTimer(int addr, out string er)
        {
            er = string.Empty;

            try
            {
                Thread.Sleep(_delayMs);

                COnOffPara para = new COnOffPara();

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

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

                _Mon[addr].Para.Timer.BIToTime = para.BIToTime;

                for (int i = 0; i < _Mon[addr].Para.Timer.wOnOff.Length; i++)
                {
                    _Mon[addr].Para.Timer.wOnOff[i] = para.wOnOff[i];
                    _Mon[addr].Para.Timer.wON[i]    = para.wON[i];
                    _Mon[addr].Para.Timer.wOFF[i]   = para.wOFF[i];
                }

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

                return(true);
            }
            catch (Exception ex)
            {
                er = ex.ToString();
                return(false);
            }
            finally
            {
            }
        }
Exemple #6
0
        /// <summary>
        /// 读取快充电压
        /// </summary>
        /// <param name="addr"></param>
        /// <param name="er"></param>
        /// <returns></returns>
        private bool readQCV(int addr, out string er)
        {
            er = string.Empty;

            try
            {
                Thread.Sleep(_delayMs);

                COnOffPara para = new COnOffPara();

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

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

                _Mon[addr].Para.Timer.wQCType = para.wQCType;

                for (int i = 0; i < _Mon[addr].Para.Timer.wQCVolt.Length; i++)
                {
                    _Mon[addr].Para.Timer.wQCVolt[i] = para.wQCVolt[i];
                }

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

                return(true);
            }
            catch (Exception ex)
            {
                er = ex.ToString();
                return(false);
            }
            finally
            {
            }
        }
Exemple #7
0
 /// <summary>
 /// 读取快充参数
 /// </summary>
 /// <param name="wAddr"></param>
 /// <param name="wPara"></param>
 /// <param name="er"></param>
 /// <returns></returns>
 public bool ReadGJM_RunQC_Para(int wAddr, ref COnOffPara rPara, out string er)
 {
     return(_devMon.ReadGJM_RunQC_Para(wAddr, ref rPara, out er));
 }
Exemple #8
0
 /// <summary>
 /// 设定快充参数
 /// </summary>
 /// <param name="wAddr"></param>
 /// <param name="rPara"></param>
 /// <param name="er"></param>
 /// <returns></returns>
 public bool SetGJM_RunQC_Para(int wAddr, COnOffPara wPara, out string er)
 {
     return(_devMon.SetGJM_RunQC_Para(wAddr, wPara, out er));
 }