我正在尝试开发opc的clinet,我使用的是OPCAutomation.dll这个组件开发的,语言用的是c#。
但是我对OPC不是很了解,现在能做到枚举某个IP节点上的服务器,和链接到制定的服务器。
但是我不明白,group和item是如何获得的?是自己建立的,还是从服务器读取的?目前公司的项目要求只要可以读就可以了。
请您给我解答一下这个问题,谢谢了!
opc的资料实在是太少了,希望您能帮助我,谢谢!
我的qq是:313887852 e-mail:badnewfish@gmail.com
如果有opc研究的朋友,希望能一起交流一下!
附枚举OPC服务器方法:
//枚举OPC服务器列表
void getAllOPCServer(string note)
{
try
{
OPCAutomation.OPCServerClass GlobalOPCServer = new OPCAutomation.OPCServerClass();
object ServerList = GlobalOPCServer.GetOPCServers(note);
//这个转换System.String
- 方法害得我找了好久好久好久···
string - [] sa = (string[])ArrayList.Adapter((Array)ServerList).ToArray(typeof(string));
for (int i = 0; i < sa.Length; i++)
{
//comboBox1是一个列表控件
comboBox1.Items.Add(sa[i]);
}
}
catch (Exception Ex)
{
MessageBox.Show("List OPC servers failed: " + Ex.Message, "OPCSample", MessageBoxButtons.OK);
}
}