controller_init.m
来自「TrueTime1.2(用于网络控制系统的仿真」· M 代码 · 共 40 行
M
40 行
function controller_init% Distributed control system: controller node%% Receives messages from the sensor node, computes control signal% and sends it to the actuator node. Also contains a high-priority% disturbing task.% Initialize TrueTime kernelttInitKernel(1, 0, 'prioFP'); % nbrOfInputs, nbrOfOutputs, fixed priority% Controller parametersh = 0.010;N = 100000;Td = 0.035;K = 1.5;% Create task data (local memory)data.u = 0.0;data.K = K; data.ad = Td/(N*h+Td);data.bd = N*K*Td/(N*h+Td);data.Dold = 0.0;data.yold = 0.0;% Create controller taskdeadline = h;prio = 2;ttCreateTask('pid_task', deadline, prio, 'ctrlcode', data);% Disturbance task (uncomment to add disturbance task)% offset = 0.0002;% period = 0.007;% prio = 1;% ttCreatePeriodicTask('dummy', offset, period, prio, 'dummycode');% Initialize networkttCreateInterruptHandler('nw_handler', prio, 'msgRcvCtrl');ttInitNetwork(4, 'nw_handler'); % node #4 in the network
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?