-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRepeatSliceReconfiguration.m
40 lines (36 loc) · 1.37 KB
/
RepeatSliceReconfiguration.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
global DEBUG g_results event_num;
event_num = 0;
g_results = table;
DEBUG = true;
%% TODO
% Add event listener to SFED, PN, and slices in PN
%% Event handling
% Event dispatcher's listeners
SFED.AddListener(PN, {'SliceArrive', 'SliceDepart', 'FlowArrive', 'FlowDepart'}, ...
@PN.eventhandler);
% Network's listeners
% There will be slices listen to the network, after they are added to the network.
PN.AddListener(SFED, {'AddSliceSucceed', 'AddSliceFailed', 'RemoveSliceSucceed', ...
'RemoveSliceFailed', 'AddFlowSucceed', 'AddFlowFailed', 'RemoveFlowSucceed', ...
'RemoveFlowFailed'}, @SFED.eventhandler);
for temp_sid = 1:PN.NumberSlices
sl = PN.slices(temp_sid);
if isa(sl, 'DynamicSlice') && sl.isDynamicFlow()
PN.AddListener(sl, {'FlowArrive', 'FlowDepart'}, @sl.eventhandler);
sl.AddListener(PN, {'AddFlowSucceed', 'AddFlowFailed', ...
'RemoveFlowSucceed', 'RemoveFlowFailed',...
'RequestDimensioning', 'DeferDimensioning'}, @PN.eventhandler);
sl.setOption('ReconfigMethod', options.ReconfigMethod);
end
end
%% Main loop
iter_num = 0;
while iter_num < NUM_EVENT
%%%
% *output*
iter_num = iter_num + 1;
total_iter_num = total_iter_num + 1;
waitbar(total_iter_num/TOTAL_NUM, progress_bar, ...
sprintf('Simulation Progress: %d/%d', total_iter_num, TOTAL_NUM));
ev = SFED.nextEvent;
end