Professional OPC
Development Tools

logos

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.

Reading Kepware Tag with wrong value

More
01 Feb 2015 07:56 #2665 by adid@contel.co.il
hello,

ok i will check it with the vendor Kepware and will update as soon as possible.

thank you,
Adi Damty

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

More
29 Jan 2015 17:28 #2659 by support
Actually, I think I have met earlier with a behavior of Kepware where for simulated tags, each client got its "own" view of the value. Please mention it to them as a possibility - they may be aware of it.

That would not explain, however, why the behavior is different with different data types.
The following user(s) said Thank You: adid@contel.co.il

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

More
29 Jan 2015 13:01 #2658 by adid@contel.co.il
hello,

thank you for your answer.
i will contact with kepware provider about this problem.
i am thinking it's rellevant to Simulate device checkbox on the device, because in production it's working with same device throgh opcLabs.

thank you,
Adi Damty

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

More
29 Jan 2015 09:18 #2657 by support
OK. Until you have posted the code, there was no mention or clue that we are discussing OPC Unified Architecture, and I have mistakenly assumed that your problem is with OPC "Classic".

Therefore my suggestion with synchronous reads cannot be applied.

To me this looks like a problem in the server. But we need some data to reliably determine the cause.

OPC Analyzer mentioned above is for OPC Classic only. A similar tool would be the Compliance Test Tool for OPC UA, or a Wireshark with OPC UA plugin. I will have to check whether I can provide the test tool to the outside of OPC Foundation membership for this purpose. But the Wireshark analysis (which I have only used little in the past) may be an option.

Will you be willing to use one of these tools? Better, can you speak to the server vendor (is it Kepware?) first, whether they are not aware of anything that could cause the issue?
The following user(s) said Thank You: adid@contel.co.il

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

More
28 Jan 2015 10:18 - 29 Jan 2015 09:10 #2655 by adid@contel.co.il
hello,
how can i switch to OPC reads from Device ?

i am doing the test in my code ( in my service ) and i can change it.
the function that read multiple tags is attached below. as you can see the read is executed in line :

valueResults = m_EasyUAClient.ReadMultipleValues(uaReadArguments.ToArray());

before this line i try to write value to the same tag ant it return succeed but the value wasn't changed.

if you want me to deploy an OPC Analyzer i would be glad if you put instructions to this route.

thank you,
Adi Damty

here is the code :
public void ReadMultipleTags(List<TagInfo> i_Tags, bool i_ThrowExceptionIfPartOfReadingFailed)
        {
            List<UAReadArguments> uaReadArguments = new List<UAReadArguments>();
            UAReadArguments uaReadArgument = null;
            StringBuilder tagsNames = new StringBuilder("");
            ValueResult[] valueResults = null;
            string nodeId = null;
            string messageToUser = null;
            int numOfReadingTagsFailed = 0;
 
            foreach (TagInfo taginfo in i_Tags)
            {
                nodeId = GetNodeId(taginfo.UAEndpointDescriptor, taginfo.TagName);
 
                if (taginfo.UAEndpointDescriptor == null)
                {
                    throw new Exception("UAEndpointDescriptor is null");
                }
 
                if (nodeId == null)
                {
                    throw new Exception(string.Format("tag wasnt found for UAEndpointDescriptor [{0}] tag name [{1}]", taginfo.UAEndpointDescriptor, taginfo.TagName));
                }
 
                tagsNames.AppendFormat(@"[{0}] , ", taginfo.TagName);
 
                uaReadArgument = new UAReadArguments();
                uaReadArgument.EndpointDescriptor = taginfo.UAEndpointDescriptor;
                uaReadArgument.NodeDescriptor = nodeId;
                uaReadArguments.Add(uaReadArgument);
            }
 
            if (uaReadArguments.Count > 0)
            {
                valueResults = m_EasyUAClient.ReadMultipleValues(uaReadArguments.ToArray());
            }
 
            if (valueResults != null)
            {
                for (int i = 0; i < valueResults.Length; i++)
                {
                    if (valueResults[i].Succeeded)
                    {
                        i_Tags[i].Value = valueResults[i].Value;
                    }
                    else
                    {
                        numOfReadingTagsFailed++;
                        messageToUser = string.Format("Error reading from opc server [{0}] tag [{1}] : {2}", uaReadArguments[i].EndpointDescriptor, uaReadArguments[i].NodeDescriptor, valueResults[i].Exception.Message);
                        m_Logger.LogErrorAndWriteToDB(m_ServiceName, messageToUser);
                    }
                }               
            }
 
            if (valueResults == null ||
                numOfReadingTagsFailed == uaReadArguments.Count ||
                (i_ThrowExceptionIfPartOfReadingFailed == true &&
                numOfReadingTagsFailed >= 1))
            {
                throw new Exception(string.Format("ReadMultipleTags Error : Failed to read tags {0}", tagsNames.ToString().Substring(0, tagsNames.ToString().Length - 3)));
            }
        }
Last edit: 29 Jan 2015 09:10 by support. Reason: formatted the code

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

More
28 Jan 2015 10:02 #2654 by support
First I'd suggest to switch to OPC reads from Device. This can be done by setting properties in the code. Are you doing your tests using your code (or, can you modify the code), or are you just using the executable demo app? If you can modify the code, post a piece of it here and I'll post how to modify it.

If you cannot modify the code or the switch to sync reads does not help, I suggest that you deploy an OPC Analyzer and we take the logs of what happens between the client and the server. This will then allow to determine which part is responsible for the behavior. Again, I can give instructions to this route.

Best regards
The following user(s) said Thank You: adid@contel.co.il

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

More
28 Jan 2015 09:03 #2653 by adid@contel.co.il
hello,

something is strange.
i try to write value 100 to this tag using opcLabs - i didn't get any exception thrown, than i go to the kepware client and saw that the tag value wasn't changed and it still 200.
than i wait 10 seconds and try to read this tag using opcLabs - i get value 0 with result success.

thank you,
Adi Damty

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

More
28 Jan 2015 07:16 #2652 by adid@contel.co.il
hello,

i write value 100 through kepware client ( through async write ) and it takes 1-2 seconds.
after i saw the tag value was changed than i also wait 10 seconds and than try to read it thourgh the opcLabs - and it returns value 0 with result success. it's not happend for word tag under simulator device, and it not happened for boolean tag under the same Simense device.
i hope it's helping to understand the problem.

thank you,
Adi Damty

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

More
27 Jan 2015 15:06 #2650 by support
Is there a delay between the write and the read, and if so, roughly how long?
The following user(s) said Thank You: adid@contel.co.il

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

More
27 Jan 2015 11:41 #2649 by adid@contel.co.il
hello,

i am using opcLabs version 5.30.1114.1.
i create tag with device driver simulator and operate opc client and change the tag value to 100, and than read the tag value with opcLabs function Read - the tag values was read successfully.
i create another device driver : Siemens TCP/IP Ethernet, define device property S7-300, create word tag inside the device, operate opc client and change the tag value to 100, and than trying to read the value with opcLabs function read - than the function return success but return value 0 and not value 100.
i also saw that under the same Simens device driver if i define boolean tag than the opcLabs read it's value successfully - so the problem occurs only with tag from type short and word.
what is the problem ?

thank you,
Adi Damty

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

Moderators: support
Time to create page: 0.071 seconds