AdvancedHMI Software

General Category => Support Questions => Topic started by: opmal7 on April 17, 2017, 04:42:42 PM

Title: Program locks up if connection is interrupted
Post by: opmal7 on April 17, 2017, 04:42:42 PM
I'm using a Micrologix 1100 PLC with a tablet running AdvancedHMI 3.98t.

One of the issues that I've run into is that when the tablet screen is locked, the connection to the PLC gets disconnected.  Then when the screen is unlocked, the program locks up, and doesn't appear to be communicating with the PLC anymore.  If I exit the program, and restart it, the program works fine.

I was wondering if there is any way to prevent this from happening.  Or, if there is a way to make a button to re-establish the connection with the PLC.  Then I could make a popup dialog box saying "Connection interrupted, Click OK to re-establish the connection" or something along those lines.  Thanks.
Title: Re: Program locks up if connection is interrupted
Post by: Archie on April 17, 2017, 05:08:43 PM
Try using 3.99w
Title: Re: Program locks up if connection is interrupted
Post by: qsiguy on March 03, 2023, 01:34:45 PM
I'm on 3.99x and if the IP isn't correct when you start the HMI it locks up before I have a chance to update the IP from my on screen textbox.  Trying to figure out how to prevent this.  Any help would be appreciated.
Title: Re: Program locks up if connection is interrupted
Post by: Archie on March 03, 2023, 03:59:08 PM
I'm on 3.99x and if the IP isn't correct when you start the HMI it locks up before I have a chance to update the IP from my on screen textbox.  Trying to figure out how to prevent this.  Any help would be appreciated.
Try it on V3.99y Beta that you can download from this forum.
Title: Re: Program locks up if connection is interrupted
Post by: qsiguy on March 03, 2023, 04:34:31 PM
Thanks, I'll give that a try!

I did build a work around but would like it not to freeze up if it looses comms.
Title: Re: Program locks up if connection is interrupted
Post by: qsiguy on March 13, 2023, 07:28:29 PM
Try it on V3.99y Beta that you can download from this forum.

How do I migrate my project to 3.99y or does running the "AdvancedHMIv35.sln" file from 3.99y update my PC so when opening the project from the old folder opens with "y"?

I did try this from another thread and I get a bunch of "...not a member of..." errors

"As long as you don't cross over the 3.5 version update:

1) Open the newest version in Visual Studio
2) Right Click AdvancedHMI in Solution Explorer
3) Select Add->Existing Item
4) Browse to and select your .vb files (forms) from your previous project"

I added my MainForm.vb which is my only page. Is there something else I need to import using the Add function?

Thanks.
Title: Re: Program locks up if connection is interrupted
Post by: qsiguy on March 15, 2023, 12:20:06 AM
Anyone?  I'm sure I am missing some minor detail or I've over simplified adding just the MainForm.vb file.  It can't be that difficult to move my project from 'x' to 'y'.

One error I did notice was for an image file I had on my MainForm so that was easy to import manually. Since it didn't migrate the graphic over, there must be more to do to bring the project over than import the one .vb file?
Title: Re: Program locks up if connection is interrupted
Post by: Archie on March 15, 2023, 12:35:11 AM
Anyone?  I'm sure I am missing some minor detail or I've over simplified adding just the MainForm.vb file.  It can't be that difficult to move my project from 'x' to 'y'.

One error I did notice was for an image file I had on my MainForm so that was easy to import manually. Since it didn't migrate the graphic over, there must be more to do to bring the project over than import the one .vb file?
Can you post more details of at least one of the errors?
Title: Re: Program locks up if connection is interrupted
Post by: qsiguy on March 16, 2023, 12:55:29 AM
A screenshot seemed the easiest way to share what I'm seeing.
Title: Re: Program locks up if connection is interrupted
Post by: Archie on March 16, 2023, 01:03:07 AM
Open MainForm.designer.vb and do a Search and Replace for ".LightColors" to ".LightColorOption"
Title: Re: Program locks up if connection is interrupted
Post by: qsiguy on March 16, 2023, 01:13:35 AM
That seems to have cleared up quite a few.  Here's what is left.

Thanks for the assistance!
Title: Re: Program locks up if connection is interrupted
Post by: Archie on March 16, 2023, 01:45:38 AM
VisibleControlEnum -> VisibleControlOptions
ForeColoeAltername -> ForeColorAlternate

HighLightColor* and HighlightKey* -> delete each line completely. Those properties no longer exist.
Title: Re: Program locks up if connection is interrupted
Post by: qsiguy on March 16, 2023, 02:14:15 AM
Thank you very much, would have never figured that out on my own.  Some things are broken now as I was using those obsolete things but I think I can work with this.

Really appreciate it.

Shane
Title: Re: Program locks up if connection is interrupted
Post by: qsiguy on March 16, 2023, 02:16:18 AM
Unfortunately it still locks up if the Modbus TCP comm fails.
Title: Re: Program locks up if connection is interrupted
Post by: qsiguy on March 16, 2023, 02:22:33 AM
I have a couple "MessageByDisplayValue" functions that broke after that.  When I try to open the "Collection" to repair the messages Visual Studio shuts off and restarts.

Update:
I just copied the old ones from 399x and pasted them to 399y and it seems to have worked.
Title: Re: Program locks up if connection is interrupted
Post by: Archie on March 16, 2023, 08:50:00 AM
Some things are broken now as I was using those obsolete things but I think I can work with this.
The Highlight colors and characters are now controlled with each message through the use of foreground and background colors
Title: Re: Program locks up if connection is interrupted
Post by: lpou on April 06, 2023, 06:15:33 PM
How to prevent the program from crashing when accessing a plc that is not connected?. It can be controlled with some instruction that the plc is connected before accessing to read in it?.
Title: Re: Program locks up if connection is interrupted
Post by: Archie on April 06, 2023, 08:38:06 PM
How to prevent the program from crashing when accessing a plc that is not connected?. It can be controlled with some instruction that the plc is connected before accessing to read in it?.
Are you using V3.99y beta? it has better communication handling.
Title: Re: Program locks up if connection is interrupted
Post by: lpou on April 07, 2023, 02:43:57 AM
I am using version 3.99x.
I have an other question.
 How can I run multiple apps at the same time?
Title: Re: Program locks up if connection is interrupted
Post by: lpou on April 07, 2023, 03:31:44 AM
I already found the solution to the question of how to run multiple applications in the tips and tricks section.
Is there a way to control if a plc is connected before executing a read or write in it, to avoid the error or if we control the error that there is no delay time. For example
if OmronEthernetFINSCom1 is connected then.
It is possible to use or implement the property?
Title: Re: Program locks up if connection is interrupted
Post by: lpou on April 20, 2023, 10:34:48 AM
I have to control a network with 6 omron plcs with the OmronEthernetFinsCom driver, the problem is that if there are plcs not connected, and I execute a read or write instruction to the plcs not connected, the delay time is high. My question is,You can control if a plc is not connected,so do not perform a read or write access on it and avoid communication delay.

Example: if OmronEthernetFinsCom is connected Then OmronEthernetfinsCom.Read("D10") end if
Title: Re: Program locks up if connection is interrupted
Post by: RobS on April 20, 2023, 09:03:26 PM
You can use..
    OmronEthernetFinsCom.ConnectionEstablished
    OmronEthernetFinsCom.ConnectionClosed
    OmronEthernetFinsCom.ComError
    OmronEthernetFinsCom.DataReceived
to monitor the status of the device comms.
Then
    OmronEthernetFinsCom.PollRateOverride
    OmronEthernetFinsCom.DisableSubscriptions
to throttle or enable / disable comms. Up to you how you code it to suit your requirements.
Title: Re: Program locks up if connection is interrupted
Post by: lpou on April 21, 2023, 02:59:14 PM
The event or property ConnectionEstablished and ConnectionClosed I can't find them.
If I use the ComError event
the delay time is about 4 sec.
I have 6 plc in the network, if all of them are disconnected, the delay time is 46 seconds.
How can I monitor if the plc is connected without having to read or write to the plc, since it causes execution time until the ComError event occurs.
Title: Re: Program locks up if connection is interrupted
Post by: RobS on April 22, 2023, 02:52:11 AM
Reduce the timeout ?
Title: Re: Program locks up if connection is interrupted
Post by: lpou on April 22, 2023, 05:27:31 AM
Yes.
Title: Re: Program locks up if connection is interrupted
Post by: RobS on April 22, 2023, 06:36:54 AM
Yes what? Did you reduce the timeout? Did it help your problem?
Title: Re: Program locks up if connection is interrupted
Post by: lpou on April 22, 2023, 07:35:32 AM
No, the waiting time is the same, about 46 sec. , if the 6 plcs are disconnected. How can you reduce the Timeout?. I'm also testing with Ping, but the timeout is also high. How can you reduce the timeout of Ping?.
Title: Re: Program locks up if connection is interrupted
Post by: RobS on April 22, 2023, 08:54:32 AM
Reduce the timeout in the comms driver properties, looks like the default is 3secs, change it to 200ms or something that will give error free comms when you actually have stuff connected. 
Title: Re: Program locks up if connection is interrupted
Post by: Archie on April 22, 2023, 09:16:55 AM
The event or property ConnectionEstablished and ConnectionClosed I can't find them.
They don't exist for the Omron driver. Attached are some patch files that can be used with 3.99y Beta that adds those events.

Extract the zip file, then replace the files in the AdvancedHMIDrivers project with the attached files, then Rebuild Solution

NOTE: These events have not been tested
Title: Re: Program locks up if connection is interrupted
Post by: lpou on April 23, 2023, 03:27:22 AM
With the Timeout 200 property the total time is 34 sec., with the Timeout at 3000 it is 38 sec., I don't understand why. The solution that I have implemented that works for me is with Ping. Example:

Dim p As New Ping
Dim response = p.Send("192.168.250.1", 100)
        If response.Status.ToString <> "TimedOut" Then
           Try
                OmronEthernetFinsCom.Write("W61.01", 1)
            Catch ex As Exception
           End Try
        end if.

With the use of Ping, the waiting time is 3 seconds, with the 6 plcs disconnected.


Title: Re: Program locks up if connection is interrupted
Post by: bachphi on April 23, 2023, 04:32:49 PM
It appears there is a bug in the timeout of the ping command, anything less than 500 ms will default to 500ms. It will work with multiples of 500 ms.

Are you going to test out the new driver?

Code: [Select]
    Dim PingSender As Ping = New Ping()
    Dim PLCIsConnected As Boolean() = Nothing

    Dim lines() As String = ReadAllLines(".\PLCDevicesList.txt")
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Debug.Print(DateTime.Now())
        Dim i As Integer = 0
        ReDim PLCIsConnected(lines.Count() - 1)
        For Each lineItem In lines
            Dim PingResponse As PingReply = PingSender.Send(lineItem, 500, Encoding.ASCII.GetBytes(1), New PingOptions(64, True))
            If PingResponse.Status = IPStatus.Success Then
                PLCIsConnected(i) = 1
            Else
                PLCIsConnected(i) = 0
            End If
            i = i + 1

        Next
        Debug.Print(DateTime.Now())
    End Sub


Archie,  how about adding a function 'IsConnected' to the driver?  Other drivers I have seen, they all have that  feature.
Title: Re: Program locks up if connection is interrupted
Post by: lpou on April 24, 2023, 12:52:41 PM
I agree, You would have to create the IsConnected property in the drivers, to avoid the execution of read or write in the plc, if there is no connection, and thus avoid delay times.