This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Modbus RTU to TCP bridging
#1
Hi,

It has probably been asked before, but I can't seem to find any proper thread or answer to this,
so I'll try again Smile

Is it possible to add several RTU devices to LM5 and then bridge them to modbus TCP as well?
Making the LM5 a modbus rtu to tcp gateway.

I Have several meters connected to my LM5 over rtu, and would like to expose these to another device on my network.
I already have a template for my meters on my other PLC, so would be great if i could expose my modbus devices 
with the same register addresses, so no work on the PLC template are necessary.


Br
Christian
Best regards
Christian
Reply
#2
All you need is now modbus TCP slave.
https://openrb.com/lm-as-modbus-tcp-slave/
------------------------------
Ctrl+F5
Reply
#3
Thanks Daniel! Smile

I have tried this script, but as far as I can see, this script needs to map all modbus registers through knx before exposing them to modbus TCP again.
Wouldn't that make the original modbus addressing shift, so that I need to create new profiles on my receiving PLC?

So the first mapping defined in the list of registers, eg GA 1/3/67, would be exposed on Modbus TCP as register 0 and so on.

-- list of register mapping, starting from 0
registers = { '1/3/67' }

-- list of register data types, element count must match registers table
regdt = { dt.float32 }

I was looking for a solution were i could poll the modbus RTU devices by their actual modbus ID, and same register for each ID.

For instance:

ID: Register: Desc:
151 3019 Voltage A-B for slave #151
152 3019 Voltage A-B for slave #152
153 3019 Voltage A-B for slave #153

Is that possible?
Best regards
Christian
Reply
#4
This is quite complicated.
------------------------------
Ctrl+F5
Reply
#5
The LM Modbus slave supports only one ID. Another possible solution is to run Modbus slave on your PLC and make LM write values to it periodically.
Reply
#6
Just use a EGX150 for this task, that is why we created it (:

Connect your RTU to the Link150 and read the devices from LM over IP and you can read them from any other location as well.. No configuration and scripts needed just set the IP and RTU settings and done.
Reply
#7
Thanks guys! I bought a EGX150, and waiting for it to arrive Smile

Still interessted in a solution to send control commands to my NSX devices over RTU (trv00210).
Have you seen my PM Erwin? Seems like the script isn't working for me.
Best regards
Christian
Reply
#8
Did you unlock the locking pad on the IFM interface? 

• protected by password where a password is required in the command
• protected by configuration: ◦ with the IFM interface, the remote control commands are enabled when the locking pad on the IFM interface is in the open position.

In sample below the used password is 0000 (ASCII 00 = 00110000 00110000 => 12336 in Decimal) 

Code:
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485', 19200, 'E', 8, 1, 'H')
mb:connect()
mb:setslave(1)
if event.getvalue() == true then
  mb:writeregisters(7999, 904, 10, 4353,1,12336,12336,0,0,0,0,0,0,0,0,0,0,0,8019,8020,8021) -- Open command
else
  mb:writeregisters(7999, 905, 10, 4353,1,12336,12336,0,0,0,0,0,0,0,0,0,0,0,8019,8020,8021) -- Close command
end
mb:close()
Reply
#9
Hi Erwin,

Thanks for getting back to me! Big Grin

The IFM interface is in the unlocked position. I've just tried with your password 0000, as I don't think or know if there's been set any other user password on these devices.
Could that be changed og checked with some software tools?

(25.05.2021, 08:57)Erwin van der Zwart Wrote: Did you unlock the locking pad on the IFM interface? 

• protected by password where a password is required in the command
• protected by configuration: ◦ with the IFM interface, the remote control commands are enabled when the locking pad on the IFM interface is in the open position.

In sample below the used password is 0000 (ASCII 00 = 00110000 00110000 => 12336 in Decimal) 

Code:
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485', 19200, 'E', 8, 1, 'H')
mb:connect()
mb:setslave(1)
if event.getvalue() == true then
  mb:writeregisters(7999, 904, 10, 4353,1,12336,12336,0,0,0,0,0,0,0,0,0,0,0,8019,8020,8021) -- Open command
else
  mb:writeregisters(7999, 905, 10, 4353,1,12336,12336,0,0,0,0,0,0,0,0,0,0,0,8019,8020,8021) -- Close command
end
mb:close()

Hi Erwin,

Since I can't fiqure out how to send an attachment in PM, i'll just try here.

Attached Files Thumbnail(s)
   
.json   Compact_NSX-Compact_NSX_E.json (Size: 24.04 KB / Downloads: 5)
Best regards
Christian
Reply
#10
Does your NSX has the motor control add-on option(s)? A default NSX is without this option..
Reply
#11
yes, they skould be equiped with those. It goes some wiring inside the NSX breakers, and in the circuit diagram there's a circuit-breaker called Supply for NSX motors.

I've added a few more modbus registers to my profile, and I now try to read out the status registers 8020 and 8021.

I get the following response:
8020 = 905 ( command for close )
8021 = 775 ( error kode 7?, which means: Negative acknowledgment, The slave cannot perform the programming request sent by the master. )
Best regards
Christian
Reply
#12
i made this application with automation server and for open/close i write only the first 5 register ( from 8000 to 8005 ).
Reply


Forum Jump: