/// <summary> /// 设置所有负载通道电流 /// </summary> /// <param name="addr"></param> /// <param name="load"></param> /// <param name="?"></param> /// <returns></returns> public bool SetLoad(int addr, CwLoad para, out string er) { er = string.Empty; try { if (!_Mon.ContainsKey(addr)) { er = "DD模块地址[" + addr.ToString("D2") + "不存在"; return(false); } _Mon[addr].Para.LoadSet = para.Clone(); _Mon[addr].Para.LoadSet.saveEEPROM = _saveEPROM; _Mon[addr].Para.wLoad_OP = EOP.写入; return(true); } catch (Exception ex) { er = ex.ToString(); return(false); } finally { } }
/// <summary> /// 设置新负载值 /// </summary> /// <param name="wAddr"></param> /// <param name="loadPara"></param> /// <param name="er"></param> /// <returns></returns> public bool SetNewLoad(int wAddr, CwLoad loadPara, out string er) { try { string cmd0 = "01"; string cmd1; if (loadPara.saveEEPROM == 1) { cmd1 = "06"; } else { cmd1 = "07"; } string wCmd = cmd0 + cmd1; string wData = string.Empty; for (int i = 0; i < loadPara.loadVal.Length; i++) { wData += ((int)(loadPara.loadVal[i] * 10)).ToString("X2"); } wData = CalDataFromDDCmd(wAddr, wCmd, wData); string rData = string.Empty; int rLen = 0; if (!SendCmdToDDLoad(wData, rLen, out rData, out er)) { return(false); } return(true); } catch (Exception ex) { er = ex.ToString(); return(false); } }
public CwLoad Clone() { CwLoad para = new CwLoad(); para.saveEEPROM = this.saveEEPROM; for (int i = 0; i < 8; i++) { para.loadVal[i] = this.loadVal[i]; } return(para); }
/// <summary> /// 设置负载 /// </summary> /// <param name="wStartAddr"></param> /// <param name="wEndAddr"></param> /// <param name="loadPara"></param> /// <param name="er"></param> /// <returns></returns> public bool SetNewLoad(int wStartAddr, int wEndAddr, CwLoad loadPara, out string er) { return(_devMon.SetNewLoad(wStartAddr, wEndAddr, loadPara, out er)); }
/// <summary> /// 设置负载 /// </summary> /// <param name="wAddr"></param> /// <param name="loadPara"></param> /// <param name="er"></param> /// <returns></returns> public bool SetNewLoad(int wAddr, CwLoad loadPara, out string er) { return(_devMon.SetNewLoad(wAddr, loadPara, out er)); }