Author Topic: Application loses comms to PLC when pump runs  (Read 715 times)

ASF

  • Newbie
  • *
  • Posts: 26
    • View Profile
Application loses comms to PLC when pump runs
« on: April 01, 2018, 03:14:25 AM »
I have an Advanced HMI application running my garden watering system. It all works as desired, but whenever the pump runs, the comms to the PLC (Click Koyo using Modbus TCP) drop out until the pump stops. Since the pump only runs for a minute or so every other day, it's not a major drama, but I'd like to get to the bottom of why it's happening - especially since my "stop pump" button doesn't work while the pump is running.

I've ruled out as best I can any physical-level problems - my ethernet infrastructure is very well segregated from the power to the pump, and the pump is just a little single phase DOL unit, so there's no funny business going on with VSD's and interference.

On my main display, there are a few things that happen when the pump starts. There is a water pump object which animates to green. There are some graphics that become visible to indicate watering. There is a basic label which may or may not animate a different colour, depending on which zones are being watered (comms problems exist regardless of which zones are being watered). Various level readings and a tank graphic will update as the tank level changes.

When the pump stops, some VBA runs to log the watering details, which includes data gathered from the PLC. This all happens fine, so apparently the comms come back pretty well immediately once the pump stops.

I'm assuming that there must be some object on the display causing problems when it becomes visible or animates. How might I start trying to track down the culprit? Is there any datalogging/event logging that goes on behind the scenes that I can look at to try and narrow down my search?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Application loses comms to PLC when pump runs
« Reply #1 on: April 01, 2018, 07:43:57 AM »
I can think of 2 possible reasons this could happen.

1) The PLC simply stops responding. Not sure how this could happen, but it would be noticeable by the controls, especially the BasicLabel, switching to a "No Response" message. Unless you set the SuppressErrorDisplay property to True.

Since there is no built in logging on the Ethernet drivers, the best way to test this would be to run a Wireshark capture and see if there is a Modbus request, but no immediate response.

2) The UI thread is being held up and not letting the display update. Windows runs its GUI on a single thread, but driver subscriptions run on a background thread and can continue to communicate independent of the GUI. A simple test would be this:

- From the Toolbox's All Windows Forms group, add a Button to the form
- Double click the button to get back to the code
- Add this code"
MsgBox("UI has responded")
- Run the app and when the pump runs, click that button

If you immediately get a popup box, then it rules this out. If the button does not respond immediately, then it confirms the UI thread is held up.

ASF

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Application loses comms to PLC when pump runs
« Reply #2 on: April 02, 2018, 01:22:28 AM »
Thanks Archie. I'll try those things and report back.

I don't suspect that the UI itself is frozen, because most of the graphics show some sort of comms issue message ("no response from [IP Address]" or something similar), and I have a PLC connection status bar that goes from green (healthy) to red (error) when this happens. So most likely it is an issue with the comms - not sure whether it's a software-related issue or a hardware-related issue, hopefully wireshark can tell me something.