Author Topic: Simultaneous Connections to Controllogix  (Read 3182 times)

simon k

  • Newbie
  • *
  • Posts: 4
    • View Profile
Simultaneous Connections to Controllogix
« on: April 07, 2016, 05:49:38 AM »
Hi, I am new to Advanced HMI, but can already see that it is a great solution to many of the problems I have! well done!

However, I need to connect to two ControlLogix PLCs at the same time, from the same form. I spent a lot of time checking and rechecking that I have not made any mistakes, and I just can't figure out the problem.

I made the simplest form that I could based on the solution downloaded in AdvancedHMIBetaV399d

the 2 PLCs are a test PLC (192.168.0.81) and a live PLC (192.168.1.8 ). The test PLC has a tag address "Test_Bool" that is set to 1. The live PLC has a tag address "Sorting_Room_Puffers_Auto_En" that is also set to 1.

I placed a PilotLight control on the form, and allowed it to automatically create an EthernetIPforCLXCom driver. I then set the IP of the driver to my test PLC (192.168.0.81). I set the PLCAddressValue of the PilotLight to my test address (Test_Bool). I debugged the application and the pilotlight read the value and turned on faultlessly. I restarted the application several times and the pilotlight always came on.

I then changed the IP address of the driver to the address of the live PLC (192.168.1.8 ). I set the PLCAddressValue of the pilotlight to the required address (Sorting_Room_Puffers_Auto_En). I tested this in the same way and the pilot light always came on.

I changed the IP of the driver and the tag of the pilotlight back to that of the test PLC and retested to be sure

I then placed another PilotLight on the form, and allowed it to create another EthernetIPforCLXCom driver. I set the IP of the driver to my live PLC, and the address of the PilotLight to the live address.

This is when it becomes very flaky. When starting the application, sometimes the test PLC will connect, sometimes the live PLC will connect, sometimes neither PLC will connect, and very occasionally both PLCs will connect.

Here is the relevant section from InitializeComponent

Code: [Select]
        'EthernetIPforCLXCom1
        '
        Me.EthernetIPforCLXCom1.CIPConnectionSize = 508
        Me.EthernetIPforCLXCom1.DisableMultiServiceRequest = False
        Me.EthernetIPforCLXCom1.DisableSubscriptions = False
        Me.EthernetIPforCLXCom1.IPAddress = "192.168.0.81"
        Me.EthernetIPforCLXCom1.PollRateOverride = 500
        Me.EthernetIPforCLXCom1.Port = 44818
        Me.EthernetIPforCLXCom1.ProcessorSlot = 0
        '
        'PilotLight1
        '
        Me.PilotLight1.Blink = False
        Me.PilotLight1.CommComponent = Me.EthernetIPforCLXCom1
        Me.PilotLight1.LegendPlate = MfgControl.AdvancedHMI.Controls.PilotLight.LegendPlates.Large
        Me.PilotLight1.LightColor = MfgControl.AdvancedHMI.Controls.PilotLight.LightColors.Green
        Me.PilotLight1.LightColorOff = MfgControl.AdvancedHMI.Controls.PilotLight.LightColors.Red
        Me.PilotLight1.Location = New System.Drawing.Point(163, 312)
        Me.PilotLight1.Name = "PilotLight1"
        Me.PilotLight1.OutputType = MfgControl.AdvancedHMI.Controls.OutputType.MomentarySet
        Me.PilotLight1.PLCAddressClick = ""
        Me.PilotLight1.PLCAddressText = ""
        Me.PilotLight1.PLCAddressValue = "Test_Bool"
        Me.PilotLight1.PLCAddressVisible = ""
        Me.PilotLight1.Size = New System.Drawing.Size(75, 110)
        Me.PilotLight1.TabIndex = 45
        Me.PilotLight1.Text = "PilotLight1"
        Me.PilotLight1.Value = False
        '
        'PilotLight2
        '
        Me.PilotLight2.Blink = False
        Me.PilotLight2.CommComponent = Me.EthernetIPforCLXCom2
        Me.PilotLight2.LegendPlate = MfgControl.AdvancedHMI.Controls.PilotLight.LegendPlates.Large
        Me.PilotLight2.LightColor = MfgControl.AdvancedHMI.Controls.PilotLight.LightColors.Green
        Me.PilotLight2.LightColorOff = MfgControl.AdvancedHMI.Controls.PilotLight.LightColors.White
        Me.PilotLight2.Location = New System.Drawing.Point(459, 312)
        Me.PilotLight2.Name = "PilotLight2"
        Me.PilotLight2.OutputType = MfgControl.AdvancedHMI.Controls.OutputType.MomentarySet
        Me.PilotLight2.PLCAddressClick = ""
        Me.PilotLight2.PLCAddressText = ""
        Me.PilotLight2.PLCAddressValue = "Sorting_Room_Puffers_Auto_En"
        Me.PilotLight2.PLCAddressVisible = ""
        Me.PilotLight2.Size = New System.Drawing.Size(75, 110)
        Me.PilotLight2.TabIndex = 46
        Me.PilotLight2.Text = "PilotLight2"
        Me.PilotLight2.Value = False
        '
        'EthernetIPforCLXCom2
        '
        Me.EthernetIPforCLXCom2.CIPConnectionSize = 508
        Me.EthernetIPforCLXCom2.DisableMultiServiceRequest = False
        Me.EthernetIPforCLXCom2.DisableSubscriptions = False
        Me.EthernetIPforCLXCom2.IPAddress = "192.168.1.8"
        Me.EthernetIPforCLXCom2.PollRateOverride = 500
        Me.EthernetIPforCLXCom2.Port = 44818
        Me.EthernetIPforCLXCom2.ProcessorSlot = 0

I then added an event handler for each of the drivers for the ComError event, along with a handler for the Connected event - this is the only custom code in the application, everything else is drag and drop from the toolbox and set via properties:

Code: [Select]
    Private Sub EthernetIPforCLXCom1_ComError(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles EthernetIPforCLXCom1.ComError

        If (e.ErrorMessage.StartsWith("Could not connect to ")) Then
            Diagnostics.Debug.WriteLine("CLXCom1_ComError " & e.ErrorMessage & " but should connect to " & CType(sender, AdvancedHMIDrivers.EthernetIPforCLXCom).IPAddress)

        Else
            Diagnostics.Debug.WriteLine("CLXCom1_ComError " & e.ErrorMessage)
        End If

    End Sub

    Private Sub EthernetIPforCLXCom2_ComError(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles EthernetIPforCLXCom2.ComError

        If (e.ErrorMessage.StartsWith("Could not connect to ")) Then
            Diagnostics.Debug.WriteLine("CLXCom2_ComError " & e.ErrorMessage & " but should connect to " & CType(sender, AdvancedHMIDrivers.EthernetIPforCLXCom).IPAddress)

        Else
            Diagnostics.Debug.WriteLine("CLXCom2_ComError " & e.ErrorMessage)
        End If

    End Sub

    Private Sub EthernetIPforCLXCom1_ConnectionEstablished(sender As Object, e As EventArgs) Handles EthernetIPforCLXCom1.ConnectionEstablished
        Diagnostics.Debug.WriteLine("CLXCom1 connected")
    End Sub

    Private Sub EthernetIPforCLXCom2_ConnectionEstablished(sender As Object, e As EventArgs) Handles EthernetIPforCLXCom2.ConnectionEstablished
        Diagnostics.Debug.WriteLine("CLXCom2 connected")
    End Sub


After starting the application, it does nothing for 3-4 seconds, then the error handlers start writing debug messages. I get many different errors, but the error shown here concerns me the most

Quote
CLXCom2_ComError Could not connect to 192.168.0.81, port 44818. Timed out but should connect to 192.168.1.8
CLXCom1_ComError Could not connect to 192.168.0.81, port 44818. Timed out but should connect to 192.168.0.81
CLXCom2_ComError 192.168.0.81 An invalid argument was supplied
CLXCom1_ComError 192.168.0.81 An invalid argument was supplied

EthernetIPforCLXCom2 is configured to connect to 192.168.1.8, but is attempting to connect to 192.168.0.81

It seems like the drivers may be cross threading or somehow sharing the IP addresses and other resources when trying to connect.

The next time I ran it, the situation reversed, EthernetIPFormCLXCom1 was trying to use the IP for the other driver!

Quote
CLXCom1_ComError Could not connect to 192.168.1.8, port 44818. Timed out but should connect to 192.168.0.81
CLXCom2_ComError Could not connect to 192.168.1.8, port 44818. Timed out but should connect to 192.168.1.8
CLXCom1 connected
CLXCom2 connected
CLXCom1_ComError Unknown Code 256
CLXCom2_ComError Unknown Code 256
CLXCom1_ComError CIP - Path Segment Error (Invalid Tag Name)
CLXCom1_ComError CIP - Path Segment Error (Invalid Tag Name)
CLXCom1_ComError CIP - Path Segment Error (Invalid Tag Name)
.... continuing

I do get some other error messages, and I can only assume that they're all related to something like a threading issue

Quote from: another error scenario
CLXCom2_ComError No Response from PLC(21)
CLXCom1_ComError No Response from PLC(21)
CLXCom2_ComError No Response from PLC(22)
CLXCom1_ComError No Response from PLC(22)
CLXCom2 connected
CLXCom1 connected
CLXCom1_ComError CIP - Path Segment Error (Invalid Tag Name)
CLXCom1_ComError CIP - Path Segment Error (Invalid Tag Name)
CLXCom1_ComError CIP - Path Segment Error (Invalid Tag Name)
CLXCom1_ComError CIP - Path Segment Error (Invalid Tag Name)
...

I am very eager to use this tool, but I must be able to connect to multiple PLCs!

thanks very much
Simon

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Simultaneous Connections to Controllogix
« Reply #1 on: April 07, 2016, 07:27:33 AM »
The Path Segment Error is usually an invalid tag. Are you using all controller scope tags?

Which version of AdvancedHMI are you using?

I won't have access to 2 ControlLogix PLCs for about a week and half, so I can give you some various things to try so we can try to figure out the problem. The first place to start is using Wireshark. If you run a Wireshark packet capture and send it directly to me at the support at advancedhmi email, I will be able to see much more of what is happening.

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Simultaneous Connections to Controllogix
« Reply #2 on: April 07, 2016, 12:32:36 PM »
Hi Simon,

I would suggest that your problem lies within IP Addresses of  PLC. Since as per your your specification I would guess that you have set the IP Address of your PC to automatic thus when you connect to 192.168.0.81 your PC IP Address becomes 192.168.0.xxx and when you try to connect to 192.168.1.8 your PC IP Address becomes 192.168.1.xxx.

But when you try to connect both the PLC at the same time it will either take 192.168.0.xxx series or 192.168.1.xxx series and the other driver will go into error mode or both will go to error mode.

I would suggest that you convert your PLC address to either of the series and then try connecting it.

Hope this will help you solve your problem.

simon k

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Simultaneous Connections to Controllogix
« Reply #3 on: April 07, 2016, 07:59:34 PM »
The Path Segment Error is usually an invalid tag. Are you using all controller scope tags?

Which version of AdvancedHMI are you using?

I won't have access to 2 ControlLogix PLCs for about a week and half, so I can give you some various things to try so we can try to figure out the problem. The first place to start is using Wireshark. If you run a Wireshark packet capture and send it directly to me at the support at advancedhmi email, I will be able to see much more of what is happening.

thanks Archie - as I said in my post above, everything has come from AdvancedHMIBetaV399d

the path segment error would be due to an invalid tag, which adds weight to my assumption about the same IP address being used by both drivers - if one driver has picked up the IP from the other driver, and has connected, then the tags it's looking for won't exist - they're on the other PLC

Wireshark log will come through soon

aquilmustafa - thanks for the input, but TCPIP doesn't work like that, gateways and subnets take care of it

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Simultaneous Connections to Controllogix
« Reply #4 on: April 07, 2016, 10:29:33 PM »
Quote
This is when it becomes very flaky. When starting the application, sometimes the test PLC will connect, sometimes the live PLC will connect, sometimes neither PLC will connect, and very occasionally both PLCs will connect.

According to the results you posted, to me this looks like the timing issue.

Could it be that your IP addresses are changing while the same driver is operating?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Simultaneous Connections to Controllogix
« Reply #5 on: April 07, 2016, 10:32:45 PM »
He sent me some Wiresharks and I found an issue in the driver. The 2 drivers were both trying to create a DLL layer at the same time. A fix for this will be in the next release.