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 limits
#1
I state that I have read all the posts containing the term "modbus" but have not found an answer

Situation: Wiser4KNX which interrogates about 30 slave devices made up of switches or meters (Masterpact, Compact NSX, PowerTags, etc.) connected to Modbus TCP gateways (ComX510, IFE, Smartlink).
No connection problems.

For each of these devices only 2 registers are needed: Active Power and Active Energy.

Overall, therefore, a small amount of information is acquired from the system.

If I configure the devices in the Modbus section, using the preloaded profiles, after 7-8 objects an error message appears: "The limit has been reached. It is not possible to add objects of the same type".

If I access by script I can configure further 7-8 devices (therefore a total of about 16 readings).




Code:
require('luamodbus')

mb = luamodbus.tcp()
mb:open('192.168.90.105', 502)
res, err = mb:connect()
if res then
  mb:setslave(1)
  value1 = mb:readregistervalue(32095,"uint64") * 0.001   
  grp.update("50/3/0", value1)
  mb:setslave(2)
  value2 = mb:readregistervalue(1999,"int32")             
  grp.update("50/3/1", value2)
  mb:setslave(3)
  value3 = mb:readregistervalue(1999,"int32")                         
  grp.update("50/3/2", value3)
  mb:setslave(4)
  value4 = mb:readregistervalue(1999,"int32")                            
  grp.update("50/3/3", value4)
  mb:setslave(5)
  value5 = mb:readregistervalue(1999,"int32")                            
  grp.update("50/3/4", value5)
  mb:setslave(6)
  value6 = mb:readregistervalue(1999,"int32")                            
  grp.update("50/3/5", value6)
  mb:setslave(7)
  value7 = mb:readregistervalue(1999,"int32")                            
  grp.update("50/3/6", value7)
else
  log('connect failed', err)
end
mb:close()


Each additional line of code produces no reading.


In the Modbus configuration I tried to differentiate the ip hosts or the polling time but the result does not change.

What is this limitation determined by?

Thanks
Reply
#2
Hi,

First of all a Wiser for KNX can host a maximum of 10 devices by profile, this is a software restriction that is build in the Wiser for KNX firmware, if you need more profiles then you need to have a spaceLYnk that has no software limit. You should be able to read the 30 devices by profile with a spaceLYnk.

As i understand it correctly you now have several devices by profile and another set by script, do you read them over the same gateway (ICF module)?

If yes then i think you have a port (502) conflict when the profile and the script are reading the same device at the same moment. If that is the case i would advice you to read them all in sequence from script and to remove the other devices from the Modbus template engine.

To simplify your script (and have some extra routine checks) you can do this:
Code:
require('luamodbus')
mb = luamodbus.tcp()
mb:open('192.168.90.105', 502)
res, err = mb:connect()
if res then
  mb:setslave(1)
  value = mb:readregistervalue(32095,"uint64")
  if value then
     value = value * 0.001
     grp.update("50/3/0", value)
  end
  for i = 2, 6, 1 do
    os.sleep(0.2)
    mb:setslave(i)
    value = mb:readregistervalue(1999,"int32")            
    if value then   
       grp.update("50/3/" .. (i-1), value)
    end
  end
else
  log('connect failed', err)
end
mb:close()
BR,

Erwin
Reply
#3
Thank you so much Erwin!
Everything is working properly now.
I hadn't noticed this limitation between Wiser and Spacelynk
During the weekend I temporarily implemented the script on two different plants with 32 meters the first and 28 the second.
No problem, CPU load does not exceed 0.09.
The script that reads the energy values runs every 5 minutes.
The power is read every 5 seconds.

BR,
Alberto
Reply
#4
FYI, a SpaceLYnk can easily handle 250 Modbus TCP IP clients.
Reply


Forum Jump: