aligning omnet++ clock with the system clock

2019-07-19 01:54发布

问题:

I'm trying to integrate omnet++ with a 3d robot simulator, and this is roughly what I'm picturing.

So There are a number of objects in the robot simulator, and they communicate with each other using 802.11 which will be simulated by omnet++. Each node in omnet++ corresponds to each object in the robot simulator, and an object's movement will be synchronized with the corresponding node in omnet++.

But since omnet++ is a discrete event simulator, I need to deal with the clock mismatch problem between omnet++ and the robot simulator.

I know omnet++ has cRealTimeScheduler class for synchronizing simulation clock to wall clock, but I'm not sure if this will do what I want.

I'm a noob when it comes to network simulation, so I want to know if this is even possible or not. Does using cRealTimeScheduler class take care of clock synchronization? or do I need to take a different tack? (a different scheduler, or even a different simulator?)

Any help will be greatly appreciated. Thank you.

回答1:

If the robot simulator itself is running in real-time, then you are fine with the cRealTimeScheduler approach. cRealTimeScheduler will synchronize with the wall clock time. If the robot simulator is also running in real-time then the two will be implicitly synchronized, too.

If the robot simulator has its own simulation time (i.e. can run faster than real time) then you should create your own scheduler class that synchronizes the two simulation. This is called co-simulation where two simulation in tandem. Veins (sumo + omnet) is also doing this where Sumo (car traffic simulator) and omnet (network simulator) is working together.

What you are trying to achieve is possible, however I'm not familiar with the robot simulator part, but as long as the other simulator is also communicating with messages are discrete time points, and you can get the simulation time from the robot simulator, you should be fine.