TrueTime: Real-time Control System Simulation with MATLAB/Simulink
Publikation/Tidskrift/Serie: Proceedings of the Nordic MATLAB Conference
Traditional control design using MATLAB/Simulink, often disregards the temporal effects arising fromthe actual implementation of the controllers. Nowadays, controllersare often implemented as tasks in a real-time kernel and communicatewith other nodes over a network. Consequently, the constraints of thetarget system, e.g., limited CPU speed and network bandwidth, must betaken into account at design time.For this purpose we have developed TrueTime, a toolbox forsimulation of distributed real-time control systems. TrueTimemakes it possible to simulate the timely behavior of real-time kernelsexecuting controller tasks. TrueTime also makes it possibleto simulate simple models of network protocols and their influence onnetworked control loops.TrueTime consists of a kernel block and a network block, bothvariable-step S-functions written in C++. TrueTimealso provides a collection of MATLAB functions used to, e.g., do A/Dand D/A conversion, send and receive network messages, set up timers,and change task attributes. The TrueTime blocks are connectedwith ordinary continuous Simulink blocks to form a real-time controlsystem.The TrueTime kernel block simulates a computer with anevent-driven real-time kernel, A/D and D/A converters, a networkinterface, and external interrupt channels. The kernel executesuser-defined tasks and interrupt handlers, representing, e.g., I/Otasks, control algorithms, and communication tasks. Execution isdefined by user-written code functions (C++ functions orm-files) or graphically using ordinary discrete Simulink blocks. Thesimulated execution time of the code may be modeled as constant,random or even data-dependent. Furthermore, the real-time schedulingpolicy of the kernel is arbitrary and decided by the user.The TrueTime network block is event driven and distributesmessages between computer nodes according to a chosen network model.Currently five of the most common medium access control protocols aresupported (CSMA/CD (Ethernet), CSMA/CA (CAN), token-ring, FDMA, andTDMA). It is also possible to specify network parameters such astransmission rate, pre- and post-processing delays, frame overhead,and loss probability.TrueTime is currently used as an experimental platform forresearch on flexible approaches to real-time implementation andscheduling of controller tasks. One example is feedback schedulingwhere feedback is used in the real-time system to dynamicallydistribute resources according to the current situation in the system.
- Technology and Engineering