Professional OPC
Development Tools

logos

Powerbuilder writing using the same OpcLabs.BaseLib.Collections.ElasticVector

More
05 Mar 2019 13:23 #7171 by support
Hello,

here are some suggestions for speed:

- If the use case allows it, use subscriptions instead of periodic reads.
- Always combine as many as possible OPC operations (the actual read/write/subscribe) into one call (use methods with "Multiple" in their name).
- The connection process can take some time. QuickOPC manages connections and connections automatically, so you need a bit of care here. By default, QuickOPC disconnects after cca 5 seconds if you are not using anything from the server. So, if you are subscribed to anything, or let's say you are doing a read each second, you are OK because QuickOPC won't disconnect at all. Otherwise, in order to prevent the slowdown caused by a re-connection, you'd need to increase the "hold period" parameter; or, if you are subscribe to anything, that would take care of it as well.

Best regards

Please Log in or Create an account to join the conversation.

More
04 Mar 2019 16:30 #7162 by spaxman
You can just update it in your next release. I will go ahead and just create a new instance every time. I am critical for speed on this application. We create a serialized inflator for the automobile industry and we gather critical data every sec from the machines as they build the inflators. So if you have any suggestions on things to do to interact faster with the opc server via the opclabs client I would appreciate the suggestions.


Thanks for all your quick repsonses!!

Please Log in or Create an account to join the conversation.

More
03 Mar 2019 06:05 - 03 Mar 2019 06:05 #7158 by admin
I can now confirm that there is a bug in current implementation of ElasticVector.Clear. Instead of removing all elements, it just sets all existing elements to null, without changing the size of the vector.

We can fix that into the upcoming version (QuickOPC 2019.1); the release date is not set, and it would be several months from now for sure. That would be easier for us. Or, if you really depend on it right now, we can also make a patch/new build of the current QuckOPC 2018.3. But, as I wrote, it should be just as good to create new instances of the vector as needed. Let me know.

Best regards
Last edit: 03 Mar 2019 06:05 by admin.

Please Log in or Create an account to join the conversation.

More
01 Mar 2019 18:13 #7153 by admin
Thank you for the details.

I have now tested the ElasticVector.Clear method from VBScript and it indeed is not functioning.
I will need some time to investigate; will post here when I will know more.

BTW, I would not see it as a problem to create new instances of ElasticVector as needed. The performance impact is negligible compared to the actual OPC operations.

Best regards

Please Log in or Create an account to join the conversation.

More
01 Mar 2019 17:57 #7152 by spaxman
Ok I did some more testing and captured as much as Powerbuilder lets me.

In my local function of_model_list I did this..
ll_rowcount = g_msg94_recv.msg_opclabs_handles.count()
g_msg94_recv.msg_opclabs_handles.clear()
ll_rowcount = g_msg94_recv.msg_opclabs_handles.count()
the first time I call ll_rowcount = 0 before and after the clear.

Then I load up the vector with all the data and call count again

for ll_idx = 1 to ll_upper

// 02/27/0219 shp load the opc labs stuff -- load the values and put the objects up in the msg_opclabs_handles
g_msg94_recv.sta_data.opc_item_handle3[ll_idx].value = ls_model_nbr[ll_idx]
g_msg94_recv.sta_data.opc_item_handle[ll_idx].value = ls_model_id[ll_idx]
g_msg94_recv.sta_data.opc_item_handle4[ll_idx].value = len(ls_model_nbr[ll_idx])
g_msg94_recv.sta_data.opc_item_handle2[ll_idx ].value =len(ls_model_id[ll_idx] )

g_msg94_recv.msg_opclabs_handles.add(g_msg94_recv.sta_data.opc_item_handle3[ll_idx])
g_msg94_recv.msg_opclabs_handles.add(g_msg94_recv.sta_data.opc_item_handle[ll_idx])
g_msg94_recv.msg_opclabs_handles.add(g_msg94_recv.sta_data.opc_item_handle4[ll_idx])
g_msg94_recv.msg_opclabs_handles.add(g_msg94_recv.sta_data.opc_item_handle2[ll_idx])

check count
ll_rowcount = g_msg94_recv.msg_opclabs_handles.count()
ll_rowcount is now at 96 which is correct I want to write out 96 items

Call function that does the write
operationResultList = g_opclabs.WriteItemValueList(g_msg94_recv.msg_opclabs_handles)
works perfectly no issues.

Call my of_model_list function again
ll_rowcount = g_msg94_recv.msg_opclabs_handles.count()
g_msg94_recv.msg_opclabs_handles.clear()
ll_rowcount = g_msg94_recv.msg_opclabs_handles.count()

ll_rowcount = 96 before calling clear
call clear
ll_rowcount = 96 after calling clear .. It did not remove anything.

I then load the data gain which just adds onto the existing 96
and now i have 192 items after the call to count again but when I call
operationResultList = g_opclabs.WriteItemValueList(g_msg94_recv.msg_opclabs_handles)

it blows up... Here is everything powerbuilder allows me to capture
getmessage = Error calling external object function writeitemvaluelist at line 110 in function wf_opc_write of object w_plc_2_db.
text = Error calling external object function writeitemvaluelist at line 110 in function wf_opc_write of object w_plc_2_db.
description = Null element in argumentsArray.
helpfile = Null element in argumentsArray.
helpcontext = 0
number = 35

As far as I can tell the Clear method is not clearing the vector but is does something to the vector cause on my next call to write the data it blows up..

Please Log in or Create an account to join the conversation.

More
01 Mar 2019 05:50 #7149 by admin
Hello,
no, this is no related to the trial license.

In order to be able to help, I need
- the error you are getting
- the code

Best regards

Please Log in or Create an account to join the conversation.

More
28 Feb 2019 22:29 #7148 by spaxman
I am trying to use the same vector over and over and load different DAItemValueArguments into the vector to call the WriteItemValueList I am doing this because each time I hit the database I can have different data to send back to the plc. I can also have different amounts of DAItemValueArguments to send back.

Everything works great the first write. I then tried to call the clear() method on the vector to empty it out and load for the next time. This does not seem to work.
What should I do to send data back. I was trying for speed purposes not recreate everything every time.

FYI I am Still on the demo code. Is this why I can only do One write?

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.195 seconds

      

 Recommend this on Google