-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathin_Refresh_ID.m
51 lines (41 loc) · 2 KB
/
in_Refresh_ID.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
%% Refresh_ID : Refresh ID arrays used in Epidemic and PRoPHET routing protocols
% Get messages and buffered messages destination address
ID_messages_x = [];
ID_messages_y = [];
ID_received_messages_x = [];
ID_received_messages_y = [];
ID_buffer_x = [];
ID_buffer_y = [];
% Get messages IDs of nodes x and y
if length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_1).MESSAGE) > 0
for msg_index = 1: length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_1).MESSAGE)
ID_messages_x(end+1) = str2double(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_1).MESSAGE(msg_index).ID);
end
end
if length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_2).MESSAGE) > 0
for msg_index = 1: length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_2).MESSAGE)
ID_messages_y(end+1) = str2double(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_2).MESSAGE(msg_index).ID);
end
end
% Get received messages IDs of nodes x and y
if length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_1).RECEIVED_MESSAGE) > 0
for msg_index = 1: length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_1).RECEIVED_MESSAGE)
ID_received_messages_x(end+1) = str2double(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_1).RECEIVED_MESSAGE(msg_index).ID);
end
end
if length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_2).RECEIVED_MESSAGE) > 0
for msg_index = 1: length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_2).RECEIVED_MESSAGE)
ID_received_messages_y(end+1) = str2double(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_2).RECEIVED_MESSAGE(msg_index).ID);
end
end
% Get buffered messages IDs of nodes x and y
if length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_1).BUFFER) > 0
for msg_index = 1: length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_1).BUFFER)
ID_buffer_x(end+1) = str2double(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_1).BUFFER(msg_index).ID);
end
end
if length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_2).BUFFER) > 0
for msg_index = 1: length(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_2).BUFFER)
ID_buffer_y(end+1) = str2double(MN_DATA_ROUTING_temp.VS_NODE(MN_INDEX_2).BUFFER(msg_index).ID);
end
end