⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 一个很棒的网络控制系统仿真软件
💻
字号:
---------------------------------------------- TrueTime version 1.13 Example: Simple PID Task Simulation Directory: $DIR/examples/simple_pid----------------------------------------------1. INTRODUCTIONThese examples are intended to give a basic introduction to theTrueTime simulation environment. The examples consider simple PIDcontrol of a DC-servo process. The process is controlled by acontroller task implemented in a TrueTime kernel block. Two versionsof the code function are provided, one standard PID implementation andone that calls a Simulink block diagram to calculate the controlsignal in each sample. The example is also extended to the case ofthree PID-tasks running concurrently on the same CPU controlling threedifferent servo systems.2. COMPILING THE SIMULATION FILESBefore starting Matlab, you must set the environment variable TTKERNELto point to the directory with the TrueTime kernel files:    Unix/Linux: > export TTKERNEL=$DIR/kernel    Windows:  Control Panel / System / Advanced / Environment VariablesAfter starting Matlab, you must also add the directories $DIR/kernel and$DIR/kernel/matlab to your Matlab path. You could for instance do this inyour startup script as follows:    addpath(getenv('TTKERNEL'))    addpath([getenv('TTKERNEL') '/matlab'])As described in the reference manual it is possible to write aTrueTime simulation (i.e. the code functions for the tasks and theinitialization commands) either as m-files or as C++ functions. Bothapproaches are provided for this example and the compilations neededfor the respective alternatives are described below.2.1 Matlab version       The files for Matlab-simulation of the example are located in the    directory $DIR/examples/simple_pid/matlab. All necessary    compilation is performed by the m-file makepid.m. Run this file    from the Matlab command prompt:    >> makepid       NOTE: The makepid-file only needs to be run once. No    re-compilation is needed after changing code functions or    initialization commands.2.2 C++ version        The files for C++-simulation of the example are located in the    directory $DIR/examples/distributed/c++. Compilation of the    various init scripts is performed by the m-file makepid.m. Run    this file from the Matlab command prompt:    >> makepid    NOTE: If changes are made to the code functions or the    initialization commands, the corresponding init-file needs to be    re-compiled.3. EXPERIMENTS3.1 Single PID task    Open the model servo.mdl to run the single PID task simulation.     - Run a simulation and verify that the controller behaves as      expected. Notice the computational delay in the control signal.      Compare with the code function. Study the schedule plot.    - Try changing the execution time of the first segment of the code      function, to simulate the effect of different input-output delays.    - Also try changing the sampling period and study the resulting      control performance.    - A PID controller is implemented in the Simulink block      controller.mdl. Change the name of the init-file in the parameter      field of the kernel block to block_init. Now the code function will      use this Simulink block to compute the control signal in each sample.3.2 Three PID tasks    Open the model threeservos.mdl to run the three PID task 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 + -