I'm finally getting free from my unintentional career in cybersecurity, and may resume focusing on "productivity" solutions rather than "defense solutions"; cybersecurity is vital to be sure, but I hate it worse than tax law.
So, roughly two years ago, I found the "PSM" environment Thiago introduced, which I saw as an opportunity to leverage for making connections to OpenPLC soft PLC runtime instance "peers", very necessary for my plant simulator because the plant I need to simulate uses a "peer request" methodology, where no PLC "writes" to any other, but instead makes a number of registers available to be read from by remote "peers" and/or SCADA/HMI instances.
The OpenPLC runtime cannot connect to MODBUS "servers" by default, but it does incorporate pymodbus to perform its core MODBUS TCP service, and this fact allows the PSM to be used to create MODBUS server connection objects, which may then be read to update OpenPLC internal registers in the usual fashion.
The code which accomplishes this inside the PSM is still extremely "alpha", so I won't be sharing it until I have it more "fleshed-out" and conscribed into "include modules" so the PSM window doesn't become too crowded.
Basic connectivity is fast and robust, but I am still working on efficient connectivity detection and timeout management/reconnect routines, with an interface allowing easy definition of peers.
Below is the console output from an OpenPLC runtime instance as it starts up PSM then establishes connections to active OpenPLC instances on a Proxmox O.T. network populated with 26 PLCs (failed connections are "correct" as their instance were not started in Proxmox):
OpenPLC Runtime starting...
PSM: Starting PSM...
Interactive Server: Listening on port 43628
Successful connection to PLC05 at 192.168.0.105
Issued start_modbus() command to start on port: 502
Server: Listening on port 502
Server: waiting for new client...
Issued stop_dnp3() command
Issued stop_enip() command
Issued stop_pstorage() command
PSM: Connected to PSM
Warning: Persistent Storage file not found
Failed to connect to PLC06 at 192.168.0.106
Successful connection to PLC07 at 192.168.0.107
Successful connection to PLC08 at 192.168.0.108
Successful connection to PLC09 at 192.168.0.109
Successful connection to PLC10 at 192.168.0.110
Successful connection to PLC11 at 192.168.0.111
Successful connection to PLC12 at 192.168.0.112
Successful connection to PLC13 at 192.168.0.113
Failed to connect to PLC14 at 192.168.0.114
Failed to connect to PLC50 at 192.168.0.150
Successful connection to PLC54 at 192.168.0.154
QX0.0 is TRUE
QX0.0 is FALSE
IX0.0 is TRUE
QX0.0 is TRUE
IX0.0 is FALSE
IX0.0 is TRUE
QX0.0 is FALSE
QX0.0 is TRUE...
...This is going to really open up some horizons.