The simulation loop is the main loop where the synchronization of engines, data transfer and data processing happens. The class responsible for managing its execution is: FTILoop, which stands for Fixed Time Increment Loop and implements the synchronization algorithm summarized below in this page.
On initialization, it creates a TransceiverFunctionManager to manage all user-generated TransceiverFunctions. Additionally, it runs the initialization routines of all engines.
During the simulation, a sequence of steps is managed by the FTILoop. Each step represents a series of data exchange and processing that happen at a given simulation time, t. This simulation time is calculated by the FTILoop on the basis of all individual engine time steps (see below). In order to guarantee an ordered synchronization of the various engines with each other, we thus strongly suggest that the users impose some constraints to the values taken by the engine time steps declared in the experiment configuration (see section Simulation Configuration hereafter). One such constraint can be that all individual engine time steps be a multiple of the smallest engine time step dt. In that case, t is always a multiple of the smallest engine time step dt. Another such constraint, even stronger, is that every individual time step be the product of the smallest engine time step dt by a power of two (i.e. 2n dt). In this case, all engines will synchronize with each other at times that are multiples of the largest individual engine time step.
The way the FTILoop works is described below:
On shutdown, each engine is issued a shutdown command to close gracefully.
The entire loop is executed within one function, FTILoop::runLoop. Should any of the above steps fail, an exception is thrown.