Page 1 of 1

How many virtual devices can be added at base module?

Posted: 01 Aug 2025, 02:01
by okwon
How many virtual devices can be added at base module (connect4 or connect5)?

I want to add modbus/tcp master virtual devices at my connect4 or connect5 module in pictory.
There is a limit of 10 expansion modules, but what about virtual devices? Is there a limit for virtual devices?

Thank you.

Re: How many virtual devices can be added at base module?

Posted: 01 Aug 2025, 13:08
by RamiGspo
Hi okwon,

Unlike the fixed limit of 10 expansion modules, there isn't a specific numerical limit for virtual devices. However, there is a practical constraint you need to consider: the Process Image (Prozessabbild) is limited to 4096 bytes total.
Why 4096? Because the Process Image is a 4 kByte buffer in RAM provided by PiControl, the central driver of the RevPis. This memory contains all IO data that the system manages. Through the PiCtory configuration, each IO byte or bit gets its own place (=offset) assigned in the Process Image. PiControl manages the access and ensures data exchange between IO modules and the RevPi.

This means the actual number of virtual devices you can add depends on how much data each virtual device uses:

The actual number of virtual devices depends entirely on their memory footprint. For instance, a RevPi Virtual Device uses only 32 bytes input + 32 bytes output (64 bytes total), so you could add many of these.
On the other hand, a Modbus TCP Slave Adapter uses 1024 bytes input + 1024 bytes output (2048 bytes total), which means you can only add one of these devices since the Connect5 base module also needs some bytes from the 4096 byte total. Adding a second Modbus TCP Slave would exceed the 4096 byte limit.

For your Modbus TCP Master virtual devices specifically, here's a practical example:
- A Modbus TCP Master with 150 input/output words uses approximately 384 bytes input + 328 bytes output = 712 bytes total per device
- On a Connect5, you can add up to 5 of these Modbus TCP Master devices before reaching the 4096-byte limit

However, if you configure smaller Modbus TCP Master devices, you can add many more. For example, a smaller Modbus TCP Master uses only 101 bytes input + 73 bytes output = 174 bytes total per device. With these smaller devices, you could theoretically add around 23 devices before hitting the 4096-byte limit.

You can verify your current Process Image usage with the command `piTest -d`, which shows the offset and length for each device. The offset + length cannot exceed 4096 bytes.

Example with 5 large Modbus TCP Master devices (150 words):

Code: Select all

pi@RevPi94366:~$ piTest -d
Found 6 devices:

Address: 0 module type: 138 (0x8a) RevPi Connect 5 V1.0
Module is present
     input offset: 0 length: 6
    output offset: 6 length: 7

Address: 64 module type: 24579 (0x6003) ModbusTCP Master Adapter V0.0
Module is present
     input offset: 13 length: 384
    output offset: 397 length: 328

Address: 65 module type: 24579 (0x6003) ModbusTCP Master Adapter V0.0
Module is present
     input offset: 743 length: 384
    output offset: 1127 length: 328

Address: 66 module type: 24579 (0x6003) ModbusTCP Master Adapter V0.0
Module is present
     input offset: 1473 length: 384
    output offset: 1857 length: 328

Address: 67 module type: 24579 (0x6003) ModbusTCP Master Adapter V0.0
Module is present
     input offset: 2203 length: 384
    output offset: 2587 length: 328

Address: 68 module type: 24579 (0x6003) ModbusTCP Master Adapter V0.0
Module is present
     input offset: 2933 length: 384
    output offset: 3317 length: 328


Example with 2 smaller Modbus TCP Master devices:

Code: Select all

pi@RevPi94366:~$ piTest -d
Found 3 devices:

Address: 0 module type: 138 (0x8a) RevPi Connect 5 V1.0
Module is present
     input offset: 0 length: 6
    output offset: 6 length: 7

Address: 64 module type: 24579 (0x6003) ModbusTCP Master Adapter V0.0
Module is present
     input offset: 13 length: 101
    output offset: 114 length: 73

Address: 65 module type: 24579 (0x6003) ModbusTCP Master Adapter V0.0
Module is present
     input offset: 205 length: 101
    output offset: 306 length: 73

In this second example, the last output shows: offset 306 + length 73 = 379 bytes, leaving plenty of room for additional devices. As I mentioned above, in total there should be around 23 devices possible. I haven't tested it... I've only calculated it. :mrgreen:

I hope this helps clarify your question!