AdvancedHMI Software

General Category => Support Questions => Topic started by: timryder on November 03, 2017, 11:26:55 AM

Title: Lost all my Comms
Post by: timryder on November 03, 2017, 11:26:55 AM
Ok so I'm doing this remote update and something I did to my project caused me to loose all my communication from the HMI to the PLC.  When I test an older .exe which i used this ones source code to start from it works... but my new one doesn't.  All of the controls say No Response From PLC.  I made one button larger and it tells me this (See attachment). What did I do wrong?  Can anyone help me figure it out please.   All the IP and Port and Timeout settings match and I tried to do a code comparison of all the files in the projects except the AdvancedHMI project and they all appear to be identical.

Micro850 PLC
Title: Re: Lost all my Comms
Post by: Archie on November 03, 2017, 11:52:53 AM
I'm going to take a bit of a guess and say that maybe you changed something in the program that is not supported by the Micro800 series. There are a number of things the 800 will not support, such as program scope tag reading. I don't remember all of the limitations and I do not have access to a Midro800 right now to test anyhting. I seem to remember some limitation with timers and maybe reading arrays. The definite way to know is through a wireshark capture to see if the PLC rejects any requests.

I will also assume you are using version 3.99x?
Title: Re: Lost all my Comms
Post by: timryder on November 03, 2017, 11:57:28 AM
Yes I am reading arrays... I am also writing arrays... those 2 things are new.  3.99 is correct.
So thats interesting.  I could comment out the array sections and find out if thats it. Is there some comprehensive list of tasks/features that the Micro800 won't do so I can look through the code and find it?

Can't wireshark it, I'm in Michigan and this machine is in California in a clean room.
Title: Re: Lost all my Comms
Post by: Archie on November 03, 2017, 12:31:52 PM
I am not aware of any consolidated list of the limitations. I stumbled across a few while experimenting with a Micro820. The program scope limitation I since found buried in one of the manuals.

Strings in a Micro800 are handled differently that in the ControlLogix, but the driver was modified to make that work. Program scope tags are just completely blocked. I looked at a work-around to attempt to get those to work, but have not had success yet. I also found multi-read requests were not supported, which makes the updates tremendously slower when compared a ControlLogix.

Maybe the reading and writing of multiple array elements is not supported. It may require using a separate read or write for each element.
Title: Re: Lost all my Comms
Post by: timryder on November 03, 2017, 12:52:15 PM
Quote
Program scope tags are just completely blocked.

What is this? I don't know about it, perhaps I'm doing it?
Title: Re: Lost all my Comms
Post by: Archie on November 03, 2017, 01:08:11 PM
Quote
Program scope tags are just completely blocked.

What is this? I don't know about it, perhaps I'm doing it?
Those are the tags only accessible to an individual program. The non-global tags/variables. If you try to read those you will get an error saying the tag does not exist.
Title: Re: Lost all my Comms
Post by: timryder on November 03, 2017, 02:32:03 PM
Thanks that clears it up for me.
Title: Re: Lost all my Comms
Post by: timryder on November 04, 2017, 01:10:58 PM
FYI:

I haven't been able to try anything yet but I was looking at the two solutions and I noticed that the original solution did NOT! have any DataSubsribers reading an Array... whereas my new logic has several.

So looks like i'll have to reinvent the wheel on my code and parse them all manually.  Quick Question.  Whats the recommend MAX number of tags I can read/write in one DS2?

Thanks
Title: Re: Lost all my Comms
Post by: timryder on November 04, 2017, 02:07:45 PM
Ok so another question, I have 64 tags to write to the PLC that I need to parse a List object for each value. Since I can't just do an Array write, whats the best method to write these values into the PLC? I know I can do a For Loop with i and for the name but what AdvancedHMI Component should I use for writing them down?  Also is there a Synchronous method for writing the values? I'd love to do some sort of a Progress Bar to let the user know the values are downloading.

Thanks in advance.
Title: Re: Lost all my Comms
Post by: Archie on November 05, 2017, 07:50:01 AM
There is no limit to the number of items added to a DataSubscriber2. Here is what you want to keep in mind.... The Micro800 series does not support multi-read requests, therefore every item requires its own packet. Each packet will typically take 10ms round trip. The DataSubscriber adds its items to the update list the same as the controls on the screen, so it will read those values at the same rate (unless you use a separate driver instance with a different PollRateOverride). So let's take the case where you have 25 items on the form and you have a DataSubscriber with 25 items. With 50 individual packets to update all values, it will takes about 500ms in between updates of each value. In other words be careful on how much you add to a single form and DataSubscribers when using the Micro800 series because things can get sluggish.

You can write an array using a for next loop. For example:

For index=0 to 99
    EthernetIPforMicro800Com1.Write("PLCArray[" & index & "]", MyArray[index])
Next


The write is a synchronous operation, so your screen will essentially freeze during that loop, unless you put it on a background thread.
Title: Re: Lost all my Comms
Post by: timryder on November 05, 2017, 09:46:27 AM
Is there any sort of Handshake bit or a return like a function returns a result to let you know the transfer was a success? 

Also I have a DS2 and EthernetIPforMicro800Com1 driver on my main MDIParent form and each childform(1 displayed at a time) which is docked in the parent has its own as well. The parent only has like 6 tags in the DS2, do you see this as a problematic setup?



Title: Re: Lost all my Comms
Post by: Archie on November 05, 2017, 12:32:36 PM
Since the Write is synchronous, it will return when the write has succeeded otherwise it will throw an exception.

Whether your configuration will be a problem depends on how fast you need the data to refresh. The PollRateOverride regulates the refresh rate as long as the PLC can keep up to it. For example, lets say you set PollRateOverride to 100ms, but have 15 items in the screen. It will most likely refresh at about 150ms and not be able to achieve the 100ms.
Title: Re: Lost all my Comms
Post by: timryder on November 05, 2017, 03:58:37 PM
Good to know, so if I just do a Try Catch on the call and if it doesn't cast an error I can just update my progress bar within the loop?

Code: [Select]
Try
     For index=0 to 99
         EthernetIPforMicro800Com1.Write("PLCArray[" & index & "]", MyArray[index])
         Me.Progressbar1.Value = index
     Next     
Catch ex As Exception
     Messagebox.show(ex.message, "Download Failed",vbOK)
End Try
Title: Re: Lost all my Comms
Post by: Archie on November 05, 2017, 08:07:17 PM
Exactly!
Title: Re: Lost all my Comms
Post by: timryder on November 06, 2017, 02:12:49 PM
So I tried serveral different versions of downloading the 64 tags to the PLC. Again it's a Micro850.  So what I've found today is that the PLC DOES support the array write.

The first method I did was the following.
Code: [Select]
Try
            For i As Integer = 1 To 32
                Me.ProgressBar1.Increment(1)
                Dim s As String = "XPartPositions[" & i & "]"
                EthernetIPforMicro800Com1.Write(s, xValues.Item(i).ToString)
                Me.tbActions.AppendText("Download: XPartPositions[" & i & "]" + vbCrLf)
            Next
            For i As Integer = 1 To 32
                Me.ProgressBar1.Increment(1)
                Dim s As String = "YPartPositions[" & i & "]"
                EthernetIPforMicro800Com1.Write(s, yValues.Item(i).ToString)
                Me.tbActions.AppendText("Download: YPartPositions[" & i & "]" + vbCrLf)
            Next
99% of the time the logic would parse through 1 or a few of them and then give me "Object not set to an instance of an object"  Randomly and very rarely the function would blaze through all 64 tags and return successful. However most all of the time it would fail.

Code: [Select]
Dim s(31) As String
            For index = 0 To 31
                s(index) = xValues(index).ToString
            Next
            Dim s2(31) As String
            For index = 0 To 31
                s2(index) = yValues(index).ToString
            Next

Then for the heck of it I disabled all of the other forms in my project so they don't load at all which make sure none of their driver instances or DS2 are active and it seemed to help some... but still it would fail in the same manor nearly every time.

So I tried to use the BeginWrite function of the driver and believe it or not... this worked! It wouldn't return with an error and I actually saw the data change on the PLC.  I will note however sometimes I wouldn't see it change for several seconds or even as much as a minute without attempting it again.  I even tried refreshing the page.  But it became more frequent that the data in the array just didn't change.  The more I enabled things in my project again the worse it got.

So what I'm wondering now, is there anyway to pause all other driver instances on other forms?  Can't I tell them to stop somehow?
Title: Re: Lost all my Comms
Post by: Phrog30 on November 06, 2017, 04:11:57 PM
So what I'm wondering now, is there anyway to pause all other driver instances on other forms?  Can't I tell them to stop somehow?

Yes, when you download the application, Archie has this code on the main form.  Basically, when not visible it stops the comms.
Title: Re: Lost all my Comms
Post by: timryder on November 06, 2017, 04:58:48 PM
i was looking at that code and I see the call he's making, but what I don't understand is how to Reinitialize the comms?

Does anyone see it as a problem to have a Communications driver which is active all the time on my MDIParent form and also a driver on each subsequent child form which 1 will show at a time.  Does this raise any alarms for anyone?  Because i'm just having loads of communication issues and timeouts. I can't see any other way to do it though... in my HMI design, the Parent is always monitoring over machine status bits that the rest of the forms use and also some controls like status banner utilize also.  Thoughts are really appreciated.

Also... whats the difference between the 2 of these?
Code: [Select]
Dim s As String = DataSubscriber21.PLCAddressValueItems(1).LastValue
Dim s As String = e.Values(1)
Title: Re: Lost all my Comms
Post by: Archie on November 06, 2017, 06:42:54 PM
Subscription communications cab be paused by setting the DisableSubscriptions property to true for each driver instance. The purpose of the driver instance for each form is to have the granularity of pausing groups of subscriptions, so when the form is hidden that group of communications are paused. If a single instance were to be used for everything, then everything would update including hidden forms, therefore making update rates much slower.

To pause communcations, it would be like this:

EthernetIPforMicro800Com1.DisableSubscriptions = True
Title: Re: Lost all my Comms
Post by: timryder on November 06, 2017, 07:26:22 PM
Thanks Archie.

What about my other questions in the previous post.
Title: Re: Lost all my Comms
Post by: Phrog30 on November 06, 2017, 07:46:04 PM
I use mdiparent as well. I have no issues. I don't show all forms in the beginning though.
Title: Re: Lost all my Comms
Post by: Archie on November 06, 2017, 08:03:08 PM
whats the difference between the 2 of these?
Code: [Select]
Dim s As String = DataSubscriber21.PLCAddressValueItems(1).LastValue
Dim s As String = e.Values(1)
The first line of code can be used anywhere. The second only works in the DataChanged or DataReturned event handler.
Title: Re: Lost all my Comms
Post by: timryder on November 07, 2017, 07:19:20 AM
So I'm working on a test today to see if this will help... I've added code to the "Leave" and "Enter" events of each child form I can

Code: [Select]
    Private Sub frmMain_Leave(sender As Object, e As EventArgs) Handles MyBase.Leave
        Me.EthernetIPforMicro800Com1.DisableSubscriptions = True
    End Sub
    Private Sub frmMain_Enter(sender As Object, e As EventArgs) Handles MyBase.Enter
        Me.EthernetIPforMicro800Com1.DisableSubscriptions = False
    End Sub

Since I am opening all of my forms in the beginning which for me is needed, otherwise the forms flash when you open and close them constantly and I don't want the border or the form controls to be visible so it's much cleaner result for me.  Anyway because of that I added these methods which I hope fully reduce the overall traffic on the network and improve my stability.
Title: Re: Lost all my Comms
Post by: Archie on November 07, 2017, 07:35:23 AM
You mentioned the PLC does support the writing a arrays in a single write. So was the original problem a result of the communication problems or is it the reading of arrays?

The "Object not set to an instance" error is not normal. This must be a bug in the driver. The Micro800 driver is actually the same driver as the CLX driver only with Multi-Read disabled and the route path removed. I haven't had any reports of this error with the CLX series, so it must be something unique to the 800.
Title: Re: Lost all my Comms
Post by: timryder on November 07, 2017, 09:34:11 AM
Archie,

Yes I have found that it absolutely DOES support Writing using the .BeginWrite(PLCTag,NumElements,Array)

I can also confirm that it does appear to be reading an array of values.  I have a DS2 on my form which is looking up a DINT array of 32 and it pulls all of that in just fine.  I'm doing a local compare of my array versus the PLC's to determine if my "Download" was successful or not.  Reading seems to be very consisting however while reading and when I try to Write is where I get the issues.  I'm remoting into a computer in CA from MI every morning for 3-4 hours so my debug time and abilities are limited because the remote computer doesn't have VS installed on it.  So today I'm going to try and set all of my Driver.DisableSubcriptions = true on every other form when I have my Download dialog open and foremost.  Perhaps the PLC just can't do both?

Is there anything you'd like me to try for troubleshooting that "Object not set to an instance" error?
Title: Re: Lost all my Comms
Post by: Archie on November 07, 2017, 09:53:22 AM
I have only done a little bit of work with the Micro800 series, so I never really tried to push the communication ability to the limit. I just need to get that opportunity to see if I can replicate the problem. My suspicion is that it is requesting array data and the PLC returns something not recognized as an error, then the driver tries to parse the values from the packet as if it were the array data

Unfortunately it may be a couple weeks before I am at the shop long enough to dig out the Micro820 and do some testing.

There is one other option you can try.. there is a patched version of 3.99x that corrects a problem in the CLX driver. I do not suspect this will do anything because the problem only occurs when all communications stop for about 15 seconds, then a new request is done.
Title: Re: Lost all my Comms
Post by: Archie on November 07, 2017, 09:56:14 AM
If you wanted to try the patched version, you can get it form here:

https://sourceforge.net/projects/advancedhmi/files/advancedhmi/3.5/
Title: Re: Lost all my Comms
Post by: Phrog30 on November 07, 2017, 10:02:56 AM
Also, in this thread I have a link to an app that shows how I change forms and stop comms:
http://advancedhmi.com/forum/index.php?topic=1896.0 (http://advancedhmi.com/forum/index.php?topic=1896.0)

James
Title: Re: Lost all my Comms
Post by: timryder on November 07, 2017, 10:31:59 AM
I keep getting lots of errors... all the time..
I have deleted all of the drivers from every other form excepting one which i'm working on.  I keep getting this when performing my Write or BeginWrite

"No response from PLC when getting Tag Information"  Also the writing is incredibly slow when writing 1 tag at a time and nearly always it breaks in the middle... the write array seems to be FAST but the PLC doesn't update the local data for quite sometime... minutes even.... i'll try multiple attempts of downloading but still... minutes....
Title: Re: Lost all my Comms
Post by: Archie on November 07, 2017, 10:38:50 AM
Just for a shot in the dark, download the V3.99xPatched version.

Make a copy of your current complete solution. Replace the complete AdvancedHMIDrivers folder from the patched version into the copy of your project. Open the project and Rebuild Solution.

See if that version makes any difference.

If there was only a way to Wireshark the communications, that would reveal exactly what is happening.

Does your original version still work without errors?
Title: Re: Lost all my Comms
Post by: timryder on November 07, 2017, 10:41:20 AM
FYI,

That IS with the update 3.99x patched.  All i did was copy over the Drivers folder in the project into my new project and it made it worse.   Now i can't even get 1 tag to write either way,  Can I wireshark from the computer itself?

If so i can do that

EDIT: ALso I don't mean to push my problems onto you but if you're interested I can have you remote into my computer using TeamViewer and see what im seeing... you can even drive the system in CA and try to capture the wireshark.   If you have time and or interest anytime this week give me a contact.  tryder@columbiamt.com  Tim Ryder.  I'll hook you up with the remote tool.

EDIT 2:  Sorry to forgot to answer your question.. Yes the absolute original version which shipped with the machine months ago works without issue.
Title: Re: Lost all my Comms
Post by: Archie on November 07, 2017, 10:55:56 AM
Ok, so the patch made it worst. There must be more changes to the patch than I remember.

If you are TeamViewed into the remote computer, does that mean it possibly has internet access to let you download Wireshark directly to it. Or you could download on your computer then file transfer it to the remote PC through TeamViewer. Would they be ok with you installing it on the PC?

I won't have much time over the next few days to remote in because I am about to head to a job site to test out a new program. But on Friday I will be back at my office and will have the opportunity.
Title: Re: Lost all my Comms
Post by: timryder on November 07, 2017, 10:58:11 AM
I have downloaded the WireShark installer and already pushed it down to the remote computer. I plan on installing it ASAP once they say it's fine. 

Then i'll try and capture all the traffic from the PC to the PLC and ill upload it ASAP.

Please if you'd be so generous i'd love to have some of your time on Friday... that would be a great help!!!!! Let me see where I get with this though.
Title: Re: Lost all my Comms
Post by: timryder on November 07, 2017, 11:44:23 AM
Here are some shark reports adequately named.

Also Found another little quirk... i have an array in the plc which is.... "XPositions"  [1..32].  But In my loop if I do  I = 1 to 32 ... it ALways fails on the 32...... So if I try 0 - 31... it says index out of bounds....
I tried increasing my array size to 33 and looping 1-32... but it still fails at 32 no mater what..

So I switched it over to a .BeginWrite with an array... and it works fine.  Here's the shark of that.
Title: Re: Lost all my Comms
Post by: Archie on November 07, 2017, 12:10:27 PM
Right off I see some forward open connections failing for "Out of Connections". This may happen if your application does not shut down properly and dispose of every driver instance. It will then take about 30 seconds for the PLC to clear the connections.

The next thing I see is a Multiple Service Request for XPartPositions and YPartPositions. This is the multi service not supported by the Micro800. There is a driver property named DisableMultiServiceRequest that must be set to True for the Micro800. Make sure that did not get changed on any of your driver instances. This could potentially be caused by the patched version because I remember there were some changes that attempted to improve the performance of the multi-service and maybe those changes are not respecting that property any more.
Title: Re: Lost all my Comms
Post by: timryder on November 07, 2017, 12:44:05 PM
Ok so I went through and I did see one of the drivers had the MultiService set to false.
I fixed that... also what I found was the PLC isn't able to READ an array but it can for some reason Write an array.  So as of now I have a DS2 reading about 64 tags and if the poll time wasn't increase it would constantly error.  Now that I increased it, it seems to have fixed that.  I am still writing down using the BeginWrite with an array of String type variables which is working great.

But now strangely enough on my Main page... the controls keep saying No Com Component was selected even though there is..... ?  no clue.... I've clean and rebuilt several times.
Title: Re: Lost all my Comms
Post by: Archie on November 07, 2017, 08:59:38 PM
Did you try the full clean as described here:

http://advancedhmi.com/forum/index.php?topic=1062.msg5555#msg5555
Title: Re: Lost all my Comms
Post by: timryder on November 08, 2017, 11:51:24 AM
OK seems to have fixed that... I have a few new strange issues.

First, on the driver setting the .DisableSubscriptions = True doesn't seem to do anything.  I went through on every form and set the property of the driver to True and when I Wireshark them it would seem that they still are being polled.  I can see the tags on the other forms still constantly being polled.  I also am using the Form.Leave and Form.Enter events to set the property to True and False respectively. No matter what though they still seem to keep polling.

For some reason on 2 of my forms in the designer, there automatically keeps coming back a Driver EthernetIPforCLXCom1 but I checked the list of components on the form and every single one has the EthernetIPforMicro800Com1 already set as the ComComponent. Why the heck does this keep happening?

OTher than that I think I have everything fixed by upping the Poll Override times and by making completely sure that all of the DisableMultiServiceRequest = True.  Everything seems to be ok now.  Thoughts on this silly little issue in the Designer?

NOTE:  The Final configuration for me is that you CAN write down an array to the Micro800 family and you CAN read an array of values with the DS2.  I used the Starting address of the Tag TagName[1] and set the value of the number of elements to the Array Size [32].