Real-time data exchange between OMNeT++ simulation and Python ML model

I’m working with an OMNeT++ simulation (version 4.6) that uses the INET framework. My goal is to establish communication between the running simulation and a machine learning model built in Python.

The simulation needs to continuously send network data to the Python script while running. This includes signal quality measurements and node position information. The Python model processes this data and sends back control commands to optimize network performance.

What’s the best approach to set up this bidirectional communication? I need both applications to exchange data without stopping the simulation. Has anyone implemented something similar before?

I did something similar two years back with named pipes (FIFOs) on Linux. Worked great for continuous data exchange during simulation runtime. I made custom OMNeT++ modules that write sim data to output pipes and read control commands from input pipes - just used standard C++ file operations. Python opens the same pipes for reading/writing. Super simple with no external dependencies. Just watch out for pipe blocking - use non-blocking reads in OMNeT++ or you’ll freeze the simulation when Python’s processing data. Performance was fine for my setup where I exchanged data every few simulation seconds.

hey, i also tried this with zmq for similar needs. super easy to set up sockets in both omnet and python. worked smooth for bi-directional data! low latency too, so no worries about timing issues. good luck!