简体   繁体   中英

Cost efficient way to test scalability of RS485 Modbus device read operation

We are fairly new to Modbus and RS485 communication and are currently in the process of writing a Python application to read specified registers from multiple smart meters. Our final python script shall be able to read registers from up to 50-200 smart meters at a time via RS485 using Modbus.

For testing, performance and scalability purposes I would like to have a cost efficient physical simulation environment in our lab in order to understand how many devices we will be able to read in practice.

The goal is to understand how many devices, with which length of bus wiring, repeaters, etc. our Python script can handle, what the response time is, and whether other parts of the script need to be adjusted.

We understand that we can make use of multiple serial interfaces but we would like to discover how we can minimize the requirement of multiple serial interfaces with the use of RS485 repeaters as well.

We were asking ourselves if there might be some physical Modbus RTU sensors with RS485 to get to a close setup as if they were smart meters. Given the size of 50-200 devices are there any similar, simple devices in range of $5 where we could do similar practical testings?

So far, we only have access to small lab of a few smart meters where we can do our tests. Our current script runs on a Raspberry Pi 4 4GB.

In my opinion, there is no real need for testing. But you need to take into account several factors that you seem not to be aware of.

Consider the following:

  • How many registers are you going to read from each meter? You can read a couple of registers (for instance, just total power) or many (50-100 or more if you read all the data the meters are collecting).
  • How frequently will you take readings from each meter? If you are fine reading once every minute you will be able to read from many devices, but what if you need readings every second? Most meters will probably update once or twice a second; if you need 100 registers from 200 devices twice a second you might have a problem (more on that later).
  • How far apart are your devices? Are they all in the same room within 10 meters from your computer/PLC or 1 km apart each? As you probably know, the maximum speed on any RS-485 link depends on the maximum length of the bus. And obviously, that's also related to my two previous questions: number of registers (amount of data) and its rate (once a second or once a minute).

Once you answer those questions you would be able to do a back-of-the-envelope calculation, you can take a look here for a sample calculation.

Elaborating a bit more on your questions:

The goal is to understand how many devices, with which length of bus wiring, repeaters, etc. our Python script can handle, what the response time is, and whether other parts of the script need to be adjusted.

This is, in my opinion, the wrong way of looking at the problem. Your software (Python script) should never be your limiting factor. Are you sure you would be able to decide the location of your meters based on what your software is able to handle? I think it should be the other way around.

We understand that we can make use of multiple serial interfaces but we would like to discover how we can minimize the requirement of multiple serial interfaces with the use of RS485 repeaters as well.

If you split your.network into two or more chunks you might reach a point where either your Python script or the computing power of your RPi does become your limiting factor. I don't know what your setup would look like but I would think about it this way: every time you split your.network you will need two more wires (and one more serial port), if your distances are long, after a very short while splitting you would be better off going to Modbus over TCP.

We were asking ourselves if there might be some physical Modbus RTU sensors with RS485 to get to a close setup as if they were smart meters. Given the size of 50-200 devices are there any similar, simple devices in range of $5 where we could do similar practical testings?

Again, this is in my opinion, the wrong approach. Instead of looking for lookalike devices why don't you look at the documentation of the real device you will be using? That should give you, at the very least, the refresh rate at which you will be reading data. Obviously, your bus will not be sending data faster than that.

You would be able to emulate any sensor with a computer (RPi or otherwise) and a serial port. With most computers and most serial ports you should be able to send data (random, or fake, or whatever) as fast as possible for each baud rate you can imagine from 150 bps to at least 1 Mbps, but that would be pointless. What you want to know is the data rate of your real sensors/meters, and that should become clear from reading their documentation (or otherwise asking their manufacturer).

At the very bottom of every measuring instrument, there is an AD (analog to digital) converter that's taking samples at a fixed rate. You can ask the instrument for faster readings but if you do that what you will get is the same values until a new reading comes in. If for instance, you get readings from the instrument once a second and you ask for values twice a second you will get the same value twice each second. As simple as that.

I hope you find some useful ideas in my long and theoretical post.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM