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 - stix

Pages: [1]
1
I am thinking it is the higher number of labels (180) causing the issue as well -because it seems to work with a limited number. It will choke around 100 or so and sometimes further down, sometimes it will do all of them.
  I am not sure how your driver is coded internally , but my guess is your subscriptions are added to a list of some sort and it is the remove and add that get in the way of each other. It does seem to behave like an issue with access to the list removing and inserting. If I update a second time - the update seems to work (obviously fewer changes). Perhaps it would be nice to be able to do a bulk Address Change where a bulk of Addresses are removed first and then added - for example as a group. This might be more efficient for the driver. In my application I have basically the same layout for 4 to 6 Forms - I auto generate the form with the Labels. On any given form load I need to change the base address from System01, to System02 etc.. So I would like to have a single form with the layout and simply change the IO points. On the Button_Click handler. For System01, System02 etc... similar to   System01_Click(sender as object, e as eventargs) ChangeSystem("System01") End
ChangeSystem(systemName As String) '   Iterate Addresses and change to systemName.

Each of my labels has to do an unsubscribe and a resubscribe - I am sure other things are happening at the same time inside the driver - it makes it inefficient . So if I could unsubscribe all labels as a  group, and then Subscribe them as a different group of addresses ) I would be doing a bulk unsubscribe, then resubscribe .. Much like using SuspendLayout , ResumeLayout on a Winform control.
 


2
AdvHMI V3.99K

I guess in what I am doing - the behavior might be comparable to changing forms quickly - the subscriptions in the driver are not being updated fast enough - maybe a race condition of sorts is happening. I cant see your driver code - so I am wondering how the transition of the subscriptions are done; especially considering with 180 elements on the Form. I wonder if you have the Subscriptions added to a queue or list(Of T) in the driver.


Again here is my code:

Code: [Select]
    Private Sub ReAssignPLCAddress(planningClass As String, Is_ReadOnly As Boolean)
        IsReadOnly = Is_ReadOnly
        tblPlan.SuspendLayout()
        Dim element As Integer = 0
        Dim total As Integer = tblPlan.RowCount - 1
        For element = 0 To total
            Dim rowIndexer As String = "[" + element.ToString() + "]."
            For gutters As Integer = 1 To 4
                Try
                    Dim num As String = gutters.ToString()
                    Dim gutterTag As String = "Length_Cog_" + num + "_Inches"
                    Dim plcPath As String = planningClass + rowIndexer + gutterTag
                    Dim tempLabel As BasicLabel = New BasicLabel()
                    Dim ctrlX As Control() = tblPlan.Controls.Find(element.ToString() + gutterTag, True)
                    Dim ctrl As Control = ctrlX(0)
                    If Not ctrl Is Nothing Then
                        If ctrl.GetType() Is GetType(AdvancedHMIControls.BasicLabel) Then
                            tempLabel = ctrl
                            tempLabel.PLCAddressValue = plcPath
                            If IsReadOnly Then
                                tempLabel.PLCAddressKeypad = ""
                            Else
                                tempLabel.PLCAddressKeypad = plcPath
                            End If
                        End If
                    End If
                Catch ex As Exception
                    Dim err As String = ex.ToString()
                End Try
            Next
        Next
        tblPlan.Update()
    End Sub

3
Yes - the com component is on the form and set, I add the controls programmatically - this works fine - strangely enough. If I then try to reassign addresses - I have issues with them reassigning.
I am seeing sometimes it works flawlessly and at other times not. It gets sluggish or locks the UI. They appear to eventually update  - but sometimes after the UI is hung and 30 seconds plus goes by and then I see changes and they may not always be what I expect.  I replied on the sluggish driver thread - because this seems to be the issue my code is posted there.
I think this post really belongs on that thread.
 I do notice when iterating the items to write simply : myDriver.Write(address,value) it can get confused and will not take the value into the PLC.; this same behaviour can also be noticed
when entering in on the keypad rapidly from one basiclabel to the other basiclabel etc.. will cause a similar effect. 


 


4
Support Questions / Re: Driver slowing to a halt - almost
« on: June 21, 2016, 12:34:43 PM »
I have had a similar issue reassigning PLC Addresses - I have tried to do this both with the driver on the form and also creating it programatically : I have 180 objects on the form using BasicLabel , I change the PLC Address through an Iteration and use FindControl(controlName,true) on each control I then set the PLCAddress . This works to some extent - if I do this 3 times in a row it can choke, sometimes it will do 12 times, So if you imagine a UDT in the Compact Logix PLC  'MySystem01.ValueTag'  where I change to 'MySystem02.ValueTag' and so on for 12 different components. I simply reassign all 180 objects on the screen to the new Address.  This works for a few times and then slogs down and locks my UI, I wait and wait a bit and then my UI comes back, and I can change and change and then slog even half way through.

Code: [Select]
    Private Sub ReAssignPLCAddress(planningClass As String, Is_ReadOnly As Boolean)
        IsReadOnly = Is_ReadOnly
        tblPlan.SuspendLayout()
        Dim element As Integer = 0
        Dim total As Integer = tblPlan.RowCount - 1
        For element = 0 To total
            Dim rowIndexer As String = "[" + element.ToString() + "]."
            For gutters As Integer = 1 To 4
                Try
                    Dim num As String = gutters.ToString()
                    Dim gutterTag As String = "Length_Cog_" + num + "_Inches"
                    Dim plcPath As String = planningClass + rowIndexer + gutterTag
                    Dim tempLabel As BasicLabel = New BasicLabel()
                    Dim ctrlX As Control() = tblPlan.Controls.Find(element.ToString() + gutterTag, True)
                    Dim ctrl As Control = ctrlX(0)
                    If Not ctrl Is Nothing Then
                        If ctrl.GetType() Is GetType(AdvancedHMIControls.BasicLabel) Then
                            tempLabel = ctrl
                            tempLabel.PLCAddressValue = plcPath
                            If IsReadOnly Then
                                tempLabel.PLCAddressKeypad = ""
                            Else
                                tempLabel.PLCAddressKeypad = plcPath
                            End If
                        End If
                    End If
                Catch ex As Exception
                    Dim err As String = ex.ToString()
                End Try
            Next
        Next
        tblPlan.Update()
    End Sub

5
I have approximately 180 Labels programmatically added to a Windows Form. I iterate to create the PLCAddress , my labels do not update. They stay the same - no change in values. I believe it has something to do when the subscription is created, I have tried to modify the code for PLCAddress property and use place the Subscriptions.UnSubscribe method in the Setter but that did not work either. Any ideas ?

Pages: [1]