TrueTime
TrueTime 2.0 http://www.control.lth.se/truetime/ Reference Manual link
Communication Network TrueTime is a Matlab/Simulink Event-based simulator for real-time control system. It is used for the simulation of Networked Control System (NCS). In NCS, actuators, sensors and controllers are interconnected by a communication network. Process Actuator Sensor Communication Network Controller
TrueTime capabilities: Investigate the true, timely behavior of time or event-triggered control loops affected by real-time scheduling and networking Experiment with novel real-time scheduling techniques, including feedback scheduling Investigate the performance of various wired or wireless MAC protocols Simulate complex scenarios involving battery-powered mobile robots communicating over a wireless network
Components
Computation component Simulates and event-based real- time kernel. Executes user-defined tasks and interrupt handler (C or M-files) Arbitrary user-defined scheduling policies Supports external interrupts and timers Code structured into code segments
Init Each kernel block must have an initialization script The purposes of the initialization script are: Specify the number of I/O Define a scheduling policy Creating tasks Creating interrupts handlers Pre-defined priority functions exist for scheduling policies: fixed-priority rate-monotonic deadline-monotonic earliest-deadline-first scheduling
Example Initialize the kernel, specifying the scheduling policy Create a periodic task Create an aperiodic task Attach an aperiodic task or interrupt handler to a network interface
Tasks Tasks are used to model the execution of user code The release of task instances (jobs) may be periodic or aperiodic For periodic tasks, the jobs are created by an internal periodic timer For aperiodic tasks, the jobs must be created by the user (e.g., in response to interrupts)
Task code is represented by a code function in the format: [exectime,data] = function mycode(segment,data) The data input/output argument represents the local memory of the task The segment input argument represents the program counter The exectime output argument represents the execution time of the current code segment
All statements in a segment are executed sequentially, non- preemptively, and in zero simulation time Only the delay can be preempted by other tasks No local variables are saved between segments
The name of the initialization script An optional argument to the initialization script Number of local Inputs and Outputs Number of external triggers for the kernel task Number of the node (must be unique) A constant time offset and time drift from the nominal time.
Communication component Network Block Ethernet CAN TDMA FDMA Round Robin Switched Ethernet FlexRay PROFINET Wireless Network Block 802.11b WLAN 802.15.4 ZigBee
Modelling wired networks Models the medium access delay and the transmission delay. No built-in support for network and transport layer protocols
Modelling wireless network Used in a similar way as the wired network block Supports two common MAC layer policies: 802.11b/g (WLAN) 802.15.4 (ZigBee) Variable network parameters x and y inputs for node locations Generates a transmission schedule
The number assigned to the network block. The number of nodes connected to the network. The speed of the network. The minimum frame size The probability that a network message is lost during transmission
Example Networked
Networked control of a DC-Servo Controller Task Dummy Task Sensor Task Actuator Task Interfering Task Controller Sensor / Actuator Interfering Node CSMA/CD 80 kbps
Networked Control Loop
Step Response Step Response Control Signal
Network Schedule Control Node Sensor/Actuator Node Interfering Node High → Sending Medium → Waiting Low → Idle
CPU Schedule Actuator Task Sensor Task High → Running Medium → Ready Low → Idle