Author Topic: Modbus-RTU help  (Read 3112 times)

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Modbus-RTU help
« on: January 20, 2021, 08:10:58 AM »
Hi All,

I'm looking for Modbus-RTU Slave communication. I've tried using Shortbus but failed drastically. Can some one please guide me in right direction or help me figure out with Modbus-RTU slave comms. in vb.net.

I've designed siemen's drivers around Advanced HMI using libnodave successfully. I'm collecting the data also. Now that data needs to be shared with other scada using either OPC DA/UA server or Modbus-RTU/TCP slave. I cannot find support to any of these drivers over here. Can some one please help me.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Modbus-RTU help
« Reply #1 on: January 20, 2021, 02:46:04 PM »
AdvancedHMI does not have any drivers as Modbus slaves. If OPC DA is an option, you could use the OpcDaCom driver.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Modbus-RTU help
« Reply #2 on: January 20, 2021, 03:44:51 PM »
If OpcDaCom driver is an option then just ignore the following suggestion.

nModbus library provides an option for creating a slave, that's how the following simulator was created:

   https://www.advancedhmi.com/forum/index.php?topic=2567.0

You can just use the simulator to share the data, either the one mentioned above or MODRSsim2.
Just bridge your data collecting, to write it to the simulator at the same time, and have the other SCADA access the simulator directly.
See this component:

   https://www.advancedhmi.com/forum/index.php?topic=2672.0

Or use database instead.
« Last Edit: January 20, 2021, 03:58:04 PM by Godra »

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Modbus-RTU help
« Reply #3 on: January 20, 2021, 09:20:38 PM »
hey archie,

never used opc can you please guide me how to?

I don't have OPC Server in place. What other options do I have in my hands..
« Last Edit: January 20, 2021, 09:31:15 PM by aquilmustafa »

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Modbus-RTU help
« Reply #4 on: January 20, 2021, 09:28:32 PM »
Hey godra,

I've been trying to get the NModbus connected but since all the codes are written in c# I'm unable to advance more into it. Can you please guide me with an example of NModbus in vb.net.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Modbus-RTU help
« Reply #5 on: January 20, 2021, 10:04:03 PM »
The simulator app itself is a VB code that is using nModbus dll.


   

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Modbus-RTU help
« Reply #6 on: January 21, 2021, 09:28:46 AM »
Hi Archie and Godra,

Thanks both for the support and quick reply. I've started using NModbus and successfully created Modbus-TCP slave which I was able to test successfully with modscan64.

Now I'm stuck at reading the data back from Master. If you could please help me with that It will be very helpful.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Modbus-RTU help
« Reply #7 on: January 21, 2021, 07:39:41 PM »
I don't have any further suggestions for you.

In my opinion, you have been given enough information to figure this out on your own, especially considering that you are dealing with software you created.

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Modbus-RTU help
« Reply #8 on: January 22, 2021, 10:17:14 AM »
Thank you Archie and Godra for all the help.

I've successfully completed the project.

Hope we might have OPC server and client added to the new version.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Modbus-RTU help
« Reply #9 on: January 23, 2021, 08:38:15 PM »
If you do bother explaining how you resolved this then the next person with similar issue might be able to use it and do the same.

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Modbus-RTU help
« Reply #10 on: January 24, 2021, 08:59:08 PM »
Hi,

For communicating with Siemens I used AHMI updated by Mr. Bryan Goose for Siemens protocol though I've made some changes into it to remove the shortcomings of the project like it was unable to read values above M2.7.

Then I was stuck with Modbus Slave drivers but as per Godra's suggestion a link posted by Godra for NModbus  https://www.advancedhmi.com/forum/index.php?topic=2567.0

It had codes for Modbus Slave Drivers for all three RTU/ASCII/TCP. I used that as the reference to collect the data.

The software I developed was like OPC. It worked in background to collect the data from from 2 siemens PLCs and 5 ABB PLCs (on Modbus TCP Slave) and send them to Emerson SCADA using Modbus-TCP on IP:127.0.0.1 and Port:502. Though I'm still unable to read the data in Float and Char Format. Hope someone might help out with that too.

Anyways a big thanks to Archie for AHMI and this beautiful forum. And thanks to Godra for that lifesaving suggestion at the right moment.
« Last Edit: January 24, 2021, 09:02:43 PM by aquilmustafa »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Modbus-RTU help
« Reply #11 on: January 25, 2021, 06:37:03 PM »
I am not familiar with your setup or the software you created but here are some general things about Modbus:

Float32 or single values are 32-bit and stored into two consecutive 16-bit registers.
Float64 or double values are 64-bit and stored into four consecutive 16-bit registers.

A single 16-bit register can hold either 1 or 2 characters (8-bit each) so you would generally need to know the length of the stored string, divide it by 2 and if necessary round it up to get the total number of 16-bit registers that are storing this string. For example, either a 7 or 8 character string is stored in 4 consecutive registers.

For as long as you can read registers then you can extract these values in the code.

There is also a consideration about byte and word swapping.
« Last Edit: January 25, 2021, 06:46:53 PM by Godra »