Author Topic: Basic Labels sometimes do not update  (Read 1539 times)

SomeGuy

  • Newbie
  • *
  • Posts: 3
    • View Profile
Basic Labels sometimes do not update
« on: August 06, 2018, 12:41:59 AM »
Hi, First post here.

I am experiencing intermittent failure of basic labels to update values with their PLC addresses. Some of the labels in the program, some of the time,in no particular pattern, display 0 - though the keypad functionality still works, and will update the PLC.

Restarting the program tends to solve this problem, and for any given instance of the program, the labels seem to either work, or not, and don't change their behavior during runtime.

The communication driver is ModbusTCPCom, and I am using AdvancedHMIv35

Does this bug have a known solution/cause?

Thanks,
Connor

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Basic Labels sometimes do not update
« Reply #1 on: August 06, 2018, 10:46:54 AM »
Are you using version 3.99x ?

SomeGuy

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Basic Labels sometimes do not update
« Reply #2 on: August 06, 2018, 01:54:57 PM »
Ah, sorry, I should've said - I am using version 3.99w.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Basic Labels sometimes do not update
« Reply #3 on: August 06, 2018, 03:17:29 PM »
I generally recommend trying the latest version first which is now 3.99y Beta. I do not see anything in the release notes that would indicate a fix for this, but not all minor fixes make it to the release notes.

https://www.advancedhmi.com/forum/index.php?topic=2058.0


SomeGuy

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Basic Labels sometimes do not update
« Reply #4 on: August 07, 2018, 09:05:31 PM »
The version change did not solve this issue, but I have found a workaround.

Setting DisableSubscriptions = true on ModbusTCPCom1 caused all of the labels to exhibit this behaviour, so it seemed to be a result of subscriptions failing to be established.
However, Subscription.SuccessfullySubscribed = true for the malfunctioning labels.

I suspect that the root cause is the CLICK Koyo PLC, as closing and reopening the form (as opposed to show and hide as I was doing) would randomize which labels failed (usually none), the same as a full restart had previously.


I ran a timer on the form, and on intervals ran the following subroutine, where L() is a list of the BasicLabels.

Code: [Select]
    Private Sub Check_Subscription()    'procs ever 200ms. About 6s to do the whole page
        Dim address, format, suffix, temp As String
        address = L(Check_Index).PLCAddressValue
        format = L(Check_Index).NumericFormat
        suffix = L(Check_Index).ValueSuffix
        Try
            temp = ModbusTCPCom1.Read(address, 1)(0)
            temp = CType(temp, Double).ToString(format) + suffix

            If L(Check_Index).Text <> temp Then    'If the value does not match the PLC value, re-subscribe
                Invoke(Sub() L(Check_Index).PLCAddressValue = "400000")
                Invoke(Sub() L(Check_Index).PLCAddressValue = address)
            End If
        Catch ex As Exception
        End Try

        Check_Index += 1
        If Check_Index >= L.Count Then
            Check_Index = 0
        End If
    End Sub

Changing the address of the label forces the BasicLabel's SubscribeToComDriver method to run, and doing so established a functional subscription.

It certainly is a bodge, but I'll leave that for posterity.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Basic Labels sometimes do not update
« Reply #5 on: August 07, 2018, 09:11:16 PM »
Try reducing the MaxReadGroupSize to a smaller value.