routing_state_bvr.m

来自「best routing protocol」· M 代码 · 共 32 行

M
32
字号
function states =routing_state_bvr(res,neighborhop)if nargin<2  neighborhop=1;endUSE_BYTE_OR_N_ENTRY = 1; %=1: use byte, =0: use number of entriesn_beacon = length( res.beacons );NEXT_HOP_COST = 2; % 2 bytes to store a nexthop entryBYTE_PER_BEACON = 2+1+1+NEXT_HOP_COST;BYTE_PER_COORD_ENTRY = n_beacon + 8;if neighborhop==2  if USE_BYTE_OR_N_ENTRY  states = res.state_per_node_bvr_2h*BYTE_PER_COORD_ENTRY ...	   + repmat(n_beacon*(BYTE_PER_BEACON), ...		    length(res.cluster_cr),1);  else    states = res.state_per_node_bvr_2h;  endelse  if USE_BYTE_OR_N_ENTRY  states = res.state_per_node_bvr_sf*BYTE_PER_COORD_ENTRY ...	   + repmat(n_beacon*(BYTE_PER_BEACON), ...		    length(res.cluster_cr),1);  else    states = res.state_per_node_bvr_sf;  end  end

⌨️ 快捷键说明

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