public void downLoadWeight() { if (lastweight == curweight.ToString()) { if (xiachuanFlag == 1) { return; } else { if (PlcSvr.GetInstance().setVal(L1ValId, curweight) == true) { xiachuanFlag = 1; } } } else { xiachuanFlag = 0; lastweight = curweight.ToString(); if (PlcSvr.GetInstance().setVal(L1ValId, curweight) == true) { xiachuanFlag = 1; } } }
public void getWcfStatus() { #region 各个服务启动 try { if (!PlcSvr.GetInstance().opc_connected) { label23.Text = "net服务连接启动!"; label23.ForeColor = Color.Red; } else { label23.Text = "net服务连接已启动!"; } if (!WinccBof.GetInstance().opc_connected) { label24.Text = "135服务连接没有启动!"; label24.ForeColor = Color.Red; } else { label24.Text = "135服务连接已启动!"; } if (!WinccBof_B.GetInstance().opc_connected) { label25.Text = "48135服务连接没有启动!"; label25.ForeColor = Color.Red; } else { label25.Text = "48135服务连接已启动!"; } if (!WinccCcm.GetInstance().opc_connected) { label26.Text = "125服务连接没有启动!"; label26.ForeColor = Color.Red; } else { label26.Text = "125服务连接已启动!"; } if (!WinccCcm_B.GetInstance().opc_connected) { label27.Text = "48125服务连接没有启动!"; label27.ForeColor = Color.Red; } else { label27.Text = "48125服务连接已启动!"; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } #endregion }
/// <summary> /// 根据变量ID获取变量的值 /// </summary> /// <param name="id"></param> /// <returns></returns> public double getVal(int id) { try { return(Convert.ToDouble(PlcSvr.GetInstance().getVal(id))); } catch { return(0); } }
public int getValueInt(int id) { return(Convert.ToInt16(PlcSvr.GetInstance().getVal(id))); }
public double getValue(int id) { return(Convert.ToDouble(PlcSvr.GetInstance().getVal(id))); }