Utgard. Unable to write the value of the tag on the OPC Server Codesys.

444 views
Skip to first unread message

Alexander Kuleshov

unread,
Feb 6, 2015, 9:30:16 AM2/6/15
to open...@googlegroups.com
Having difficulty write the tag on the OPC Server Codesys, although with other servers (Matrikon, Kepware) do not have such problems.
I chose specifically code fragment taken from your example (https://openscada.atlassian.net/wiki/display/OP/HowToStartWithUtgard):

public class Main 
{
 
    public static void main(String[] args) throws Exception 
    {
 
        final ConnectionInformation ci = new ConnectionInformation();
 
        ci.setHost("myhost");
        ci.setDomain("OPCHOST");
        ci.setUser("user");
        ci.setPassword("password");
        //ci.setProgId("SWToolbox.TOPServer.V5");
        ci.setClsid("7904C302-AC19-11d4-9E1E-00105A4AB1C6"); // if ProgId is not working, try it using the Clsid instead
        final String itemId = "PLC1:.arm_GKS_HA_03";
        // create a new server
        final Server server = new Server(ci, Executors.newSingleThreadScheduledExecutor());
        try 
        {
            // connect to server
            server.connect();
            // add sync access, poll every 500 ms
            final AccessBase access = new SyncAccess(server, 5000);
            access.addItem(itemId, new DataCallback() 
            {

                public void changed(Item item, ItemState state) 
                {
                try
{
System.out.println("Changed tag: ["+state+"\t, "+state.getValue().getObject());
} catch (JIException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
                }

            });
 
            // Add a new group
            final Group group = server.addGroup("test");
            // Add a new item to the group
            final Item item = group.addItem(itemId);
 
            // start reading
            access.bind();
 
            // add a thread for writing a value every 3 seconds
            ScheduledExecutorService writeThread = Executors.newSingleThreadScheduledExecutor();
            //final AtomicInteger i = new AtomicInteger(0);
            writeThread.scheduleWithFixedDelay(new Runnable() 
            {
                public void run() {
                    //final JIVariant value = new JIVariant(i.incrementAndGet());
                final JIVariant value = new JIVariant(new Random().nextBoolean());
                    try 
                    {
                        System.out.println("Write value: "+value.getObject());
                        item.write(value);
                    } catch (JIException e) {
                        e.printStackTrace();
                    }
                }
            }, 5, 3, TimeUnit.SECONDS);
 
            // wait a little bit
            Thread.sleep(20 * 1000);
            writeThread.shutdownNow();
            // stop reading
            access.unbind();
        } catch (final JIException e) {
            System.out.println(String.format("%08X: %s", e.getErrorCode(), server.getErrorMessage(e.getErrorCode())));
        }
    }
}


As a result, I get an unspecified error:

18:26:59.507 [main] DEBUG org.openscada.opc.lib.da.AccessBase - Realizing item: PLC1:.arm_GKS_HA_03
фев 06, 2015 6:26:59 PM rpc.DefaultConnection processOutgoing
INFO: 
 Sending REQUEST
фев 06, 2015 6:26:59 PM rpc.DefaultConnection processIncoming
INFO: 
 Recieved RESPONSE
18:26:59.507 [main] DEBUG org.openscada.opc.lib.da.Item - Adding new item 'PLC1:.arm_GKS_HA_03' (0x00000001) for group org.openscada.opc.lib.da.Group@10e5ab41
18:26:59.507 [main] DEBUG org.openscada.opc.lib.da.Group - Adding item: 'PLC1:.arm_GKS_HA_03', 1
фев 06, 2015 6:26:59 PM rpc.DefaultConnection processOutgoing
INFO: 
 Sending ALTER_CTX
фев 06, 2015 6:26:59 PM rpc.DefaultConnection processIncoming
INFO: 
 Recieved ALTER_CTX_RESP
фев 06, 2015 6:26:59 PM rpc.DefaultConnection processOutgoing
INFO: 
 Sending REQUEST
фев 06, 2015 6:26:59 PM rpc.DefaultConnection processIncoming
INFO: 
 Recieved RESPONSE
Changed tag: [Value: [[false]], Timestamp: Пт фев 06 17:53:33 MSK 2015, Quality: 8, ErrorCode: 00000000 , false
Write value: false
фев 06, 2015 6:27:04 PM rpc.DefaultConnection processOutgoing
INFO: 
 Sending REQUEST
фев 06, 2015 6:27:04 PM rpc.DefaultConnection processIncoming
INFO: 
 Recieved RESPONSE
org.jinterop.dcom.common.JIException: Unspecified Error. [0x80004005]
at org.jinterop.dcom.core.JIComServer.call(Unknown Source)
at org.jinterop.dcom.core.JIComServer.call(Unknown Source)
at org.jinterop.dcom.core.JIComObjectImpl.call(Unknown Source)
at org.jinterop.dcom.core.JIComObjectImpl.call(Unknown Source)
at org.openscada.opc.dcom.common.impl.Helper.callRespectSFALSE(Helper.java:41)
at org.openscada.opc.dcom.da.impl.OPCSyncIO.write(OPCSyncIO.java:102)
at org.openscada.opc.lib.da.Group.write(Group.java:352)
at org.openscada.opc.lib.da.Item.write(Item.java:81)
at ru.intetech.opcwriter.Main$2.run(Main.java:79)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.jinterop.dcom.common.JIRuntimeException: Unspecified Error. [0x80004005]
at org.jinterop.dcom.core.JICallBuilder.readResult(Unknown Source)
at org.jinterop.dcom.core.JICallBuilder.read(Unknown Source)
at ndr.NdrObject.decode(Unknown Source)
at rpc.ConnectionOrientedEndpoint.call(Unknown Source)
at rpc.Stub.call(Unknown Source)
... 16 more
фев 06, 2015 6:27:04 PM rpc.DefaultConnection processOutgoing
INFO: 
 Sending REQUEST
фев 06, 2015 6:27:04 PM rpc.DefaultConnection processIncoming
INFO: 
 Recieved RESPONSE
Changed tag: [Value: [[false]], Timestamp: Пт фев 06 17:53:33 MSK 2015, Quality: 8, ErrorCode: 00000000 , false

Jens Reimann

unread,
Feb 6, 2015, 11:04:26 AM2/6/15
to open...@googlegroups.com
The result comes from your OPC server.

So the question is, why does it return with 0x8004005?

--
You received this message because you are subscribed to the Google Groups "openSCADA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openscada+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexander Kuleshov

unread,
Feb 6, 2015, 11:21:40 AM2/6/15
to open...@googlegroups.com
Do you have any idea why I dont get this error when I use the Matrikon-Client for write the value of the tag?

пятница, 6 февраля 2015 г., 19:04:26 UTC+3 пользователь Jens Reimann написал:

Jens Reimann

unread,
Feb 6, 2015, 11:24:09 AM2/6/15
to open...@googlegroups.com

Sorry, no.

A. Corral

unread,
May 4, 2015, 1:51:15 PM5/4/15
to open...@googlegroups.com
Capturing ethernet traffic in both cases and comparing it could be usefull.
On the other hand it could be an error in codesys implementation, may be enabling logging in codesys could help also.
Reply all
Reply to author
Forward
0 new messages