Author Topic: Multiple instance of modbusTCPCom  (Read 2079 times)

robkwan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Multiple instance of modbusTCPCom
« on: November 11, 2015, 05:56:29 PM »
Application form runs PopupForm.ShowDialog() which has basicLabel mapped to PLC address. Click on basicLabel brings up virtual keypad.

I pass the modbusTCPCom component by setting to a static variable, then on PopupForm.Load, set the basicLabel.CommComponent from the static variable.

The basicLabel displays "CommComponent Property not set" when Enter is pressed on the keypad.

It should work? If not, is there a workaround other than dropping a modbusTCPCom component onto PopupForm and run another instance of Modbus server for the new TCP port.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Multiple instance of modbusTCPCom
« Reply #1 on: November 11, 2015, 06:00:58 PM »
There is no drawback to using another driver instance. The transport layer is shared among all drivers with the same IP address, so another connection is not actually opened.

robkwan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Multiple instance of modbusTCPCom
« Reply #2 on: November 12, 2015, 12:29:13 PM »
Yes, all driver instances will set to the same IP address. But can all instances set to the same port number?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Multiple instance of modbusTCPCom
« Reply #3 on: November 12, 2015, 04:42:01 PM »
When the driver is first created, it will check all open connections for a matching IP address and TCP/IP port number. If one is found, then it will send data to the existing connection, otherwise it creates a new connection.

robkwan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Multiple instance of modbusTCPCom
« Reply #4 on: November 13, 2015, 03:52:21 PM »
I assign the AdvancedHMI control PLCAddress at runtime, much easier to maintain than assign them at design time.

For ModbusTCPCom Read():
Does it return the value locally where the driver updates at poll rate or does it make a TCP trip to get the value?

For ModbusTCPCom Write:
Does it queue the writes for the driver to write a block or does it make an immediate TCP trip to send the single value?

I would assume the former is true in both Read & Write. Can you please confirm this.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Multiple instance of modbusTCPCom
« Reply #5 on: November 13, 2015, 05:36:31 PM »
Each Read will queue another packet independent of what subscriptions are doing. Unlike OPC, you will never receive "dirty" data that you have to check to quality of.

Writes are similar. Each write will immediately send a packet.