📄 readme
字号:
----------------------------------------------- TrueTime version 1.13 Example: Distributed Control System Directory: $DIR/examples/distributed-----------------------------------------------1. INTRODUCTIONThis example simulates distributed control of a DC-servo. The examplecontains four computer nodes, each represented by a TrueTime kernelblock. An time-driven sensor node samples the process periodically andsends the samples over the network to the controller node. The controltask in this node calculates the control signal and sends the resultto the actuator node, where it is subsequently actuated. Thesimulation also involves an interfering node sending disturbingtraffic over the network, and a disturbing high-priority taskexecuting in the controller node.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/distributed/matlab. All necessary compilation is performed by the m-file makedist.m. Run this file from the Matlab command prompt: >> makedist NOTE: The makedist-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 init scripts of the four computer blocks is performed by the m-file makedist.m. Run this file from the Matlab command prompt: >> makedist NOTE: If changes are made to the code functions or the initialization commands, the affected init scripts need to be re-compiled. Copy and paste from makedist.m to compile the relevant files individually. 3. EXPERIMENTS Open the model distributed.mdl to run the simulation. - Run a first simulation without disturbing traffic and without interference in the controller node. This is obtained by setting the variable BWshare in the code function of the interfering node to zero, and by commenting out the creation of the task 'dummy' in controller_init. In this case we will get a constant round-trip delay and satisfactory control performance. Study the network schedule and the resulting control performance. - Switch on the disturbing node and the interfering task in the controller node. Set the variable BWshare to the percentage of the network bandwidth to be used by the disturbing node. Again study the network schedule and the resulting control performance. Experiment with different network protocols and different scheduling policies in the controller node.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -