Professional OPC
Development Tools

logos

Can Develop OPC XML DA C++ client in Visual Studio 2015?

More
18 Nov 2016 12:23 #4580 by Vasanth
Hi,

Thanks for the update.

I have a query regarding subscription based one.

What I am doing is sending group of events for subscription using below code, As mentioned in ExamplesCOM. And waiting for item changed events, Here I am getting single item changed event at a time, I suppose to get event for all group of items I subscribed, but I am not.

I get single item and convert into JSON and upload to cloud, it leaks to much memory for each item if I do. Therefore, I am looking for a way, where I can get group of items get changed at a time where I subscribed group of items only.

Please do let me know your inputs.


for (int i = 0; i < noOftags; i++)
{
_EasyDAItemSubscriptionArgumentsPtr ItemSubscriptionArgumentsPtr(_uuidof(EasyDAItemSubscriptionArguments));
ItemSubscriptionArgumentsPtr->ServerDescriptor->UrlString = urlString.m_str;
ItemSubscriptionArgumentsPtr->ItemDescriptor->ItemId = itemIds.m_str;
ItemSubscriptionArgumentsPtr->GroupParameters->RequestedUpdateRate = 1;
arguments.SetAt(i, _variant_t((IDispatch*)ItemSubscriptionArgumentsPtr));
}

LPSAFEARRAY pArguments = arguments.Detach();
CComSafeArray<VARIANT> handles(ClientPtr->SubscribeMultipleItems(&pArguments));
arguments.Attach(pArguments);

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

More
17 Nov 2016 10:04 #4577 by support
As to the memory consumption, I do not consider it an issue. It's just the way it is.

For the CPU consumption, I will need a reproducible scenario in order to be able to help further. It should be noted, however, that OPC XML-DA is not designed for high performance, and produces large messages and lots of communication even for relatively small item/event counts. It is therefore possible that the message processing for 130 changes/second is that much demanding as well.

Regards
The following user(s) said Thank You: Vasanth

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

More
17 Nov 2016 09:25 #4574 by Vasanth
Okay, I have done same thing for connection status, Sending first 2 tags to check connection status than I am starting actual tags execution, In that case am I doing right I guess.

The CPU and Memory usages are more in QuickOPC Libraries, Please help me to solve this CPU n Memory issues or any lead which will help me.

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

More
16 Nov 2016 12:53 #4572 by support
Ad 1. This is described in the documentation. You cannot check, but when subscribed, you get notification message using the same event - you just need to check for .Exception in the incoming results.

Ad 2. It is possible.
The following user(s) said Thank You: Vasanth

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

More
16 Nov 2016 12:39 #4570 by Vasanth
Hi,

1. How do I check server status? whether its running, disconnected and etc? Is there any QuickOPC API for this, as per as I searched I could not find one.

2. My application taking around 50MB of RAM consistently, In that around 17MB is my application(private working set) and 42MB is shared working set. In that case quickOPc assemblies are taking 42MB?

PLease clarify above questions.

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

More
16 Nov 2016 10:47 - 16 Nov 2016 10:48 #4569 by Vasanth
There are 130+ events. I have put sleep for 1 min so that event is having 1 min time to deliver.
Last edit: 16 Nov 2016 10:48 by Vasanth. Reason: missed a point

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

More
16 Nov 2016 10:08 #4568 by support
If you are using the Win32 Sleep function, and not something else, then it is simply not possible that such loop on itself would consume much CPU ( msdn.microsoft.com/en-us/en-en/library/windows/desktop/ms686298(v=vs.85).aspx ).

And, I do not understand how you could have tested by removing the loop, because without the loop, the program won't have time to deliver events. So, for example, if the high CPU consumption comes from processing the events, then of course removing the loop would "solve" the problem, but that would not be because the loop itself has consumed the CPU, but because other parts of the program did not run,

There are tools to check the CPU consumption per thread, SysInternals tools, profilers, etc. You need to figure out the true place where the CPU is consumed.

BTW, how many events per second are you receiving? Many?
The following user(s) said Thank You: Vasanth

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

More
16 Nov 2016 09:21 #4567 by Vasanth
I just checked by commenting this loop for sometime, is there any-other way to wait continuously without this loop?

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

More
16 Nov 2016 08:53 #4566 by support
Unless the Sleep is implemented in some insane way, I can't believe that this loop is taking much CPU. How do you know the CPU consumption comes from here?

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

More
16 Nov 2016 08:46 #4565 by Vasanth
Inside I put Sleep(60000);

while (1) {
Sleep(60000);
}

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

Moderators: support
Time to create page: 0.242 seconds

      

 Recommend this on Google