diff --git a/scripts/sample_app1/matlab/plotTaskFailureReason.m b/scripts/sample_app1/matlab/plotTaskFailureReason.m
index 8e9e31f..d8f2c8e 100644
--- a/scripts/sample_app1/matlab/plotTaskFailureReason.m
+++ b/scripts/sample_app1/matlab/plotTaskFailureReason.m
@@ -12,16 +12,16 @@ function [] = plotTaskFailureReason()
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
- plotGenericResult(5, 4, 'Failed Tasks due to WLAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
- plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
- plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
- plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
- plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
+ plotGenericResult(5, 5, 'Failed Tasks due to WLAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
+ plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
+ plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
+ plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
+ plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
- plotGenericResult(5, 6, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
- plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
- plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
- plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
- plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
+ plotGenericResult(5, 7, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
+ plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
+ plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
+ plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
+ plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
end
\ No newline at end of file
diff --git a/scripts/sample_app2/matlab/plotTaskFailureReason.m b/scripts/sample_app2/matlab/plotTaskFailureReason.m
index 8dfd6a9..4e71b7f 100644
--- a/scripts/sample_app2/matlab/plotTaskFailureReason.m
+++ b/scripts/sample_app2/matlab/plotTaskFailureReason.m
@@ -12,22 +12,22 @@ function [] = plotTaskFailureReason()
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
- plotGenericResult(5, 4, 'Failed Tasks due to WLAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
- plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
- plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
- plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
- plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
+ plotGenericResult(5, 5, 'Failed Tasks due to WLAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
+ plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
+ plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
+ plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
+ plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
- plotGenericResult(5, 5, 'Failed Tasks due to MAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
- plotGenericResult(5, 5, {'Failed Tasks due to MAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
- plotGenericResult(5, 5, {'Failed Tasks due to MAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
- plotGenericResult(5, 5, {'Failed Tasks due to MAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
- plotGenericResult(5, 5, {'Failed Tasks due to MAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
+ plotGenericResult(5, 6, 'Failed Tasks due to MAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
+ plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
+ plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
+ plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
+ plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
- plotGenericResult(5, 6, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
- plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
- plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
- plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
- plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
+ plotGenericResult(5, 7, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
+ plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
+ plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
+ plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
+ plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
end
\ No newline at end of file
diff --git a/scripts/sample_app3/config/applications.xml b/scripts/sample_app3/config/applications.xml
new file mode 100644
index 0000000..daf7cfd
--- /dev/null
+++ b/scripts/sample_app3/config/applications.xml
@@ -0,0 +1,59 @@
+
+
+
+ 30
+ 20
+ 2
+ 40
+ 20
+ 1500
+ 250
+ 12000
+ 1
+ 8
+ 0.8
+ 20
+
+
+ 20
+ 20
+ 3
+ 45
+ 90
+ 200
+ 1250
+ 6000
+ 1
+ 4
+ 0.4
+ 10
+
+
+ 20
+ 40
+ 20
+ 60
+ 120
+ 2500
+ 200
+ 30000
+ 1
+ 20
+ 2
+ 50
+
+
+ 30
+ 10
+ 7
+ 30
+ 45
+ 250
+ 1000
+ 15000
+ 1
+ 10
+ 1
+ 25
+
+
\ No newline at end of file
diff --git a/scripts/sample_app3/config/default_config.properties b/scripts/sample_app3/config/default_config.properties
new file mode 100644
index 0000000..a19a3ac
--- /dev/null
+++ b/scripts/sample_app3/config/default_config.properties
@@ -0,0 +1,43 @@
+#default config file
+simulation_time=33
+warm_up_period=3
+vm_load_check_interval=0.1
+vm_location_check_interval=0.1
+file_log_enabled=true
+deep_file_log_enabled=false
+
+min_number_of_mobile_devices=200
+max_number_of_mobile_devices=2000
+mobile_device_counter_size=200
+
+wan_propogation_delay=0.1
+lan_internal_delay=0.005
+wlan_bandwidth=0
+wan_bandwidth=0
+gsm_bandwidth=0
+
+#all the host on cloud runs on a single datacenter
+number_of_host_on_cloud_datacenter=1
+number_of_vm_on_cloud_host=4
+core_for_cloud_vm=4
+mips_for_cloud_vm=100000
+ram_for_cloud_vm=32000
+storage_for_cloud_vm=1000000
+
+#each mobile device has one host which serves one VM
+#all the host runs on a single datacenter due to the out of memory (oom) issue
+core_for_mobile_vm=1
+mips_for_mobile_vm=4000
+ram_for_mobile_vm=2000
+storage_for_mobile_vm=32000
+
+#use ',' for multiple values
+orchestrator_policies=ONLY_EDGE,ONLY_MOBILE,HYBRID
+
+#use ',' for multiple values
+simulation_scenarios=MOBILE_PROCESSING_SCENARIO
+
+#mean waiting time in seconds
+attractiveness_L1_mean_waiting_time=480
+attractiveness_L2_mean_waiting_time=300
+attractiveness_L3_mean_waiting_time=120
diff --git a/scripts/sample_app3/config/edge_devices.xml b/scripts/sample_app3/config/edge_devices.xml
new file mode 100644
index 0000000..1f9279f
--- /dev/null
+++ b/scripts/sample_app3/config/edge_devices.xml
@@ -0,0 +1,983 @@
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 1
+ 1
+ 0
+ 0
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 2
+ 2
+ 1
+ 0
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 3
+ 3
+ 2
+ 1
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 4
+ 4
+ 3
+ 1
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 5
+ 5
+ 4
+ 1
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 6
+ 6
+ 5
+ 1
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 7
+ 7
+ 6
+ 2
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 8
+ 8
+ 7
+ 2
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 9
+ 9
+ 8
+ 2
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 10
+ 10
+ 9
+ 2
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 11
+ 11
+ 10
+ 2
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 12
+ 12
+ 11
+ 2
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 13
+ 13
+ 12
+ 2
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
+ 0.1
+ 3.0
+ 0.05
+ 0.1
+
+ 14
+ 14
+ 13
+ 2
+
+
+
+ 16
+ 80000
+ 16000
+ 400000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+ 2
+ 10000
+ 2000
+ 50000
+
+
+
+
+
+
\ No newline at end of file
diff --git a/scripts/sample_app3/matlab/getConfiguration.m b/scripts/sample_app3/matlab/getConfiguration.m
new file mode 100644
index 0000000..3f23926
--- /dev/null
+++ b/scripts/sample_app3/matlab/getConfiguration.m
@@ -0,0 +1,53 @@
+%--------------------------------------------------------------
+%description
+% returns a value according to the given argumentssss
+%--------------------------------------------------------------
+function [ret_val] = getConfiguration(argType)
+ if(argType == 1)
+ ret_val = 'D:\sim_results';
+ elseif(argType == 2)
+ ret_val = 10; %Number of iterations
+ elseif(argType == 3)
+ ret_val = 200; %min number of mobile device
+ elseif(argType == 4)
+ ret_val = 200; %step size of mobile device count
+ elseif(argType == 5)
+ ret_val =2000; %max number of mobile device
+ elseif(argType == 6)
+ ret_val = 1; %xTickLabelCoefficient
+ elseif(argType == 7)
+ ret_val = {'ONLY_EDGE','ONLY_MOBILE','HYBRID'};
+ elseif(argType == 8)
+ ret_val = {'only edge','only mobile','hybrid'};
+ elseif(argType == 9)
+ ret_val=[10 3 12 12]; %position of figure
+ elseif(argType == 10)
+ ret_val = 'Number of Mobile Devices'; %Common text for x axis
+ elseif(argType == 11)
+ ret_val = 1; %return 1 if you want to save figure as pdf
+ elseif(argType == 12)
+ ret_val = 0; %return 1 if you want to plot errors
+ elseif(argType == 20)
+ ret_val=1; %return 1 if graph is plotted colerful
+ elseif(argType == 21)
+ ret_val=[0.55 0 0]; %color of first line
+ elseif(argType == 22)
+ ret_val=[0 0.15 0.6]; %color of second line
+ elseif(argType == 23)
+ ret_val=[0 0.23 0]; %color of third line
+ elseif(argType == 24)
+ ret_val=[0.6 0 0.6]; %color of fourth line
+ elseif(argType == 25)
+ ret_val=[0.08 0.08 0.08]; %color of fifth line
+ elseif(argType == 26)
+ ret_val=[0 0.8 0.8]; %color of sixth line
+ elseif(argType == 27)
+ ret_val=[0.8 0.4 0]; %color of seventh line
+ elseif(argType == 28)
+ ret_val=[0.8 0.8 0]; %color of eighth line
+ elseif(argType == 40)
+ ret_val={'-k*','-ko','-ks','-kv','-kp','-kd','-kx','-kh'}; %line style (marker) of the colerless line
+ elseif(argType == 50)
+ ret_val={':k*',':ko',':ks',':kv',':kp',':kd',':kx',':kh'}; %line style (marker) of the colerfull line
+ end
+end
\ No newline at end of file
diff --git a/scripts/sample_app3/matlab/plotAvgFailedTask.m b/scripts/sample_app3/matlab/plotAvgFailedTask.m
new file mode 100644
index 0000000..dc9a792
--- /dev/null
+++ b/scripts/sample_app3/matlab/plotAvgFailedTask.m
@@ -0,0 +1,21 @@
+function [] = plotAvgFailedTask()
+
+ plotGenericResult(1, 2, 'Failed Tasks (%)', 'ALL_APPS', 'percentage_for_all');
+ plotGenericResult(1, 2, {'Failed Tasks for';'Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_all');
+ plotGenericResult(1, 2, 'Failed Tasks for Health App (%)', 'HEALTH_APP', 'percentage_for_all');
+ plotGenericResult(1, 2, {'Failed Tasks for';'Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_all');
+ plotGenericResult(1, 2, 'Failed Tasks for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 'percentage_for_all');
+
+ plotGenericResult(2, 2, 'Failed Tasks on Edge (%)', 'ALL_APPS', 'percentage_for_all');
+ plotGenericResult(2, 2, {'Failed Tasks on Edge';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_all');
+ plotGenericResult(2, 2, 'Failed Tasks on Edge for Health App (%)', 'HEALTH_APP', 'percentage_for_all');
+ plotGenericResult(2, 2, 'Failed Tasks on Edge for Infotainment App (%)', 'INFOTAINMENT_APP', 'percentage_for_all');
+ plotGenericResult(2, 2, 'Failed Tasks on Edge for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 'percentage_for_all');
+
+ plotGenericResult(4, 2, 'Failed Tasks on Mobile (%)', 'ALL_APPS', 'percentage_for_all');
+ plotGenericResult(4, 2, {'Failed Tasks on Mobile for';'Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_all');
+ plotGenericResult(4, 2, 'Failed Tasks on Mobile for Health App (%)', 'HEALTH_APP', 'percentage_for_all');
+ plotGenericResult(4, 2, 'Failed Tasks on Mobile for Infotainment App (%)', 'INFOTAINMENT_APP', 'percentage_for_all');
+ plotGenericResult(4, 2, 'Failed Tasks on Mobile for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 'percentage_for_all');
+
+end
\ No newline at end of file
diff --git a/scripts/sample_app3/matlab/plotAvgNetworkDelay.m b/scripts/sample_app3/matlab/plotAvgNetworkDelay.m
new file mode 100644
index 0000000..69f2342
--- /dev/null
+++ b/scripts/sample_app3/matlab/plotAvgNetworkDelay.m
@@ -0,0 +1,14 @@
+function [] = plotAvgNetworkDelay()
+
+ plotGenericResult(1, 7, 'Average Network Delay (sec)', 'ALL_APPS', '');
+ plotGenericResult(1, 7, {'Average Network Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
+ plotGenericResult(1, 7, 'Average Network Delay for Health App (sec)', 'HEALTH_APP', '');
+ plotGenericResult(1, 7, {'Average Network Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
+ plotGenericResult(1, 7, {'Average Network Delay';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
+
+ plotGenericResult(5, 1, 'Average WLAN Delay (sec)', 'ALL_APPS', '');
+ plotGenericResult(5, 1, {'Average WLAN Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
+ plotGenericResult(5, 1, 'Average WLAN Delay for Health App (sec)', 'HEALTH_APP', '');
+ plotGenericResult(5, 1, {'Average WLAN Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
+ plotGenericResult(5, 1, {'Average WLAN Delay';'for Heavy Comp. App %(sec)'}, 'HEAVY_COMP_APP', '');
+end
\ No newline at end of file
diff --git a/scripts/sample_app3/matlab/plotAvgProcessingTime.m b/scripts/sample_app3/matlab/plotAvgProcessingTime.m
new file mode 100644
index 0000000..3f915e7
--- /dev/null
+++ b/scripts/sample_app3/matlab/plotAvgProcessingTime.m
@@ -0,0 +1,21 @@
+function [] = plotAvgProcessingTime()
+
+ plotGenericResult(1, 6, 'Processing Time (sec)', 'ALL_APPS', '');
+ plotGenericResult(1, 6, 'Processing Time for Augmented Reality App (sec)', 'AUGMENTED_REALITY', '');
+ plotGenericResult(1, 6, 'Processing Time for Health App (sec)', 'HEALTH_APP', '');
+ plotGenericResult(1, 6, 'Processing Time for Infotainment App (sec)', 'INFOTAINMENT_APP', '');
+ plotGenericResult(1, 6, 'Processing Time for Heavy Comp. App (sec)', 'HEAVY_COMP_APP', '');
+
+ plotGenericResult(2, 6, 'Processing Time on Edge (sec)', 'ALL_APPS', '');
+ plotGenericResult(2, 6, {'Processing Time on Edge';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
+ plotGenericResult(2, 6, {'Processing Time on Edge';'for Health App (sec)'}, 'HEALTH_APP', '');
+ plotGenericResult(2, 6, {'Processing Time on Edge';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
+ plotGenericResult(2, 6, {'Processing Time on Edge';'for Heavy Computation App (sec)'}, 'HEAVY_COMP_APP', '');
+
+ plotGenericResult(4, 6, 'Processing Time on Mobile (sec)', 'ALL_APPS', '');
+ plotGenericResult(4, 6, {'Processing Time on Mobile';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
+ plotGenericResult(4, 6, {'Processing Time on Mobile';'for Health App (sec)'}, 'HEALTH_APP', '');
+ plotGenericResult(4, 6, {'Processing Time on Mobile';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
+ plotGenericResult(4, 6, {'Processing Time on Mobile';'for Heavy Computation App (sec)'}, 'HEAVY_COMP_APP', '');
+
+end
\ No newline at end of file
diff --git a/scripts/sample_app3/matlab/plotAvgServiceTime.m b/scripts/sample_app3/matlab/plotAvgServiceTime.m
new file mode 100644
index 0000000..791d59b
--- /dev/null
+++ b/scripts/sample_app3/matlab/plotAvgServiceTime.m
@@ -0,0 +1,21 @@
+function [] = plotAvgServiceTime()
+
+ plotGenericResult(1, 5, 'Service Time (sec)', 'ALL_APPS', '');
+ plotGenericResult(1, 5, {'Service Time for';'Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
+ plotGenericResult(1, 5, 'Service Time for Health App (sec)', 'HEALTH_APP', '');
+ plotGenericResult(1, 5, 'Service Time for Infotainment App (sec)', 'INFOTAINMENT_APP', '');
+ plotGenericResult(1, 5, {'Service Time for';'Compute Intensive App (sec)'}, 'HEAVY_COMP_APP', '');
+
+ plotGenericResult(2, 5, 'Service Time on Edge (sec)', 'ALL_APPS', '');
+ plotGenericResult(2, 5, {'Service Time on Edge';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
+ plotGenericResult(2, 5, 'Service Time on Edge for Health App (sec)', 'HEALTH_APP', '');
+ plotGenericResult(2, 5, {'Service Time on Edge';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
+ plotGenericResult(2, 5, {'Service Time on Edge';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
+
+ plotGenericResult(4, 5, 'Service Time on Mobile (sec)', 'ALL_APPS', '');
+ plotGenericResult(4, 5, {'Service Time on Mobile';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
+ plotGenericResult(4, 5, 'Service Time on Mobile for Health App (sec)', 'HEALTH_APP', '');
+ plotGenericResult(4, 5, {'Service Time on Mobile';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
+ plotGenericResult(4, 5, {'Service Time on Mobile';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
+
+end
\ No newline at end of file
diff --git a/scripts/sample_app3/matlab/plotAvgVmUtilization.m b/scripts/sample_app3/matlab/plotAvgVmUtilization.m
new file mode 100644
index 0000000..4ef9307
--- /dev/null
+++ b/scripts/sample_app3/matlab/plotAvgVmUtilization.m
@@ -0,0 +1,14 @@
+function [] = plotAvgVmUtilization()
+
+ plotGenericResult(2, 8, 'Average VM Utilization of Edge (%)', 'ALL_APPS', '');
+ plotGenericResult(2, 8, {'Average VM Utilization of Edge';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', '');
+ plotGenericResult(2, 8, {'Average VM Utilization of Edge';'for Health App (%)'}, 'HEALTH_APP', '');
+ plotGenericResult(2, 8, {'Average VM Utilization of Edge';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', '');
+ plotGenericResult(2, 8, {'Average VM Utilization of Edge';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', '');
+
+ plotGenericResult(4, 8, 'Average VM Utilization of Mobile(%)', 'ALL_APPS', '');
+ plotGenericResult(4, 8, {'Average VM Utilization of Mobile';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', '');
+ plotGenericResult(4, 8, {'Average VM Utilization of Mobile';'for Health App (%)'}, 'HEALTH_APP', '');
+ plotGenericResult(4, 8, {'Average VM Utilization of Mobile';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', '');
+ plotGenericResult(4, 8, {'Average VM Utilization of Mobile';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', '');
+end
\ No newline at end of file
diff --git a/scripts/sample_app3/matlab/plotGenericResult.m b/scripts/sample_app3/matlab/plotGenericResult.m
new file mode 100644
index 0000000..9d60fc0
--- /dev/null
+++ b/scripts/sample_app3/matlab/plotGenericResult.m
@@ -0,0 +1,149 @@
+function [] = plotGenericResult(rowOfset, columnOfset, yLabel, appType, calculatePercentage)
+ folderPath = getConfiguration(1);
+ numOfSimulations = getConfiguration(2);
+ startOfMobileDeviceLoop = getConfiguration(3);
+ stepOfMobileDeviceLoop = getConfiguration(4);
+ endOfMobileDeviceLoop = getConfiguration(5);
+ xTickLabelCoefficient = getConfiguration(6);
+
+ scenarioType = getConfiguration(7);
+ legends = getConfiguration(8);
+ numOfMobileDevices = (endOfMobileDeviceLoop - startOfMobileDeviceLoop)/stepOfMobileDeviceLoop + 1;
+
+ pos=getConfiguration(9);
+
+ all_results = zeros(numOfSimulations, size(scenarioType,2), numOfMobileDevices);
+ min_results = zeros(size(scenarioType,2), numOfMobileDevices);
+ max_results = zeros(size(scenarioType,2), numOfMobileDevices);
+
+ for s=1:numOfSimulations
+ for i=1:size(scenarioType,2)
+ for j=1:numOfMobileDevices
+ try
+ mobileDeviceNumber = startOfMobileDeviceLoop + stepOfMobileDeviceLoop * (j-1);
+ filePath = strcat(folderPath,'\ite',int2str(s),'\SIMRESULT_MOBILE_PROCESSING_SCENARIO_',char(scenarioType(i)),'_',int2str(mobileDeviceNumber),'DEVICES_',appType,'_GENERIC.log');
+
+ readData = dlmread(filePath,';',rowOfset,0);
+ value = readData(1,columnOfset);
+ if(strcmp(calculatePercentage,'percentage_for_all'))
+ readData = dlmread(filePath,';',1,0);
+ totalTask = readData(1,1)+readData(1,2);
+ value = (100 * value) / totalTask;
+ elseif(strcmp(calculatePercentage,'percentage_for_completed'))
+ readData = dlmread(filePath,';',1,0);
+ totalTask = readData(1,1);
+ value = (100 * value) / totalTask;
+ elseif(strcmp(calculatePercentage,'percentage_for_failed'))
+ readData = dlmread(filePath,';',1,0);
+ totalTask = readData(1,2);
+ value = (100 * value) / totalTask;
+ end
+
+ all_results(s,i,j) = value;
+ catch err
+ error(err)
+ end
+ end
+ end
+ end
+
+ if(numOfSimulations == 1)
+ results = all_results;
+ else
+ results = mean(all_results); %still 3d matrix but 1xMxN format
+ end
+
+ results = squeeze(results); %remove singleton dimensions
+
+ for i=1:size(scenarioType,2)
+ for j=1:numOfMobileDevices
+ x=all_results(:,i,j); % Create Data
+ SEM = std(x)/sqrt(length(x)); % Standard Error
+ ts = tinv([0.05 0.95],length(x)-1); % T-Score
+ CI = mean(x) + ts*SEM; % Confidence Intervals
+
+ if(CI(1) < 0)
+ CI(1) = 0;
+ end
+
+ if(CI(2) < 0)
+ CI(2) = 0;
+ end
+
+ min_results(i,j) = results(i,j) - CI(1);
+ max_results(i,j) = CI(2) - results(i,j);
+ end
+ end
+
+ types = zeros(1,numOfMobileDevices);
+ for i=1:numOfMobileDevices
+ types(i)=startOfMobileDeviceLoop+((i-1)*stepOfMobileDeviceLoop);
+ end
+
+ hFig = figure;
+ set(hFig, 'Units','centimeters');
+ set(hFig, 'Position',pos);
+ set(0,'DefaultAxesFontName','Times New Roman');
+ set(0,'DefaultTextFontName','Times New Roman');
+ set(0,'DefaultAxesFontSize',10);
+ set(0,'DefaultTextFontSize',12);
+ if(getConfiguration(20) == 1)
+ for i=1:1:numOfMobileDevices
+ xIndex=startOfMobileDeviceLoop+((i-1)*stepOfMobileDeviceLoop);
+
+ markers = getConfiguration(50);
+ for j=1:size(scenarioType,2)
+ plot(xIndex, results(j,i),char(markers(j)),'MarkerFaceColor',getConfiguration(20+j),'color',getConfiguration(20+j));
+ hold on;
+ end
+ end
+
+ for j=1:size(scenarioType,2)
+ if(getConfiguration(12) == 1)
+ errorbar(types, results(j,:), min_results(j,:),max_results(j,:),':k','color',getConfiguration(20+j),'LineWidth',1.5);
+ else
+ plot(types, results(j,:),':k','color',getConfiguration(20+j),'LineWidth',1.5);
+ end
+ hold on;
+ end
+
+ set(gca,'color','none');
+ else
+ markers = getConfiguration(40);
+ for j=1:size(scenarioType,2)
+ if(getConfiguration(12) == 1)
+ errorbar(types, results(j,:),min_results(j,:),max_results(j,:),char(markers(j)),'MarkerFaceColor','w','LineWidth',1.2);
+ else
+ plot(types, results(j,:),char(markers(j)),'MarkerFaceColor','w','LineWidth',1.2);
+ end
+ hold on;
+ end
+
+ end
+
+ lgnd = legend(legends,'Location','NorthWest');
+ if(getConfiguration(20) == 1)
+ set(lgnd,'color','none');
+ end
+
+ hold off;
+ axis square
+ xlabel(getConfiguration(10));
+ set(gca,'XTick', (startOfMobileDeviceLoop*xTickLabelCoefficient):(stepOfMobileDeviceLoop*xTickLabelCoefficient):endOfMobileDeviceLoop);
+ set(gca,'XTickLabel', (startOfMobileDeviceLoop*xTickLabelCoefficient):(stepOfMobileDeviceLoop*xTickLabelCoefficient):endOfMobileDeviceLoop);
+ ylabel(yLabel);
+ set(gca,'XLim',[startOfMobileDeviceLoop-5 endOfMobileDeviceLoop+5]);
+
+ set(get(gca,'Xlabel'),'FontSize',12)
+ set(get(gca,'Ylabel'),'FontSize',12)
+ set(lgnd,'FontSize',11)
+
+ if(getConfiguration(11) == 1)
+ set(hFig, 'PaperUnits', 'centimeters');
+ set(hFig, 'PaperPositionMode', 'manual');
+ set(hFig, 'PaperPosition',[0 0 pos(3) pos(4)]);
+ set(gcf, 'PaperSize', [pos(3) pos(4)]); %Keep the same paper size
+ filename = strcat(folderPath,'\',int2str(rowOfset),'_',int2str(columnOfset),'_',appType);
+ saveas(gcf, filename, 'pdf');
+ end
+end
\ No newline at end of file
diff --git a/scripts/sample_app3/matlab/plotTaskFailureReason.m b/scripts/sample_app3/matlab/plotTaskFailureReason.m
new file mode 100644
index 0000000..e6216a0
--- /dev/null
+++ b/scripts/sample_app3/matlab/plotTaskFailureReason.m
@@ -0,0 +1,20 @@
+function [] = plotTaskFailureReason()
+
+ plotGenericResult(1, 10, 'Failed Task due to VM Capacity (%)', 'ALL_APPS', 'percentage_for_failed');
+ plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
+ plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
+ plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
+ plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
+
+ plotGenericResult(1, 11, 'Failed Task due to Mobility (%)', 'ALL_APPS', 'percentage_for_failed');
+ plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
+ plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
+ plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
+ plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
+
+ plotGenericResult(1, 4, 'Failed Tasks due to Network failure (%)', 'ALL_APPS', 'percentage_for_failed');
+ plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
+ plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
+ plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
+ plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
+end
\ No newline at end of file
diff --git a/src/edu/boun/edgecloudsim/applications/sample_app1/SampleScenarioFactory.java b/src/edu/boun/edgecloudsim/applications/sample_app1/SampleScenarioFactory.java
index 48e4ed9..cec4d26 100644
--- a/src/edu/boun/edgecloudsim/applications/sample_app1/SampleScenarioFactory.java
+++ b/src/edu/boun/edgecloudsim/applications/sample_app1/SampleScenarioFactory.java
@@ -19,6 +19,8 @@ import edu.boun.edgecloudsim.edge_server.DefaultEdgeServerManager;
import edu.boun.edgecloudsim.edge_server.EdgeServerManager;
import edu.boun.edgecloudsim.edge_client.DefaultMobileDeviceManager;
import edu.boun.edgecloudsim.edge_client.MobileDeviceManager;
+import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.DefaultMobileServerManager;
+import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerManager;
import edu.boun.edgecloudsim.mobility.MobilityModel;
import edu.boun.edgecloudsim.mobility.NomadicMobility;
import edu.boun.edgecloudsim.task_generator.IdleActiveLoadGenerator;
@@ -71,8 +73,14 @@ public class SampleScenarioFactory implements ScenarioFactory {
public CloudServerManager getCloudServerManager() {
return new DefaultCloudServerManager();
}
-
+
+ @Override
public MobileDeviceManager getMobileDeviceManager() throws Exception {
return new DefaultMobileDeviceManager();
}
+
+ @Override
+ public MobileServerManager getMobileServerManager() {
+ return new DefaultMobileServerManager();
+ }
}
diff --git a/src/edu/boun/edgecloudsim/applications/sample_app2/SampleScenarioFactory.java b/src/edu/boun/edgecloudsim/applications/sample_app2/SampleScenarioFactory.java
index 8fc3d8d..4348180 100644
--- a/src/edu/boun/edgecloudsim/applications/sample_app2/SampleScenarioFactory.java
+++ b/src/edu/boun/edgecloudsim/applications/sample_app2/SampleScenarioFactory.java
@@ -17,6 +17,8 @@ import edu.boun.edgecloudsim.edge_orchestrator.EdgeOrchestrator;
import edu.boun.edgecloudsim.edge_server.DefaultEdgeServerManager;
import edu.boun.edgecloudsim.edge_server.EdgeServerManager;
import edu.boun.edgecloudsim.edge_client.MobileDeviceManager;
+import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.DefaultMobileServerManager;
+import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerManager;
import edu.boun.edgecloudsim.mobility.MobilityModel;
import edu.boun.edgecloudsim.mobility.NomadicMobility;
import edu.boun.edgecloudsim.task_generator.IdleActiveLoadGenerator;
@@ -73,4 +75,9 @@ public class SampleScenarioFactory implements ScenarioFactory {
public MobileDeviceManager getMobileDeviceManager() throws Exception {
return new SampleMobileDeviceManager();
}
+
+ @Override
+ public MobileServerManager getMobileServerManager() {
+ return new DefaultMobileServerManager();
+ }
}
diff --git a/src/edu/boun/edgecloudsim/applications/sample_app3/MainApp.java b/src/edu/boun/edgecloudsim/applications/sample_app3/MainApp.java
new file mode 100644
index 0000000..e319b99
--- /dev/null
+++ b/src/edu/boun/edgecloudsim/applications/sample_app3/MainApp.java
@@ -0,0 +1,131 @@
+/*
+ * Title: EdgeCloudSim - Main Application
+ *
+ * Description: Main application for Sample App3
+ *
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
+ * Copyright (c) 2017, Bogazici University, Istanbul, Turkey
+ */
+
+package edu.boun.edgecloudsim.applications.sample_app3;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.cloudbus.cloudsim.Log;
+import org.cloudbus.cloudsim.core.CloudSim;
+
+import edu.boun.edgecloudsim.core.ScenarioFactory;
+import edu.boun.edgecloudsim.core.SimManager;
+import edu.boun.edgecloudsim.core.SimSettings;
+import edu.boun.edgecloudsim.utils.SimLogger;
+import edu.boun.edgecloudsim.utils.SimUtils;
+
+public class MainApp {
+
+ /**
+ * Creates main() to run this example
+ */
+ public static void main(String[] args) {
+ //disable console output of cloudsim library
+ Log.disable();
+
+ //enable console ourput and file output of this application
+ SimLogger.enablePrintLog();
+
+ int iterationNumber = 1;
+ String configFile = "";
+ String outputFolder = "";
+ String edgeDevicesFile = "";
+ String applicationsFile = "";
+ if (args.length == 5){
+ configFile = args[0];
+ edgeDevicesFile = args[1];
+ applicationsFile = args[2];
+ outputFolder = args[3];
+ iterationNumber = Integer.parseInt(args[4]);
+ }
+ else{
+ SimLogger.printLine("Simulation setting file, output folder and iteration number are not provided! Using default ones...");
+ configFile = "scripts/sample_app3/config/default_config.properties";
+ applicationsFile = "scripts/sample_app3/config/applications.xml";
+ edgeDevicesFile = "scripts/sample_app3/config/edge_devices.xml";
+ outputFolder = "sim_results/ite" + iterationNumber;
+ }
+
+ //load settings from configuration file
+ SimSettings SS = SimSettings.getInstance();
+ if(SS.initialize(configFile, edgeDevicesFile, applicationsFile) == false){
+ SimLogger.printLine("cannot initialize simulation settings!");
+ System.exit(0);
+ }
+
+ if(SS.getFileLoggingEnabled()){
+ SimLogger.enableFileLog();
+ SimUtils.cleanOutputFolder(outputFolder);
+ }
+
+ DateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
+ Date SimulationStartDate = Calendar.getInstance().getTime();
+ String now = df.format(SimulationStartDate);
+ SimLogger.printLine("Simulation started at " + now);
+ SimLogger.printLine("----------------------------------------------------------------------");
+
+ for(int j=SS.getMinNumOfMobileDev(); j<=SS.getMaxNumOfMobileDev(); j+=SS.getMobileDevCounterSize())
+ {
+ for(int k=0; k vmArray = SimManager.getInstance().getMobileServerManager().getVmList(task.getMobileDeviceId());
+ double requiredCapacity = ((CpuUtilizationModel_Custom)task.getUtilizationModelCpu()).predictUtilization(vmArray.get(0).getVmType());
+ double targetVmCapacity = (double) 100 - vmArray.get(0).getCloudletScheduler().getTotalUtilizationOfCpu(CloudSim.clock());
+
+ if (requiredCapacity <= targetVmCapacity)
+ result = SimSettings.MOBILE_DATACENTER_ID;
+ else
+ result = SimSettings.GENERIC_EDGE_DEVICE_ID;
+ }
+ else {
+ SimLogger.printLine("Unknow edge orchestrator policy! Terminating simulation...");
+ System.exit(0);
+ }
+
+ return result;
+ }
+
+ @Override
+ public Vm getVmToOffload(Task task, int deviceId) {
+ Vm selectedVM = null;
+
+ if (deviceId == SimSettings.MOBILE_DATACENTER_ID) {
+ List vmArray = SimManager.getInstance().getMobileServerManager().getVmList(task.getMobileDeviceId());
+ double requiredCapacity = ((CpuUtilizationModel_Custom)task.getUtilizationModelCpu()).predictUtilization(vmArray.get(0).getVmType());
+ double targetVmCapacity = (double) 100 - vmArray.get(0).getCloudletScheduler().getTotalUtilizationOfCpu(CloudSim.clock());
+
+ if (requiredCapacity <= targetVmCapacity)
+ selectedVM = vmArray.get(0);
+ }
+ else if(deviceId == SimSettings.GENERIC_EDGE_DEVICE_ID){
+ //Select VM on edge devices via Least Loaded algorithm!
+ double selectedVmCapacity = 0; //start with min value
+ for(int hostIndex=0; hostIndex vmArray = SimManager.getInstance().getEdgeServerManager().getVmList(hostIndex);
+ for(int vmIndex=0; vmIndex selectedVmCapacity){
+ selectedVM = vmArray.get(vmIndex);
+ selectedVmCapacity = targetVmCapacity;
+ }
+ }
+ }
+ }
+ else{
+ SimLogger.printLine("Unknown device id! The simulation has been terminated.");
+ System.exit(0);
+ }
+
+ return selectedVM;
+ }
+
+ @Override
+ public void processEvent(SimEvent arg0) {
+ // Nothing to do!
+ }
+
+ @Override
+ public void shutdownEntity() {
+ // Nothing to do!
+ }
+
+ @Override
+ public void startEntity() {
+ // Nothing to do!
+ }
+
+}
\ No newline at end of file
diff --git a/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileDeviceManager.java b/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileDeviceManager.java
new file mode 100644
index 0000000..98036e1
--- /dev/null
+++ b/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileDeviceManager.java
@@ -0,0 +1,299 @@
+/*
+ * Title: EdgeCloudSim - Mobile Device Manager
+ *
+ * Description:
+ * Mobile Device Manager is one of the most important component
+ * in EdgeCloudSim. It is responsible for creating the tasks,
+ * submitting them to the related VM with respect to the
+ * Edge Orchestrator decision, and takes proper actions when
+ * the execution of the tasks are finished. It also feeds the
+ * SimLogger with the relevant results.
+
+ * SampleMobileDeviceManager sends tasks to the edge servers or
+ * mobile device processing unit.
+ *
+ * If you want to use different topology, you should modify
+ * the flow implemented in this class.
+ *
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
+ * Copyright (c) 2017, Bogazici University, Istanbul, Turkey
+ */
+
+package edu.boun.edgecloudsim.applications.sample_app3;
+
+import org.cloudbus.cloudsim.UtilizationModel;
+import org.cloudbus.cloudsim.UtilizationModelFull;
+import org.cloudbus.cloudsim.Vm;
+import org.cloudbus.cloudsim.core.CloudSim;
+import org.cloudbus.cloudsim.core.CloudSimTags;
+import org.cloudbus.cloudsim.core.SimEvent;
+
+import edu.boun.edgecloudsim.core.SimManager;
+import edu.boun.edgecloudsim.core.SimSettings;
+import edu.boun.edgecloudsim.core.SimSettings.NETWORK_DELAY_TYPES;
+import edu.boun.edgecloudsim.core.SimSettings.VM_TYPES;
+import edu.boun.edgecloudsim.edge_client.CpuUtilizationModel_Custom;
+import edu.boun.edgecloudsim.edge_client.MobileDeviceManager;
+import edu.boun.edgecloudsim.edge_client.Task;
+import edu.boun.edgecloudsim.network.NetworkModel;
+import edu.boun.edgecloudsim.utils.EdgeTask;
+import edu.boun.edgecloudsim.utils.Location;
+import edu.boun.edgecloudsim.utils.SimLogger;
+
+public class SampleMobileDeviceManager extends MobileDeviceManager {
+ private static final int BASE = 100000; //start from base in order not to conflict cloudsim tag!
+
+ private static final int REQUEST_RECEIVED_BY_EDGE_DEVICE = BASE + 1;
+ private static final int REQUEST_RECEIVED_BY_MOBILE_DEVICE = BASE + 2;
+ private static final int RESPONSE_RECEIVED_BY_MOBILE_DEVICE = BASE + 3;
+
+ private int taskIdCounter=0;
+
+ public SampleMobileDeviceManager() throws Exception{
+ }
+
+ @Override
+ public void initialize() {
+ }
+
+ @Override
+ public UtilizationModel getCpuUtilizationModel() {
+ return new CpuUtilizationModel_Custom();
+ }
+
+ @Override
+ public void startEntity() {
+ super.startEntity();
+ }
+
+ /**
+ * Submit cloudlets to the created VMs.
+ *
+ * @pre $none
+ * @post $none
+ */
+ protected void submitCloudlets() {
+ //do nothing!
+ }
+
+ /**
+ * Process a cloudlet return event.
+ *
+ * @param ev a SimEvent object
+ * @pre ev != $null
+ * @post $none
+ */
+ protected void processCloudletReturn(SimEvent ev) {
+ NetworkModel networkModel = SimManager.getInstance().getNetworkModel();
+ Task task = (Task) ev.getData();
+
+ SimLogger.getInstance().taskExecuted(task.getCloudletId());
+
+ if(task.getAssociatedDatacenterId() == SimSettings.GENERIC_EDGE_DEVICE_ID){
+ double delay = networkModel.getDownloadDelay(task.getAssociatedDatacenterId(), task.getMobileDeviceId(), task);
+
+ if(delay > 0)
+ {
+ Location currentLocation = SimManager.getInstance().getMobilityModel().getLocation(task.getMobileDeviceId(),CloudSim.clock()+delay);
+ if(task.getSubmittedLocation().getServingWlanId() == currentLocation.getServingWlanId())
+ {
+ networkModel.downloadStarted(task.getSubmittedLocation(), SimSettings.GENERIC_EDGE_DEVICE_ID);
+ SimLogger.getInstance().setDownloadDelay(task.getCloudletId(), delay, NETWORK_DELAY_TYPES.WLAN_DELAY);
+
+ schedule(getId(), delay, RESPONSE_RECEIVED_BY_MOBILE_DEVICE, task);
+ }
+ else
+ {
+ SimLogger.getInstance().failedDueToMobility(task.getCloudletId(), CloudSim.clock());
+ }
+ }
+ else
+ {
+ SimLogger.getInstance().failedDueToBandwidth(task.getCloudletId(), CloudSim.clock(), NETWORK_DELAY_TYPES.WLAN_DELAY);
+ }
+ }
+ else if(task.getAssociatedDatacenterId() == SimSettings.MOBILE_DATACENTER_ID) {
+ SimLogger.getInstance().taskEnded(task.getCloudletId(), CloudSim.clock());
+
+ /*
+ * TODO: In this scenario device to device (D2D) communication is ignored.
+ * If you want to consider D2D communication, you should transmit the result
+ * of the task to the sender mobile device. Hence, you should calculate
+ * D2D_DELAY here and send the following event:
+ *
+ * schedule(getId(), delay, RESPONSE_RECEIVED_BY_MOBILE_DEVICE, task);
+ *
+ * Please not that you should deal with the mobility and D2D delay calculation.
+ * The task can be failed due to the network bandwidth or the nobility.
+ */
+ }
+ else {
+ SimLogger.printLine("Unknown datacenter id! Terminating simulation...");
+ System.exit(0);
+ }
+ }
+
+ protected void processOtherEvent(SimEvent ev) {
+ if (ev == null) {
+ SimLogger.printLine(getName() + ".processOtherEvent(): " + "Error - an event is null! Terminating simulation...");
+ System.exit(0);
+ return;
+ }
+
+ NetworkModel networkModel = SimManager.getInstance().getNetworkModel();
+
+ switch (ev.getTag()) {
+ case REQUEST_RECEIVED_BY_MOBILE_DEVICE:
+ {
+ Task task = (Task) ev.getData();
+ submitTaskToVm(task, SimSettings.VM_TYPES.MOBILE_VM);
+ break;
+ }
+ case REQUEST_RECEIVED_BY_EDGE_DEVICE:
+ {
+ Task task = (Task) ev.getData();
+ networkModel.uploadFinished(task.getSubmittedLocation(), SimSettings.GENERIC_EDGE_DEVICE_ID);
+ submitTaskToVm(task, SimSettings.VM_TYPES.EDGE_VM);
+ break;
+ }
+ case RESPONSE_RECEIVED_BY_MOBILE_DEVICE:
+ {
+ Task task = (Task) ev.getData();
+
+ networkModel.downloadFinished(task.getSubmittedLocation(), SimSettings.GENERIC_EDGE_DEVICE_ID);
+
+ SimLogger.getInstance().taskEnded(task.getCloudletId(), CloudSim.clock());
+ break;
+ }
+ default:
+ SimLogger.printLine(getName() + ".processOtherEvent(): " + "Error - event unknown by this DatacenterBroker. Terminating simulation...");
+ System.exit(0);
+ break;
+ }
+ }
+
+ public void submitTask(EdgeTask edgeTask) {
+ double delay = 0;
+ int nextEvent = 0;
+ int nextDeviceForNetworkModel = 0;
+ VM_TYPES vmType = null;
+ NETWORK_DELAY_TYPES delayType = null;
+
+ NetworkModel networkModel = SimManager.getInstance().getNetworkModel();
+
+ //create a task
+ Task task = createTask(edgeTask);
+
+ Location currentLocation = SimManager.getInstance().getMobilityModel().
+ getLocation(task.getMobileDeviceId(), CloudSim.clock());
+
+ //set location of the mobile device which generates this task
+ task.setSubmittedLocation(currentLocation);
+
+ //add related task to log list
+ SimLogger.getInstance().addLog(task.getCloudletId(),
+ task.getTaskType(),
+ (int)task.getCloudletLength(),
+ (int)task.getCloudletFileSize(),
+ (int)task.getCloudletOutputSize());
+
+ int nextHopId = SimManager.getInstance().getEdgeOrchestrator().getDeviceToOffload(task);
+
+ if(nextHopId == SimSettings.GENERIC_EDGE_DEVICE_ID){
+ delay = networkModel.getUploadDelay(task.getMobileDeviceId(), nextHopId, task);
+ vmType = SimSettings.VM_TYPES.EDGE_VM;
+ nextEvent = REQUEST_RECEIVED_BY_EDGE_DEVICE;
+ delayType = NETWORK_DELAY_TYPES.WLAN_DELAY;
+ nextDeviceForNetworkModel = SimSettings.GENERIC_EDGE_DEVICE_ID;
+ }
+ else if(nextHopId == SimSettings.MOBILE_DATACENTER_ID){
+ vmType = VM_TYPES.MOBILE_VM;
+ nextEvent = REQUEST_RECEIVED_BY_MOBILE_DEVICE;
+
+ /*
+ * TODO: In this scenario device to device (D2D) communication is ignored.
+ * If you want to consider D2D communication, you should calculate D2D
+ * network delay here.
+ *
+ * You should also add D2D_DELAY to the following enum in SimSettings
+ * public static enum NETWORK_DELAY_TYPES { WLAN_DELAY, MAN_DELAY, WAN_DELAY }
+ *
+ * If you want to get statistics of the D2D networking, you should modify
+ * SimLogger in a way to consider D2D_DELAY statistics.
+ */
+ }
+ else {
+ SimLogger.printLine("Unknown nextHopId! Terminating simulation...");
+ System.exit(0);
+ }
+
+ if(delay>0 || nextHopId == SimSettings.MOBILE_DATACENTER_ID){
+
+ Vm selectedVM = SimManager.getInstance().getEdgeOrchestrator().getVmToOffload(task, nextHopId);
+
+ if(selectedVM != null){
+ //set related host id
+ task.setAssociatedDatacenterId(nextHopId);
+
+ //set related host id
+ task.setAssociatedHostId(selectedVM.getHost().getId());
+
+ //set related vm id
+ task.setAssociatedVmId(selectedVM.getId());
+
+ //bind task to related VM
+ getCloudletList().add(task);
+ bindCloudletToVm(task.getCloudletId(), selectedVM.getId());
+
+ SimLogger.getInstance().taskStarted(task.getCloudletId(), CloudSim.clock());
+
+ if(nextHopId != SimSettings.MOBILE_DATACENTER_ID) {
+ networkModel.uploadStarted(task.getSubmittedLocation(), nextDeviceForNetworkModel);
+ SimLogger.getInstance().setUploadDelay(task.getCloudletId(), delay, delayType);
+ }
+
+ schedule(getId(), delay, nextEvent, task);
+ }
+ else{
+ //SimLogger.printLine("Task #" + task.getCloudletId() + " cannot assign to any VM");
+ SimLogger.getInstance().rejectedDueToVMCapacity(task.getCloudletId(), CloudSim.clock(), vmType.ordinal());
+ }
+ }
+ else
+ {
+ //SimLogger.printLine("Task #" + task.getCloudletId() + " cannot assign to any VM");
+ SimLogger.getInstance().rejectedDueToBandwidth(task.getCloudletId(), CloudSim.clock(), vmType.ordinal(), delayType);
+ }
+ }
+
+ private void submitTaskToVm(Task task, SimSettings.VM_TYPES vmType) {
+ //SimLogger.printLine(CloudSim.clock() + ": Cloudlet#" + task.getCloudletId() + " is submitted to VM#" + task.getVmId());
+ schedule(getVmsToDatacentersMap().get(task.getVmId()), 0, CloudSimTags.CLOUDLET_SUBMIT, task);
+
+ SimLogger.getInstance().taskAssigned(task.getCloudletId(),
+ task.getAssociatedDatacenterId(),
+ task.getAssociatedHostId(),
+ task.getAssociatedVmId(),
+ vmType.ordinal());
+ }
+
+ private Task createTask(EdgeTask edgeTask){
+ UtilizationModel utilizationModel = new UtilizationModelFull(); /*UtilizationModelStochastic*/
+ UtilizationModel utilizationModelCPU = getCpuUtilizationModel();
+
+ Task task = new Task(edgeTask.mobileDeviceId, ++taskIdCounter,
+ edgeTask.length, edgeTask.pesNumber,
+ edgeTask.inputFileSize, edgeTask.outputFileSize,
+ utilizationModelCPU, utilizationModel, utilizationModel);
+
+ //set the owner of this task
+ task.setUserId(this.getId());
+ task.setTaskType(edgeTask.taskType);
+
+ if (utilizationModelCPU instanceof CpuUtilizationModel_Custom) {
+ ((CpuUtilizationModel_Custom)utilizationModelCPU).setTask(task);
+ }
+
+ return task;
+ }
+}
diff --git a/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileServerManager.java b/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileServerManager.java
new file mode 100644
index 0000000..8757969
--- /dev/null
+++ b/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileServerManager.java
@@ -0,0 +1,184 @@
+/*
+ * Title: EdgeCloudSim - Mobile Server Manager
+ *
+ * Description:
+ * VehicularDefaultMobileServerManager is responsible for creating
+ * mobile datacenters, hosts and VMs.
+ *
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
+ * Copyright (c) 2017, Bogazici University, Istanbul, Turkey
+ */
+
+package edu.boun.edgecloudsim.applications.sample_app3;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
+import org.cloudbus.cloudsim.Datacenter;
+import org.cloudbus.cloudsim.DatacenterCharacteristics;
+import org.cloudbus.cloudsim.Host;
+import org.cloudbus.cloudsim.Pe;
+import org.cloudbus.cloudsim.Storage;
+import org.cloudbus.cloudsim.VmAllocationPolicy;
+import org.cloudbus.cloudsim.VmSchedulerSpaceShared;
+import org.cloudbus.cloudsim.core.CloudSim;
+import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
+import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
+import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
+
+import edu.boun.edgecloudsim.core.SimManager;
+import edu.boun.edgecloudsim.core.SimSettings;
+import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileHost;
+import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerManager;
+import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileVM;
+import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileVmAllocationPolicy_Custom;
+
+public class SampleMobileServerManager extends MobileServerManager{
+ private int numOfMobileDevices=0;
+
+ public SampleMobileServerManager(int _numOfMobileDevices) {
+ numOfMobileDevices=_numOfMobileDevices;
+ }
+
+ @Override
+ public void initialize() {
+ }
+
+ @Override
+ public VmAllocationPolicy getVmAllocationPolicy(List extends Host> list, int dataCenterIndex) {
+ return new MobileVmAllocationPolicy_Custom(list, dataCenterIndex);
+ }
+
+ @Override
+ public void startDatacenters() throws Exception {
+ //in the initial version, each mobile device has a separate datacenter
+ //however, this approach encounters with out of memory (oom) problem.
+ //therefore, we use single datacenter for all mobile devices!
+ localDatacenter = createDatacenter(SimSettings.MOBILE_DATACENTER_ID);
+ }
+
+ @Override
+ public void terminateDatacenters() {
+ localDatacenter.shutdownEntity();
+ }
+
+ @Override
+ public void createVmList(int brockerId) {
+ //VMs should have unique IDs, so create Mobile VMs after Edge+Cloud VMs
+ int vmCounter=SimSettings.getInstance().getNumOfEdgeVMs() + SimSettings.getInstance().getNumOfCloudVMs();
+
+ //Create VMs for each hosts
+ //Note that each mobile device has one host with one VM!
+ for (int i = 0; i < numOfMobileDevices; i++) {
+ vmList.add(i, new ArrayList());
+
+ String vmm = "Xen";
+ int numOfCores = SimSettings.getInstance().getCoreForMobileVM();
+ double mips = SimSettings.getInstance().getMipsForMobileVM();
+ int ram = SimSettings.getInstance().getRamForMobileVM();
+ long storage = SimSettings.getInstance().getStorageForMobileVM();
+ long bandwidth = 0;
+
+ //VM Parameters
+ MobileVM vm = new MobileVM(vmCounter, brockerId, mips, numOfCores, ram, bandwidth, storage, vmm, new CloudletSchedulerTimeShared());
+ vmList.get(i).add(vm);
+ vmCounter++;
+ }
+ }
+
+ @Override
+ public double getAvgUtilization() {
+ double totalUtilization = 0;
+ double vmCounter = 0;
+
+ List extends Host> list = localDatacenter.getHostList();
+ // for each host...
+ for (int hostIndex=0; hostIndex < list.size(); hostIndex++) {
+ List vmArray = SimManager.getInstance().getMobileServerManager().getVmList(hostIndex);
+ //for each vm...
+ for(int vmIndex=0; vmIndex hostList=createHosts();
+
+ String name = "MobileDatacenter_" + Integer.toString(index);
+ double time_zone = 3.0; // time zone this resource located
+ LinkedList storageList = new LinkedList(); //we are not adding SAN devices by now
+
+ // 5. Create a DatacenterCharacteristics object that stores the
+ // properties of a data center: architecture, OS, list of
+ // Machines, allocation policy: time- or space-shared, time zone
+ // and its price (G$/Pe time unit).
+ DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
+ arch, os, vmm, hostList, time_zone, costPerSec, costPerMem, costPerStorage, costPerBw);
+
+ // 6. Finally, we need to create a PowerDatacenter object.
+ Datacenter datacenter = null;
+
+ VmAllocationPolicy vm_policy = getVmAllocationPolicy(hostList,index);
+ datacenter = new Datacenter(name, characteristics, vm_policy, storageList, 0);
+
+ return datacenter;
+ }
+
+ private List createHosts(){
+ // Here are the steps needed to create a PowerDatacenter:
+ // 1. We need to create a list to store one or more Machines
+ List hostList = new ArrayList();
+
+ for (int i = 0; i < numOfMobileDevices; i++) {
+
+ int numOfCores = SimSettings.getInstance().getCoreForMobileVM();
+ double mips = SimSettings.getInstance().getMipsForMobileVM();
+ int ram = SimSettings.getInstance().getRamForMobileVM();
+ long storage = SimSettings.getInstance().getStorageForMobileVM();
+ long bandwidth = 0;
+
+ // 2. A Machine contains one or more PEs or CPUs/Cores. Therefore, should
+ // create a list to store these PEs before creating
+ // a Machine.
+ List peList = new ArrayList();
+
+ // 3. Create PEs and add these into the list.
+ //for a quad-core machine, a list of 4 PEs is required:
+ for(int j=0; j ");
+
+ if(numOfWlanUser < experimentalWlanDelay.length)
+ result = taskSizeInKb /*Kb*/ / (experimentalWlanDelay[numOfWlanUser] * (double) 3 ) /*Kbps*/; //802.11ac is around 3 times faster than 802.11n
+
+ //System.out.println("--> " + numOfWlanUser + " user, " + taskSizeInKb + " KB, " +result + " sec");
+ return result;
+ }
+
+ //wlan upload and download delay is symmetric in this model
+ private double getWlanUploadDelay(Location accessPointLocation, double dataSize) {
+ return getWlanDownloadDelay(accessPointLocation, dataSize);
+ }
+}
diff --git a/src/edu/boun/edgecloudsim/applications/sample_app3/SampleScenarioFactory.java b/src/edu/boun/edgecloudsim/applications/sample_app3/SampleScenarioFactory.java
new file mode 100644
index 0000000..0ffa7ce
--- /dev/null
+++ b/src/edu/boun/edgecloudsim/applications/sample_app3/SampleScenarioFactory.java
@@ -0,0 +1,82 @@
+/*
+ * Title: EdgeCloudSim - Scenario Factory
+ *
+ * Description: Sample scenario factory providing the default
+ * instances of required abstract classes
+ *
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
+ * Copyright (c) 2017, Bogazici University, Istanbul, Turkey
+ */
+
+package edu.boun.edgecloudsim.applications.sample_app3;
+
+import edu.boun.edgecloudsim.cloud_server.CloudServerManager;
+import edu.boun.edgecloudsim.cloud_server.DefaultCloudServerManager;
+import edu.boun.edgecloudsim.core.ScenarioFactory;
+import edu.boun.edgecloudsim.edge_orchestrator.EdgeOrchestrator;
+import edu.boun.edgecloudsim.edge_server.DefaultEdgeServerManager;
+import edu.boun.edgecloudsim.edge_server.EdgeServerManager;
+import edu.boun.edgecloudsim.edge_client.MobileDeviceManager;
+import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerManager;
+import edu.boun.edgecloudsim.mobility.MobilityModel;
+import edu.boun.edgecloudsim.mobility.NomadicMobility;
+import edu.boun.edgecloudsim.task_generator.IdleActiveLoadGenerator;
+import edu.boun.edgecloudsim.task_generator.LoadGeneratorModel;
+import edu.boun.edgecloudsim.network.NetworkModel;
+
+public class SampleScenarioFactory implements ScenarioFactory {
+ private int numOfMobileDevice;
+ private double simulationTime;
+ private String orchestratorPolicy;
+ private String simScenario;
+
+ SampleScenarioFactory(int _numOfMobileDevice,
+ double _simulationTime,
+ String _orchestratorPolicy,
+ String _simScenario){
+ orchestratorPolicy = _orchestratorPolicy;
+ numOfMobileDevice = _numOfMobileDevice;
+ simulationTime = _simulationTime;
+ simScenario = _simScenario;
+ }
+
+ @Override
+ public LoadGeneratorModel getLoadGeneratorModel() {
+ return new IdleActiveLoadGenerator(numOfMobileDevice, simulationTime, simScenario);
+ }
+
+ @Override
+ public EdgeOrchestrator getEdgeOrchestrator() {
+ return new SampleEdgeOrchestrator(orchestratorPolicy, simScenario);
+ }
+
+ @Override
+ public MobilityModel getMobilityModel() {
+ return new NomadicMobility(numOfMobileDevice,simulationTime);
+ }
+
+ @Override
+ public NetworkModel getNetworkModel() {
+ return new SampleNetworkModel(numOfMobileDevice, simScenario);
+ }
+
+ @Override
+ public EdgeServerManager getEdgeServerManager() {
+ return new DefaultEdgeServerManager();
+ }
+
+ @Override
+ public CloudServerManager getCloudServerManager() {
+ return new DefaultCloudServerManager();
+ }
+
+ @Override
+ public MobileDeviceManager getMobileDeviceManager() throws Exception {
+ return new SampleMobileDeviceManager();
+ }
+
+ @Override
+ public MobileServerManager getMobileServerManager() {
+ return new SampleMobileServerManager(numOfMobileDevice);
+ }
+}
diff --git a/src/edu/boun/edgecloudsim/cloud_server/CloudServerManager.java b/src/edu/boun/edgecloudsim/cloud_server/CloudServerManager.java
index 73be0df..4696e30 100644
--- a/src/edu/boun/edgecloudsim/cloud_server/CloudServerManager.java
+++ b/src/edu/boun/edgecloudsim/cloud_server/CloudServerManager.java
@@ -1,3 +1,19 @@
+/*
+ * Title: EdgeCloudSim - CloudServerManager
+ *
+ * Description:
+ * CloudServerManager is responsible for creating and terminating
+ * the cloud datacenters which operates the hosts and VMs.
+ * It also provides the list of VMs running on the hosts and
+ * the average utilization of all VMs.
+ *
+ * Please note that, EdgeCloudSim is built on top of CloudSim
+ * Therefore, all the computational units are handled by CloudSim
+ *
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
+ * Copyright (c) 2017, Bogazici University, Istanbul, Turkey
+ */
+
package edu.boun.edgecloudsim.cloud_server;
import java.util.ArrayList;
diff --git a/src/edu/boun/edgecloudsim/cloud_server/CloudVmAllocationPolicy_Custom.java b/src/edu/boun/edgecloudsim/cloud_server/CloudVmAllocationPolicy_Custom.java
index 34d88c2..ff28b60 100644
--- a/src/edu/boun/edgecloudsim/cloud_server/CloudVmAllocationPolicy_Custom.java
+++ b/src/edu/boun/edgecloudsim/cloud_server/CloudVmAllocationPolicy_Custom.java
@@ -3,9 +3,9 @@
*
* Description:
* VmAllocationPolicy_Custom implements VmAllocationPolicy to decide which.
- * VM is created on which host locatied on the datacenters. For those
+ * VM is created on which host located on the datacenters. For those
* who wants to add another Vm Allocation Policy to EdgeCloudSim should
- * provide another concreate instance of VmAllocationPolicy via ScenarioFactory
+ * provide another concrete instance of VmAllocationPolicy via ScenarioFactory
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
diff --git a/src/edu/boun/edgecloudsim/core/ScenarioFactory.java b/src/edu/boun/edgecloudsim/core/ScenarioFactory.java
index aa23f54..b83217e 100644
--- a/src/edu/boun/edgecloudsim/core/ScenarioFactory.java
+++ b/src/edu/boun/edgecloudsim/core/ScenarioFactory.java
@@ -15,6 +15,7 @@ package edu.boun.edgecloudsim.core;
import edu.boun.edgecloudsim.cloud_server.CloudServerManager;
import edu.boun.edgecloudsim.edge_client.MobileDeviceManager;
+import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerManager;
import edu.boun.edgecloudsim.edge_orchestrator.EdgeOrchestrator;
import edu.boun.edgecloudsim.edge_server.EdgeServerManager;
import edu.boun.edgecloudsim.mobility.MobilityModel;
@@ -52,6 +53,11 @@ public interface ScenarioFactory {
*/
public CloudServerManager getCloudServerManager();
+ /**
+ * provides abstract Mobile Server Model
+ */
+ public MobileServerManager getMobileServerManager();
+
/**
* provides abstract Mobile Device Manager Model
*/
diff --git a/src/edu/boun/edgecloudsim/core/SimManager.java b/src/edu/boun/edgecloudsim/core/SimManager.java
index 6ded386..0cca0b2 100644
--- a/src/edu/boun/edgecloudsim/core/SimManager.java
+++ b/src/edu/boun/edgecloudsim/core/SimManager.java
@@ -26,6 +26,7 @@ import edu.boun.edgecloudsim.edge_server.EdgeServerManager;
import edu.boun.edgecloudsim.edge_server.EdgeVmAllocationPolicy_Custom;
import edu.boun.edgecloudsim.cloud_server.CloudServerManager;
import edu.boun.edgecloudsim.edge_client.MobileDeviceManager;
+import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerManager;
import edu.boun.edgecloudsim.mobility.MobilityModel;
import edu.boun.edgecloudsim.task_generator.LoadGeneratorModel;
import edu.boun.edgecloudsim.network.NetworkModel;
@@ -48,6 +49,7 @@ public class SimManager extends SimEntity {
private EdgeOrchestrator edgeOrchestrator;
private EdgeServerManager edgeServerManager;
private CloudServerManager cloudServerManager;
+ private MobileServerManager mobileServerManager;
private LoadGeneratorModel loadGeneratorModel;
private MobileDeviceManager mobileDeviceManager;
@@ -85,6 +87,10 @@ public class SimManager extends SimEntity {
//Create Physical Servers on cloud
cloudServerManager = scenarioFactory.getCloudServerManager();
cloudServerManager.initialize();
+
+ //Create Physical Servers on mobile devices
+ mobileServerManager = scenarioFactory.getMobileServerManager();
+ mobileServerManager.initialize();
//Create Client Manager
mobileDeviceManager = scenarioFactory.getMobileDeviceManager();
@@ -111,7 +117,11 @@ public class SimManager extends SimEntity {
//Start Edge Datacenters & Generate VMs
cloudServerManager.startDatacenters();
cloudServerManager.createVmList(mobileDeviceManager.getId());
-
+
+ //Start Mobile Datacenters & Generate VMs
+ mobileServerManager.startDatacenters();
+ mobileServerManager.createVmList(mobileDeviceManager.getId());
+
CloudSim.startSimulation();
}
@@ -151,6 +161,10 @@ public class SimManager extends SimEntity {
return cloudServerManager;
}
+ public MobileServerManager getMobileServerManager(){
+ return mobileServerManager;
+ }
+
public LoadGeneratorModel getLoadGeneratorModel(){
return loadGeneratorModel;
}
@@ -175,6 +189,11 @@ public class SimManager extends SimEntity {
mobileDeviceManager.submitVmList(cloudServerManager.getVmList(i));
}
+ for(int i=0; i list, int dataCenterIndex) {
+ return new MobileVmAllocationPolicy_Custom(list, dataCenterIndex);
+ }
+
+ @Override
+ public void startDatacenters() throws Exception {
+ //local computation is not supported in default Mobile Device Manager
+ }
+
+ @Override
+ public void terminateDatacenters() {
+ //local computation is not supported in default Mobile Device Manager
+ }
+
+ @Override
+ public void createVmList(int brockerId) {
+ //local computation is not supported in default Mobile Device Manager
+ }
+
+ @Override
+ public double getAvgUtilization() {
+ //local computation is not supported in default Mobile Device Manager
+ return 0;
+ }
+}
diff --git a/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileHost.java b/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileHost.java
new file mode 100644
index 0000000..22f8df1
--- /dev/null
+++ b/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileHost.java
@@ -0,0 +1,43 @@
+/*
+ * Title: EdgeCloudSim - MobileHost
+ *
+ * Description:
+ * MobileHost adds associated mobile device id information over CloudSim's Host class
+ *
+ * Please note that the mobile processing units are simulated via
+ * CloudSim. It is assumed that the mobile devices operate Hosts
+ * and VMs like a server. That is why the class names are similar
+ * to other Cloud and Edge components (to provide consistency).
+ *
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
+ * Copyright (c) 2017, Bogazici University, Istanbul, Turkey
+ */
+
+package edu.boun.edgecloudsim.edge_client.mobile_processing_unit;
+
+import java.util.List;
+
+import org.cloudbus.cloudsim.Host;
+import org.cloudbus.cloudsim.Pe;
+import org.cloudbus.cloudsim.VmScheduler;
+import org.cloudbus.cloudsim.provisioners.BwProvisioner;
+import org.cloudbus.cloudsim.provisioners.RamProvisioner;
+
+public class MobileHost extends Host {
+ private int mobileDeviceId;
+
+ public MobileHost(int id, RamProvisioner ramProvisioner,
+ BwProvisioner bwProvisioner, long storage,
+ List extends Pe> peList, VmScheduler vmScheduler) {
+ super(id, ramProvisioner, bwProvisioner, storage, peList, vmScheduler);
+
+ }
+
+ public void setMobileDeviceId(int _mobileDeviceId){
+ mobileDeviceId=_mobileDeviceId;
+ }
+
+ public int getMobileDeviceId(){
+ return mobileDeviceId;
+ }
+}
diff --git a/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileServerManager.java b/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileServerManager.java
new file mode 100644
index 0000000..b64ba18
--- /dev/null
+++ b/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileServerManager.java
@@ -0,0 +1,78 @@
+/*
+ * Title: EdgeCloudSim - MobileServerManager
+ *
+ * Description:
+ * MobileServerManager is responsible for creating and terminating
+ * the mobile datacenters which operates the hosts and VMs.
+ * It also provides the list of VMs running on the hosts and
+ * the average utilization of all VMs.
+ *
+ * Please note that, EdgeCloudSim is built on top of CloudSim
+ * Therefore, all the computational units are handled by CloudSim
+ *
+ * The mobile processing units are simulated via CloudSim as well.
+ * It is assumed that the mobile devices operate Hosts and VMs
+ * like a server. That is why the class names are similar to other
+ * Cloud and Edge components.
+ *
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
+ * Copyright (c) 2017, Bogazici University, Istanbul, Turkey
+ */
+
+package edu.boun.edgecloudsim.edge_client.mobile_processing_unit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.cloudbus.cloudsim.Datacenter;
+import org.cloudbus.cloudsim.Host;
+import org.cloudbus.cloudsim.VmAllocationPolicy;
+
+public abstract class MobileServerManager {
+ protected Datacenter localDatacenter;
+ protected List> vmList;
+
+ public MobileServerManager() {
+ vmList = new ArrayList>();
+ }
+
+ public List getVmList(int hostId){
+ if(vmList.size() > hostId)
+ return vmList.get(hostId);
+ else
+ return null;
+ }
+
+ public Datacenter getDatacenter(){
+ return localDatacenter;
+ }
+
+ /*
+ * initialize edge server manager if needed
+ */
+ public abstract void initialize();
+
+ /*
+ * provides abstract Vm Allocation Policy for Mobile Datacenters
+ */
+ public abstract VmAllocationPolicy getVmAllocationPolicy(List extends Host> list, int dataCenterIndex);
+
+ /*
+ * Starts Datacenters
+ */
+ public abstract void startDatacenters() throws Exception;
+
+ /*
+ * Terminates Datacenters
+ */
+ public abstract void terminateDatacenters();
+ /*
+ * Creates VM List
+ */
+ public abstract void createVmList(int brockerId);
+
+ /*
+ * returns average utilization of all VMs
+ */
+ public abstract double getAvgUtilization();
+}
\ No newline at end of file
diff --git a/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileVM.java b/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileVM.java
new file mode 100644
index 0000000..72adebe
--- /dev/null
+++ b/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileVM.java
@@ -0,0 +1,36 @@
+/*
+ * Title: EdgeCloudSim - MobileVM
+ *
+ * Description:
+ * MobileVM adds vm type information over CloudSim's VM class
+ *
+ * Please note that the mobile processing units are simulated via
+ * CloudSim. It is assumed that the mobile devices operate Hosts
+ * and VMs like a server. That is why the class names are similar
+ * to other Cloud and Edge components (to provide consistency).
+ *
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
+ * Copyright (c) 2017, Bogazici University, Istanbul, Turkey
+ */
+
+package edu.boun.edgecloudsim.edge_client.mobile_processing_unit;
+
+import org.cloudbus.cloudsim.CloudletScheduler;
+import org.cloudbus.cloudsim.Vm;
+
+import edu.boun.edgecloudsim.core.SimSettings;
+
+public class MobileVM extends Vm {
+ private SimSettings.VM_TYPES type;
+
+ public MobileVM(int id, int userId, double mips, int numberOfPes, int ram,
+ long bw, long size, String vmm, CloudletScheduler cloudletScheduler) {
+ super(id, userId, mips, numberOfPes, ram, bw, size, vmm, cloudletScheduler);
+
+ type = SimSettings.VM_TYPES.MOBILE_VM;
+ }
+
+ public SimSettings.VM_TYPES getVmType(){
+ return type;
+ }
+}
diff --git a/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileVmAllocationPolicy_Custom.java b/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileVmAllocationPolicy_Custom.java
new file mode 100644
index 0000000..2aae6bb
--- /dev/null
+++ b/src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileVmAllocationPolicy_Custom.java
@@ -0,0 +1,132 @@
+/*
+ * Title: EdgeCloudSim - Custom VM Allocation Policy for Mobile Devices' VMs
+ *
+ * Description:
+ * VmAllocationPolicy_Custom implements VmAllocationPolicy to decide which.
+ * VM is created on which host located on the datacenters. For those
+ * who wants to add another Vm Allocation Policy to EdgeCloudSim should
+ * provide another concrete instance of VmAllocationPolicy via ScenarioFactory
+ *
+ * Please note that the mobile processing units are simulated via
+ * CloudSim. It is assumed that the mobile devices operate Hosts
+ * and VMs like a server. That is why the class names are similar
+ * to other Cloud and Edge components (to provide consistency).
+ *
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
+ * Copyright (c) 2017, Bogazici University, Istanbul, Turkey
+ */
+
+package edu.boun.edgecloudsim.edge_client.mobile_processing_unit;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.cloudbus.cloudsim.Host;
+import org.cloudbus.cloudsim.Log;
+import org.cloudbus.cloudsim.Vm;
+import org.cloudbus.cloudsim.VmAllocationPolicy;
+import org.cloudbus.cloudsim.core.CloudSim;
+
+import edu.boun.edgecloudsim.core.SimSettings;
+
+/*
+ * Same as VmAllocationPolicySimple.
+ */
+public class MobileVmAllocationPolicy_Custom extends VmAllocationPolicy {
+ /** The vm table. */
+ private Map vmTable;
+ private static int createdVmNum;
+ private int DataCenterIndex;
+
+ public MobileVmAllocationPolicy_Custom(List extends Host> list, int _DataCenterIndex) {
+ super(list);
+
+ setVmTable(new HashMap());
+ DataCenterIndex = _DataCenterIndex;
+ createdVmNum = 0;
+ }
+
+ @Override
+ public boolean allocateHostForVm(Vm vm) {
+ boolean result = false;
+
+ if (!getVmTable().containsKey(vm.getUid()) && vm instanceof MobileVM) { // if this vm was not created
+ int hostIndex = vm.getId() - SimSettings.getInstance().getNumOfEdgeVMs() - SimSettings.getInstance().getNumOfCloudVMs();
+
+ if(DataCenterIndex == SimSettings.MOBILE_DATACENTER_ID){
+ Host host = getHostList().get(hostIndex);
+ result = host.vmCreate(vm);
+
+ if (result) { // if vm were succesfully created in the host
+ getVmTable().put(vm.getUid(), host);
+ createdVmNum++;
+ Log.formatLine("%.2f: Mobile VM #" + vm.getId() + " has been allocated to the host #" + host.getId(),CloudSim.clock());
+ result = true;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean allocateHostForVm(Vm vm, Host host) {
+ if (host.vmCreate(vm)) { // if vm has been succesfully created in the host
+ getVmTable().put(vm.getUid(), host);
+ createdVmNum++;
+
+ Log.formatLine("%.2f: Mobile VM #" + vm.getId() + " has been allocated to the host #" + host.getId(),CloudSim.clock());
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public List