initsim.m

来自「用于网络控制系统仿真」· M 代码 · 共 60 行

M
60
字号
clear functionsrand('state',0);nbrNodes = 7;% Lots of printouts or just a few?global verboseverbose = 0; % Initialize routing table (7 nodes)global routing_tablefor k=1:nbrNodes  routing_table{k} = [];end  % Initialize AODV sequence numbersglobal seqNbrsseqNbrs = zeros(nbrNodes, nbrNodes);% Initialize AODV parametersglobal AODVparamsAODVparams.ACTIVE_ROUTE_TIMEOUT = 3; % 3000 msecAODVparams.MY_ROUTE_TIMEOUT = 2 * AODVparams.ACTIVE_ROUTE_TIMEOUT;AODVparams.HELLO_INTERVAL = 1; % 1000 msecAODVparams.ALLOWED_HELLO_LOSS = 2;AODVparams.DELETE_PERIOD = AODVparams.ALLOWED_HELLO_LOSS * AODVparams.HELLO_INTERVAL;% Initialize node positions, transmission power, and thresholdsglobal xPos yPos pow thres% X positionsxPos(1) = -15;xPos(2) = -10;xPos(3) = -5;xPos(4) =  0;xPos(5) =  5;xPos(6) =  5;xPos(7) =  15;% Y positionsyPos(1) =  5;yPos(2) = -5;yPos(3) =  10;yPos(4) = -5;yPos(5) =  5;yPos(6) = -10;yPos(7) =  5;pow = -8; % dBmthres = -48;codethres = 0.03;% To track sent (from node 1) and % received (in node 7) dataglobal sentsent = [];global receivedreceived = [];

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?