OPC-DA Handler

User avatar
Marco Grawunder
Posts: 272
Joined: Tue Jul 29, 2014 10:29 am
Location: Oldenburg, Germany
Contact:

Re: OPC-DA Handler

Post by Marco Grawunder » Fri Aug 22, 2014 1:23 pm

Found and fixed the error. Takes some time to build the fresh update site. EDIT: Site is built

Martin Schmid
Posts: 34
Joined: Fri Aug 15, 2014 5:22 pm

Re: OPC-DA Handler

Post by Martin Schmid » Tue Aug 26, 2014 10:39 am

So far so good.

This script runs now:

Code: Select all

#PARSER PQL
#ADDQUERY
output2 := OPCDASOURCE({
                progid = 'National Instruments.Variable Engine.1',
                paths = ["\\.\PVR-WRS-1\'I_DC_1.1'",
                             "\\.\PVR-WRS-1\'I_DC_2.1'"],
                clsid = '7EFA5AA7-3A85-4693-8561-4AC60CA09909',
                host = 'x',
                source = 'OPC:Demo2',
                username = 'administrator',
                password = 'x',
                domain = 'none',
                schema=[
	                ['I_DC_1.1', 'OPCValue'],
	                ['I_DC_2.1', 'OPCValue']
                ]                             
              }                       
            )
However, I'm having trouble resolving 'OPC-Value'. I'm getting returned values that looks like this:

I_DC_1.1:

de.uniol.inf.is.odysseus.wrapper.opcdata.datatype.OPCValue@10ec0731
de.uniol.inf.is.odysseus.wrapper.opcdata.datatype.OPCValue@563d2761
de.uniol.inf.is.odysseus.wrapper.opcdata.datatype.OPCValue@11baee12

I'm assuming that these values, e.g. 10ec0731 hold the actual values for timestamp, value, quality and error.

I transformed the hex-values into binary and tried to resolve them with what information I have about OPC-Quality Flags but it is unclear to me how the actual information is stored.

"Ideally" Odysseus would return three separate Values to us:

- The actual Float Value
- The Timestamp
- The OPC Quality Flags (8 bit value)

This should be implemented for each Tag.

Any help will be appreciated.

edit: On another note, is the Rename Operator now functionally integrated into the OPCDASOURCEOperator?
Last edited by Martin Schmid on Mon Sep 29, 2014 11:50 am, edited 1 time in total.

User avatar
ckuka
Posts: 35
Joined: Tue Jul 29, 2014 10:55 am
Location: Shanghai, P.R. China/中国上海
Contact:

Re: OPC-DA Handler

Post by ckuka » Tue Aug 26, 2014 11:51 am

Finally :D

Ok, now to the other problem, these strings:
de.uniol.inf.is.odysseus.wrapper.opcdata.datatype.OPCValue@10ec0731
..
and so on, are Java objects. Right now an OPC value is encapsulated into a Java object to hold all 4 values into a single attribute value.

To access the quality/error/timestamp and so on there are the MEP functions quality(OPCValue), error(OPCValue), timestamp(OPCValue), and value(OPCValue) that can be used in a MAP [1] operation or SELECT [2] operation,i.e.:

output = MAP({
expressions = [
['quality(I_DC_1.1)','quality'],
['error(I_DC_1.1)','error']
]
}, input)

[1] http://odysseus.offis.uni-oldenburg.de: ... p+operator
[2] http://odysseus.offis.uni-oldenburg.de: ... t+operator
kind regards / 祝好
Christian Kuka

Martin Schmid
Posts: 34
Joined: Fri Aug 15, 2014 5:22 pm

Re: OPC-DA Handler

Post by Martin Schmid » Tue Aug 26, 2014 4:36 pm

Hey,
just posting some feedback here because I will be gone for the next three weeks (and thus unable to work on Odysseus):

Everything is looking very well. There might be some minor modifications (e.g. the quality returns a decimal value whereas binary would be preferred) but all major issues seem to be resolved.

Thank you,

MS.

User avatar
ckuka
Posts: 35
Joined: Tue Jul 29, 2014 10:55 am
Location: Shanghai, P.R. China/中国上海
Contact:

Re: OPC-DA Handler

Post by ckuka » Wed Aug 27, 2014 2:17 am

That sounds good.

For the representation of the data there are two functions now: toHex() and toBinary(). Both functions can be used with strings, floating point numbers and integers.

Enjoy your holidays.
kind regards / 祝好
Christian Kuka

Martin Schmid
Posts: 34
Joined: Fri Aug 15, 2014 5:22 pm

Re: OPC-DA Handler

Post by Martin Schmid » Mon Sep 01, 2014 2:16 pm

Hello,


There seems to be a new bug in the OPC-DA Handler.

After updating Odysseus, the OPC-DA Handler has stopped working.


Here's the stack trace/console output:

Code: Select all

25942 DEBUG StandardQueryOptimizer  - Start rewriting of query... - de.uniol.inf.is.odysseus.planmanagement.optimization.query.standardqueryoptimizer.StandardQueryOptimizer.optimizeQuery(StandardQueryOptimizer.java:134) 
25947 DEBUG StandardQueryOptimizer  - Rewriting of query done. - de.uniol.inf.is.odysseus.planmanagement.optimization.query.standardqueryoptimizer.StandardQueryOptimizer.optimizeQuery(StandardQueryOptimizer.java:138) 
25947 DEBUG StandardQueryOptimizer  - Starting transformation for the logical query... - de.uniol.inf.is.odysseus.planmanagement.optimization.query.standardqueryoptimizer.StandardQueryOptimizer.optimizeQuery(StandardQueryOptimizer.java:157) 
25963 DEBUG StandardQueryOptimizer  - Transformation into a physical query done. - de.uniol.inf.is.odysseus.planmanagement.optimization.query.standardqueryoptimizer.StandardQueryOptimizer.optimizeQuery(StandardQueryOptimizer.java:161) 
25967 DEBUG ReceiverPO  - Process_open - de.uniol.inf.is.odysseus.core.server.physicaloperator.access.push.ReceiverPO.process_open(ReceiverPO.java:72) 
25977 DEBUG AutoReconnectController  - Connection state changed: false - org.openscada.opc.lib.da.AutoReconnectController.connectionStateChanged(AutoReconnectController.java:133) 
25977 DEBUG AutoReconnectController  - Requesting connection - org.openscada.opc.lib.da.AutoReconnectController.connect(AutoReconnectController.java:107) 
25977 DEBUG AutoReconnectController  - Trigger reconnect - org.openscada.opc.lib.da.AutoReconnectController.triggerReconnect(AutoReconnectController.java:164) 
25985 DEBUG AutoReconnectController  - Connecting to server - org.openscada.opc.lib.da.AutoReconnectController.performReconnect(AutoReconnectController.java:213) 
25990 INFO  Server  - Socket timeout: 0  - org.openscada.opc.lib.da.Server.connect(Server.java:109) 
26013 INFO  JIComOxidRuntime  - Running ClientPingTimerTask ! - org.jinterop.dcom.core.JIComOxidRuntime$ClientPingTimerTask.run(?:?) 
26015 INFO  JISession  - Created Session: 419492366 - org.jinterop.dcom.core.JISession.createSession(?:?) 
26020 DEBUG JIComTransport  - Opening socket on /10.1.183.3:135 - org.jinterop.dcom.transport.JIComTransport.attach(?:?) 
26021 INFO  JIComOxidRuntime  - Running ServerPingTimerTask ! - org.jinterop.dcom.core.JIComOxidRuntime$ServerPingTimerTask.run(?:?) 
26015 INFO  JISession  - Release_References_TimerTask:[RUN] Session:  419492366 , listOfDeferencedIpids.size(): 0 - org.jinterop.dcom.core.JISession$Release_References_TimerTask.run(?:?) 
26543 DEBUG JIComTransport  - Socket closed... Socket[unconnected] host 10.1.183.3, port 135 - org.jinterop.dcom.transport.JIComTransport.close(?:?) 
26546 INFO  JIComOxidRuntime  - addUpdateOXIDs: finally this oid is { IPID ref count is 1 } and OID in bytes[] 00000: EF E7 A2 AE 8D 7A 1D FB                          |ï碮.z.û        |

 , hasExpired false }  - org.jinterop.dcom.core.JIComOxidRuntime.addUpdateOXIDs(?:?) 
26547 INFO  JISession  - [addToSession] Adding IPID: 00002409-06d0-0000-8314-c40573b3e16c to session: 419492366 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
26547 INFO  JISession  - for IID: 00000000-0000-0000-c000-000000000046 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
26548 INFO  JIComObjectImpl  - addRef: Adding 5 references for 00002409-06d0-0000-8314-c40573b3e16c session: 419492366 - org.jinterop.dcom.core.JIComObjectImpl.addRef(?:?) 
26548 DEBUG JIComTransport  - Opening socket on /10.1.183.3:1496 - org.jinterop.dcom.transport.JIComTransport.attach(?:?) 
26883 INFO  JIComOxidRuntime  - addUpdateOXIDs: finally this oid is { IPID ref count is 2 } and OID in bytes[] 00000: EF E7 A2 AE 8D 7A 1D FB                          |ï碮.z.û        |

 , hasExpired false }  - org.jinterop.dcom.core.JIComOxidRuntime.addUpdateOXIDs(?:?) 
26884 INFO  JISession  - [addToSession] Adding IPID: 0000c402-06d0-0000-954d-6887cbcec004 to session: 419492366 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
26884 INFO  JISession  - for IID: 39c13a4d-011e-11d0-9675-0020afd8adb3 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
26885 INFO  JIComObjectImpl  - addRef: Adding 5 references for 0000c402-06d0-0000-954d-6887cbcec004 session: 419492366 - org.jinterop.dcom.core.JIComObjectImpl.addRef(?:?) 
26912 INFO  JIComOxidRuntime  - addUpdateOXIDs: finally this oid is { IPID ref count is 3 } and OID in bytes[] 00000: EF E7 A2 AE 8D 7A 1D FB                          |ï碮.z.û        |

 , hasExpired false }  - org.jinterop.dcom.core.JIComOxidRuntime.addUpdateOXIDs(?:?) 
26913 INFO  JISession  - [addToSession] Adding IPID: 00001006-06d0-0000-90f4-f78362ac556d to session: 419492366 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
26914 INFO  JISession  - for IID: f31dfde2-07b6-11d2-b2d8-0060083ba1fb - org.jinterop.dcom.core.JISession.addToSession(?:?) 
26914 INFO  JIComObjectImpl  - addRef: Adding 5 references for 00001006-06d0-0000-90f4-f78362ac556d session: 419492366 - org.jinterop.dcom.core.JIComObjectImpl.addRef(?:?) 
26929 DEBUG AutoReconnectController  - Connection state changed: true - org.openscada.opc.lib.da.AutoReconnectController.connectionStateChanged(AutoReconnectController.java:133) 
26929 DEBUG AccessBase  - Create a new group - org.openscada.opc.lib.da.AccessBase.start(AccessBase.java:210) 
26930 DEBUG JIComTransport  - Opening socket on /10.1.183.3:1496 - org.jinterop.dcom.transport.JIComTransport.attach(?:?) 
27179 INFO  JIComOxidRuntime  - addUpdateOXIDs: Adding OID to holder SetID[null] , currentSetOIDs[{{ IPID ref count is 3 } and OID in bytes[] 00000: EF E7 A2 AE 8D 7A 1D FB                          |ï碮.z.û        |

 , hasExpired false } ={ IPID ref count is 3 } and OID in bytes[] 00000: EF E7 A2 AE 8D 7A 1D FB                          |ï碮.z.û        |

 , hasExpired false } }], current size of currentSetOIDs is 1 - org.jinterop.dcom.core.JIComOxidRuntime.addUpdateOXIDs(?:?) 
27180 INFO  JIComOxidRuntime  - addUpdateOXIDs: finally this oid is { IPID ref count is 1 } and OID in bytes[] 00000: D9 C4 71 ED 19 52 0E 11                          |ÙÄqí.R..        |

 , hasExpired false }  - org.jinterop.dcom.core.JIComOxidRuntime.addUpdateOXIDs(?:?) 
27180 INFO  JISession  - [addToSession] Adding IPID: 00007805-06d0-0000-9cb8-36daba52e7e6 to session: 419492366 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
27181 INFO  JISession  - for IID: 39c13a50-011e-11d0-9675-0020afd8adb3 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
27181 INFO  JIComObjectImpl  - addRef: Adding 5 references for 00007805-06d0-0000-9cb8-36daba52e7e6 session: 419492366 - org.jinterop.dcom.core.JIComObjectImpl.addRef(?:?) 
27242 INFO  JIComOxidRuntime  - addUpdateOXIDs: finally this oid is { IPID ref count is 2 } and OID in bytes[] 00000: D9 C4 71 ED 19 52 0E 11                          |ÙÄqí.R..        |

 , hasExpired false }  - org.jinterop.dcom.core.JIComOxidRuntime.addUpdateOXIDs(?:?) 
27242 INFO  JISession  - [addToSession] Adding IPID: 00007805-06d0-0000-9cb8-36daba52e7e6 to session: 419492366 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
27242 INFO  JISession  - for IID: 39c13a50-011e-11d0-9675-0020afd8adb3 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
27242 INFO  JIComObjectImpl  - addRef: Adding 5 references for 00007805-06d0-0000-9cb8-36daba52e7e6 session: 419492366 - org.jinterop.dcom.core.JIComObjectImpl.addRef(?:?) 
27327 DEBUG Group  - Creating new group instance with COM group org.openscada.opc.dcom.da.impl.OPCGroupStateMgt@5dea9 - org.openscada.opc.lib.da.Group.<init>(Group.java:74) 
27341 INFO  JIComOxidRuntime  - addUpdateOXIDs: finally this oid is { IPID ref count is 3 } and OID in bytes[] 00000: D9 C4 71 ED 19 52 0E 11                          |ÙÄqí.R..        |

 , hasExpired false }  - org.jinterop.dcom.core.JIComOxidRuntime.addUpdateOXIDs(?:?) 
27341 INFO  JISession  - [addToSession] Adding IPID: 00002c03-06d0-0000-8267-51e0520237a2 to session: 419492366 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
27341 INFO  JISession  - for IID: 39c13a54-011e-11d0-9675-0020afd8adb3 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
27341 INFO  JIComObjectImpl  - addRef: Adding 5 references for 00002c03-06d0-0000-8267-51e0520237a2 session: 419492366 - org.jinterop.dcom.core.JIComObjectImpl.addRef(?:?) 
27415 INFO  JIComOxidRuntime  - addUpdateOXIDs: finally this oid is { IPID ref count is 4 } and OID in bytes[] 00000: D9 C4 71 ED 19 52 0E 11                          |ÙÄqí.R..        |

 , hasExpired false }  - org.jinterop.dcom.core.JIComOxidRuntime.addUpdateOXIDs(?:?) 
27417 INFO  JISession  - [addToSession] Adding IPID: 00006808-06d0-0000-a712-3da323c52891 to session: 419492366 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
27417 INFO  JISession  - for IID: 39c13a52-011e-11d0-9675-0020afd8adb3 - org.jinterop.dcom.core.JISession.addToSession(?:?) 
27417 INFO  JIComObjectImpl  - addRef: Adding 5 references for 00006808-06d0-0000-a712-3da323c52891 session: 419492366 - org.jinterop.dcom.core.JIComObjectImpl.addRef(?:?) 
27443 DEBUG AccessBase  - Realizing item: \\.\PVR-WRS-1\'I_DC_1.1' - org.openscada.opc.lib.da.AccessBase.realizeItem(AccessBase.java:222) 
27497 DEBUG Item  - Adding new item '\\.\PVR-WRS-1\'I_DC_1.1'' (0x00000001) for group org.openscada.opc.lib.da.Group@106be703 - org.openscada.opc.lib.da.Item.<init>(Item.java:42) 
27508 DEBUG Group  - Adding item: '\\.\PVR-WRS-1\'I_DC_1.1'', 1 - org.openscada.opc.lib.da.Group.addItem(Group.java:245) 
27509 DEBUG AutoReconnectController  - performReconnect completed : true - org.openscada.opc.lib.da.AutoReconnectController$1.run(AutoReconnectController.java:178) 
27527 DEBUG OPCDATransportHandler  - 0: 5.858758 - de.uniol.inf.is.odysseus.wrapper.opcda.physicaloperator.access.OPCDATransportHandler.process(OPCDATransportHandler.java:230) 
27528 ERROR SyncAccess  - Sync read failed - org.openscada.opc.lib.da.SyncAccess.run(SyncAccess.java:63) 
java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Double
	at de.uniol.inf.is.odysseus.wrapper.opcda.physicaloperator.access.OPCDATransportHandler.process(OPCDATransportHandler.java:232)
	at de.uniol.inf.is.odysseus.wrapper.opcda.physicaloperator.access.OPCDATransportHandler$1.changed(OPCDATransportHandler.java:205)
	at org.openscada.opc.lib.da.AccessBase.updateItem(AccessBase.java:341)
	at org.openscada.opc.lib.da.SyncAccess.runOnce(SyncAccess.java:97)
	at org.openscada.opc.lib.da.SyncAccess.run(SyncAccess.java:54)
	at java.lang.Thread.run(Thread.java:745)
Typecasting a float Value to a double seems to cause the error, because I actually get the correct value from OPC-Server

Code: Select all

27527 DEBUG OPCDATransportHandler  - 0: 5.858758 - de.uniol.inf.is.odysseus.wrapper.opcda.physicaloperator.access.OPCDATransportHandler.process(OPCDATransportHandler.java:230) 
but then a typecast error occurs, the process terminates and is restarted.

Any help will be much appreciated.

MS

User avatar
ckuka
Posts: 35
Joined: Tue Jul 29, 2014 10:55 am
Location: Shanghai, P.R. China/中国上海
Contact:

Re: OPC-DA Handler

Post by ckuka » Mon Sep 01, 2014 2:45 pm

Partially fixed in the SVN. Should work for float and double but strings are currently not supported.
kind regards / 祝好
Christian Kuka

Martin Schmid
Posts: 34
Joined: Fri Aug 15, 2014 5:22 pm

Re: OPC-DA Handler

Post by Martin Schmid » Mon Sep 01, 2014 3:01 pm

confirming that the error has been (partially) fixed.

Much appreciated,

MS

User avatar
Marco Grawunder
Posts: 272
Joined: Tue Jul 29, 2014 10:29 am
Location: Oldenburg, Germany
Contact:

Re: OPC-DA Handler

Post by Marco Grawunder » Mon Oct 06, 2014 4:00 pm

Strings should now (tomorrow via update site) work, too. Must be defined in the schema as OPCValue<String> and value(x) should deliver this String.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest