📄 readme
字号:
---------------------------------------------- TrueTime 1.5 Example: Task Scheduling and Control Directory: $DIR/examples/threeservos----------------------------------------------1. INTRODUCTIONThis example extends the simple PID control example (located in$DIR/examples/simple_pid) to the case of three PID-tasks runningconcurrently on the same CPU controlling three different servosystems. The effect of the scheduling policy on the global controlperformance is demonstrated.2. COMPILING THE SIMULATION FILES2.1 Configuring the TrueTime Environment Before starting Matlab, you must set the environment variable TTKERNEL to point to the directory with the TrueTime kernel files: Unix/Linux: > export TTKERNEL=$DIR/kernel Windows: Control Panel / System / Advanced / Environment Variables Then add the following lines to your MATLAB startup script. This will set up all necessary paths to the TrueTime kernel files. addpath(getenv('TTKERNEL')) init_truetime;2.2 Compilation As described in the reference manual it is possible to write a TrueTime simulation (i.e. the code functions for the tasks and the initialization commands) either as m-files or as C++ functions. Both approaches are provided for this example and the compilations needed for the respective alternatives are described below. 2.2.1 Matlab version Since the TrueTime archive contains pre-compiled files, no compilation is required to run TrueTime in the Matlab version. However, if needed, the files may be re-compiled by issuing the command make_truetime from the command prompt. 2.2.2 C++ version Compilation of the init script of the computer block is performed by the command: >> ttmex threeservos_init.cpp NOTE: If changes are made to the code function or the initialization commands, the init-file needs to be re-compiled.3. SIMULATIONSOpen the model threeservos.mdl to run the simulation.- Make sure that rate-monotonic scheduling is specified in the function ttInitKernel and simulate the system. Study the computer schedule and the control performance. Task 1 will miss all its deadlines and the corresponding control loop is unstable.- Change the scheduling policy to earliest-deadline-first and run a new simulation. Again study the computer schedule and the control performance. After an initial transient all tasks will miss their deadlines, but the overall control performance, however, is satisfactory.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -