Author Topic: Modbus fix  (Read 13151 times)

vitico bon

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Modbus fix
« on: January 09, 2017, 09:58:53 AM »
Archie/Godra,

Fist I would like to pass my recognition for the time and effort that you guy  are putting helping me, I hope that the result of all that will be a better and more robust product that is already amazing.   
Today I spent some time testing modbus, I did a fresh download of the 399r version and rebuild the applications. For my test, according to Archie he the 399r version already have the fix. And here is what I found.

Keeping in mind that I am working on a PC application, the goal is to be able to open two identical windows showing/controlling data in two (or more) devices simultaneously, also I use a MDI form as startup that dynamically load as many instances of ModbusRTUCom to collect data for trending and alarms, so I am hitting each device at a frequency of about 2 seconds. 

Now here is what I found with the revised version, I can open one window and all my data comes, then I open another instance of the window to the other device, the data to the second window start coming but the data to the first instance stop coming until I close the second one. Better than before but not quite as I need it, I would like the customer to be able to see data simultaneously in the two windows, also the data collection get affected by this.

Thank you guys.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Modbus fix
« Reply #1 on: January 09, 2017, 10:52:46 AM »
Are you using 3.99r or 3.99t?

vitico bon

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Modbus fix
« Reply #2 on: January 09, 2017, 11:02:08 AM »
I am using the version that I just downloaded from the link in the home page, Now that I double check that is version t.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Modbus fix
« Reply #3 on: January 09, 2017, 12:52:52 PM »
The way I understand this, you can only communicate to 1 station at the time (unless you establish some sort of timed switching).

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Modbus fix
« Reply #4 on: January 09, 2017, 01:33:58 PM »
When I did my testing, I used 2 driver instances and 2 BasicLabels to show values from 2 controllers simultaneously

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Modbus fix
« Reply #5 on: January 09, 2017, 01:51:33 PM »
From Victor's other topic, he seems to be looking to use 2 instances of the same form and just changing the driver's StationAddress.

If he doesn't keep on switching the StationAddress back and forth then the driver will be communicating with 1 station only.

vitico bon

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Modbus fix
« Reply #6 on: January 09, 2017, 01:57:34 PM »
In that case let me try to do a test with as many drivers as devices I intent to control here (no more than 8) and use the DisableSubcription to enable only the one I need. No idea how this is going to go since I will have to change also the ComComponet on each one of the controls in the code. but it worth the try. There also be a issue with a few direct read and write that I do in the program.

Ideally, since the device ID is part of the command and have nothing to do with the port itself  you should be able to change the device ID on the fly so commands can be send to any device, but maybe this is not possible because of the way the hole driver was put together trying to accommodate several protocols.
 

vitico bon

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Modbus fix
« Reply #7 on: January 09, 2017, 02:00:18 PM »
You are correct Godra, let me see if by the end of the day I can make a small movie of the system and load it here, else I will put it in youtube and will give you the link.

vitico bon

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Modbus fix
« Reply #8 on: January 09, 2017, 06:37:55 PM »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Modbus fix
« Reply #9 on: January 09, 2017, 07:49:46 PM »
I created a simple app that uses multiple instances of the same form. I can open both forms simultaneously and I still get updates from both controllers. I posted the project in the sample project section under the name ModbusRTUMultiNodev399t

https://sourceforge.net/projects/advancedhmi/files/advancedhmi/3.5/SampleProjects/
« Last Edit: January 09, 2017, 09:13:12 PM by Archie »

vitico bon

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Modbus fix
« Reply #10 on: January 10, 2017, 09:40:48 AM »
Were you using a real hardware or a simulator?.  I just run your program with same result, when windows are open one at the time everything seem ok, but is you open both windows at the same time only one control is updating his values (only one tx LED is blinking)

I do not believe this have to do with hardware since I already tested it with a GE product.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Modbus fix
« Reply #11 on: January 10, 2017, 09:48:16 AM »
Were you using a real hardware or a simulator?.  I just run your program with same result, when windows are open one at the time everything seem ok, but is you open both windows at the same time only one control is updating his values (only one tx LED is blinking)
I tested this with 2 Solo temperature controllers. Try setting the EnableLogging property of the driver to True. Then run the test and post the log file that was generated.

vitico bon

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Modbus fix
« Reply #12 on: January 10, 2017, 10:10:55 AM »
Will do, but also, and keeping in mind that I am new to .net    I had to recompile your program to adjust to the port setting of my hardware.       Is it possible that I am missing some project settings here? 

vitico bon

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Modbus fix
« Reply #13 on: January 10, 2017, 10:21:31 AM »
Ok this must tell you something! Using your test the only data in the DriverLog.txt was the one collected during your test, then just to doublecheck I deleted it and open the program again, and no new log file was created. I think I have something grown in my setup.

BTW I am using Visual Studio 2010 R1.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Modbus fix
« Reply #14 on: January 10, 2017, 10:56:26 AM »
I started the test application and immediately clicked both buttons to open both windows. Attached is the DriverLog.txt file that it generated. You can see that it alternates between address 1 and 2.