我正在使用以下代码建立从UTGARD到Kepware V6 OPC DA的连接。
package com.flutura.openscada.tutorial;
import java.util.concurrent.Executors;
import java.util.logging.Logger;
import org.jinterop.dcom.common.JIException;
import org.openscada.opc.lib.common.ConnectionInformation;
import org.openscada.opc.lib.da.AccessBase;
import org.openscada.opc.lib.da.DataCallback;
import org.openscada.opc.lib.da.Item;
import org.openscada.opc.lib.da.ItemState;
import org.openscada.opc.lib.da.Server;
import org.openscada.opc.lib.da.SyncAccess;
public class UtgardTutorial1 {
public static void main(String[] args) throws Exception {
// create connection information
final ConnectionInformation ci = new ConnectionInformation();
ci.setHost("localhost");
ci.setDomain("");
ci.setUser("");
ci.setPassword("");
ci.setProgId("Kepware.KEPServerEX.V6\\Simulation Examples.Functions.Ramp1");
//ci.setProgId("SWToolbox.TOPServer.V5");
ci.setClsid("7BC0CC8E-482C-47CA-ABDC-0FE7F9C6E729"); // if ProgId is not working, try it using the Clsid instead
final String itemId = "_System._Time_Second";
// create a new server
System.out.println("Server1");
final Server server = new Server(ci, Executors.newSingleThreadScheduledExecutor());
System.out.println("Server1 =>" + server);
try {
server.connect();
final AccessBase access = new SyncAccess(server, 500);
access.addItem(itemId, new DataCallback() {
@Override
public void changed(Item item, ItemState state) {
System.out.println("Data change " + item + " : " + state);
}
});
access.bind();
Thread.sleep(10 * 1000);
access.unbind();
} catch (final JIException e) {
System.out.println("Errorrrrrrrr : " + String.format("%08X: %s", e.getErrorCode(), server.getErrorMessage(e.getErrorCode())));
} catch (Exception ex) {
System.out.println("Errorrrrrrrr : " + ex.getMessage());
}
}
}
我想从kepServer获取IOT网关中所有参数的数据,
但是要测试它,我只提到了一个参数名称=> Simulation Examples.Functions.Ramp1
我正在得到这样的输出
Server1
Server1 =>org.openscada.opc.lib.da.Server@724af044
Sep 18, 2018 12:51:22 PM rpc.DefaultConnection processOutgoing
INFO:
Sending BIND
Sep 18, 2018 12:51:22 PM rpc.DefaultConnection processIncoming
INFO:
Recieved BIND_ACK
Sep 18, 2018 12:51:22 PM rpc.DefaultConnection processOutgoing
INFO:
Sending AUTH3
Sep 18, 2018 12:51:23 PM rpc.DefaultConnection processOutgoing
INFO:
Sending ALTER_CTX
Sep 18, 2018 12:51:23 PM rpc.DefaultConnection processIncoming
INFO:
Recieved ALTER_CTX_RESP
Sep 18, 2018 12:51:23 PM rpc.DefaultConnection processOutgoing
Errorrrrrrrr : 00000005: Unknown error (00000005)
INFO:
Sending REQUEST
Sep 18, 2018 12:51:23 PM rpc.DefaultConnection processIncoming
INFO:
Recieved FAULT
我是UTGARD代码的新手。我无法理解代码中的错误以及为什么出现此错误:
00000005:未知错误(00000005)