⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sim_with_dht.m

📁 best routing protocol
💻 M
字号:
function res = sim_with_dht(topo_fn, n_beacons)S = load(topo_fn);D = S.D;coord = S.coord;n_nodes = S.n_nodes;n_random_pairs = S.n_random_pairs;random_pairs = S.random_pairs;clear S;k = min(n_beacons, 10); %routing beacon for bvrtmp = randperm(n_nodes);beacons = tmp(1:n_beacons);failure_nodes = [];[routing_path, routing_dist_bvr_2h, load_bvr_2h, storage_bvr_2h, ... dht_bvr_2h, failure_bvr_2h, state_per_node_bvr_2h, transmission_dist_bvr_2h,...routing_hops_2h, nodes_with_2hop_info, extra_control_traffic_2h]=bvr(D, n_beacons, ...  k , beacons, random_pairs, 1, failure_nodes, 1, 1, 1);failure_bvr_2h_real = length(find(routing_dist_bvr_2h==Inf))/ ...  n_random_pairs[routing_path, routing_dist_bvr_sf, load_bvr_sf, storage_bvr_sf, ... dht_bvr_sf, failure_bvr_sf,state_per_node_bvr_sf,transmission_dist_bvr_sf,... routing_hops_sf]=bvr(D, n_beacons, ...  k , beacons, random_pairs, 1, failure_nodes, 1, 1, 0);failure_bvr_sf_real = length(find(routing_dist_bvr_sf==Inf))/ ...  n_random_pairs[routing_dist_cr, load_cr,storage_cr, dht_cr, cluster_cr, dv_packets_cr, dv_entries_cr] = ...  compactrouting(D, beacons, random_pairs,failure_nodes, 2, coord, 1);%distance vectorfailure_cr = length(find(routing_dist_cr==Inf))/n_random_pairs;res = struct(...    'failure_bvr',failure_bvr_sf, ...    'failure_bvr_real',failure_bvr_sf_real, ...    'failure_bvr_2h', failure_bvr_2h, ...    'failure_bvr_2h_real', failure_bvr_2h_real, ...    'failure_cr', failure_cr, ...    'routing_dist_bvr_2h', routing_dist_bvr_2h, ...    'routing_dist_bvr_sf', routing_dist_bvr_sf, ...    'routing_dist_cr',routing_dist_cr, ...    'load_bvr_2h', load_bvr_2h, ...    'load_bvr_sf', load_bvr_sf, ...    'load_cr',load_cr, ...    'beacons',beacons, ...    'cluster_cr', cluster_cr, ...    'dv_packets_cr', dv_packets_cr, ...    'dv_entries_cr', dv_entries_cr, ...    'dht_cr', dht_cr,...    'dht_bvr_2h', dht_bvr_2h, ...    'dht_bvr_sf', dht_bvr_sf, ...    'nodes_with_2hop_info', nodes_with_2hop_info,...    'extra_control_traffic_2h',extra_control_traffic_2h,...    'storage_bvr_sf', storage_bvr_sf,...    'storage_bvr_2h', storage_bvr_2h,...    'storage_cr', storage_cr,...    'state_per_node_bvr_2h', state_per_node_bvr_2h, ...    'state_per_node_bvr_sf', state_per_node_bvr_sf);

⌨️ 快捷键说明

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