1
Support Questions / Re: Monitor different tags with DataSubscriber2 help
« on: January 13, 2025, 09:24:26 PM »
Thanks for the reply @Archie. I'm using DataSubscriber for this because I want to add more states (colors) such as divert active, divert disabled, divert 50% full, divert 100% full, and divert jam.. and maybe more . I thought using DataSubscribers with BasicIndicators was the way to achieve this. I believe I fixed it by changing the scope of divert status variables. It seems to be working with all the diverts being full, but I'm connecting to my system through a VPN so its pretty slow, I'll check it when I'm on-site tomorrow.
Here is the updated code:
Here is the updated code:
Code: [Select]
Private d5_full As Boolean = False
Private d5_half_full As Boolean = False
Private d5_active As Boolean = False
Private Sub Divert5_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs)
If e.PlcAddress = "SORT_LANE5_FULL_TIMER.DN" Then
If e.Values(0) = True Then
d5_full = True
End If
End If
If e.PlcAddress = "SORT_LANE5_ACTIVE" Then
If e.Values(0) = True Then
d5_active = True
End If
End If
If e.PlcAddress = "SORT_LANE5_HALF_FULL_TIMER.DN" Then
If e.Values(0) = True Then
d5_half_full = True
End If
End If
If d5_active And Not d5_half_full And Not d5_full Then
Divert_5.Color1 = Color.Green
ElseIf d5_active And d5_full And d5_half_full Then
Divert_5.Color1 = Color.Blue
ElseIf d5_active And Not d5_full And d5_half_full Then
Divert_5.Color1 = Color.Yellow
End If
End Sub