Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
Read items from OPC DA server takes extremly long
I am glad to hear this. I agree that turning off the firewall is not the way to go for production purposes, but doing it temporarily is a perfectly sensible test.
DCOM uses port 135 statically, but in addition to that, it then negotiates a range of additional ports that are also necessary. See e.g.
- learn.microsoft.com/en-us/troubleshoot/windows-server/networ...port-allocation-with-firewalls .(DCOM is based on RPC)
- support.microsoft.com/en-us/topic/how-to-configure-rpc-to-us...98-063a-479a-8452-9cf07ac613d9
- learn.microsoft.com/en-us/answers/questions/1178830/windows-...-rpc-dynamic-range-not-working
Best regards
Please Log in or Create an account to join the conversation.
After long experiments I deactivated my firewall completely (although there were defined rules for port 135 and OpCEnum in both directions).
Result: Yes now I can subscribe to the remote OPC DA server items, without problem . The response is now definitly shorter then read item: just 1-2 seconds.
For validating, I turned off the firewall again, and the subscribing failed again.
Now I try to find out what specific firewall rule I have to define, because deactivating firewall comletely, will not be accepted in our company. It is strange that with the activated firewall the OPC DA test client could subscribe to items without any problem. I couldn't see any appl. specific rule for that. I don't know if the test client can define rules programmatically over registers.
Thank you again for your great support.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Do I understand it well that the reading was fast? So your problem can be resolved by using the synchronous reads?
Regards
Please Log in or Create an account to join the conversation.
With the sample code you send, Icould also read item from the remote machine. There was no problem.
Please Log in or Create an account to join the conversation.
Sorry, I do not have clear explanation or answers to your questions, but what you have observed leads me to another possible cause. What happens there is that in OPC DA, not only is the client calling the server, but also the server may call the client - such callbacks are used 1) for delivering results of asynchronous reads and writes, and 2) for delivering subscription value updates. The "backwards" channel has its own security permission settings (problems...) etc. The fact the subscription did not work remotely tells us that there might be something wrong with the callbacks. And, the *default* method used for Reads and Writes is asynchronous, which means that it needs the callbacks as well. So, a problem with callbacks can explain both.
It is possible to switch to synchronous reads/writes. See opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...an%20item%20synchronously.html
Can you try it out?
Best regards
Please Log in or Create an account to join the conversation.
I have made following tests, acoording your suggestion: (All running on the same machine, .Net Framework 4.7.2, OPC Labs V5.71)
1)*********************************
First I have tried to read item with following simplified code from the remote CNC machine: (Result: item can be read after 40 seconds.
public void read_item()
{
ComManagement.Instance.Configuration.InstantiationParameters.OverrideDefaultSecurity = false;
ComManagement.Instance.Configuration.SecurityParameters.UseCustomSecurity = true;
ComManagement.Instance.Configuration.SecurityParameters.TurnOffCallSecurity = true;
Console.WriteLine(EasyDAClient.SharedInstance.ReadItemValue(
"10.92.120.174", "OPC.IwSCP.1", "!BSTR,IndraMotion_MTX_P70,System.HardwareDescription").ToString());
Console.ReadLine();
}
2)*********************************
Then I have tried to subscribe to the same item (again remote CNC machine) Result: There is no error but I don't get any value, after waiting for few minutes.
public void subscribe_items_CNC()
{
ComManagement.Instance.Configuration.InstantiationParameters.OverrideDefaultSecurity = false;
ComManagement.Instance.Configuration.SecurityParameters.UseCustomSecurity = true;
ComManagement.Instance.Configuration.SecurityParameters.TurnOffCallSecurity = true;
EasyDAClient.SharedInstance.SubscribeItem(
"10.92.120.174", "OPC.IwSCP.1", "!BSTR,IndraMotion_MTX_P70,System.HardwareDescription", 1000,
(_, args) => Console.WriteLine(args.Vtq.Value));
Console.ReadLine();
}
3)*********************************
On the same PC where my code is running, I have installed a OPC DA server for simulation (Matrikon) and tried to subscribe to a test item.
This worked absolutely fine. It cathces every change of the item immediatly. But one remark!!!;
When I used the security parameters like above I got the situation like 2) (no error, but also no data, just waiting)
When I used no security patameters or just the first, or the first two of the parameters, I could subscribe,
Here TurnOffCallSecurity = true was preventing to subscribe.
public void subscribe_items_simulation()
{
EasyDAClient.SharedInstance.SubscribeItem(
"localhost", "Matrikon.OPC.Simulation.1", "group_1.item_1", 1000,
(_, args) => Console.WriteLine(args.Vtq.Value));
Console.ReadLine();
}
**************************************************
Result:
Is it possible that "read item" and "subscribe item" do not work with same security parameters for reading from my remote CNC machine?
Or did the TurnOffCallSecurity = true caused a problem, just because I was subscribing to an item of the local machine (Simulation OPC DA server)?
Please Log in or Create an account to join the conversation.
The server should send an initial update right away, even for values that are hot changing. This is weird. I suppose "10.92.120.174" is not your (client) machine, but some remote one, is that true? If so, have you tried the same locally (with the client and the server on the same computer)?
Is there a way I can get hold of (demo version of) the OPC server in question and try it out?
Best regards
Please Log in or Create an account to join the conversation.
I have tried instead of reading multiple item, as you suggested subscribing multiple items with following code: I have taken the same items that I could read delayed with "read multiple items". Although I am waiting for 60 seconds I get no value (The event is not triggered) and the console exits without any value. The items that I try to read are non changing items (Version infos). Could that be the reason? Or should I be able to read them at least for the first time, although their values are not changing?
public static void subscribe_items()
{
// Instantiate the client object.
using (var client = new EasyDAClient())
{
client.ItemChanged += client_Main1_ItemChanged;
Console.WriteLine("Subscribing item changes...");
client.SubscribeMultipleItems(
new[] {
new DAItemGroupArguments("10.92.120.174", "OPC.IwSCP.1", "!BSTR,IndraMotion_MTX_P70,System.HardwareDescription", 1000, null),
new DAItemGroupArguments("10.92.120.174", "OPC.IwSCP.1", "!BSTR,IndraMotion_MTX_P70,Plc.FirmwareVersion", 1000, null),
new DAItemGroupArguments("10.92.120.174", "OPC.IwSCP.1", "!BSTR,IndraMotion_MTX_P70,Firmware.DeviceFirmware{0,0}", 1000, null),
});
Console.WriteLine("Processing item changed events for 1 minute...");
Thread.Sleep(60 * 1000);
Console.WriteLine("Unsubscribing item changes...");
}
Console.WriteLine("Finished.");
}
// Item changed event handler
static void client_Main1_ItemChanged(object sender, EasyDAItemChangedEventArgs e)
{
if (e.Succeeded)
Console.WriteLine($"{e.Arguments.ItemDescriptor.ItemId}: {e.Vtq}");
else
Console.WriteLine($"{e.Arguments.ItemDescriptor.ItemId} *** Failure: {e.ErrorMessageBrief}");
}
Please Log in or Create an account to join the conversation.
Given that OPC (DA) Expert Client takes the same time for node browsing, I think we can safely conclude at this point that the slow node browsing is a server issue.
Most interactive OPC clients do not do "Read" unless specifically instructed to (if they can do it at all). I think that when you drag&drop items, it actually does OPC subscribe. My suggestion now is that you re-write the code using a SubscribeMultipleXXXX call, and measure how fast you get the first useful data delivered.
Best regards
Please Log in or Create an account to join the conversation.