Author Topic: Program locks up if connection is interrupted  (Read 4962 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Program locks up if connection is interrupted
« Reply #15 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

lpou

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #16 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?.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Program locks up if connection is interrupted
« Reply #17 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.

lpou

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #18 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?

lpou

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #19 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?

lpou

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #20 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

RobS

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #21 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.

lpou

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #22 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.

RobS

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #23 on: April 22, 2023, 02:52:11 AM »
Reduce the timeout ?

lpou

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #24 on: April 22, 2023, 05:27:31 AM »
Yes.

RobS

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #25 on: April 22, 2023, 06:36:54 AM »
Yes what? Did you reduce the timeout? Did it help your problem?

lpou

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #26 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?.

RobS

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #27 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. 

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Program locks up if connection is interrupted
« Reply #28 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
« Last Edit: April 22, 2023, 09:35:42 AM by Archie »

lpou

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Program locks up if connection is interrupted
« Reply #29 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.