Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - texasdru92

Pages: [1]
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  ;D. 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:
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

2
Support Questions / Monitor different tags with DataSubscriber2 help
« on: January 13, 2025, 02:31:49 PM »
I'm not sure what I'm doing wrong, but I'm trying to use a DataSubscriber2 to get a basicIndicator color to change when a specific PLC tag is true. I have tried two different ways:

First
Code: [Select]
    Private Sub Divert3_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles Divert3.DataReturned
        Dim full As Boolean = False
        Dim half_full As Boolean = False

        If e.PlcAddress = "SORT_LANE3_HALF_FULL_TIMER.DN" Then
            If e.Values(0) = True Then
                Divert_3.Color1 = Color.Yellow
                half_full = True
            End If
        End If

        If e.PlcAddress = "SORT_LANE3_FULL_TIMER.DN" Then
            If e.Values(0) = True Then
                Divert_3.Color1 = Color.Blue
                full = True
            End If
        End If

        If e.PlcAddress = "SORT_LANE3_ACTIVE" Then
            If e.Values(0) = True And half_full = False And full = False Then
                Divert_3.Color1 = Color.Green
            End If
        End If

Second
Code: [Select]
    Private Sub Divert6_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles Divert6.DataReturned
        Dim full As Boolean = False
        Dim half_full As Boolean = False
        Dim active As Boolean = False

        If e.PlcAddress = "SORT_LANE6_FULL_TIMER.DN" Then
            If e.Values(0) = True Then
                'Divert_6.Color1 = Color.Blue
                full = True
            End If
        End If



        If e.PlcAddress = "SORT_LANE6_ACTIVE" Then
            If e.Values(0) = True Then
                'Divert_6.Color1 = Color.Green
                active = True
            End If
        End If

        If e.PlcAddress = "SORT_LANE6_HALF_FULL_TIMER.DN" Then
            If e.Values(0) = True Then
                'Divert_6.Color1 = Color.Yellow
                half_full = True
            End If
        End If

        If active And Not half_full And Not full Then
            Divert_6.Color1 = Color.Green
        ElseIf active And full And half_full Then
            Divert_6.Color1 = Color.Blue
        ElseIf active And Not full And half_full Then
            Divert_6.Color1 = Color.Yellow
        End If

    End Sub

Pages: [1]