AdvancedHMI Software

General Category => Support Questions => Topic started by: Astabi on September 27, 2016, 03:35:08 PM

Title: BasicLabels not being updated
Post by: Astabi on September 27, 2016, 03:35:08 PM
Hello,

Just wondering if I'm doing something wrong. When starting up a new project with AdvancedHMIBeta399a all I needed to do was add the EthernetIPforSLCMicroCom1 driver to my form, set the IP address of the PLC, add a BasicLabel, set the PLC address value and it just works! I have a value that changes.

I simply do the same with either AdvancedHMIv399r and even tried AdvancedHMIv399p and I get no change to the label, the text stays the same. I have tried other controls and the datalogger2 with similar results. No changes unless I use the older beta version.

I'm using MS Visual Studio 2015 and changing the controls right in the properties, no extra code at all.

Any help would be appreciated, I'm getting back to my project after some time off and an still very new at this!

Thanks,
Alan
Title: Re: BasicLabels not being updated
Post by: Archie on September 27, 2016, 04:19:49 PM
It sounds like you are doing everything right. Can you run a Wireshark packet capture?
Title: Re: BasicLabels not being updated
Post by: Godra on September 27, 2016, 07:20:27 PM
I just tried the same steps with the same driver in v3.99r and the label was updating properly.
Title: Re: BasicLabels not being updated
Post by: Astabi on September 28, 2016, 03:45:42 PM
Ok, trying to figure out how to use wireshark and haven't quite got it yet but it looks like the session in the working program was registered as a success. I attached the 2 packet captures.
Title: Re: BasicLabels not being updated
Post by: Archie on September 28, 2016, 03:51:18 PM
The "NotWorking" shows no attempt at all to connect. Make sure the DisableSubscriptions property of your driver is set to False.

Try this:

- In a blank area of your form, double click. This will take you back to code
- Enter this code:

Me.Text=EthernetIPforSLCMicroCom1.Read("N7:0")


Run the application with a Wireshark capture running.
Title: Re: BasicLabels not being updated
Post by: Astabi on September 29, 2016, 09:39:19 AM
Hi Archie,

The DisableSubscriptions property of the driver is set to False. Here is a wireshark run after adding the code to the form as you requested. Thank you for your assistance!

I just noticed that inserting the code changed the title bar from reading AdvancedHMI v3.99r to now reading the number 3 !
Title: Re: BasicLabels not being updated
Post by: Archie on September 29, 2016, 10:01:40 AM
I just noticed that inserting the code changed the title bar from reading AdvancedHMI v3.99r to now reading the number 3 !
This means communication with the PLC is good, but the subscriptions to update the labels are not starting. For your BasicLabel, what do you have in PLCAddressValue? Also check the ComComponent property to make sure it has EthernetIPforSLCMicroCom1


Let's try a manual subscription via code...... In the place you added the previous line of code, replace that code with this:

        EthernetIPforSLCMicroCom1.Subscribe("N7:0", 1, 500, AddressOf DataChanged)


Now just 2 lines down, below the End Sub, add these lines of code:

    Private Sub DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs)
        MsgBox("N7:0=" & e.Values(0))
    End Sub



Now run the application again with another Wireshark capture and let me know if you get a message box pop up.
Title: Re: BasicLabels not being updated
Post by: Astabi on September 29, 2016, 12:36:30 PM
In the PLCAddressValue, for the first BasicLabel I have set up is ST20:18. I do not get a message box pop up, also I've attached another wireshark capture.

I did notice if I leave the application running for a while one of the BasicLabel's text changed to Value was either too large or to small for an unsigned byte, it has a PLCAddressvalue of ST20:0.
Title: Re: BasicLabels not being updated
Post by: Archie on September 29, 2016, 12:51:06 PM
I found some old debug code that could potentially cause this.

- In Solution Explorer, expand down the AdvancedHMIDrivers project
- Expand down the \AllenBradley folder
- Right click EthernetIPForSLCMicroCom.vb and select View Code
- Go down to line 263
- Delete these 3 lines of code:
Code: [Select]
            If e.Values(0) Is Nothing Then
                Dim dbg = 0
            End If

Rebuild the solution and try again
Title: Re: BasicLabels not being updated
Post by: Astabi on September 30, 2016, 12:57:55 PM
Hi Archie, Once again thank you greatly for your help!

I found the code and commented it out. The code wasn't in AdvancedHMIv399p but was in in the AdvancedHMIv399r. If I add more than one label it doesn't update so I'm not sure the removal had anything to do with it because I've had 5 labels installed the whole time.

To recap: Using AdvancedHMIv399r, I commented out the code you suggested but it doesn't matter, as soon as I add more than 1 label I get no updates on either one.

Here are 2 captures, filtered on the build computer as source the other using plc as source.
Title: Re: BasicLabels not being updated
Post by: Archie on September 30, 2016, 01:04:06 PM
What if you use 2 labels with the same address? For example 2 BasicLabels with PLCAddressValue both set to N7:0

If that works, then try 2 consecutive addresses of N7:0 and N7:1

In the Wireshark captures I still see only a single read of N7:0, but nothing else.
Title: Re: BasicLabels not being updated
Post by: Astabi on September 30, 2016, 03:36:24 PM
Hi Archie,

It seems like it depends on the combination of addresses used. Here are some of the results of my trials:

2 or more labels: Same address in each label: always works
2 labels: addresses N7:0 and  N7:1: works
2 labels: addresses ST20:0 and ST20:1: NOT Working

I tried 5 consecutive labels N7:0 to N7:5 and had great results.
I tried ST20:0, ST20:1, ST20:2, ST20:18, ST20:19 and nothing updates.

When I use the same addresses in the beta version it works fine.

The other thing is when I capture the data with wireshark I easily see data when it's working as you can see by my good capture attached. When I'm using labels with addresses that aren't working there is little to no data to capture. One last thing, if I place the addresses I need data for into the labels they all work by themselves, for example, I place ST:20:0 in all 5 labels they all update with the same data. Next, I place ST20:1 in all 5 and it works, and so on.
Title: Re: BasicLabels not being updated
Post by: Archie on September 30, 2016, 04:09:27 PM
Not sure if this is the same thing, but I did find if a string has 82 characters in the PLC, it will not show in the BasicLabel. How long are the values in your strings?
Title: Re: BasicLabels not being updated
Post by: Godra on September 30, 2016, 04:57:27 PM
Archie,

If v3.99a has no issues like this then what change in the driver of the new versions could actually cause this?
Title: Re: BasicLabels not being updated
Post by: Archie on September 30, 2016, 05:09:55 PM
If v3.99a has no issues like this then what change in the driver of the new versions could actually cause this?
In version 3.99e, there was a major restructure of the driver architecture for the SLC/Micro/PLC5 in order to make it comply with the latest architecture.

This seems to be related to reading strings, but the closest I have been able to come to reproducing is to put 82 characters in the strings. Even when I do that, the other BasicLabels pointing to N7:0 will continue to update.
Title: Re: BasicLabels not being updated
Post by: Godra on October 01, 2016, 06:23:52 PM
Archie,

The driver in v3.99r allows me to read 2 elements from ST table with the BeginRead function (example of the elements would be ST9:0 and ST9:1). This works even with 2 BasicLabels on their own.

According to the manual, each of these elements is 42 words in length.

Also, according to the manual, the string length is in the range 0 to 82 characters.

Does this info help in any way?
Title: Re: BasicLabels not being updated
Post by: Archie on October 01, 2016, 06:48:38 PM
The one thing I discovered, but don't think it is the same issue, is that when I completely fill the string with 82 characters, the BasicLabel will not show the value.

The reason I don't think it is related is because I can put another BasicLabel on the form for N7:0 and it will update the value.
Title: Re: BasicLabels not being updated
Post by: Godra on October 02, 2016, 12:34:34 PM
I tried using 3 labels with different ST addresses and the driver did provide response for each. These 3 elements seem to be the maximum allowed since their size is slightly less than 255 allowed for unsigned byte.

One of the labels did show an 82 character string as well.

BeginWrite function appears to only work for 1 address (out of an array of 3 strings it did write only the first one which was 82 characters).
Title: Re: BasicLabels not being updated
Post by: Astabi on October 03, 2016, 09:49:05 AM
I added 2 labels, with addresses ST20:0 and ST20:1 - They both worked fine and update immediately. I then add a 3rd label, ST20:2 and none of the labels update.

I let it just sit and run for a few minutes and I get ST20:0 to update with the message: Value was either too large or too small for an unsigned byte.
Title: Re: BasicLabels not being updated
Post by: Archie on October 03, 2016, 10:10:28 AM
What PLC are you communicating with? Godra may have stumbled across the root of the problem. There is a limitation on the packet size and different PLCs have different limitations. When reading multiple strings, it may be exceeding that packet size.
Title: Re: BasicLabels not being updated
Post by: Astabi on October 03, 2016, 10:27:46 AM
Allen-Bradley Micrologix 1100
Title: Re: BasicLabels not being updated
Post by: Archie on October 03, 2016, 10:35:31 AM
It appears the problem is in the driver's optimizer that groups as much as possible into each read. The communication packet limit for the ML1100  is 236 bytes. The optimizer will group up to 20 elements. With strings it is easy to exceed that packet length in just a few string values.

I'm going to do some testing with this tomorrow and see if I can come up with a patch to fix the problem.
Title: Re: BasicLabels not being updated
Post by: Astabi on October 06, 2016, 09:45:20 AM
Hi Archie,

I just wondered if you had a chance to look more into this? Thanks again.

Alan
Title: Re: BasicLabels not being updated
Post by: Archie on October 06, 2016, 10:03:13 AM
There is a new patch that addresses some issues with reading large amounts of data, such as 3 or more strings. Try this patch to see if it helps:

1) Download and extract Patch 3 for V3.99r

https://sourceforge.net/projects/advancedhmi/files/advancedhmi/3.5/Patches/

2) In Visual Studio, go to Solution Explorer
3) Expand down the AdvancedHMIDrivers project
4) Right click the Support folder and select Add->Existing Item
5) Browse to and select the file you extracted in step 1
6) It will ask to replace an existing file, select Yes
7) Build->Rebuild Solution
Title: Re: BasicLabels not being updated
Post by: Astabi on October 06, 2016, 11:26:30 AM
Hey Archie, All 5 labels are now being read! Thanks!

When I added the file to the support folder it didn't ask to replace an existing file, thought you'd want to know.

Thanks again,
Alan
Title: Re: BasicLabels not being updated
Post by: Archie on October 06, 2016, 11:44:16 AM
When I added the file to the support folder it didn't ask to replace an existing file, thought you'd want to know.
In Solution Explorer, right click the Support folder and select Open Folder in File Explorer. Check the file date to see if it is from October.
Title: Re: BasicLabels not being updated
Post by: Astabi on October 06, 2016, 01:53:23 PM
Yes, it is from October 6th, 2016
Title: Re: BasicLabels not being updated
Post by: Archie on October 06, 2016, 02:06:06 PM
Yes, it is from October 6th, 2016
Ok. Not sure why it didn't prompt for replacing an existing file.