TrueTime [Cervin et al., 2003; Henriksson et al., 2003; Henriksson and Cervin, 2003; Henriksson et al., 2002b] is a MATLAB/Simulink-based tool that facilitates simulation of the temporal behaviour of a multitasking real-time kernel executing controller tasks. The tasks are controlling processes that are modelled as ordinary continuous-time Simulink blocks. TrueTime also makes it possible to simulate models of standard MAC layer network protocols, and their influence on networked control
loops. In TrueTime, kernel and network Simulink blocks are introduced, the interfaces of which are shown in Figure 34. The kernel blocks are event-driven and execute code that models, e.g., I/O tasks, control algorithms, and network interfaces. The scheduling policy of the individual kernel blocks is arbitrary and decided by the user. Likewise, in the network, messages are sent and received according to the chosen network model.
The level of simulation detail is also chosen by the user-it is often neither necessary nor desirable to simulate code execution on instruction level or network transmissions on bit level. TrueTime allows the execution time of tasks and the transmission times of messages to be modeled as constant, random, or data-dependent. Furthermore, TrueTime allows simulation of context switching and task synchronization using events or monitors.
TrueTime provides a collection of C++ functions with corresponding MATLAB MEX-interfaces. Some functions are used to configure the simulation by creating tasks, interrupt handlers, monitors, timers, etc. The remaining functions are real-time primitives that are called from the task code during execution. These include functions for AD-DA conversion, changing task attributes, entering and leaving monitors, sending and receiving network messages, and more. TrueTime is configured in a C++ or MATLAB m-file, called an initialization script. Likewise, task and interrupt handler code is defined by C++ functions or MATLAB m-files according to a pre-specified format. The possibility for graphical modeling has been avoided to make the tool more general and more connected to the real implementation code.
More information on TrueTime (p.71)