📄 readme
字号:
----------------------------------------------- TrueTime 1.5 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. A 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 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 scripts of the four computer blocks is performed by the m-file make.m. Run this file from the Matlab command prompt: >> make 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 make.m to compile the relevant files individually. 3. SIMULATIONSOpen 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 + -